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]ACPI: re-enable mwait for xen cpuidle

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: RE: [Xen-devel] [PATCH]ACPI: re-enable mwait for xen cpuidle
From: "Wei, Gang" <gang.wei@xxxxxxxxx>
Date: Fri, 2 Apr 2010 17:34:58 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "Yu, Ke" <ke.yu@xxxxxxxxx>
Delivery-date: Fri, 02 Apr 2010 02:35:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <E6467867A6B05E4FA831B7DF29925F5C40E67932@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <E6467867A6B05E4FA831B7DF29925F5C40E677DD@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4BB58353.5000008@xxxxxxxx> <E6467867A6B05E4FA831B7DF29925F5C40E67932@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcrSJwfP1cRYbKunSoq1Ihm8FHUCfgAA7V8QAAbiibA=
Thread-topic: [Xen-devel] [PATCH]ACPI: re-enable mwait for xen cpuidle
Here is the alternative patch you expected. 

ACPI: re-enable mwait for xen cpuidle

Xen hypervisor doesn't export mwait feature to dom0, but latest Linux kernel 
start to check this feature while initializing _PDC object. Modify xen_cpuid to 
re-enable mwait for xen cpuidle.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c3e8bff..565244f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -189,6 +189,8 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
        unsigned maskebx = ~0;
        unsigned maskecx = ~0;
        unsigned maskedx = ~0;
+       unsigned setecx  =  0;
+       unsigned setedx  =  0;
 
        /*
         * Mask out inconvenient features, to try and disable as many
@@ -198,6 +200,12 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
        case 0x1:
                maskecx = cpuid_leaf1_ecx_mask;
                maskedx = cpuid_leaf1_edx_mask;
+               setecx  = 1 << (X86_FEATURE_MWAIT % 32);
+               break;
+
+       case 0x5: /* MWAIT INFO */
+               setecx  = 0x3; /* EXTENSIONS_SUPPORTED | INTERRUPT_BREAK */
+               setedx  = ~0;
                break;
 
        case 0xb:
@@ -220,6 +228,8 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
        *bx &= maskebx;
        *cx &= maskecx;
        *dx &= maskedx;
+       *cx |= setecx;
+       *dx |= setedx;
 }
 
 static __init void xen_init_cpuid_mask(void)

On Friday, 2010-4-2 2:33 PM, Wei, Gang wrote:
> On Friday, 2010-4-2 1:41 PM, Jeremy Fitzhardinge wrote:
>> On 04/01/2010 07:38 PM, Wei, Gang wrote:
>>> I suggest including this patch in Xen 4.0 release. It is quite
>>> straightforward, and make sure the better and widely equipped cpu
>>> idle entry method MWAIT is used by xen if available.
>>> 
>>> BTW, can we consider re-open MWAIT freature for dom0 in xen
>>> hypervisor? We can discuss it post 4.0.
>>> 
>>> Jimmy
>>> 
>>> ACPI: re-enable mwait for xen cpuidle
>>> 
>>> Xen hypervisor doesn't export mwait feature to dom0, but latest
>>> Linux kernel start to check this feature while initializing _PDC
>>> object. Bypass such check in pv-ops case to re-enable mwait for xen
>>> cpuidle. 
>>> 
>> 
>> Why not just set or clear the MWAIT feature flag in xen_cpuid?
> 
> Yes, you pointed out another approach in dom0 side which has similar
> effect as re-open MWAIT feature for dom0 in xen. I am not sure
> whether exposing the MWAIT feature to whole dom0 kernel is ok. My way
> is just to narrow the impact.   
> 
> Jimmy

Attachment: re-enable-mwait_pv-ops-dom0-v2.patch
Description: re-enable-mwait_pv-ops-dom0-v2.patch

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