[PATCH v2 3/5] ARM: add support for kernel mode NEON
From: Ard Biesheuvel <hidden>
Date: 2013-06-27 15:43:44
On 27 June 2013 17:13, Catalin Marinas [off-list ref] wrote:
On Thu, Jun 27, 2013 at 02:11:27PM +0100, Ard Biesheuvel wrote:quoted
OK, just one more question before I respin the next (hopefully final) version: if a caller does sleep after calling kernel_neon_begin() (and thus receives no warning if he runs a non-PREEMPT build with CONFIG_DEBUG_ATOMIC_SLEEP disabled), he will most likely find the NEON/VFP unit disabled after waking up (as we disable it on a context switch), so any subsequent NEON instructions will trigger the undef handler.Can you check on the VFP context switch path whether kernel_neon_begin() has been called and we are moving away from the task? You could even store the LR in kernel_neon_begin() to give better error information.
I guess it should be quite doable to add the LR of the most recent kernel_neon_begin() call to the vfpstate (and clear it in kernel_neon_end), so we can check it when vfp_notifier() is called. We'll still hit the vfp undef handler on swapping the task back in, so it may be a bit redundant. What I could do is use this LR field in vfpstate when hitting the undef handler to distinguish between (a) kernel_neon_begin() erroneously not having called at all and (b) kernel_neon_begin() having been called before sleeping (and print a stacktrace in the latter case) -- Ard.