From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
To: tglx@linutronix.de, mingo@redhat.com, linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org, peterz@infradead.org,
rjw@rjwysocki.net, srivatsa.bhat@linux.vnet.ibm.com,
paulmck@linux.vnet.ibm.com, davem@davemloft.net
Subject: [PATCH] tick, broadcast: Prevent false alarm when force mask contains offline cpus
Date: Wed, 26 Mar 2014 09:26:48 +0530 [thread overview]
Message-ID: <20140326035648.21736.85740.stgit@preeti.in.ibm.com> (raw)
Its possible that the tick_broadcast_force_mask contains cpus which are not
in cpu_online_mask when a broadcast tick occurs. This could happen under the
following circumstance assuming CPU1 is among the CPUs waiting for broadcast.
CPU0 CPU1
Run CPU_DOWN_PREPARE notifiers
Start stop_machine Gets woken up by IPI to run
stop_machine, sets itself in
tick_broadcast_force_mask if the
time of broadcast interrupt is around
the same time as this IPI.
Start stop_machine
set_cpu_online(cpu1, false)
End stop_machine End stop_machine
Broadcast interrupt
Finds that cpu1 in
tick_broadcast_force_mask is offline
and triggers the WARN_ON in
tick_handle_oneshot_broadcast()
Clears all broadcast masks
in CPU_DEAD stage.
This WARN_ON was added to capture scenarios where the broadcast mask, be it
oneshot/pending/force_mask contain offline cpus whose tick devices have been
removed. But here is a case where we trigger the warn on in a valid scenario.
One could argue that the scenario is invalid and ought to be warned against
because ideally the broadcast masks need to be cleared of the cpus about to
go offine before clearing them in the online_mask so that we dont hit these
scenarios.
This would mean clearing the masks in CPU_DOWN_PREPARE stage. But
it is quite possible that this stage itself will fail and cpu hotplug will
not go through. We would then end up in a situation where the cpu has not gone
offline, and continues to wait for the broadcast interrupt like before.
However it is cleared in the broadcast masks and this interrupt will never
be delivered. Hence clearing of masks is best kept off until we are sure that
the cpu is dead, i.e. in the CPU_DEAD stage.
Hence simply ensure that the tick_broadcast_force_mask is a subset of the
online cpus to take care of rare occurences such as above. Moreover this is
not a harmful scenario where the cpu is in the mask but its tick device was
shutdown. The WARN_ON will then continue to capture cases where we could
possibly cause a kernel crash.
Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
---
kernel/time/tick-broadcast.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 63c7b2d..30b8731 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -606,7 +606,12 @@ again:
*/
cpumask_clear_cpu(smp_processor_id(), tick_broadcast_pending_mask);
- /* Take care of enforced broadcast requests */
+ /* Take care of enforced broadcast requests. We could have offline
+ * cpus in the tick_broadcast_force_mask. Thats ok, we got the interrupt
+ * before we could clear the mask.
+ */
+ cpumask_and(tick_broadcast_force_mask,
+ tick_broadcast_force_mask, cpu_online_mask);
cpumask_or(tmpmask, tmpmask, tick_broadcast_force_mask);
cpumask_clear(tick_broadcast_force_mask);
next reply other threads:[~2014-03-26 4:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-26 3:56 Preeti U Murthy [this message]
2014-03-26 11:21 ` [PATCH] tick, broadcast: Prevent false alarm when force mask contains offline cpus Srivatsa S. Bhat
2014-03-26 13:22 ` Preeti U Murthy
2014-03-27 3:02 ` Preeti U Murthy
2014-03-27 6:28 ` Srivatsa S. Bhat
2014-03-27 10:14 ` Preeti U Murthy
2014-03-28 8:47 ` Srivatsa S. Bhat
2014-04-01 5:32 ` Preeti U Murthy
2014-04-09 6:02 ` Preeti U Murthy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140326035648.21736.85740.stgit@preeti.in.ibm.com \
--to=preeti@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).