[PATCH v2 3/5] ARM: add support for kernel mode NEON
Will Deacon
will.deacon at arm.com
Wed Jun 26 07:14:30 EDT 2013
On Wed, Jun 26, 2013 at 11:55:33AM +0100, Ard Biesheuvel wrote:
> Replying to self:
>
> On 25 June 2013 22:24, Ard Biesheuvel <ard.biesheuvel at linaro.org> wrote:
> > +void kernel_neon_end(void)
> > +{
> > + /* Disable the NEON/VFP unit. */
> > + fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
> > + barrier();
> > + dec_preempt_count();
> > +}
> > +EXPORT_SYMBOL(kernel_neon_end);
>
> Meh. This is not going to please the RT crowd, as preempt_schedule()
> will not be called on PREEMPT builds in this case.
>
> Propose to replace it with
>
> preempt_enable();
> #ifndef CONFIG_PREEMPT_COUNT
> /* in this case, the preempt_enable() right above is just a barrier() */
> dec_preempt_count();
> #endif
>
> (and the converse in kernel_neon_begin())
Yuck, that's ugly as sin! How does x86 deal with this? Looking at
kernel_fpu_{begin,end}, they just disable preemption so I guess that they
assume the caller is non-blocking? There's an aside about the use of
preempt-notifiers for KVM, so it does sound like the onus is on the caller
not to shoot themselves in the face.
Will
More information about the linux-arm-kernel
mailing list