diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2013-12-05 14:16:52 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2015-02-13 22:21:04 (GMT) |
commit | e33f02dbe48761efd7022ceb10512daf7bd7b5a3 (patch) | |
tree | 118068968d75e9fc53c5201c214b33592e84c38a /kernel/range.c | |
parent | 46dbcd09f7eca4b77dc7f663c009b14a89ca30ac (diff) | |
download | linux-fsl-qoriq-e33f02dbe48761efd7022ceb10512daf7bd7b5a3.tar.xz |
cpu hotplug: Document why PREEMPT_RT uses a spinlock
The patch:
cpu: Make hotplug.lock a "sleeping" spinlock on RT
Tasks can block on hotplug.lock in pin_current_cpu(), but their
state might be != RUNNING. So the mutex wakeup will set the state
unconditionally to RUNNING. That might cause spurious unexpected
wakeups. We could provide a state preserving mutex_lock() function,
but this is semantically backwards. So instead we convert the
hotplug.lock() to a spinlock for RT, which has the state preserving
semantics already.
Fixed a bug where the hotplug lock on PREEMPT_RT can be called after a
task set its state to TASK_UNINTERRUPTIBLE and before it called
schedule. If the hotplug_lock used a mutex, and there was contention,
the current task's state would be turned to TASK_RUNNABLE and the
schedule call will not sleep. This caused unexpected results.
Although the patch had a description of the change, the code had no
comments about it. This causes confusion to those that review the code,
and as PREEMPT_RT is held in a quilt queue and not git, it's not as easy
to see why a change was made. Even if it was in git, the code should
still have a comment for something as subtle as this.
Document the rational for using a spinlock on PREEMPT_RT in the hotplug
lock code.
Reported-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'kernel/range.c')
0 files changed, 0 insertions, 0 deletions