Scheduling while atomic in find_task_lock_mm
I'm trying to port the RT patch to Android (based on Linux 3.10) and things have been going pretty smoothly. However, I've hit a snag--I have to have hot plugging enabled and when the system tries to take down a CPU, it gets "scheduling while atomic". At a high level, the code to take the CPU down is trying to clear the CPU's bit in the mm_struct associated with every task_struct.
In more detail, cpu_stopper_thread() disables preemption, then there is a sequence of calls, passing through the ARM-specific __cpu_disable(), finally atrriving at find_lock_task_mm(). That function calls task_lock(), which uses spin_lock() to lock a task_struct. When it encounters a task_struct that is already locked, schedule() gets called and Bad Things happen.
So:
o I don't think I can enable preemption here because it's pretty like another
task will swoop in and mess things up.
o Using a raw_spin_lock() just for ARM doesn't seem like a good choice.
o I *think* I do need the spin_lock() before changing the CPU's bit in the
cpu_vm_mask_var element of the mm_struct.