Skip to contentSkip to conversation

Problems with cpufreq=xen power management on amd k8 cpu

xen 3.4.2 Sander Eikelenboom 2 participants 5 messages Jan 7, 2010 – Jan 18, 2010

lore
Share & tools
lore
#0 lore raw

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
Signature · 2 lines
Best regards,
 Sander                          mailto:[email protected]

__ __ _____ _ _ ____

 \ \/ /___ _ __   |___ /| || |  |___ \ 
  \  // _ \ \047_ \    |_ \| || |_   __) |
  /  \  __/ | | |  ___) |__   _| / __/ 
 /_/\_\___|_| |_| |____(_) |_|(_)_____|

(XEN) Xen version 3.4.2 (root@) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) Mon Dec 14 00:21:03 CET 2009 (XEN) Latest ChangeSet: unavailable
(XEN) Command line: dom0_mem=768M cpufreq=xen cpufreq.debug=2 loglvl=all loglvl_guest=all (XEN) Video information:

(XEN)  VGA is text mode 80x25, font 8x0
(XEN)  VBE/DDC methods: none; EDID transfer time: 0 seconds
(XEN)  EDID info not retrieved because no DDC retrieval method detected

(XEN) Disc information:
(XEN) Found 2 MBR signatures
(XEN) Found 2 EDD information structures
(XEN) Xen-e820 RAM map:

(XEN)  0000000000000000 - 000000000009e000 (usable)
(XEN)  000000000009e000 - 00000000000a0000 (reserved)
(XEN)  00000000000f0000 - 0000000000100000 (reserved)
(XEN)  0000000000100000 - 00000000afee0000 (usable)
(XEN)  00000000afee0000 - 00000000afee3000 (ACPI NVS)
(XEN)  00000000afee3000 - 00000000afef0000 (ACPI data)
(XEN)  00000000afef0000 - 00000000aff00000 (reserved)
(XEN)  00000000b0000000 - 00000000c0000000 (reserved)
(XEN)  00000000f0000000 - 00000000f4000000 (reserved)
(XEN)  00000000fec00000 - 0000000100000000 (reserved)
(XEN)  0000000100000000 - 0000000200000000 (usable)

