Sander Eikelenboom
2010-Jan-07 15:08 UTC
[Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu
Hi All,
I''m trying to get powermanagement working with xen and a 2.6.31.6-pvops
kernel on xen 3.4.2
From what I have read, I have 2 options:
1) Let the xen hypervisor do the powermanagement (cpufreq=xen)
2) Let the dom0 kernel do the powermanagement (cpufreq=dom0-kernel)
When booting the 2.6.31.6-pvops kernel on bare metal without hypervisor the
powernow-k8 module works.
When booting the 2.6.31.6-pvops kernel as dom0 on the xen 3.4.2 hypervisor the
powernow-k8 module doesn''t load and complains:
Jan 7 15:25:37 localhost kernel: [ 12.797914] powernow-k8: Found 1 AMD
Athlon(tm) Dual Core Processor 4850e processors (2 cpu cores) (version 2.20.00)
Jan 7 15:25:37 localhost kernel: [ 12.797926] powernow-k8: register
performance failed: bad ACPI data
Jan 7 15:25:37 localhost kernel: [ 12.797929] [Firmware Bug]:
powernow-k8: No compatible ACPI _PSS objects found.
Jan 7 15:25:37 localhost kernel: [ 12.797931] [Firmware Bug]:
powernow-k8: Try again with latest BIOS.
Jan 7 15:25:37 localhost kernel: [ 12.797941] powernow-k8: register
performance failed: bad ACPI data
Jan 7 15:25:37 localhost kernel: [ 12.822315] acpi-cpufreq:
acpi_cpufreq_init
Jan 7 15:25:37 localhost kernel: [ 12.822319] acpi-cpufreq:
acpi_cpufreq_early_init
Jan 7 15:25:37 localhost kernel: [ 12.822333] acpi-cpufreq:
acpi_cpufreq_cpu_init
Jan 7 15:25:37 localhost kernel: [ 12.822338] acpi-cpufreq:
acpi_cpufreq_cpu_init
It could be that additional changes are needed to the pvops kernel that have
been made to the xen 2.6.18.8 kernel ?
When trying the first option, and let the hypervisor do the powermanagement
(booting with cpufreq=xen cpufreq.debug=2 loglvl=all)
it shows the following in xm dmesg (complete xm dmesg attachted):
(XEN) Set CPU acpi_id(0) cpuid(0) Px State info:
(XEN) _PPC: 0
(XEN) Set CPU acpi_id(0) cpuid(0) Px State info:
(XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
(XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
(XEN) _PSS: state_count=6
(XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391
(XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0
(XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e
(XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc
(XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a
(XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582
(XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2
(XEN) _PPC: 0
(XEN) Set CPU acpi_id(1) cpuid(1) Px State info:
(XEN) _PPC: 0
(XEN) Set CPU acpi_id(1) cpuid(1) Px State info:
(XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
(XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
(XEN) _PSS: state_count=6
(XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391
(XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0
(XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e
(XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc
(XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a
(XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582
(XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2
(XEN) _PPC: 0
So it seems to find all available powerstates, but using xenpm doesn''t
seem to work:
serveerstertje:~# xenpm get-cpu-topology
CPU core socket
CPU0 0 0
CPU1 1 0
serveerstertje:~# xenpm set-scaling-governor userspace
[CPU0] failed to set governor name
[CPU1] failed to set governor name
serveerstertje:~# xenpm set-scaling-governor ondemand
[CPU0] failed to set governor name
[CPU1] failed to set governor name
serveerstertje:~# xenpm set-scaling-governor performance
[CPU0] failed to set governor name
[CPU1] failed to set governor name
serveerstertje:~# xenpm set-scaling-governor powersave
[CPU0] failed to set governor name
[CPU1] failed to set governor name
serveerstertje:~# xenpm get-cpufreq-para
[CPU0] failed to get cpufreq parameter
[CPU1] failed to get cpufreq parameter
--
Best regards,
Sander mailto:linux@eikelenboom.it
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Yu, Ke
2010-Jan-08 14:32 UTC
RE: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu
Hi Sander, For option1 "cpufreq=dom0-kernel", it is not working currently, the reason is a bit complex, and let me explain. For every processor, there is corresponding acpi processor object in ACPI DSDT table. Kernel use struct acpi_processor to represent the acpi processor object. There is a field "id" in acpi_processor representing the cpu id (the same id as smp_processor_id()). Kernel cpufreq use acpi_processor->id to do the frequency scaling. Unfortunately, in pv_ops domain0, the acpi_processor->id value is not correct, because it is get by acpi_id->apic_id->id mapping, and in pv_ops dom0, the apic_id of vcpu is not correctly initialized. Please see drivers/acpi/processor_core.c:get_cpu_id() for detail code, where cpu_physical_id() is not initialized in pv_ops dom0 case. I am still thinking if there is better approach to do the acpi_id->apic_id->id mapping in pv_ops dom0 case. BTW, "cpufreq=dom0-kernel" is not recommend, due to that it require #pCPU=#vCPU, and all vCPU in dom0 must be pined. For option2 "cpufreq=xen", from the log, Xen can get all the P states info, but it failed to do cpufreq cpu initialization (xen/arch/x86/acpi/cpufreq/cpufreq.c: cpufreq_cpu_init()), so the cpufreq is not started finally, and xenpm cannot set cpufreq parameter. To get more debug info, I write a simple patch as attached, could you please have a try and send the debug info? Another thing is, does "cpufreq=xen" work with linux-2.6.18-xen dom0? Best Regards Ke -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Sander Eikelenboom Sent: Thursday, January 07, 2010 11:08 PM To: xen-devel@lists.xensource.com Subject: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu Hi All, I''m trying to get powermanagement working with xen and a 2.6.31.6-pvops kernel on xen 3.4.2>From what I have read, I have 2 options:1) Let the xen hypervisor do the powermanagement (cpufreq=xen) 2) Let the dom0 kernel do the powermanagement (cpufreq=dom0-kernel) When booting the 2.6.31.6-pvops kernel on bare metal without hypervisor the powernow-k8 module works. When booting the 2.6.31.6-pvops kernel as dom0 on the xen 3.4.2 hypervisor the powernow-k8 module doesn''t load and complains: Jan 7 15:25:37 localhost kernel: [ 12.797914] powernow-k8: Found 1 AMD Athlon(tm) Dual Core Processor 4850e processors (2 cpu cores) (version 2.20.00) Jan 7 15:25:37 localhost kernel: [ 12.797926] powernow-k8: register performance failed: bad ACPI data Jan 7 15:25:37 localhost kernel: [ 12.797929] [Firmware Bug]: powernow-k8: No compatible ACPI _PSS objects found. Jan 7 15:25:37 localhost kernel: [ 12.797931] [Firmware Bug]: powernow-k8: Try again with latest BIOS. Jan 7 15:25:37 localhost kernel: [ 12.797941] powernow-k8: register performance failed: bad ACPI data Jan 7 15:25:37 localhost kernel: [ 12.822315] acpi-cpufreq: acpi_cpufreq_init Jan 7 15:25:37 localhost kernel: [ 12.822319] acpi-cpufreq: acpi_cpufreq_early_init Jan 7 15:25:37 localhost kernel: [ 12.822333] acpi-cpufreq: acpi_cpufreq_cpu_init Jan 7 15:25:37 localhost kernel: [ 12.822338] acpi-cpufreq: acpi_cpufreq_cpu_init It could be that additional changes are needed to the pvops kernel that have been made to the xen 2.6.18.8 kernel ? When trying the first option, and let the hypervisor do the powermanagement (booting with cpufreq=xen cpufreq.debug=2 loglvl=all) it shows the following in xm dmesg (complete xm dmesg attachted): (XEN) Set CPU acpi_id(0) cpuid(0) Px State info: (XEN) _PPC: 0 (XEN) Set CPU acpi_id(0) cpuid(0) Px State info: (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 (XEN) _PSS: state_count=6 (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391 (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0 (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582 (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2 (XEN) _PPC: 0 (XEN) Set CPU acpi_id(1) cpuid(1) Px State info: (XEN) _PPC: 0 (XEN) Set CPU acpi_id(1) cpuid(1) Px State info: (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 (XEN) _PSS: state_count=6 (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391 (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0 (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582 (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2 (XEN) _PPC: 0 So it seems to find all available powerstates, but using xenpm doesn''t seem to work: serveerstertje:~# xenpm get-cpu-topology CPU core socket CPU0 0 0 CPU1 1 0 serveerstertje:~# xenpm set-scaling-governor userspace [CPU0] failed to set governor name [CPU1] failed to set governor name serveerstertje:~# xenpm set-scaling-governor ondemand [CPU0] failed to set governor name [CPU1] failed to set governor name serveerstertje:~# xenpm set-scaling-governor performance [CPU0] failed to set governor name [CPU1] failed to set governor name serveerstertje:~# xenpm set-scaling-governor powersave [CPU0] failed to set governor name [CPU1] failed to set governor name serveerstertje:~# xenpm get-cpufreq-para [CPU0] failed to get cpufreq parameter [CPU1] failed to get cpufreq parameter -- Best regards, Sander mailto:linux@eikelenboom.it _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Sander Eikelenboom
2010-Jan-08 17:23 UTC
Re: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu
Hello Ke,
With xen-3.4.2 with your patch and 2.6.31.6-pvops it returns
But when i look at the current linux kernels powernow-k8.c your check
isn''t valid for family 15 (CPUID_XFAM_K8) but only for CPUID_XFAM_10H
cpu''s.
I have a family 15 cpu.
I don''t know what this means for the rest of the code in de powernow-k8
version in xen. Should it support the family 15 cpu''s ?
Regards,
Sander
static void check_supported_cpu(void *_rc)
512 {
513 u32 eax, ebx, ecx, edx;
514 int *rc = _rc;
515
516 *rc = -ENODEV;
517
518 if (current_cpu_data.x86_vendor != X86_VENDOR_AMD)
519 return;
520
521 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
522 if (((eax & CPUID_XFAM) != CPUID_XFAM_K8) &&
523 ((eax & CPUID_XFAM) < CPUID_XFAM_10H))
524 return;
525
526 if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) {
527 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD)
||
528 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_MASK)) {
529 printk(KERN_INFO PFX
530 "Processor cpuid %x not
supported\n", eax);
531 return;
532 }
533
534 eax = cpuid_eax(CPUID_GET_MAX_CAPABILITIES);
535 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) {
536 printk(KERN_INFO PFX
537 "No frequency change capabilities
detected\n");
538 return;
539 }
540
541 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx,
&ecx, &edx);
542 if ((edx & P_STATE_TRANSITION_CAPABLE)
543 != P_STATE_TRANSITION_CAPABLE) {
544 printk(KERN_INFO PFX
545 "Power state transitions not
supported\n");
546 return;
547 }
548 } else { /* must be a HW Pstate capable processor */
549 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx,
&ecx, &edx);
550 if ((edx & USE_HW_PSTATE) == USE_HW_PSTATE)
551 cpu_family = CPU_HW_PSTATE;
552 else
553 return;
554 }
555
556 *rc = 0;
557 }
Friday, January 8, 2010, 3:32:18 PM, you wrote:
> Hi Sander,
> For option1 "cpufreq=dom0-kernel", it is not working currently,
the reason is a bit complex, and let me explain. For every processor, there is
corresponding acpi processor object in ACPI DSDT table. Kernel use struct
acpi_processor to represent the acpi processor object. There is a field
"id" in acpi_processor representing the cpu id (the same id as
smp_processor_id()). Kernel cpufreq use acpi_processor->id to do the
frequency scaling. Unfortunately, in pv_ops domain0, the acpi_processor->id
value is not correct, because it is get by acpi_id->apic_id->id mapping,
and in pv_ops dom0, the apic_id of vcpu is not correctly initialized. Please see
drivers/acpi/processor_core.c:get_cpu_id() for detail code, where
cpu_physical_id() is not initialized in pv_ops dom0 case. I am still thinking if
there is better approach to do the acpi_id->apic_id->id mapping in pv_ops
dom0 case.
> BTW, "cpufreq=dom0-kernel" is not recommend, due to that it
require #pCPU=#vCPU, and all vCPU in dom0 must be pined.
> For option2 "cpufreq=xen", from the log, Xen can get all the P
states info, but it failed to do cpufreq cpu initialization
(xen/arch/x86/acpi/cpufreq/cpufreq.c: cpufreq_cpu_init()), so the cpufreq is not
started finally, and xenpm cannot set cpufreq parameter. To get more debug info,
I write a simple patch as attached, could you please have a try and send the
debug info?
> Another thing is, does "cpufreq=xen" work with linux-2.6.18-xen
dom0?
> Best Regards
> Ke
> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com
[mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Sander Eikelenboom
> Sent: Thursday, January 07, 2010 11:08 PM
> To: xen-devel@lists.xensource.com
> Subject: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen
power management on amd k8 cpu
> Hi All,
> I''m trying to get powermanagement working with xen and a
2.6.31.6-pvops kernel on xen 3.4.2
> From what I have read, I have 2 options:
> 1) Let the xen hypervisor do the powermanagement (cpufreq=xen)
> 2) Let the dom0 kernel do the powermanagement (cpufreq=dom0-kernel)
> When booting the 2.6.31.6-pvops kernel on bare metal without hypervisor the
powernow-k8 module works.
> When booting the 2.6.31.6-pvops kernel as dom0 on the xen 3.4.2 hypervisor
the powernow-k8 module doesn''t load and complains:
> Jan 7 15:25:37 localhost kernel: [ 12.797914] powernow-k8: Found 1
AMD Athlon(tm) Dual Core Processor 4850e processors (2 cpu cores) (version
2.20.00)
> Jan 7 15:25:37 localhost kernel: [ 12.797926] powernow-k8: register
performance failed: bad ACPI data
> Jan 7 15:25:37 localhost kernel: [ 12.797929] [Firmware Bug]:
powernow-k8: No compatible ACPI _PSS objects found.
> Jan 7 15:25:37 localhost kernel: [ 12.797931] [Firmware Bug]:
powernow-k8: Try again with latest BIOS.
> Jan 7 15:25:37 localhost kernel: [ 12.797941] powernow-k8: register
performance failed: bad ACPI data
> Jan 7 15:25:37 localhost kernel: [ 12.822315] acpi-cpufreq:
acpi_cpufreq_init
> Jan 7 15:25:37 localhost kernel: [ 12.822319] acpi-cpufreq:
acpi_cpufreq_early_init
> Jan 7 15:25:37 localhost kernel: [ 12.822333] acpi-cpufreq:
acpi_cpufreq_cpu_init
> Jan 7 15:25:37 localhost kernel: [ 12.822338] acpi-cpufreq:
acpi_cpufreq_cpu_init
> It could be that additional changes are needed to the pvops kernel that
have been made to the xen 2.6.18.8 kernel ?
> When trying the first option, and let the hypervisor do the powermanagement
(booting with cpufreq=xen cpufreq.debug=2 loglvl=all)
> it shows the following in xm dmesg (complete xm dmesg attachted):
> (XEN) Set CPU acpi_id(0) cpuid(0) Px State info:
> (XEN) _PPC: 0
> (XEN) Set CPU acpi_id(0) cpuid(0) Px State info:
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PSS: state_count=6
> (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391
> (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0
> (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e
> (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc
> (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a
> (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582
> (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2
> (XEN) _PPC: 0
> (XEN) Set CPU acpi_id(1) cpuid(1) Px State info:
> (XEN) _PPC: 0
> (XEN) Set CPU acpi_id(1) cpuid(1) Px State info:
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PSS: state_count=6
> (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391
> (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0
> (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e
> (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc
> (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a
> (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582
> (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2
> (XEN) _PPC: 0
> So it seems to find all available powerstates, but using xenpm
doesn''t seem to work:
> serveerstertje:~# xenpm get-cpu-topology
> CPU core socket
> CPU0 0 0
> CPU1 1 0
> serveerstertje:~# xenpm set-scaling-governor userspace
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm set-scaling-governor ondemand
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm set-scaling-governor performance
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm set-scaling-governor powersave
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm get-cpufreq-para
> [CPU0] failed to get cpufreq parameter
> [CPU1] failed to get cpufreq parameter
--
Best regards,
Sander mailto:linux@eikelenboom.it
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Yu, Ke
2010-Jan-09 02:53 UTC
RE: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu
Ok, then we can narrow down the issue to Powernow driver. CC Mark who is the
author of Powernow.
Regards
Ke
-----Original Message-----
From: Sander Eikelenboom [mailto:linux@eikelenboom.it]
Sent: Saturday, January 09, 2010 1:24 AM
To: Yu, Ke
Cc: xen-devel@lists.xensource.com
Subject: Re: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen
power management on amd k8 cpu
Hello Ke,
With xen-3.4.2 with your patch and 2.6.31.6-pvops it returns
But when i look at the current linux kernels powernow-k8.c your check
isn''t valid for family 15 (CPUID_XFAM_K8) but only for CPUID_XFAM_10H
cpu''s.
I have a family 15 cpu.
I don''t know what this means for the rest of the code in de powernow-k8
version in xen. Should it support the family 15 cpu''s ?
Regards,
Sander
static void check_supported_cpu(void *_rc)
512 {
513 u32 eax, ebx, ecx, edx;
514 int *rc = _rc;
515
516 *rc = -ENODEV;
517
518 if (current_cpu_data.x86_vendor != X86_VENDOR_AMD)
519 return;
520
521 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
522 if (((eax & CPUID_XFAM) != CPUID_XFAM_K8) &&
523 ((eax & CPUID_XFAM) < CPUID_XFAM_10H))
524 return;
525
526 if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) {
527 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD)
||
528 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_MASK)) {
529 printk(KERN_INFO PFX
530 "Processor cpuid %x not
supported\n", eax);
531 return;
532 }
533
534 eax = cpuid_eax(CPUID_GET_MAX_CAPABILITIES);
535 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) {
536 printk(KERN_INFO PFX
537 "No frequency change capabilities
detected\n");
538 return;
539 }
540
541 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx,
&ecx, &edx);
542 if ((edx & P_STATE_TRANSITION_CAPABLE)
543 != P_STATE_TRANSITION_CAPABLE) {
544 printk(KERN_INFO PFX
545 "Power state transitions not
supported\n");
546 return;
547 }
548 } else { /* must be a HW Pstate capable processor */
549 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx,
&ecx, &edx);
550 if ((edx & USE_HW_PSTATE) == USE_HW_PSTATE)
551 cpu_family = CPU_HW_PSTATE;
552 else
553 return;
554 }
555
556 *rc = 0;
557 }
Friday, January 8, 2010, 3:32:18 PM, you wrote:
> Hi Sander,
> For option1 "cpufreq=dom0-kernel", it is not working currently,
the reason is a bit complex, and let me explain. For every processor, there is
corresponding acpi processor object in ACPI DSDT table. Kernel use struct
acpi_processor to represent the acpi processor object. There is a field
"id" in acpi_processor representing the cpu id (the same id as
smp_processor_id()). Kernel cpufreq use acpi_processor->id to do the
frequency scaling. Unfortunately, in pv_ops domain0, the acpi_processor->id
value is not correct, because it is get by acpi_id->apic_id->id mapping,
and in pv_ops dom0, the apic_id of vcpu is not correctly initialized. Please see
drivers/acpi/processor_core.c:get_cpu_id() for detail code, where
cpu_physical_id() is not initialized in pv_ops dom0 case. I am still thinking if
there is better approach to do the acpi_id->apic_id->id mapping in pv_ops
dom0 case.
> BTW, "cpufreq=dom0-kernel" is not recommend, due to that it
require #pCPU=#vCPU, and all vCPU in dom0 must be pined.
> For option2 "cpufreq=xen", from the log, Xen can get all the P
states info, but it failed to do cpufreq cpu initialization
(xen/arch/x86/acpi/cpufreq/cpufreq.c: cpufreq_cpu_init()), so the cpufreq is not
started finally, and xenpm cannot set cpufreq parameter. To get more debug info,
I write a simple patch as attached, could you please have a try and send the
debug info?
> Another thing is, does "cpufreq=xen" work with linux-2.6.18-xen
dom0?
> Best Regards
> Ke
> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com
[mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Sander Eikelenboom
> Sent: Thursday, January 07, 2010 11:08 PM
> To: xen-devel@lists.xensource.com
> Subject: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen
power management on amd k8 cpu
> Hi All,
> I''m trying to get powermanagement working with xen and a
2.6.31.6-pvops kernel on xen 3.4.2
> From what I have read, I have 2 options:
> 1) Let the xen hypervisor do the powermanagement (cpufreq=xen)
> 2) Let the dom0 kernel do the powermanagement (cpufreq=dom0-kernel)
> When booting the 2.6.31.6-pvops kernel on bare metal without hypervisor the
powernow-k8 module works.
> When booting the 2.6.31.6-pvops kernel as dom0 on the xen 3.4.2 hypervisor
the powernow-k8 module doesn''t load and complains:
> Jan 7 15:25:37 localhost kernel: [ 12.797914] powernow-k8: Found 1
AMD Athlon(tm) Dual Core Processor 4850e processors (2 cpu cores) (version
2.20.00)
> Jan 7 15:25:37 localhost kernel: [ 12.797926] powernow-k8: register
performance failed: bad ACPI data
> Jan 7 15:25:37 localhost kernel: [ 12.797929] [Firmware Bug]:
powernow-k8: No compatible ACPI _PSS objects found.
> Jan 7 15:25:37 localhost kernel: [ 12.797931] [Firmware Bug]:
powernow-k8: Try again with latest BIOS.
> Jan 7 15:25:37 localhost kernel: [ 12.797941] powernow-k8: register
performance failed: bad ACPI data
> Jan 7 15:25:37 localhost kernel: [ 12.822315] acpi-cpufreq:
acpi_cpufreq_init
> Jan 7 15:25:37 localhost kernel: [ 12.822319] acpi-cpufreq:
acpi_cpufreq_early_init
> Jan 7 15:25:37 localhost kernel: [ 12.822333] acpi-cpufreq:
acpi_cpufreq_cpu_init
> Jan 7 15:25:37 localhost kernel: [ 12.822338] acpi-cpufreq:
acpi_cpufreq_cpu_init
> It could be that additional changes are needed to the pvops kernel that
have been made to the xen 2.6.18.8 kernel ?
> When trying the first option, and let the hypervisor do the powermanagement
(booting with cpufreq=xen cpufreq.debug=2 loglvl=all)
> it shows the following in xm dmesg (complete xm dmesg attachted):
> (XEN) Set CPU acpi_id(0) cpuid(0) Px State info:
> (XEN) _PPC: 0
> (XEN) Set CPU acpi_id(0) cpuid(0) Px State info:
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PSS: state_count=6
> (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391
> (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0
> (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e
> (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc
> (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a
> (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582
> (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2
> (XEN) _PPC: 0
> (XEN) Set CPU acpi_id(1) cpuid(1) Px State info:
> (XEN) _PPC: 0
> (XEN) Set CPU acpi_id(1) cpuid(1) Px State info:
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0,
bit_offset=0, reserved=0, address=0
> (XEN) _PSS: state_count=6
> (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391
> (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0
> (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e
> (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc
> (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a
> (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582
> (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2
> (XEN) _PPC: 0
> So it seems to find all available powerstates, but using xenpm
doesn''t seem to work:
> serveerstertje:~# xenpm get-cpu-topology
> CPU core socket
> CPU0 0 0
> CPU1 1 0
> serveerstertje:~# xenpm set-scaling-governor userspace
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm set-scaling-governor ondemand
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm set-scaling-governor performance
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm set-scaling-governor powersave
> [CPU0] failed to set governor name
> [CPU1] failed to set governor name
> serveerstertje:~# xenpm get-cpufreq-para
> [CPU0] failed to get cpufreq parameter
> [CPU1] failed to get cpufreq parameter
--
Best regards,
Sander mailto:linux@eikelenboom.it
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Sander Eikelenboom
2010-Jan-18 09:03 UTC
Re: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu
Hello Ke, Unfortunately no answer yet :-( Regards, Sander Saturday, January 9, 2010, 3:53:55 AM, you wrote:> Ok, then we can narrow down the issue to Powernow driver. CC Mark who is the author of Powernow.> Regards > Ke> -----Original Message----- > From: Sander Eikelenboom [mailto:linux@eikelenboom.it] > Sent: Saturday, January 09, 2010 1:24 AM > To: Yu, Ke > Cc: xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu> Hello Ke,> With xen-3.4.2 with your patch and 2.6.31.6-pvops it returns> But when i look at the current linux kernels powernow-k8.c your check isn''t valid for family 15 (CPUID_XFAM_K8) but only for CPUID_XFAM_10H cpu''s. > I have a family 15 cpu. > I don''t know what this means for the rest of the code in de powernow-k8 version in xen. Should it support the family 15 cpu''s ?> Regards,> Sander> static void check_supported_cpu(void *_rc) > 512 { > 513 u32 eax, ebx, ecx, edx; > 514 int *rc = _rc; > 515 > 516 *rc = -ENODEV; > 517 > 518 if (current_cpu_data.x86_vendor != X86_VENDOR_AMD) > 519 return; > 520 > 521 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); > 522 if (((eax & CPUID_XFAM) != CPUID_XFAM_K8) && > 523 ((eax & CPUID_XFAM) < CPUID_XFAM_10H)) > 524 return; > 525 > 526 if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) { > 527 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || > 528 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_MASK)) { > 529 printk(KERN_INFO PFX > 530 "Processor cpuid %x not supported\n", eax); > 531 return; > 532 } > 533 > 534 eax = cpuid_eax(CPUID_GET_MAX_CAPABILITIES); > 535 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) { > 536 printk(KERN_INFO PFX > 537 "No frequency change capabilities detected\n"); > 538 return; > 539 } > 540 > 541 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); > 542 if ((edx & P_STATE_TRANSITION_CAPABLE) > 543 != P_STATE_TRANSITION_CAPABLE) { > 544 printk(KERN_INFO PFX > 545 "Power state transitions not supported\n"); > 546 return; > 547 } > 548 } else { /* must be a HW Pstate capable processor */ > 549 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); > 550 if ((edx & USE_HW_PSTATE) == USE_HW_PSTATE) > 551 cpu_family = CPU_HW_PSTATE; > 552 else > 553 return; > 554 } > 555 > 556 *rc = 0; > 557 }> Friday, January 8, 2010, 3:32:18 PM, you wrote:>> Hi Sander,>> For option1 "cpufreq=dom0-kernel", it is not working currently, the reason is a bit complex, and let me explain. For every processor, there is corresponding acpi processor object in ACPI DSDT table. Kernel use struct acpi_processor to represent the acpi processor object. There is a field "id" in acpi_processor representing the cpu id (the same id as smp_processor_id()). Kernel cpufreq use acpi_processor->id to do the frequency scaling. Unfortunately, in pv_ops domain0, the acpi_processor->id value is not correct, because it is get by acpi_id->apic_id->id mapping, and in pv_ops dom0, the apic_id of vcpu is not correctly initialized. Please see drivers/acpi/processor_core.c:get_cpu_id() for detail code, where cpu_physical_id() is not initialized in pv_ops dom0 case. I am still thinking if there is better approach to do the acpi_id->apic_id->id mapping in pv_ops dom0 case.>> BTW, "cpufreq=dom0-kernel" is not recommend, due to that it require #pCPU=#vCPU, and all vCPU in dom0 must be pined.>> For option2 "cpufreq=xen", from the log, Xen can get all the P states info, but it failed to do cpufreq cpu initialization (xen/arch/x86/acpi/cpufreq/cpufreq.c: cpufreq_cpu_init()), so the cpufreq is not started finally, and xenpm cannot set cpufreq parameter. To get more debug info, I write a simple patch as attached, could you please have a try and send the debug info?>> Another thing is, does "cpufreq=xen" work with linux-2.6.18-xen dom0?>> Best Regards >> Ke>> -----Original Message----- >> From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Sander Eikelenboom >> Sent: Thursday, January 07, 2010 11:08 PM >> To: xen-devel@lists.xensource.com >> Subject: [Xen-devel] [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu>> Hi All,>> I''m trying to get powermanagement working with xen and a 2.6.31.6-pvops kernel on xen 3.4.2 >> From what I have read, I have 2 options: >> 1) Let the xen hypervisor do the powermanagement (cpufreq=xen) >> 2) Let the dom0 kernel do the powermanagement (cpufreq=dom0-kernel)>> When booting the 2.6.31.6-pvops kernel on bare metal without hypervisor the powernow-k8 module works. >> When booting the 2.6.31.6-pvops kernel as dom0 on the xen 3.4.2 hypervisor the powernow-k8 module doesn''t load and complains: >> Jan 7 15:25:37 localhost kernel: [ 12.797914] powernow-k8: Found 1 AMD Athlon(tm) Dual Core Processor 4850e processors (2 cpu cores) (version 2.20.00) >> Jan 7 15:25:37 localhost kernel: [ 12.797926] powernow-k8: register performance failed: bad ACPI data >> Jan 7 15:25:37 localhost kernel: [ 12.797929] [Firmware Bug]: powernow-k8: No compatible ACPI _PSS objects found. >> Jan 7 15:25:37 localhost kernel: [ 12.797931] [Firmware Bug]: powernow-k8: Try again with latest BIOS. >> Jan 7 15:25:37 localhost kernel: [ 12.797941] powernow-k8: register performance failed: bad ACPI data >> Jan 7 15:25:37 localhost kernel: [ 12.822315] acpi-cpufreq: acpi_cpufreq_init >> Jan 7 15:25:37 localhost kernel: [ 12.822319] acpi-cpufreq: acpi_cpufreq_early_init >> Jan 7 15:25:37 localhost kernel: [ 12.822333] acpi-cpufreq: acpi_cpufreq_cpu_init >> Jan 7 15:25:37 localhost kernel: [ 12.822338] acpi-cpufreq: acpi_cpufreq_cpu_init>> It could be that additional changes are needed to the pvops kernel that have been made to the xen 2.6.18.8 kernel ?>> When trying the first option, and let the hypervisor do the powermanagement (booting with cpufreq=xen cpufreq.debug=2 loglvl=all) >> it shows the following in xm dmesg (complete xm dmesg attachted):>> (XEN) Set CPU acpi_id(0) cpuid(0) Px State info: >> (XEN) _PPC: 0 >> (XEN) Set CPU acpi_id(0) cpuid(0) Px State info: >> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 >> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 >> (XEN) _PSS: state_count=6 >> (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391 >> (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0 >> (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e >> (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc >> (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a >> (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582 >> (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2 >> (XEN) _PPC: 0 >> (XEN) Set CPU acpi_id(1) cpuid(1) Px State info: >> (XEN) _PPC: 0 >> (XEN) Set CPU acpi_id(1) cpuid(1) Px State info: >> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 >> (XEN) _PCT: descriptor=130, length=12, space_id=127, bit_width=0, bit_offset=0, reserved=0, address=0 >> (XEN) _PSS: state_count=6 >> (XEN) State0: 2500MHz 50000mW 100us 9us 0xe8201391 0x391 >> (XEN) State1: 2400MHz 46020mW 100us 9us 0xe82013d0 0x3d0 >> (XEN) State2: 2200MHz 38671mW 100us 9us 0xe820144e 0x44e >> (XEN) State3: 2000MHz 32100mW 100us 9us 0xe82014cc 0x4cc >> (XEN) State4: 1800MHz 26265mW 100us 9us 0xe820154a 0x54a >> (XEN) State5: 1000MHz 13888mW 100us 9us 0xe8201582 0x582 >> (XEN) _PSD: num_entries=5 rev=0 domain=0 coord_type=253 num_processors=2 >> (XEN) _PPC: 0>> So it seems to find all available powerstates, but using xenpm doesn''t seem to work:>> serveerstertje:~# xenpm get-cpu-topology >> CPU core socket >> CPU0 0 0 >> CPU1 1 0 >> serveerstertje:~# xenpm set-scaling-governor userspace >> [CPU0] failed to set governor name >> [CPU1] failed to set governor name >> serveerstertje:~# xenpm set-scaling-governor ondemand >> [CPU0] failed to set governor name >> [CPU1] failed to set governor name >> serveerstertje:~# xenpm set-scaling-governor performance >> [CPU0] failed to set governor name >> [CPU1] failed to set governor name >> serveerstertje:~# xenpm set-scaling-governor powersave >> [CPU0] failed to set governor name >> [CPU1] failed to set governor name >> serveerstertje:~# xenpm get-cpufreq-para >> [CPU0] failed to get cpufreq parameter >> [CPU1] failed to get cpufreq parameter-- Best regards, Sander mailto:linux@eikelenboom.it _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel