CPUFreq driver using CPPC methods
Subsystems (5)
v9 cover CPUFreq driver using CPPC methods
CPPC:
====
CPPC (Collaborative Processor Performance Control) is a new way to control CPU performance using an abstract continous scale as against a discretized P-state scale which is tied to CPU frequency only. It is defined in the ACPI 5.0+ spec. In brief, the basic operation involves:
- OS makes a CPU performance request. (Can provide min and max tolerable bounds)
- Platform (such as BMC) is free to optimize request within requested bounds depending on power/thermal budgets etc.
- Platform conveys its decision back to OS
The communication between OS and platform occurs through another medium called (PCC) Platform communication Channel. This is a generic mailbox like mechanism which includes doorbell semantics to indicate register updates. See drivers/mailbox/pcc.c
This patchset introduces a CPPC based CPUFreq driver that works with existing governors such as ondemand. The CPPC table parsing and the CPPC communication semantics are abstracted into separate files to allow future CPPC based drivers to implement their own governors if required.
Initial patchsets included an adaptation of the PID governor from intel_pstate.c. However recent experiments led to extensive modifications of the algorithm to calculate CPU busyness. Until it is verified that these changes are worthwhile, the existing governors should provide for a good enough starting point for ARM64 servers.
Finer details about the PCC and CPPC spec are available in the latest ACPI 5.1 specification.[2]
Testing:
=======
This was tested on an SBSA compatible ARMv8 server with CPPCv2 firmware running on a remote processor. I verified that each CPUs performance limits were detected and that new performance requests were made by the on-demand governor proportional to the load on each CPU. I also verified that using the acpi_processor driver correctly maps the physical CPU ids to logical CPU ids, which helps in picking up the proper _CPC details from a processor object, in the case where CPU physical ids may not be contiguous.
Changes since V8:
- Fixed up several debug prints, return types and comments.
- Simplified read/write ops using existing ACPI core API.
- Removed ->get() from cpufreq driver for now.
- Fixed bug introduced by copy-paste err in set_perf.
Changes since V7:
- Simplied new kconfig options for PSS and idle.
- Separated patch to enable acpi processor on ARM64.
- Removed redundant kconfig cross deps on PCC.
- Decoupled processor_perflib from new PSS kconfig option.
Changes since V6:
- Separated PSS and CST from ACPI processor driver in two patches.
- Made new Kconfig symbols auto selectable from Arch Kconfigs.
Changes since V5:
- Checkpatch cleanups.
- Change pss_init to pss_perf_init. Rec by Srinivas Pandruvada.
- Explicit comment explaining why postcore_initcall to pcc mailbox.
- Fold acpi_processor_syscore_init/exit into CONFIG_ACPI_CST.
- Added patch with dummy functions used by ACPI_HOTPLUG_CPU.
Changes since V4:
- Misc cleanups. Addressed feedback from Rafael.
- Made acpi_processor.c independent of C-states, P-states and others.
- Per CPU scanning for _CPC is now made from acpi_processor.c
- Added new Kconfig options for legacy C states and P states to enable future support for newer alternatives as defined in the ACPI spec 6.0.
Changes since V3:
- Split CPPC backend methods into separate files.
- Add frontend driver which plugs into existing CPUfreq governors.
- Simplify PCC driver by moving communication space mapping and read/write into client drivers.
Changes since V2:
- Select driver if !X86, since intel_pstate will use HWP extensions instead.
- Added more comments.
- Added Freq domain awareness and PSD parsing.
Changes since V1:
- Create a new driver based on Dirks suggestion.
- Fold in CPPC backend hooks into main driver.
Changes since V0: [1]
- Split intel_pstate.c into a generic PID governor and platform specific backend.
- Add CPPC accessors as PID backend.
[1] - http://lwn.net/Articles/608715/
[2] - http://www.uefi.org/sites/default/files/resources/ACPI_5_1release.pdf
[3] - https://patches.linaro.org/40705/
Ashwin Chaugule (5):
ACPI: Introduce CPU performance controls using CPPC
CPPC: Add a CPUFreq driver for use with CPPC
ACPI: Add weak routines for ACPI CPU Hotplug
CPPC: Probe for CPPC tables for each ACPI Processor object
ACPI: Allow selection of the ACPI processor driver for ARM64
drivers/acpi/Kconfig | 20 +- drivers/acpi/Makefile | 1 + drivers/acpi/acpi_processor.c | 18 + drivers/acpi/cppc_acpi.c | 755 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/processor_driver.c | 6 + drivers/cpufreq/Kconfig.arm | 17 + drivers/cpufreq/Makefile | 2 + drivers/cpufreq/cppc_cpufreq.c | 169 +++++++++ include/acpi/cppc_acpi.h | 138 ++++++++ include/acpi/processor.h | 14 + 10 files changed, 1137 insertions(+), 3 deletions(-) create mode 100644 drivers/acpi/cppc_acpi.c create mode 100644 drivers/cpufreq/cppc_cpufreq.c create mode 100644 include/acpi/cppc_acpi.h
Signature · 1 line
1.9.1
PATCH v9 1/5 ACPI: Introduce CPU performance controls using CPPC
CPPC stands for Collaborative Processor Performance Controls and is defined in the ACPI v5.0+ spec. It describes CPU performance controls on an abstract and continuous scale allowing the platform (e.g. remote power processor) to flexibly optimize CPU performance with its knowledge of power budgets and other architecture specific knowledge.
This patch adds a shim which exports commonly used functions to get and set CPPC specific controls for each CPU. This enables CPUFreq drivers to gather per CPU performance data and use with exisiting governors or even allows for customized governors which are implemented inside CPUFreq drivers.
--- drivers/acpi/Kconfig | 14 + drivers/acpi/Makefile | 1 + drivers/acpi/cppc_acpi.c | 755 +++++++++++++++++++++++++++++++++++++++++++++++ include/acpi/cppc_acpi.h | 138 +++++++++ 4 files changed, 908 insertions(+) create mode 100644 drivers/acpi/cppc_acpi.c create mode 100644 include/acpi/cppc_acpi.h
drivers/acpi/Kconfig +14 -0
@@ -197,6 +197,20 @@ config ACPI_PROCESSOR_IDLE bool select CPU_IDLE +config ACPI_CPPC_LIB + bool + depends on ACPI_PROCESSOR + depends on !ACPI_CPU_FREQ_PSS + select MAILBOX + select PCC + help + If this option is enabled, this file implements common functionality + to parse CPPC tables as described in the ACPI 5.1+ spec. The + routines implemented are meant to be used by other + drivers to control CPU performance using CPPC semantics. + If your platform does not support CPPC in firmware, + leave this option disabled. + config ACPI_PROCESSOR tristate "Processor" depends on X86 || IA64
drivers/acpi/Makefile +1 -0
@@ -78,6 +78,7 @@ obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o +obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o # processor has its own "processor." module_param namespace processor-y := processor_driver.o
drivers/acpi/cppc_acpi.c new file +755 -0
755 lines not on this page · raw message
include/acpi/cppc_acpi.h new file +138 -0
138 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v9 1/5] ACPI: Introduce CPU performance controls using CPPC
Hi Rafael,
Are there any more suggestions for this patch series? I noticed a compiler warning, which was strangely hidden before I sent v9. Will fix and resend if there isnt anything else.
Quoted 24 lines · Ashwin Chaugule
CPPC stands for Collaborative Processor Performance Controls and is defined in the ACPI v5.0+ spec. It describes CPU performance controls on an abstract and continuous scale allowing the platform (e.g. remote power processor) to flexibly optimize CPU performance with its knowledge of power budgets and other architecture specific knowledge.
This patch adds a shim which exports commonly used functions to get and set CPPC specific controls for each CPU. This enables CPUFreq drivers to gather per CPU performance data and use with exisiting governors or even allows for customized governors which are implemented inside CPUFreq drivers.
Signed-off-by Ashwin Chaugule <[email protected]>Reviewed-by Al Stone <[email protected]>--- drivers/acpi/Kconfig | 14 + drivers/acpi/Makefile | 1 + drivers/acpi/cppc_acpi.c | 755 +++++++++++++++++++++++++++++++++++++++++++++++ include/acpi/cppc_acpi.h | 138 +++++++++ 4 files changed, 908 insertions(+) create mode 100644 drivers/acpi/cppc_acpi.c create mode 100644 include/acpi/cppc_acpi.h
[..]
drivers/acpi/cppc_acpi.c line 570
Quoted 10 lines
drivers/acpi/cppc_acpi.c new file +10
-0+ +static u64 get_phys_pcc_addr (struct cpc_reg *reg) +{ +/* PCC communication addr space begins at byte offset 0x8. */ +return (u64 )comm_base_addr +0x8 + reg->address; +} + +static void cpc_read (struct cpc_reg *reg,u64 *val) +{ +u64 addr;
Default addr = reg->address; That'll enable sys mem type read/write ops.
drivers/acpi/cppc_acpi.c line 573
Quoted 3 lines
drivers/acpi/cppc_acpi.c new file +3
-0+ +if (reg->space_id ==ACPI_ADR_SPACE_PLATFORM_COMM ) + addr =get_phys_pcc_addr (reg);
Or alternately, fold this into a function get_phys_addr() which parses for type PCC, sys mem. etc. and returns address.
drivers/acpi/cppc_acpi.c line 578
Quoted 5 lines
drivers/acpi/cppc_acpi.c new file +5
-0+ +acpi_os_read_memory ((acpi_physical_address )addr, + val, reg->bit_width); + +/* TODO:Add FFH, SYSTEM_IO support later. */
Will add a pr_err() if type is FFH/Sys IO.
Likewise below.
Quoted 5 lines
drivers/acpi/cppc_acpi.c new file +5
-0+} + +static void cpc_write (struct cpc_reg *reg,u64 val) +{ +u64 addr;
drivers/acpi/cppc_acpi.c line 593
Quoted 10 lines
drivers/acpi/cppc_acpi.c new file +10
-0+ +if (reg->space_id ==ACPI_ADR_SPACE_PLATFORM_COMM ) + addr =get_phys_pcc_addr (reg); + +acpi_os_write_memory ((acpi_physical_address )addr, + val, reg->bit_width); + +/* TODO:Add FFH, SYSTEM_IO support later. */ +} +
Regards,
Ashwin.
Re: [PATCH v9 1/5] ACPI: Introduce CPU performance controls using CPPC
Quoted 3 lines · Ashwin Chaugule
Hi Rafael,
Are there any more suggestions for this patch series?
Not at the moment. I'll get to it tomorrow or failing that early next week.
Thanks,
Rafael
Re: [PATCH v9 1/5] ACPI: Introduce CPU performance controls using CPPC
In reply to Ashwin ChauguleQuoted 16 lines · Ashwin Chaugule
CPPC stands for Collaborative Processor Performance Controls and is defined in the ACPI v5.0+ spec. It describes CPU performance controls on an abstract and continuous scale allowing the platform (e.g. remote power processor) to flexibly optimize CPU performance with its knowledge of power budgets and other architecture specific knowledge.
This patch adds a shim which exports commonly used functions to get and set CPPC specific controls for each CPU. This enables CPUFreq drivers to gather per CPU performance data and use with exisiting governors or even allows for customized governors which are implemented inside CPUFreq drivers.
Signed-off-by Ashwin Chaugule <[email protected]>Reviewed-by Al Stone <[email protected]>---
[cut]
drivers/acpi/cppc_acpi.c line 188
Quoted 4 lines
drivers/acpi/cppc_acpi.c new file +4
-0+ +/** +* acpi_get_psd_map - Map the CPUs in a common freq domain as indicated +* in the respective _PSD entries.
One minor nit: this needs to be one-line in a proper kerneldoc.
Quoted 3 lines
+ * @all_cpu_data: This array of pointers contains all the CPU specific
+ * details to access CPPC registers and freq domain information for each
+ * CPU.
Ditto.
You can add more description below.
[cut]
Quoted 6 lines
drivers/acpi/cppc_acpi.c new file +6
-0+int cppc_get_perf_ctrs (int cpunum,struct cppc_perf_fb_ctrs *perf_fb_ctrs) +{ +struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpunum); +struct cpc_register_resource *delivered_reg, *reference_reg; +u64 delivered, reference; +int ret =0 ;
drivers/acpi/cppc_acpi.c line 681
Quoted 10 lines
drivers/acpi/cppc_acpi.c new file +10
-0+ +if (!cpc_desc) { +pr_debug ("No CPC descriptor for CPU:%d\n" , cpunum); +return -ENODEV ; + } + + delivered_reg = &cpc_desc->cpc_regs[DELIVERED_CTR ]; + reference_reg = &cpc_desc->cpc_regs[REFERENCE_CTR ]; + +spin_lock (&pcc_lock);
I still have the question about this lock.
Why does it have to be a spinlock?
Rafael
Re: [PATCH v9 1/5] ACPI: Introduce CPU performance controls using CPPC
Hi Rafael,
Quoted 27 lines · Rafael J. Wysocki
Quoted 16 lines · Ashwin Chaugule
CPPC stands for Collaborative Processor Performance Controls and is defined in the ACPI v5.0+ spec. It describes CPU performance controls on an abstract and continuous scale allowing the platform (e.g. remote power processor) to flexibly optimize CPU performance with its knowledge of power budgets and other architecture specific knowledge.
This patch adds a shim which exports commonly used functions to get and set CPPC specific controls for each CPU. This enables CPUFreq drivers to gather per CPU performance data and use with exisiting governors or even allows for customized governors which are implemented inside CPUFreq drivers.
Signed-off-by Ashwin Chaugule <[email protected]>Reviewed-by Al Stone <[email protected]>---
[cut]
drivers/acpi/cppc_acpi.c line 188
Quoted 4 lines
drivers/acpi/cppc_acpi.c new file +4
-0+ +/** +* acpi_get_psd_map - Map the CPUs in a common freq domain as indicated +* in the respective _PSD entries. One minor nit: this needs to be one-line in a proper kerneldoc.
Quoted 7 lines
Quoted 3 lines
+ * @all_cpu_data: This array of pointers contains all the CPU specific
+ * details to access CPPC registers and freq domain information for each
+ * CPU.Ditto.
You can add more description below.
Ok. Will do.
Quoted 22 lines
[cut]
Quoted 6 lines
drivers/acpi/cppc_acpi.c new file +6
-0+int cppc_get_perf_ctrs (int cpunum,struct cppc_perf_fb_ctrs *perf_fb_ctrs) +{ +struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpunum); +struct cpc_register_resource *delivered_reg, *reference_reg; +u64 delivered, reference; +int ret =0 ;drivers/acpi/cppc_acpi.c line 681
Quoted 10 lines
drivers/acpi/cppc_acpi.c new file +10
-0+ +if (!cpc_desc) { +pr_debug ("No CPC descriptor for CPU:%d\n" , cpunum); +return -ENODEV ; + } + + delivered_reg = &cpc_desc->cpc_regs[DELIVERED_CTR ]; + reference_reg = &cpc_desc->cpc_regs[REFERENCE_CTR ]; + +spin_lock (&pcc_lock);I still have the question about this lock.
Quoted 1 line
Why does it have to be a spinlock?
The idea is to let CPUs send in their requests as quickly as possible. The PCC transaction only relays the request. So the CPUs don't really wait for all the clk + voltage toggling etc. I think any other primitive, might cause unnecessary delays in sending requests. Also FWIW, this is another thing I was influenced by from the pcc-cpufreq.c driver. :)
Regards,
Ashwin.
Re: [PATCH v9 1/5] ACPI: Introduce CPU performance controls using CPPC
Quoted 63 lines · Ashwin Chaugule
Hi Rafael,
Quoted 27 lines · Rafael J. Wysocki
Quoted 16 lines · Ashwin Chaugule
CPPC stands for Collaborative Processor Performance Controls and is defined in the ACPI v5.0+ spec. It describes CPU performance controls on an abstract and continuous scale allowing the platform (e.g. remote power processor) to flexibly optimize CPU performance with its knowledge of power budgets and other architecture specific knowledge.
This patch adds a shim which exports commonly used functions to get and set CPPC specific controls for each CPU. This enables CPUFreq drivers to gather per CPU performance data and use with exisiting governors or even allows for customized governors which are implemented inside CPUFreq drivers.
Signed-off-by Ashwin Chaugule <[email protected]>Reviewed-by Al Stone <[email protected]>---
[cut]
drivers/acpi/cppc_acpi.c line 188
Quoted 4 lines
drivers/acpi/cppc_acpi.c new file +4
-0+ +/** +* acpi_get_psd_map - Map the CPUs in a common freq domain as indicated +* in the respective _PSD entries. One minor nit: this needs to be one-line in a proper kerneldoc.
Quoted 7 lines
Quoted 3 lines
+ * @all_cpu_data: This array of pointers contains all the CPU specific
+ * details to access CPPC registers and freq domain information for each
+ * CPU.Ditto.
You can add more description below.
Ok. Will do.
Quoted 22 lines
[cut]
Quoted 6 lines
drivers/acpi/cppc_acpi.c new file +6
-0+int cppc_get_perf_ctrs (int cpunum,struct cppc_perf_fb_ctrs *perf_fb_ctrs) +{ +struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpunum); +struct cpc_register_resource *delivered_reg, *reference_reg; +u64 delivered, reference; +int ret =0 ;drivers/acpi/cppc_acpi.c line 681
Quoted 10 lines
drivers/acpi/cppc_acpi.c new file +10
-0+ +if (!cpc_desc) { +pr_debug ("No CPC descriptor for CPU:%d\n" , cpunum); +return -ENODEV ; + } + + delivered_reg = &cpc_desc->cpc_regs[DELIVERED_CTR ]; + reference_reg = &cpc_desc->cpc_regs[REFERENCE_CTR ]; + +spin_lock (&pcc_lock);I still have the question about this lock.
Quoted 6 lines
Quoted 1 line
Why does it have to be a spinlock?
The idea is to let CPUs send in their requests as quickly as possible. The PCC transaction only relays the request. So the CPUs don't really wait for all the clk + voltage toggling etc. I think any other primitive, might cause unnecessary delays in sending requests.
It might if there was contention.
Quoted 2 lines
Also FWIW, this is another thing I was influenced by from the
pcc-cpufreq.cdriver. :)
OK, so this sounds like an optimization, which is fine.
Thanks,
Rafael
Re: [PATCH v9 1/5] ACPI: Introduce CPU performance controls using CPPC
Hi Rafael,
Quoted 29 lines · Rafael J. Wysocki
Quoted 21 lines · Ashwin Chaugule
Quoted 20 lines · Rafael J. Wysocki
Quoted 6 lines · Ashwin Chaugule
drivers/acpi/cppc_acpi.c new file +6
-0+int cppc_get_perf_ctrs (int cpunum,struct cppc_perf_fb_ctrs *perf_fb_ctrs) +{ +struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpunum); +struct cpc_register_resource *delivered_reg, *reference_reg; +u64 delivered, reference; +int ret =0 ;drivers/acpi/cppc_acpi.c line 681
Quoted 10 lines
drivers/acpi/cppc_acpi.c new file +10
-0+ +if (!cpc_desc) { +pr_debug ("No CPC descriptor for CPU:%d\n" , cpunum); +return -ENODEV ; + } + + delivered_reg = &cpc_desc->cpc_regs[DELIVERED_CTR ]; + reference_reg = &cpc_desc->cpc_regs[REFERENCE_CTR ]; + +spin_lock (&pcc_lock);I still have the question about this lock.
Quoted 6 lines
Quoted 1 line
Why does it have to be a spinlock?
The idea is to let CPUs send in their requests as quickly as possible. The PCC transaction only relays the request. So the CPUs don't really wait for all the clk + voltage toggling etc. I think any other primitive, might cause unnecessary delays in sending requests.
Quoted 7 lines
It might if there was contention.
Quoted 2 lines
Also FWIW, this is another thing I was influenced by from the
pcc-cpufreq.cdriver. :)OK, so this sounds like an optimization, which is fine.
Great. Would you prefer a git pull request with the kernel doc + compiler warning fix, or should I send V10 ?
Regards,
Ashwin.
Re: [PATCH v9 1/5] ACPI: Introduce CPU performance controls using CPPC
Quoted 34 lines · Ashwin Chaugule
Hi Rafael,
Quoted 31 lines · Rafael J. Wysocki
Quoted 21 lines · Ashwin Chaugule
Quoted 20 lines · Rafael J. Wysocki
Quoted 6 lines · Ashwin Chaugule
drivers/acpi/cppc_acpi.c new file +6
-0+int cppc_get_perf_ctrs (int cpunum,struct cppc_perf_fb_ctrs *perf_fb_ctrs) +{ +struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpunum); +struct cpc_register_resource *delivered_reg, *reference_reg; +u64 delivered, reference; +int ret =0 ;drivers/acpi/cppc_acpi.c line 681
Quoted 10 lines
drivers/acpi/cppc_acpi.c new file +10
-0+ +if (!cpc_desc) { +pr_debug ("No CPC descriptor for CPU:%d\n" , cpunum); +return -ENODEV ; + } + + delivered_reg = &cpc_desc->cpc_regs[DELIVERED_CTR ]; + reference_reg = &cpc_desc->cpc_regs[REFERENCE_CTR ]; + +spin_lock (&pcc_lock);I still have the question about this lock.
Quoted 6 lines
Quoted 1 line
Why does it have to be a spinlock?
The idea is to let CPUs send in their requests as quickly as possible. The PCC transaction only relays the request. So the CPUs don't really wait for all the clk + voltage toggling etc. I think any other primitive, might cause unnecessary delays in sending requests.
It might if there was contention.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Also FWIW, this is another thing I was influenced by from the
pcc-cpufreq.cdriver. :)OK, so this sounds like an optimization, which is fine.
Great. Would you prefer a git pull request
No pull requests, please.
Quoted 1 line
with the kernel doc + compiler warning fix, or should I send V10 ?
You can simply update the patches that need to be updated.
Thanks,
Rafael
PATCH 1/1 ACPI: Introduce CPU performance controls using CPPC
CPPC stands for Collaborative Processor Performance Controls and is defined in the ACPI v5.0+ spec. It describes CPU performance controls on an abstract and continuous scale allowing the platform (e.g. remote power processor) to flexibly optimize CPU performance with its knowledge of power budgets and other architecture specific knowledge.
This patch adds a shim which exports commonly used functions to get and set CPPC specific controls for each CPU. This enables CPUFreq drivers to gather per CPU performance data and use with exisiting governors or even allows for customized governors which are implemented inside CPUFreq drivers.
--- drivers/acpi/Kconfig | 14 + drivers/acpi/Makefile | 1 + drivers/acpi/cppc_acpi.c | 734 +++++++++++++++++++++++++++++++++++++++++++++++ include/acpi/cppc_acpi.h | 138 +++++++++ 4 files changed, 887 insertions(+) create mode 100644 drivers/acpi/cppc_acpi.c create mode 100644 include/acpi/cppc_acpi.h
drivers/acpi/Kconfig +14 -0
@@ -197,6 +197,20 @@ config ACPI_PROCESSOR_IDLE bool select CPU_IDLE +config ACPI_CPPC_LIB + bool + depends on ACPI_PROCESSOR + depends on !ACPI_CPU_FREQ_PSS + select MAILBOX + select PCC + help + If this option is enabled, this file implements common functionality + to parse CPPC tables as described in the ACPI 5.1+ spec. The + routines implemented are meant to be used by other + drivers to control CPU performance using CPPC semantics. + If your platform does not support CPPC in firmware, + leave this option disabled. + config ACPI_PROCESSOR tristate "Processor" depends on X86 || IA64
drivers/acpi/Makefile +1 -0
@@ -78,6 +78,7 @@ obj-$(CONFIG_ACPI_HED) += hed.o obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o +obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o # processor has its own "processor." module_param namespace processor-y := processor_driver.o
drivers/acpi/cppc_acpi.c new file +734 -0
734 lines not on this page · raw message
include/acpi/cppc_acpi.h new file +138 -0
138 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v9 2/5 CPPC: Add a CPUFreq driver for use with CPPC
In reply to Ashwin ChauguleThis driver utilizes the methods introduced in the previous patch - "ACPI: Introduce CPU performance controls using CPPC" and enables usage with existing CPUFreq governors.
--- drivers/cpufreq/Kconfig.arm | 17 +++++ drivers/cpufreq/Makefile | 2 + drivers/cpufreq/cppc_cpufreq.c | 169 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 drivers/cpufreq/cppc_cpufreq.c
drivers/cpufreq/Kconfig.arm +17 -0
@@ -261,3 +261,20 @@ config ARM_PXA2xx_CPUFREQ This add the CPUFreq driver support for Intel PXA2xx SOCs. If in doubt, say N. + +config ACPI_CPPC_CPUFREQ + tristate "CPUFreq driver based on the ACPI CPPC spec" + depends on ACPI + select ACPI_CPPC_LIB + default n + help + This adds a CPUFreq driver which uses CPPC methods + as described in the ACPIv5.1 spec. CPPC stands for + Collaborative Processor Performance Controls. It + is based on an abstract continuous scale of CPU + performance values which allows the remote power + processor to flexibly optimize for power and + performance. CPPC relies on power management firmware + support for its operation. + + If in doubt, say N.
drivers/cpufreq/Makefile +2 -0
@@ -78,6 +78,8 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o obj-$(CONFIG_ARM_TEGRA_CPUFREQ) += tegra-cpufreq.o obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o +obj-$(CONFIG_ACPI_CPPC_CPUFREQ) += cppc_cpufreq.o + ################################################################################## # PowerPC platform drivers
drivers/cpufreq/cppc_cpufreq.c new file +169 -0
169 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 1/1 CPPC: Add a CPUFreq driver for use with CPPC
This driver utilizes the methods introduced in a previous patch titled - "ACPI: Introduce CPU performance controls using CPPC" and enables usage with existing CPUFreq governors.
--- drivers/cpufreq/Kconfig.arm | 17 ++++ drivers/cpufreq/Makefile | 2 + drivers/cpufreq/cppc_cpufreq.c | 176 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 drivers/cpufreq/cppc_cpufreq.c
drivers/cpufreq/Kconfig.arm +17 -0
@@ -261,3 +261,20 @@ config ARM_PXA2xx_CPUFREQ This add the CPUFreq driver support for Intel PXA2xx SOCs. If in doubt, say N. + +config ACPI_CPPC_CPUFREQ + tristate "CPUFreq driver based on the ACPI CPPC spec" + depends on ACPI + select ACPI_CPPC_LIB + default n + help + This adds a CPUFreq driver which uses CPPC methods + as described in the ACPIv5.1 spec. CPPC stands for + Collaborative Processor Performance Controls. It + is based on an abstract continuous scale of CPU + performance values which allows the remote power + processor to flexibly optimize for power and + performance. CPPC relies on power management firmware + support for its operation. + + If in doubt, say N.
drivers/cpufreq/Makefile +2 -0
@@ -78,6 +78,8 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o obj-$(CONFIG_ARM_TEGRA_CPUFREQ) += tegra-cpufreq.o obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o +obj-$(CONFIG_ACPI_CPPC_CPUFREQ) += cppc_cpufreq.o + ################################################################################## # PowerPC platform drivers
drivers/cpufreq/cppc_cpufreq.c new file +176 -0
176 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH] CPPC: Add a CPUFreq driver for use with CPPC
Quoted 6 lines · Ashwin Chaugule
This driver utilizes the methods introduced in a previous patch titled - "ACPI: Introduce CPU performance controls using CPPC" and enables usage with existing CPUFreq governors.
Signed-off-by Ashwin Chaugule <[email protected]>Reviewed-by Al Stone <[email protected]>
This doesn't seem to apply for me, care to refresh (on top of my bleeding-edge branch)?
Thanks,
Rafael
Re: [PATCH] CPPC: Add a CPUFreq driver for use with CPPC
Quoted 10 lines · Rafael J. Wysocki
Quoted 6 lines · Ashwin Chaugule
This driver utilizes the methods introduced in a previous patch titled - "ACPI: Introduce CPU performance controls using CPPC" and enables usage with existing CPUFreq governors.
Signed-off-by Ashwin Chaugule <[email protected]>Reviewed-by Al Stone <[email protected]>This doesn't seem to apply for me, care to refresh (on top of my bleeding-edge branch)?
Never mind, I've resolved this already.
Thanks,
Rafael
Re: [PATCH] CPPC: Add a CPUFreq driver for use with CPPC
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Ashwin Chaugule
This driver utilizes the methods introduced in a previous patch titled - "ACPI: Introduce CPU performance controls using CPPC" and enables usage with existing CPUFreq governors.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Ashwin Chaugule <[email protected]>Reviewed-by Al Stone <[email protected]>This doesn't seem to apply for me, care to refresh (on top of my bleeding-edge branch)?
Never mind, I've resolved this already.
Guessing some Makefile conflict. Thanks though!
Regards,
Ashwin.
PATCH v9 3/5 ACPI: Add weak routines for ACPI CPU Hotplug
In reply to Ashwin ChauguleAdd weak functions for architectures which do not support hot-adding and removing CPUs which aren't detected at bootup. (e.g. via MADT).
This helps preserve the Kconfig dependency from:
commit cbfc1bae55bb ("[ACPI] ACPI_HOTPLUG_CPU Kconfig dependency update")
prevent:
HOTPLUG_CPU=y
ACPI_PROCESSOR=y
ACPI_HOTPLUG_CPU=n
--- drivers/acpi/acpi_processor.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/acpi/acpi_processor.c +18 -0
@@ -164,6 +164,24 @@ static int acpi_processor_errata(void)-------------------------------------------------------------------------- */ #ifdef CONFIG_ACPI_HOTPLUG_CPU +int __weak acpi_map_cpu (acpi_handle handle, +phys_cpuid_t physid,int *pcpu) +{ +return -ENODEV ; +} + +int __weak acpi_unmap_cpu (int cpu) +{ +return -ENODEV ; +} + +int __weak arch_register_cpu (int cpu) +{ +return -ENODEV ; +} + +void __weak arch_unregister_cpu (int cpu) {} +static int acpi_processor_hotadd_init (struct acpi_processor *pr) {unsigned long long sta;
Signature · 1 line
1.9.1
PATCH v9 4/5 CPPC: Probe for CPPC tables for each ACPI Processor object
In reply to Ashwin ChauguleFor each detected ACPI Processor object (ACPI0007), search its device handle for CPPC specific tables (i.e. _CPC) and extract CPU specific performance capabilities.
--- drivers/acpi/processor_driver.c | 6 ++++++ include/acpi/processor.h | 14 ++++++++++++++ 2 files changed, 20 insertions(+)
drivers/acpi/processor_driver.c +6 -0
@@ -246,6 +246,10 @@ static int __acpi_processor_start(struct acpi_device *device)if (pr->flags.need_hotplug_init)return 0 ; + result =acpi_cppc_processor_probe (pr); +if (result) +return -ENODEV ; +if (!cpuidle_get_driver () ||cpuidle_get_driver () == &acpi_idle_driver)acpi_processor_power_init (pr);
@@ -291,6 +295,8 @@ static int acpi_processor_stop(struct device *dev)acpi_pss_perf_exit (pr, device); +acpi_cppc_processor_exit (pr); +return 0 ; }
include/acpi/processor.h +14 -0
@@ -314,6 +314,20 @@ phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);int acpi_map_cpuid (phys_cpuid_t phys_id,u32 acpi_id);int acpi_get_cpuid (acpi_handle ,int type,u32 acpi_id); +#ifdef CONFIG_ACPI_CPPC_LIB +extern int acpi_cppc_processor_probe (struct acpi_processor *pr); +extern void acpi_cppc_processor_exit (struct acpi_processor *pr); +#else +static inline int acpi_cppc_processor_probe (struct acpi_processor *pr) +{ +return 0 ; +} +static inline void acpi_cppc_processor_exit (struct acpi_processor *pr) +{ +return ; +} +#endif /* CONFIG_ACPI_CPPC_LIB */ +/* in processor_pdc.c */ void acpi_processor_set_pdc (acpi_handle handle);
Signature · 1 line
1.9.1
PATCH v9 5/5 ACPI: Allow selection of the ACPI processor driver for ARM64
In reply to Ashwin ChauguleNow that the ACPI processor driver has been decoupled from the C states and P states functionality, make it selectable on ARM64 so that it can be used by others e.g. CPPC.
The C states and P states code is selected only on X86 or IA64 until the relevant support is added on ARM64.
--- drivers/acpi/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/Kconfig +3 -3
@@ -213,9 +213,9 @@ config ACPI_CPPC_LIB config ACPI_PROCESSOR tristate "Processor" - depends on X86 || IA64 - select ACPI_PROCESSOR_IDLE - select ACPI_CPU_FREQ_PSS + depends on X86 || IA64 || ARM64 + select ACPI_PROCESSOR_IDLE if X86 || IA64 + select ACPI_CPU_FREQ_PSS if X86 || IA64 default y help This driver adds support for the ACPI Processor package. It is required
Signature · 1 line
1.9.1
Quoted 103 lines · Ashwin Chaugule
CPPC:
====CPPC (Collaborative Processor Performance Control) is a new way to control CPU performance using an abstract continous scale as against a discretized P-state scale which is tied to CPU frequency only. It is defined in the ACPI 5.0+ spec. In brief, the basic operation involves:
- OS makes a CPU performance request. (Can provide min and max tolerable bounds)- Platform (such as BMC) is free to optimize request within requested bounds depending on power/thermal budgets etc.
- Platform conveys its decision back to OS
The communication between OS and platform occurs through another medium called (PCC) Platform communication Channel. This is a generic mailbox like mechanism which includes doorbell semantics to indicate register updates. See
drivers/mailbox/pcc.cThis patchset introduces a CPPC based CPUFreq driver that works with existing governors such as ondemand. The CPPC table parsing and the CPPC communication semantics are abstracted into separate files to allow future CPPC based drivers to implement their own governors if required.
Initial patchsets included an adaptation of the PID governor from
intel_pstate.c. However recent experiments led to extensive modifications of the algorithm to calculate CPU busyness. Until it is verified that these changes are worthwhile, the existing governors should provide for a good enough starting point for ARM64 servers.Finer details about the PCC and CPPC spec are available in the latest ACPI 5.1 specification.[2]
Testing:
=======This was tested on an SBSA compatible ARMv8 server with CPPCv2 firmware running on a remote processor. I verified that each CPUs performance limits were detected and that new performance requests were made by the on-demand governor proportional to the load on each CPU. I also verified that using the
acpi_processordriver correctly maps the physical CPU ids to logical CPU ids, which helps in picking up the proper_CPCdetails from a processor object, in the case where CPU physical ids may not be contiguous.Changes since V8:
- Fixed up several debug prints, return types and comments.
- Simplified read/write ops using existing ACPI core API.
- Removed ->get() from cpufreq driver for now.
- Fixed bug introduced by copy-paste err inset_perf.Changes since V7:
- Simplied new kconfig options for PSS and idle.
- Separated patch to enable acpi processor on ARM64.
- Removed redundant kconfig cross deps on PCC.
- Decoupledprocessor_perflibfrom new PSS kconfig option.Changes since V6:
- Separated PSS and CST from ACPI processor driver in two patches.
- Made newKconfigsymbols auto selectable from Arch Kconfigs.Changes since V5:
- Checkpatch cleanups.
- Changepss_inittopss_perf_init. Rec by Srinivas Pandruvada.
- Explicit comment explaining whypostcore_initcallto pcc mailbox.
- Fold acpi_processor_syscore_init/exit intoCONFIG_ACPI_CST.
- Added patch with dummy functions used byACPI_HOTPLUG_CPU.Changes since V4:
- Misc cleanups. Addressed feedback from Rafael.
- Madeacpi_processor.cindependent of C-states, P-states and others.
- Per CPU scanning for_CPCis now made fromacpi_processor.c
- Added newKconfigoptions for legacy C states and P states to enable future support for newer alternatives as defined in the ACPI spec 6.0.Changes since V3:
- Split CPPC backend methods into separate files.
- Add frontend driver which plugs into existing CPUfreq governors.
- Simplify PCC driver by moving communication space mapping and read/write into client drivers.Changes since V2:
- Select driver if !X86, sinceintel_pstatewill use HWP extensions instead.
- Added more comments.
- Added Freq domain awareness and PSD parsing.Changes since V1:
- Create a new driver based on Dirks suggestion.
- Fold in CPPC backend hooks into main driver.Changes since V0: [1]
- Splitintel_pstate.cinto a generic PID governor and platform specific backend.
- Add CPPC accessors as PID backend.[1] - http://lwn.net/Articles/608715/
[2] - http://www.uefi.org/sites/default/files/resources/ACPI_5_1release.pdf
[3] - https://patches.linaro.org/40705/Ashwin Chaugule (5):
ACPI: Introduce CPU performance controls using CPPC
CPPC: Add a CPUFreq driver for use with CPPC
ACPI: Add weak routines for ACPI CPU Hotplug
CPPC: Probe for CPPC tables for each ACPI Processor object
ACPI: Allow selection of the ACPI processor driver for ARM64
Quoted 14 lines
drivers/acpi/Kconfig | 20 +- drivers/acpi/Makefile | 1 + drivers/acpi/acpi_processor.c | 18 + drivers/acpi/cppc_acpi.c | 755 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/processor_driver.c | 6 + drivers/cpufreq/Kconfig.arm | 17 + drivers/cpufreq/Makefile | 2 + drivers/cpufreq/cppc_cpufreq.c | 169 +++++++++ include/acpi/cppc_acpi.h | 138 ++++++++ include/acpi/processor.h | 14 + 10 files changed, 1137 insertions(+), 3 deletions(-) create mode 100644 drivers/acpi/cppc_acpi.c create mode 100644 drivers/cpufreq/cppc_cpufreq.c create mode 100644 include/acpi/cppc_acpi.h
Series queued up for v4.4 (with the updates).
Thanks,
Rafael
Quoted 119 lines · Rafael J. Wysocki
Quoted 103 lines · Ashwin Chaugule
CPPC:
====CPPC (Collaborative Processor Performance Control) is a new way to control CPU performance using an abstract continous scale as against a discretized P-state scale which is tied to CPU frequency only. It is defined in the ACPI 5.0+ spec. In brief, the basic operation involves:
- OS makes a CPU performance request. (Can provide min and max tolerable bounds)- Platform (such as BMC) is free to optimize request within requested bounds depending on power/thermal budgets etc.
- Platform conveys its decision back to OS
The communication between OS and platform occurs through another medium called (PCC) Platform communication Channel. This is a generic mailbox like mechanism which includes doorbell semantics to indicate register updates. See
drivers/mailbox/pcc.cThis patchset introduces a CPPC based CPUFreq driver that works with existing governors such as ondemand. The CPPC table parsing and the CPPC communication semantics are abstracted into separate files to allow future CPPC based drivers to implement their own governors if required.
Initial patchsets included an adaptation of the PID governor from
intel_pstate.c. However recent experiments led to extensive modifications of the algorithm to calculate CPU busyness. Until it is verified that these changes are worthwhile, the existing governors should provide for a good enough starting point for ARM64 servers.Finer details about the PCC and CPPC spec are available in the latest ACPI 5.1 specification.[2]
Testing:
=======This was tested on an SBSA compatible ARMv8 server with CPPCv2 firmware running on a remote processor. I verified that each CPUs performance limits were detected and that new performance requests were made by the on-demand governor proportional to the load on each CPU. I also verified that using the
acpi_processordriver correctly maps the physical CPU ids to logical CPU ids, which helps in picking up the proper_CPCdetails from a processor object, in the case where CPU physical ids may not be contiguous.Changes since V8:
- Fixed up several debug prints, return types and comments.
- Simplified read/write ops using existing ACPI core API.
- Removed ->get() from cpufreq driver for now.
- Fixed bug introduced by copy-paste err inset_perf.Changes since V7:
- Simplied new kconfig options for PSS and idle.
- Separated patch to enable acpi processor on ARM64.
- Removed redundant kconfig cross deps on PCC.
- Decoupledprocessor_perflibfrom new PSS kconfig option.Changes since V6:
- Separated PSS and CST from ACPI processor driver in two patches.
- Made newKconfigsymbols auto selectable from Arch Kconfigs.Changes since V5:
- Checkpatch cleanups.
- Changepss_inittopss_perf_init. Rec by Srinivas Pandruvada.
- Explicit comment explaining whypostcore_initcallto pcc mailbox.
- Fold acpi_processor_syscore_init/exit intoCONFIG_ACPI_CST.
- Added patch with dummy functions used byACPI_HOTPLUG_CPU.Changes since V4:
- Misc cleanups. Addressed feedback from Rafael.
- Madeacpi_processor.cindependent of C-states, P-states and others.
- Per CPU scanning for_CPCis now made fromacpi_processor.c
- Added newKconfigoptions for legacy C states and P states to enable future support for newer alternatives as defined in the ACPI spec 6.0.Changes since V3:
- Split CPPC backend methods into separate files.
- Add frontend driver which plugs into existing CPUfreq governors.
- Simplify PCC driver by moving communication space mapping and read/write into client drivers.Changes since V2:
- Select driver if !X86, sinceintel_pstatewill use HWP extensions instead.
- Added more comments.
- Added Freq domain awareness and PSD parsing.Changes since V1:
- Create a new driver based on Dirks suggestion.
- Fold in CPPC backend hooks into main driver.Changes since V0: [1]
- Splitintel_pstate.cinto a generic PID governor and platform specific backend.
- Add CPPC accessors as PID backend.[1] - http://lwn.net/Articles/608715/
[2] - http://www.uefi.org/sites/default/files/resources/ACPI_5_1release.pdf
[3] - https://patches.linaro.org/40705/Ashwin Chaugule (5):
ACPI: Introduce CPU performance controls using CPPC
CPPC: Add a CPUFreq driver for use with CPPC
ACPI: Add weak routines for ACPI CPU Hotplug
CPPC: Probe for CPPC tables for each ACPI Processor object
ACPI: Allow selection of the ACPI processor driver for ARM64Quoted 14 lines
drivers/acpi/Kconfig | 20 +- drivers/acpi/Makefile | 1 + drivers/acpi/acpi_processor.c | 18 + drivers/acpi/cppc_acpi.c | 755 ++++++++++++++++++++++++++++++++++++++++ drivers/acpi/processor_driver.c | 6 + drivers/cpufreq/Kconfig.arm | 17 + drivers/cpufreq/Makefile | 2 + drivers/cpufreq/cppc_cpufreq.c | 169 +++++++++ include/acpi/cppc_acpi.h | 138 ++++++++ include/acpi/processor.h | 14 + 10 files changed, 1137 insertions(+), 3 deletions(-) create mode 100644 drivers/acpi/cppc_acpi.c create mode 100644 drivers/cpufreq/cppc_cpufreq.c create mode 100644 include/acpi/cppc_acpi.h
Quoted 1 line
Series queued up for v4.4 (with the updates).
Great! Thanks Rafael!