(XEN) System RAM: 6910MB (7076344kB)
(XEN) ACPI: RSDP 000F7550, 0024 (r2 Nvidia)
(XEN) ACPI: XSDT AFEE3100, 004C (r1 Nvidia ASUSACPI 42302E31 AWRD 0)
(XEN) ACPI: FACP AFEED3C0, 00F4 (r3 Nvidia ASUSACPI 42302E31 AWRD 0)
(XEN) ACPI Warning (tbfadt-0444): Optional field "Pm2ControlBlock" has zero address or length: 0000000000000000/1 [20070126]
(XEN) ACPI: DSDT AFEE3280, A0D8 (r1 NVIDIA ASUSACPI 1000 MSFT 3000000)
(XEN) ACPI: FACS AFEE0A80, 0040
(XEN) ACPI: SSDT AFEED600, 028A (r1 PTLTD POWERNOW 1 LTP 1)
(XEN) ACPI: HPET AFEED900, 0038 (r1 Nvidia ASUSACPI 42302E31 AWRD 98)
(XEN) ACPI: MCFG AFEED980, 003C (r1 Nvidia ASUSACPI 42302E31 AWRD 0)
(XEN) ACPI: APIC AFEED500, 008E (r1 Nvidia ASUSACPI 42302E31 AWRD 0)
(XEN) NUMA turned off
(XEN) Faking a node at 0000000000000000-0000000200000000
(XEN) Domain heap initialised
(XEN) found SMP MP-table at 000f59c0
(XEN) DMI 2.5 present.
(XEN) Using APIC driver default
(XEN) ACPI: PM-Timer IO Port: 0x1008
(XEN) ACPI: ACPI SLEEP INFO: pm1x_cnt[1004,0], pm1x_evt[1000,0]
(XEN) ACPI: wakeup_vec[afee0a8c], vec_size[20]
(XEN) ACPI: Local APIC address 0xfee00000
(XEN) ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
(XEN) Processor #0 15:11 APIC version 16
(XEN) ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
(XEN) Processor #1 15:11 APIC version 16
(XEN) ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] disabled)
(XEN) ACPI: LAPIC (acpi_id[0x03] lapic_id[0x03] disabled)
(XEN) ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
(XEN) ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
(XEN) ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
(XEN) ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
(XEN) ACPI: IOAPIC (id[0x04] address[0xfec00000] gsi_base[0])
(XEN) IOAPIC[0]: apic_id 4, version 17, address 0xfec00000, GSI 0-23
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 14 global_irq 14 high edge)
(XEN) ACPI: IRQ0 used by override.
(XEN) ACPI: IRQ2 used by override.
(XEN) ACPI: IRQ9 used by override.
(XEN) ACPI: IRQ14 used by override.
(XEN) Enabling APIC mode: Flat. Using 1 I/O APICs
(XEN) ACPI: HPET id: 0x10de8201 base: 0xfeff0000
(XEN) Using ACPI (MADT) for SMP configuration information
(XEN) Using scheduler: SMP Credit Scheduler (credit)
(XEN) Initializing CPU#0
(XEN) Detected 2500.024 MHz processor.
(XEN) CPU0: AMD Flush Filter disabled
(XEN) CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
(XEN) CPU: L2 Cache: 512K (64 bytes/line)
(XEN) CPU 0(2) -> Core 0
(XEN) AMD SVM: ASIDs enabled.
(XEN) HVM: SVM enabled
(XEN) CPU0: AMD K8 machine check reporting enabled.
(XEN) CPU0: AMD Athlon(tm) Dual Core Processor 4850e stepping 02
(XEN) Booting processor 1/1 eip 8c000
(XEN) Initializing CPU#1
(XEN) CPU1: AMD Flush Filter disabled
(XEN) CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
(XEN) CPU: L2 Cache: 512K (64 bytes/line)
(XEN) CPU 1(2) -> Core 1
(XEN) AMD: Disabling C1 Clock Ramping Node #0
(XEN) AMD SVM: ASIDs enabled.
(XEN) CPU1: AMD K8 machine check reporting enabled.
(XEN) CPU1: AMD Athlon(tm) Dual Core Processor 4850e stepping 02
(XEN) Total of 2 processors activated.
(XEN) ENABLING IO-APIC IRQs
(XEN) -> Using new ACK method
(XEN) ..TIMER: vector=0xF0 apic1=0 pin1=2 apic2=-1 pin2=-1
(XEN) checking TSC synchronization across 2 CPUs:
(XEN) CPU#0 had -242 usecs TSC skew, fixed it up.
(XEN) CPU#1 had 242 usecs TSC skew, fixed it up.
(XEN) Platform timer is 25.000MHz HPET
(XEN) Brought up 2 CPUs
(XEN) I/O virtualisation disabled
(XEN) HPET: 3 timers in total, 0 timers will be used for broadcast
(XEN) ACPI sleep modes: S3
(XEN) MCA: Use hw thresholding to adjust polling frequency
(XEN) mcheck_poll: Machine check polling timer started.
(XEN) *** LOADING DOMAIN 0 ***
(XEN) Xen kernel: 64-bit, lsb, compat32
(XEN) Dom0 kernel: 64-bit, PAE, lsb, paddr 0x1000000 -> 0x16ef000
(XEN) PHYSICAL MEMORY ARRANGEMENT:
(XEN) Dom0 alloc.: 00000001f4000000->00000001f8000000 (180224 pages to be allocated)
(XEN) VIRTUAL MEMORY ARRANGEMENT:

