From: Sander Eikelenboom Subject: Re: [xen 3.4.2][2.6.31.6-pvops] Problems with cpufreq=xen power management on amd k8 cpu Date: Fri, 8 Jan 2010 18:23:52 +0100 Message-ID: <552574059.20100108182352@eikelenboom.it> References: <1269589227.20100107160820@eikelenboom.it> <8B81FACE836F9248894A7844CC0BA81417B6927252@shzsmsx501.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <8B81FACE836F9248894A7844CC0BA81417B6927252@shzsmsx501.ccr.corp.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Yu, Ke" Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org 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 ver= sion 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 =3D _rc; 515 516 *rc =3D -ENODEV; 517 518 if (current_cpu_data.x86_vendor !=3D X86_VENDOR_AMD) 519 return; 520 521 eax =3D cpuid_eax(CPUID_PROCESSOR_SIGNATURE); 522 if (((eax & CPUID_XFAM) !=3D CPUID_XFAM_K8) && 523 ((eax & CPUID_XFAM) < CPUID_XFAM_10H)) 524 return; 525 526 if ((eax & CPUID_XFAM) =3D=3D CPUID_XFAM_K8) { 527 if (((eax & CPUID_USE_XFAM_XMOD) !=3D CPUID_USE_XFAM_XM= OD) || 528 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_MASK)) { 529 printk(KERN_INFO PFX 530 "Processor cpuid %x not supported\n", e= ax); 531 return; 532 } 533 534 eax =3D cpuid_eax(CPUID_GET_MAX_CAPABILITIES); 535 if (eax < CPUID_FREQ_VOLT_CAPABILITIES) { 536 printk(KERN_INFO PFX 537 "No frequency change capabilities detect= ed\n"); 538 return; 539 } 540 541 cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &= edx); 542 if ((edx & P_STATE_TRANSITION_CAPABLE) 543 !=3D 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) =3D=3D USE_HW_PSTATE) 551 cpu_family =3D CPU_HW_PSTATE; 552 else 553 return; 554 } 555 556 *rc =3D 0; 557 } Friday, January 8, 2010, 3:32:18 PM, you wrote: > Hi Sander, > For option1 "cpufreq=3Ddom0-kernel", it is not working currently, the rea= son is a bit complex, and let me explain. For every processor, there is cor= responding 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. Unfort= unately, in pv_ops domain0, the acpi_processor->id value is not correct, be= cause it is get by acpi_id->apic_id->id mapping, and in pv_ops dom0, the ap= ic_id of vcpu is not correctly initialized. Please see drivers/acpi/process= or_core.c:get_cpu_id() for detail code, where cpu_physical_id() is not init= ialized in pv_ops dom0 case. I am still thinking if there is better approac= h to do the acpi_id->apic_id->id mapping in pv_ops dom0 case.=20 > BTW, "cpufreq=3Ddom0-kernel" is not recommend, due to that it require #pC= PU=3D#vCPU, and all vCPU in dom0 must be pined. > For option2 "cpufreq=3Dxen", from the log, Xen can get all the P states i= nfo, but it failed to do cpufreq cpu initialization (xen/arch/x86/acpi/cpuf= req/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 s= imple patch as attached, could you please have a try and send the debug inf= o? > Another thing is, does "cpufreq=3Dxen" work with linux-2.6.18-xen dom0?= =20 > Best Regards > Ke > -----Original Message----- > From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lis= ts.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=3D= 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 k= ernel on xen 3.4.2 > From what I have read, I have 2 options: > 1) Let the xen hypervisor do the powermanagement (cpufreq=3Dxen) > 2) Let the dom0 kernel do the powermanagement (cpufreq=3Ddom0-kernel) > When booting the 2.6.31.6-pvops kernel on bare metal without hypervisor t= he powernow-k8 module works. > When booting the 2.6.31.6-pvops kernel as dom0 on the xen 3.4.2 hyperviso= r 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) (versio= n 2.20.00) > Jan 7 15:25:37 localhost kernel: [ 12.797926] powernow-k8: regist= er performance failed: bad ACPI data > Jan 7 15:25:37 localhost kernel: [ 12.797929] [Firmware Bug]: pow= ernow-k8: No compatible ACPI _PSS objects found. > Jan 7 15:25:37 localhost kernel: [ 12.797931] [Firmware Bug]: pow= ernow-k8: Try again with latest BIOS. > Jan 7 15:25:37 localhost kernel: [ 12.797941] powernow-k8: regist= er 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 h= ave been made to the xen 2.6.18.8 kernel ? > When trying the first option, and let the hypervisor do the powermanageme= nt (booting with cpufreq=3Dxen cpufreq.debug=3D2 loglvl=3Dall) > 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=3D130, length=3D12, space_id=3D127, bit_width=3D= 0, bit_offset=3D0, reserved=3D0, address=3D0 > (XEN) _PCT: descriptor=3D130, length=3D12, space_id=3D127, bit_width=3D= 0, bit_offset=3D0, reserved=3D0, address=3D0 > (XEN) _PSS: state_count=3D6 > (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=3D5 rev=3D0 domain=3D0 coord_type=3D253 num_pro= cessors=3D2 > (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=3D130, length=3D12, space_id=3D127, bit_width=3D= 0, bit_offset=3D0, reserved=3D0, address=3D0 > (XEN) _PCT: descriptor=3D130, length=3D12, space_id=3D127, bit_width=3D= 0, bit_offset=3D0, reserved=3D0, address=3D0 > (XEN) _PSS: state_count=3D6 > (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=3D5 rev=3D0 domain=3D0 coord_type=3D253 num_pro= cessors=3D2 > (XEN) _PPC: 0 > So it seems to find all available powerstates, but using xenpm doesn't se= em 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 --=20 Best regards, Sander mailto:linux@eikelenboom.it