All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 1 of 7] APIC BUG: fix potential	 Protection Fault during shutdown
Date: Tue, 14 Jun 2011 10:44:17 +0100	[thread overview]
Message-ID: <4DF72D71.20000@citrix.com> (raw)
In-Reply-To: <4DF73B970200007800046F4D@nat28.tlf.novell.com>



On 14/06/11 09:44, Jan Beulich wrote:
>>>> On 13.06.11 at 19:02, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>> This is a rare case, but if the BIOS is set to uniprocessor, and Xen
>> is booted with 'lapic x2apic', Xen will switch into x2apic mode, which
>> will cause a protection fault when disabling the local APIC.  This
>> leads to a general protection fault as this code is also in the fault
>> handler.
>>
>> When x2apic mode is enabled, the only tranlsation which does
>> not result in a protection fault is to clear both the EN and EXTD
>> bits, which is safe to do in all cases, even if you are in xapic
>> mode rather than x2apic mode.
>>
>> The linux code from which this is derrived is protected by an
>> if ( ! x2apic_mode ...) clause which is how they get away with it.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Acked-by: Jan Beulich <jbeulich@novell.com>
>
> You may want to submit a similar patch to Linux (which is what
> this code got derived from), so that in the future no-one will get
> surprised that this is different in Xen and Linux.
>
> Otoh, interestingly this is being done only for x86-32 in Linux, and
> I highly doubt any X2APIC capable machine would boot with APIC
> disabled.
>
> Jan
>
As I said, it is an edge case and shouldn't occur under any normal
circumstances, but given the nature of the fix, we might as well help
the odd setups.  I considered upstreaming it to Linux but I doubt It
will be taken because there is no way to force their code to have a
protection fault.

~Andrew
>> diff -r 37c77bacb52a -r 076c3034c8c7 xen/arch/x86/apic.c
>> --- a/xen/arch/x86/apic.c	Mon May 23 17:38:28 2011 +0100
>> +++ b/xen/arch/x86/apic.c	Mon Jun 13 17:45:43 2011 +0100
>> @@ -340,7 +340,8 @@ void disable_local_APIC(void)
>>      if (enabled_via_apicbase) {
>>          uint64_t msr_content;
>>          rdmsrl(MSR_IA32_APICBASE, msr_content);
>> -        wrmsrl(MSR_IA32_APICBASE, msr_content & ~MSR_IA32_APICBASE_ENABLE);
>> +        wrmsrl(MSR_IA32_APICBASE, msr_content &
>> +               ~(MSR_IA32_APICBASE_ENABLE|MSR_IA32_APICBASE_EXTD));
>>      }
>>  }
>>  
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com 
>> http://lists.xensource.com/xen-devel 
>
>

-- 
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com

  reply	other threads:[~2011-06-14  9:44 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 17:02 [PATCH 0 of 7] Fix kexec in Xen (take 4) Andrew Cooper
2011-06-13 17:02 ` [PATCH 1 of 7] APIC BUG: fix potential Protection Fault during shutdown Andrew Cooper
2011-06-14  8:44   ` Jan Beulich
2011-06-14  9:44     ` Andrew Cooper [this message]
2011-06-13 17:02 ` [PATCH 2 of 7] KEXEC BUG: nmi_shootdown_cpus doesn't look after the interrupt flag Andrew Cooper
2011-06-14  8:46   ` Jan Beulich
2011-06-14  9:46     ` Keir Fraser
2011-06-15 11:01       ` [PATCH 2 of 7] KEXEC BUG: nmi_shootdown_cpus doesn't look after the interrupt flag [Reformatted] Andrew Cooper
2011-06-14  9:51     ` [PATCH 2 of 7] KEXEC BUG: nmi_shootdown_cpus doesn't look after the interrupt flag Andrew Cooper
2011-06-13 17:02 ` [PATCH 3 of 7] IOMMU: Sanitise pointer work Andrew Cooper
2011-06-13 18:13   ` Keir Fraser
2011-06-14  9:53     ` Andrew Cooper
2011-06-14 11:51       ` Keir Fraser
2011-06-13 17:02 ` [PATCH 4 of 7] APIC: record local APIC state on boot Andrew Cooper
2011-06-14  8:57   ` Jan Beulich
2011-06-14 10:48     ` Ian Campbell
2011-06-14 11:21       ` Jan Beulich
2011-06-15 12:33         ` [PATCH 4 of 7] APIC: record local APIC state on boot [Reformatted] Andrew Cooper
2011-06-15 12:42           ` Keir Fraser
2011-06-15 13:38             ` Andrew Cooper
2011-06-15 14:49               ` Andrew Cooper
2011-06-15 12:50           ` Jan Beulich
2011-06-13 17:02 ` [PATCH 5 of 7] IOMMU VTD BUG: disable Extended Interrupt Mode when disabling Interupt Remapping Andrew Cooper
2011-06-14  9:02   ` Jan Beulich
2011-06-14  9:59     ` Andrew Cooper
2011-06-14 21:20     ` Kay, Allen M
2011-06-15  6:48       ` Jan Beulich
2011-06-15  7:45         ` Ian Campbell
2011-06-15 14:49           ` [PATCH 5 of 7] IOMMU VTD BUG: disable Extended Interrupt Mode when disabling Interupt Remapping [Reformatted] Andrew Cooper
2011-06-14 21:45   ` [PATCH 5 of 7] IOMMU VTD BUG: disable Extended Interrupt Mode when disabling Interupt Remapping Kay, Allen M
2011-06-13 17:02 ` [PATCH 6 of 7] IOMMU: add crash_shutdown iommu_op Andrew Cooper
2011-06-14 12:10   ` Keir Fraser
2011-06-15 12:50     ` Andrew Cooper
2011-06-14 22:15   ` Kay, Allen M
2011-06-15 13:06     ` Andrew Cooper
2011-06-15 16:39       ` Kay, Allen M
2011-06-15 15:00     ` [PATCH 6 of 7] IOMMU: add crash_shutdown iommu_op [Reformatted] Andrew Cooper
2011-06-13 17:02 ` [PATCH 7 of 7] KEXEC: correctly revert x2apic state when kexecing Andrew Cooper
2011-06-14 12:11   ` Keir Fraser
2011-06-14 13:05     ` Andrew Cooper
2011-06-13 18:15 ` [PATCH 0 of 7] Fix kexec in Xen (take 4) Keir Fraser
2011-06-16 13:05   ` Andrew Cooper
2011-06-16 13:13     ` Keir Fraser

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=4DF72D71.20000@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@novell.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.