linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	tony.luck@intel.com, seiji.aguchi@hds.com, ak@linux.intel.com,
	mjg@redhat.com, levinsasha928@gmail.com,
	Don Zickus <dzickus@redhat.com>
Subject: [PATCH 2/2] x86, reschedule: check to see if system is shutting down
Date: Mon, 13 Feb 2012 15:27:40 -0500	[thread overview]
Message-ID: <1329164860-668-3-git-send-email-dzickus@redhat.com> (raw)
In-Reply-To: <1329164860-668-1-git-send-email-dzickus@redhat.com>

Due to reschedule changes in v3.3, a WARN_ON has popped up
because a cpu suddenly became offline without letting anyone
know.

This results in the schedule trying to move something to another
cpu only to find out it isn't there and getting confused.  The splat
looks something like:

[   32.448626] ------------[ cut here ]------------
[   32.449160] WARNING: at arch/x86/kernel/smp.c:119 native_smp_send_reschedule+0x25/0x43()
[   32.449621] Pid: 1, comm: init_stage2 Not tainted 3.2.0+ #14
[   32.449621] Call Trace:
[   32.449621]  <IRQ>  [<ffffffff81041a44>] ? native_smp_send_reschedule+0x25/0x43
[   32.449621]  [<ffffffff810735b2>] warn_slowpath_common+0x7b/0x93
[   32.449621]  [<ffffffff810962cc>] ? tick_nohz_handler+0xc9/0xc9
[   32.449621]  [<ffffffff81073675>] warn_slowpath_null+0x15/0x18
[   32.449621]  [<ffffffff81041a44>] native_smp_send_reschedule+0x25/0x43
[   32.449621]  [<ffffffff81067a00>] smp_send_reschedule+0xa/0xc
[   32.449621]  [<ffffffff8106f25e>] scheduler_tick+0x21a/0x242
[   32.449621]  [<ffffffff8107da10>] update_process_times+0x62/0x73
[   32.449621]  [<ffffffff81096336>] tick_sched_timer+0x6a/0x8a
[   32.449621]  [<ffffffff8108c5eb>] __run_hrtimer.clone.26+0x55/0xcb
[   32.449621]  [<ffffffff8108cd77>] hrtimer_interrupt+0xcb/0x19b
[   32.449621]  [<ffffffff810428a8>] smp_apic_timer_interrupt+0x72/0x85
[   32.449621]  [<ffffffff8165a8de>] apic_timer_interrupt+0x6e/0x80
[   32.449621]  <EOI>  [<ffffffff8165928e>] ? _raw_spin_unlock_irqrestore+0x3a/0x3e
[   32.449621]  [<ffffffff81042f4e>] ? arch_local_irq_restore+0x6/0xd
[   32.449621]  [<ffffffff810430c4>] default_send_IPI_mask_allbutself_phys+0x78/0x88
[   32.449621]  [<ffffffff8106c3c4>] ? __migrate_task+0xf1/0xf1
[   32.449621]  [<ffffffff81045445>] physflat_send_IPI_allbutself+0x12/0x14
[   32.449621]  [<ffffffff81041aaf>] native_stop_other_cpus+0x4d/0xa8
[   32.449621]  [<ffffffff810411c6>] native_machine_shutdown+0x56/0x6d
[   32.449621]  [<ffffffff81048499>] kvm_shutdown+0x1a/0x1c
[   32.449621]  [<ffffffff810411f9>] machine_shutdown+0xa/0xc
[   32.449621]  [<ffffffff81041265>] native_machine_restart+0x20/0x32
[   32.449621]  [<ffffffff81041297>] machine_restart+0xa/0xc
[   32.449621]  [<ffffffff81081d53>] kernel_restart+0x49/0x4d

I solved this by re-using the atomic global variable that is set during
native_smp_stop_other_cpus().  This is the piece of code that causes the
problem and it sets stopping_cpu to reflect the system is going down.

If the variable is set do not yell with the WARN_ON, just return.

v2:  use if-condition for WARN-ON instead of if {WARN_ON(1)}

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 arch/x86/kernel/smp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 48d2b7d..54d570e 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -120,7 +120,8 @@ static bool smp_no_nmi_ipi = false;
 static void native_smp_send_reschedule(int cpu)
 {
 	if (unlikely(cpu_is_offline(cpu))) {
-		WARN_ON(1);
+		/* system is not shutting down.. yell */
+		WARN_ON(atomic_read(&stopping_cpu) == -1)
 		return;
 	}
 	apic->send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR);
-- 
1.7.7.6


  parent reply	other threads:[~2012-02-13 20:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-13 20:27 [PATCH 0/2 v2] x86, reboot: cleanup NMI and REBOOT_IRQ Don Zickus
2012-02-13 20:27 ` [PATCH 1/2] x86, reboot: revert stop_other_cpus to using IRQ with NMI fallback Don Zickus
2012-03-02 20:41   ` Seiji Aguchi
2012-03-02 21:11     ` Don Zickus
2012-03-02 21:55       ` Seiji Aguchi
2012-02-13 20:27 ` Don Zickus [this message]
2012-02-13 21:22   ` [PATCH 2/2] x86, reschedule: check to see if system is shutting down Seiji Aguchi
2012-02-13 22:43     ` Don Zickus
2012-02-15 11:26   ` Peter Zijlstra
2012-02-15 14:54     ` Don Zickus
2012-02-15 14:57       ` Peter Zijlstra
2012-02-15 15:57         ` Don Zickus
2012-02-15 17:59           ` Peter Zijlstra
2012-02-16  3:14             ` Don Zickus
  -- strict thread matches above, loose matches on Subject: below --
2012-02-10 21:02 [PATCH 0/2] x86, reboot: cleanup NMI and REBOOT_IRQ Don Zickus
2012-02-10 21:02 ` [PATCH 2/2] x86, reschedule: check to see if system is shutting down Don Zickus
2012-02-10 22:42   ` Luck, Tony
2012-02-10 22:53     ` Don Zickus

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=1329164860-668-3-git-send-email-dzickus@redhat.com \
    --to=dzickus@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seiji.aguchi@hds.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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).