(XEN)  Loaded kernel: ffffffff81000000->ffffffff816ef000
(XEN)  Init. ramdisk: ffffffff816ef000->ffffffff8298b600
(XEN)  Phys-Mach map: ffffffff8298c000->ffffffff82b0c000
(XEN)  Start info:    ffffffff82b0c000->ffffffff82b0c4b4
(XEN)  Page tables:   ffffffff82b0d000->ffffffff82b26000
(XEN)  Boot stack:    ffffffff82b26000->ffffffff82b27000
(XEN)  TOTAL:         ffffffff80000000->ffffffff82c00000
(XEN)  ENTRY ADDRESS: ffffffff815687a0

(XEN) Dom0 has maximum 2 VCPUs
(XEN) Scrubbing Free RAM: .............................................................done. (XEN) Xen trace buffers: disabled
(XEN) Std. Loglevel: All
(XEN) Guest Loglevel: Nothing (Rate-limited: Errors and warnings)
(XEN) Xen is relinquishing VGA console.
(XEN) *** Serial input -> DOM0 (type \047CTRL-a\047 three times to switch input to Xen) (XEN) Freed 136kB init memory.
(XEN) io_apic.c:2126:
(XEN) ioapic_guest_write: apic=0, pin=2, old_irq=0, new_irq=-1
(XEN) ioapic_guest_write: old_entry=000009f0, new_entry=00010900
(XEN) ioapic_guest_write: Attempt to remove IO-APIC pin of in-use IRQ!
(XEN) io_apic.c:2139:
(XEN) ioapic_guest_write: apic=0, pin=0, old_irq=-1, new_irq=0
(XEN) ioapic_guest_write: old_entry=00010900, new_entry=000009f0
(XEN) ioapic_guest_write: Attempt to add IO-APIC pin for in-use IRQ!
(XEN) traps.c:2232:d0 Domain attempted WRMSR 000000000000017b from 00000000:0000001f to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 0000000000000400 from 00000000:0000007f to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 0000000000000404 from 00000000:ffffffff to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 0000000000000408 from 00000000:000fffff to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 000000000000040c from 00000000:00000007 to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 0000000000000410 from 00000000:00043bff to ffffffff:fffffbff. (XEN) traps.c:2791: GPF (0000): ffff828c801616d9 -> ffff828c801d675a
(XEN) traps.c:2232:d0 Domain attempted WRMSR 000000000000017b from 00000000:0000001f to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 0000000000000400 from 00000000:0000007f to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 0000000000000404 from 00000000:ffffffff to ffffffff:ffffffff. (XEN) traps.c:2232:d0 Domain attempted WRMSR 0000000000000408 from 00000000:000fffff to ffffffff:ffffffff. (XEN) traps.c:2791: GPF (0000): ffff828c801616d9 -> ffff828c801d675a
(XEN) PCI add device 00:00.0
(XEN) PCI add device 00:01.0
(XEN) PCI add device 00:01.1
(XEN) PCI add device 00:01.2
(XEN) PCI add device 00:01.3
(XEN) PCI add device 00:01.4
(XEN) PCI add device 00:02.0
(XEN) PCI add device 00:04.0
(XEN) PCI add device 00:06.0
(XEN) PCI add device 00:07.0
(XEN) PCI add device 00:08.0
(XEN) PCI add device 00:09.0
(XEN) PCI add device 00:0a.0
(XEN) PCI add device 00:0b.0
(XEN) PCI add device 00:10.0
(XEN) PCI add device 00:12.0
(XEN) PCI add device 00:13.0
(XEN) PCI add device 00:14.0
(XEN) PCI add device 00:18.0
(XEN) PCI add device 00:18.1
(XEN) PCI add device 00:18.2
(XEN) PCI add device 00:18.3
(XEN) PCI add device 01:08.0
(XEN) PCI add device 01:08.1
(XEN) PCI add device 01:08.2
(XEN) PCI add device 02:00.0
(XEN) PCI add device 05:00.0
(XEN) PCI add device 06:01.0
(XEN) PCI add device 06:01.1
(XEN) PCI add device 06:01.2
(XEN) PCI add device 07:00.0
(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
(XEN) io_apic.c:2139:
(XEN) ioapic_guest_write: apic=0, pin=16, old_irq=16, new_irq=16
(XEN) ioapic_guest_write: old_entry=0000a998, new_entry=0001a998
(XEN) ioapic_guest_write: Attempt to modify IO-APIC pin for in-use IRQ!
(XEN) io_apic.c:2139:
(XEN) ioapic_guest_write: apic=0, pin=16, old_irq=16, new_irq=16
(XEN) ioapic_guest_write: old_entry=0000a998, new_entry=0001a998
(XEN) ioapic_guest_write: Attempt to modify IO-APIC pin for in-use IRQ!
(XEN) io_apic.c:2139:
(XEN) ioapic_guest_write: apic=0, pin=16, old_irq=16, new_irq=16
(XEN) ioapic_guest_write: old_entry=0000a998, new_entry=0001a998
(XEN) ioapic_guest_write: Attempt to modify IO-APIC pin for in-use IRQ!

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

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: [email protected] [mailto:[email protected]] On Behalf Of Sander Eikelenboom
Sent: Thursday, January 07, 2010 11:08 PM
To: [email protected]
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

Quoted 1 line

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
Signature · 2 lines
Best regards,
 Sander                          mailto:[email protected]
xen/arch/x86/acpi/cpufreq/powernow.c +10 -0
diff -r 3f654b88e201 xen/arch/x86/acpi/cpufreq/powernow.c
@@ -193,6 +193,7 @@ static int powernow_cpufreq_cpu_init(str
     max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
 
     if (perf->control_register.space_id != perf->status_register.space_id) {
+        printk(KERN_ERR "Cpufreq space_id mismatch\n");
         result = -ENODEV;
         goto err_unreg;
     }
@@ -232,7 +233,10 @@ static int powernow_cpufreq_cpu_init(str
 
     result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
     if (result)
+    {
+        printk(KERN_ERR "cpufreq_frequency_table_cpuinfo error\n");
         goto err_freqfree;
+    }
 
     /*
      * the first call to ->target() should result in us actually
@@ -248,6 +252,8 @@ err_unreg:
 err_unreg:
     xfree(data);
     drv_data[cpu] = NULL;
+
+    printk(KERN_ERR "Cpufreq: powernow driver fail to initialize CPU%d\n",cpu);
 
     return result;
 }
@@ -285,12 +291,16 @@ unsigned int powernow_register_driver()
             u32 eax, ebx, ecx, edx;
             cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
             if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE)
+            {
+                printk(KERN_WARNING "Cpufreq capability is not supported in H/W\n");
                 ret = -ENODEV;
+            }
         }
         if (ret)
             return ret;
     }
 
     ret = cpufreq_register_driver(&powernow_cpufreq_driver);
+    printk(KERN_INFO "Register AMD powernow cpufreq driver done\n");
     return ret;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

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 }

Quoted 93 lines · you

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: [email protected] [mailto:[email protected]] On Behalf Of Sander Eikelenboom
Sent: Thursday, January 07, 2010 11:08 PM
To: [email protected]
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
Signature · 2 lines
Best regards,
 Sander                            mailto:[email protected]
#3 lore raw

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:[email protected]]
Sent: Saturday, January 09, 2010 1:24 AM
To: Yu, Ke
Cc: [email protected]
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 }

Quoted 93 lines · you

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: [email protected] [mailto:[email protected]] On Behalf Of Sander Eikelenboom
Sent: Thursday, January 07, 2010 11:08 PM
To: [email protected]
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
Signature · 2 lines
Best regards,
 Sander                            mailto:[email protected]
#4 lore raw

Hello Ke,

Unfortunately no answer yet :-(

Regards,

Sander

Quoted 169 lines · you

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:[email protected]]
Sent: Saturday, January 09, 2010 1:24 AM
To: Yu, Ke
Cc: [email protected]
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 }

Quoted 93 lines · you

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: [email protected] [mailto:[email protected]] On Behalf Of Sander Eikelenboom
Sent: Thursday, January 07, 2010 11:08 PM
To: [email protected]
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
Signature · 2 lines
Best regards,
 Sander                            mailto:[email protected]