4.4-stable review patch. If anyone has any objections, please let me know.
------------------ From: Dexuan Cui <de...@microsoft.com> commit 5596fe34495cf0f645f417eb928ef224df3e3cb4 upstream. for_each_cpu() unintuitively reports CPU0 as set independent of the actual cpumask content on UP kernels. This causes an unexpected PIT interrupt storm on a UP kernel running in an SMP virtual machine on Hyper-V, and as a result, the virtual machine can suffer from a strange random delay of 1~20 minutes during boot-up, and sometimes it can hang forever. Protect if by checking whether the cpumask is empty before entering the for_each_cpu() loop. [ tglx: Use !IS_ENABLED(CONFIG_SMP) instead of #ifdeffery ] Signed-off-by: Dexuan Cui <de...@microsoft.com> Signed-off-by: Thomas Gleixner <t...@linutronix.de> Cc: Josh Poulson <jopou...@microsoft.com> Cc: "Michael Kelley (EOSG)" <michael.h.kel...@microsoft.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Frederic Weisbecker <fweis...@gmail.com> Cc: sta...@vger.kernel.org Cc: Rakib Mullick <rakib.mull...@gmail.com> Cc: Jork Loeser <jork.loe...@microsoft.com> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: Andrew Morton <a...@linux-foundation.org> Cc: KY Srinivasan <k...@microsoft.com> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Alexey Dobriyan <adobri...@gmail.com> Cc: Dmitry Vyukov <dvyu...@google.com> Link: https://lkml.kernel.org/r/kl1p15301mb000678289fe55ba365b3279abf...@kl1p15301mb0006.apcp153.prod.outlook.com Link: https://lkml.kernel.org/r/kl1p15301mb0006fa63bc22beb64902eaa0bf...@kl1p15301mb0006.apcp153.prod.outlook.com Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- kernel/time/tick-broadcast.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -610,6 +610,14 @@ static void tick_handle_oneshot_broadcas now = ktime_get(); /* Find all expired events */ for_each_cpu(cpu, tick_broadcast_oneshot_mask) { + /* + * Required for !SMP because for_each_cpu() reports + * unconditionally CPU0 as set on UP kernels. + */ + if (!IS_ENABLED(CONFIG_SMP) && + cpumask_empty(tick_broadcast_oneshot_mask)) + break; + td = &per_cpu(tick_cpu_device, cpu); if (td->evtdev->next_event.tv64 <= now.tv64) { cpumask_set_cpu(cpu, tmpmask);