x86: Use deep C states for off-lined CPUs
PATCH v2 1/1 x86: Use deep C states for off-lined CPUs
# HG changeset patch
# User Boris Ostrovsky <[email protected]> # Date 1330642361 -3600
# Node ID 99df5c6b2964ceaa73651d7bc02fb1ae820f7691 # Parent a7bacdc5449a2f7bb9c35b2a1334b463fe9f29a9
x86: Use deep C states for off-lined CPUs
Currently when a core is taken off-line it is placed in C1 state (unless MONITOR/MWAIT is used). This patch allows a core to go to deeper C states resulting in significantly higher power savings.
xen/arch/x86/acpi/cpu_idle.c +18 -0
@@ -566,6 +566,7 @@ static void acpi_dead_idle(void)struct acpi_processor_power *power;struct acpi_processor_cx *cx;void *mwait_ptr; +struct cpuinfo_x86 *c = ¤t_cpu_data;if ( (power = processor_powers[smp_processor_id ()]) ==NULL ) goto default_halt;
@@ -601,6 +602,23 @@ static void acpi_dead_idle(void)mb ();__mwait (cx->address,0 ); } + } +else if ( c->x86_vendor ==X86_VENDOR_AMD && + cx->entry_method ==ACPI_CSTATE_EM_SYSIO ) + { +/* Intel prefers not to use SYSIO */ + +/* Avoid references to shared data after the cache flush */ +u32 address = cx->address; +u32 pmtmr_ioport_local = pmtmr_ioport; + +wbinvd (); + +while (1 ) + { +inb (address); +inl (pmtmr_ioport_local); + } } default_halt:
Fine to me.
BTW, seems another patch moving mwait_ptr declaration and related code into if(FFH) is slightly better? It's FFH staff anyway.
Thanks,
Jinsong
Quoted 48 lines · Boris Ostrovsky
# HG changeset patch
# User Boris Ostrovsky <[email protected]> # Date 1330642361 -3600
# Node ID99df5c6b2964ceaa73651d7bc02fb1ae820f7691# Parenta7bacdc5449a2f7bb9c35b2a1334b463fe9f29a9
x86: Use deep C states for off-lined CPUsCurrently when a core is taken off-line it is placed in C1 state (unless MONITOR/MWAIT is used). This patch allows a core to go to deeper C states resulting in significantly higher power savings.
Signed-off-by Boris Ostrovsky <[email protected]>diff -r
a7bacdc5449a-r99df5c6b2964xen/arch/x86/acpi/cpu_idle.cxen/arch/x86/acpi/cpu_idle.c +18
-0@@ -566,6 +566,7 @@ static void acpi_dead_idle(void)struct acpi_processor_power *power;struct acpi_processor_cx *cx;void *mwait_ptr; +struct cpuinfo_x86 *c = ¤t_cpu_data;if ( (power = processor_powers[smp_processor_id ()]) ==NULL ) goto default_halt;@@ -601,6 +602,23 @@ static void acpi_dead_idle(void)mb ();__mwait (cx->address,0 ); } + } +else if ( c->x86_vendor ==X86_VENDOR_AMD && + cx->entry_method ==ACPI_CSTATE_EM_SYSIO ) + { +/* Intel prefers not to use SYSIO */ + +/* Avoid references to shared data after the cache flush */ +u32 address = cx->address; +u32 pmtmr_ioport_local = pmtmr_ioport; + +wbinvd (); + +while (1 ) + { +inb (address); +inl (pmtmr_ioport_local); + } } default_halt:
Jan was objecting to moving it in this patch because it is not directly related to the functionality that the patch was addressing. Or was it because it wasn't properly done?
-boris
Quoted 57 lines · Jinsong
Fine to me.
BTW, seems another patch movingmwait_ptrdeclaration and related code into if(FFH) is slightly better? It's FFH staff anyway.Thanks,
JinsongQuoted 48 lines · Boris Ostrovsky
# HG changeset patch
# User Boris Ostrovsky<[email protected]> # Date 1330642361 -3600
# Node ID99df5c6b2964ceaa73651d7bc02fb1ae820f7691# Parenta7bacdc5449a2f7bb9c35b2a1334b463fe9f29a9
x86: Use deep C states for off-lined CPUsCurrently when a core is taken off-line it is placed in C1 state (unless MONITOR/MWAIT is used). This patch allows a core to go to deeper C states resulting in significantly higher power savings.
Signed-off-by Boris Ostrovsky<[email protected]>diff -r
a7bacdc5449a-r99df5c6b2964xen/arch/x86/acpi/cpu_idle.cxen/arch/x86/acpi/cpu_idle.c +18
-0@@ -566,6 +566,7 @@ static void acpi_dead_idle(void)struct acpi_processor_power *power;struct acpi_processor_cx *cx;void *mwait_ptr; +struct cpuinfo_x86 *c =¤t_cpu_data;if ( (power = processor_powers[smp_processor_id ()]) ==NULL ) goto default_halt;@@ -601,6 +602,23 @@ static void acpi_dead_idle(void)mb ();__mwait (cx->address,0 ); } + } +else if ( c->x86_vendor ==X86_VENDOR_AMD && + cx->entry_method ==ACPI_CSTATE_EM_SYSIO ) + { +/* Intel prefers not to use SYSIO */ + +/* Avoid references to shared data after the cache flush */ +u32 address = cx->address; +u32 pmtmr_ioport_local = pmtmr_ioport; + +wbinvd (); + +while (1 ) + { +inb (address); +inl (pmtmr_ioport_local); + } } default_halt:
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Boris Ostrovsky
Jan was objecting to moving it in this patch because it is not directly related to the functionality that the patch was addressing. Or was it because it wasn't properly done?
And similarly Jinsong suggested to do this in _another_ patch.
Jan
Quoted 59 lines · Jinsong
Quoted 2 lines
Fine to me.
BTW, seems another patch movingmwait_ptrdeclaration and related code intoif(FFH) is slightly better? It's FFH staff anyway.
Quoted 55 lines
Thanks,
JinsongQuoted 48 lines · Boris Ostrovsky
# HG changeset patch
# User Boris Ostrovsky<[email protected]> # Date 1330642361 -3600
# Node ID99df5c6b2964ceaa73651d7bc02fb1ae820f7691# Parenta7bacdc5449a2f7bb9c35b2a1334b463fe9f29a9
x86: Use deep C states for off-lined CPUsCurrently when a core is taken off-line it is placed in C1 state (unless MONITOR/MWAIT is used). This patch allows a core to go to deeper C states resulting in significantly higher power savings.
Signed-off-by Boris Ostrovsky<[email protected]>diff -r
a7bacdc5449a-r99df5c6b2964xen/arch/x86/acpi/cpu_idle.cxen/arch/x86/acpi/cpu_idle.c +18
-0@@ -566,6 +566,7 @@ static void acpi_dead_idle(void)struct acpi_processor_power *power;struct acpi_processor_cx *cx;void *mwait_ptr; +struct cpuinfo_x86 *c =¤t_cpu_data;if ( (power = processor_powers[smp_processor_id ()]) ==NULL ) goto default_halt;@@ -601,6 +602,23 @@ static void acpi_dead_idle(void)mb ();__mwait (cx->address,0 ); } + } +else if ( c->x86_vendor ==X86_VENDOR_AMD && + cx->entry_method ==ACPI_CSTATE_EM_SYSIO ) + { +/* Intel prefers not to use SYSIO */ + +/* Avoid references to shared data after the cache flush */ +u32 address = cx->address; +u32 pmtmr_ioport_local = pmtmr_ioport; + +wbinvd (); + +while (1 ) + { +inb (address); +inl (pmtmr_ioport_local); + } } default_halt: