WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH]x86:x2apic: Disable x2apic on x86-32 permanently

To: "Zhang, Fengzhe" <fengzhe.zhang@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH]x86:x2apic: Disable x2apic on x86-32 permanently
From: Keir Fraser <keir@xxxxxxx>
Date: Fri, 21 Jan 2011 13:09:05 +0000
Cc:
Delivery-date: Fri, 21 Jan 2011 05:10:10 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:user-agent:date:subject:from:to :message-id:thread-topic:thread-index:in-reply-to:mime-version :content-type:content-transfer-encoding; bh=gQVDcuhnDpONX4ORwz1tveQfB2is94MyYyLNOdcncY4=; b=M2pCVaDa0flJX5d1N/rAVs7YVBk/QY3Rekzw7IJwWw0Er0SzGezJPmHRfIU1Vp6YS5 9EZDOXHghlxupIgdWXR5NFm7/kJA5dYTOZPiWrnx1suAFkOnqb6kW3BYhJW/rBeHtn9p Iv8DoqhCBxyExk2U+OK1GxPifioza89g9PUOI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=qYFpSfhqvRQeW6ORIrgaYVbqn/ZD81zTPASxwSG7JNOdqczCh/T9rGggExue7OZugC bePl+M25RHdkEexOzYUOPdm5GYwzyMRR/BZLs3vDGxg5U37ZtAjwIpTPDBI2yJ64zjP2 KiC5KCfjLIMMa6qFyN19isxJGVvBjOpwPpA24=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1A42CE6F5F474C41B63392A5F80372B231F18B24@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acu5ZcYz2vLckx0kQOSJvRcHzARMuwABpsUG
Thread-topic: [Xen-devel] [PATCH]x86:x2apic: Disable x2apic on x86-32 permanently
User-agent: Microsoft-Entourage/12.28.0.101117
Could you give more info on the bug, such as a backtrace? I wonder whether
this might be better fixed in some more elegant way. Also I can't eyeball
where map_domain_page() is being called during x2apic setup.

 Thanks,
 Keir

On 21/01/2011 12:21, "Zhang, Fengzhe" <fengzhe.zhang@xxxxxxxxx> wrote:

> x86:x2apic: Disable x2apic on x86-32 permanently
> 
> x2apic initialization on x86_32 uses vcpu pointer before it is initialized. As
> x2apic is unlikely to be used on x86_32, this patch disables x2apic
> permanently on x86_32. It also asserts the sanity of vcpu pointer before
> dereference to prevent further misuse.
> 
> Signed-off-by: Fengzhe Zhang <fengzhe.zhang@xxxxxxxxx>
> 
> diff -r 02c0af2bf280 xen/arch/x86/apic.c
> --- a/xen/arch/x86/apic.c Mon Jan 17 18:05:52 2011 +0000
> +++ b/xen/arch/x86/apic.c Wed Jan 19 03:24:16 2011 -0500
> @@ -961,6 +961,22 @@
>      if ( !cpu_has_x2apic )
>          return;
> 
> +#ifdef __i386__
> +    clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability);
> +    if (x2apic_enabled) {
> +        uint64_t msr_content;
> +
> +        rdmsrl(MSR_IA32_APICBASE, msr_content);
> +        msr_content &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD);
> +        wrmsrl(MSR_IA32_APICBASE, msr_content);
> +        msr_content |= MSR_IA32_APICBASE_ENABLE;
> +        wrmsrl(MSR_IA32_APICBASE, msr_content);
> +        x2apic_enabled = 0;
> +    }
> +    printk("x2APIC disabled permanently on x86_32.\n");
> +    return;
> +#endif
> +
>      if ( !opt_x2apic )
>      {
>          if ( !x2apic_enabled )
> diff -r 02c0af2bf280 xen/arch/x86/x86_32/domain_page.c
> --- a/xen/arch/x86/x86_32/domain_page.c Mon Jan 17 18:05:52 2011 +0000
> +++ b/xen/arch/x86/x86_32/domain_page.c Wed Jan 19 03:24:16 2011 -0500
> @@ -53,6 +53,8 @@
>      perfc_incr(map_domain_page_count);
> 
>      v = mapcache_current_vcpu();
> +    /* Prevent vcpu pointer being used before initialize. */
> +    ASSERT((unsigned long)v != 0xfffff000);
> 
>      dcache = &v->domain->arch.mapcache;
>      vcache = &v->arch.mapcache;
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel