xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 1/4] x86/apic: Disable the LAPIC later in smp_send_stop()
Date: Tue, 2 Jun 2015 15:04:24 +0100	[thread overview]
Message-ID: <1433253867-29752-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1433253867-29752-1-git-send-email-andrew.cooper3@citrix.com>

__stop_this_cpu() may reset the LAPIC mode back from x2apic to xapic, but will
leave x2apic_enabled alone.  This may cause disconnect_bsp_APIC() in
disable_IO_APIC() to suffer a #GP fault.

Disabling the LAPIC can safely be deferred to being the last action.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>

---

I still think that x2apic_enabled is not appropriate an appropriate predicate
for apic_read/write() to use.  Currently LAPIC mode is inherently a per-pcpu
properly rather than a global properly, and can result in all kinds of fun
depending on the exact nature of the crash.  In this example, had the original
crash attempt got further before reentering, x2apic_enabled would have already
changed, and smp_call_function() higher would have failed to IPI the other
cpus (by trying to drive the LAPIC in xapic mode when it was actually in
x2apic mode).
---
 xen/arch/x86/smp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 06a833e..8caa0bc 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -311,9 +311,9 @@ void smp_send_stop(void)
         mdelay(1);
 
     local_irq_disable();
-    __stop_this_cpu();
     disable_IO_APIC();
     hpet_disable();
+    __stop_this_cpu();
     local_irq_enable();
 }
 
-- 
1.7.10.4

  reply	other threads:[~2015-06-02 14:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 14:04 [PATCH 0/4] x86/xen Several unassociated fixes Andrew Cooper
2015-06-02 14:04 ` Andrew Cooper [this message]
2015-06-02 14:04 ` [PATCH 2/4] xen/crash: Don't use set_fixmap() in the crash path Andrew Cooper
2015-06-02 14:04 ` [PATCH 3/4] x86/debugger: Use copy_to/from_guest() in dbg_rw_guest_mem() Andrew Cooper
2015-06-02 14:04 ` [PATCH 4/4] x86/memcpy: Reduce code size Andrew Cooper

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=1433253867-29752-2-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xen.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).