Skip to contentSkip to conversation

CPUFreq driver using CPPC methods

PATCH Superseded Ashwin Chaugule 4 participants 30 messages Jun 15, 2015 – Jul 9, 2015

Subsystems (8)

v6 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v6 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 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 (7):
PCC: Initialize PCC Mailbox earlier at boot
ACPI: Make ACPI processor driver more extensible
ACPI: Introduce CPU performance controls using CPPC
CPPC: Add a CPUFreq driver for use with CPPC
CPPC: Probe for CPPC tables for each ACPI Processor object
PCC: Enable PCC only when needed
ACPI: Add weak routines for ACPI CPU Hotplug

 drivers/acpi/Kconfig            |  48 ++-
 drivers/acpi/Makefile           |   8 +-
 drivers/acpi/acpi_processor.c   |  18 +
 drivers/acpi/cppc_acpi.c        | 812 ++++++++++++++++++++++++++++++++++++++++
 drivers/acpi/processor_driver.c |  90 +++--
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.arm     |  16 +
 drivers/cpufreq/Kconfig.x86     |   2 +
 drivers/cpufreq/Makefile        |   2 +
 drivers/cpufreq/cppc_cpufreq.c  | 197 ++++++++++
 drivers/mailbox/Kconfig         |   2 +-
 drivers/mailbox/pcc.c           |   8 +-
 include/acpi/cppc_acpi.h        | 137 +++++++
 include/acpi/processor.h        | 129 +++++--
 14 files changed, 1397 insertions(+), 74 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
#1 lore raw

PATCH v6 1/7 PCC: Initialize PCC Mailbox earlier at boot

This change initializes the PCC Mailbox earlier than the ACPI processor driver. This enables drivers introduced in follow up patches (e.g. CPPC) to be probed via the ACPI processor driver interface. The CPPC probe requires the PCC channel to be initialized for it to query each CPUs performance capabilities.

---
 drivers/mailbox/pcc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mailbox/pcc.c +7 -1
index 7e91d68..fcda63e 100644
@@ -352,4 +352,10 @@ static int __init pcc_init(void)
 
 	return 0;
 }
-device_initcall(pcc_init);
+
+/*
+ * Make pcc init postcore so that users of this mailbox
+ * such as the ACPI Processor driver have it available
+ * at their init.
+ */
+postcore_initcall(pcc_init);
Signature · 1 line
1.9.1
#2 lore raw

PATCH v6 2/7 ACPI: Make ACPI processor driver more extensible

In reply to Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +26 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
 	  This driver supports ACPI-controlled docking stations and removable
 	  drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-	tristate "Processor"
-	select THERMAL
-	select CPU_IDLE
+config ACPI_CST
+	bool "ACPI C states (CST) driver"
+	depends on ACPI_PROCESSOR
 	depends on X86 || IA64
+	select CPU_IDLE
 	default y
 	help
 	  This driver installs ACPI as the idle handler for Linux and uses
 	  ACPI C2 and C3 processor states to save power on systems that
-	  support it.  It is required by several flavors of cpufreq
+	  support it.
+
+config ACPI_PSS
+	bool "ACPI P States (PSS) driver"
+	depends on ACPI_PROCESSOR
+	depends on X86 || IA64
+	select THERMAL
+	default y
+	help
+	  This driver implements ACPI methods for controlling CPU performance
+	  using PSS methods as described in the ACPI spec. It also enables support
+	  for ACPI based performance throttling (TSS) and ACPI based thermal
+	  monitoring. It is required by several flavors of cpufreq
 	  performance-state drivers.
 
+config ACPI_PROCESSOR
+	tristate "Processor"
+	depends on X86 || IA64
+	default y
+	help
+	  This driver adds support for the ACPI Processor package. It is required
+	  by several flavors of cpufreq performance-state, thermal, throttling and
+	  idle drivers.
+
 	  To compile this driver as a module, choose M here:
 	  the module will be called processor.
 
drivers/acpi/Makefile +4 -3
index 8a063e2..30b2bfc 100644
@@ -82,9 +82,10 @@ obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
 
 # processor has its own "processor." module_param namespace
-processor-y			:= processor_driver.o processor_throttling.o
-processor-y			+= processor_idle.o processor_thermal.o
-processor-$(CONFIG_CPU_FREQ)	+= processor_perflib.o
+processor-y			:= processor_driver.o
+processor-$(CONFIG_ACPI_CST)	+= processor_idle.o
+processor-$(CONFIG_ACPI_PSS)	+= processor_perflib.o	\
+	processor_throttling.o processor_thermal.o
 
 obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o
 
drivers/acpi/processor_driver.c +58 -28

130 lines not on this page · raw message

drivers/cpufreq/Kconfig +1 -1
index 659879a..2f36e2a 100644
@@ -223,7 +223,7 @@ endif
 if IA64
 config IA64_ACPI_CPUFREQ
 	tristate "ACPI Processor P-States driver"
-	depends on ACPI_PROCESSOR
+	depends on ACPI_PROCESSOR && ACPI_PSS && ACPI_CST
 	help
 	This driver adds a CPUFreq driver which utilizes the ACPI
 	Processor Performance States.
drivers/cpufreq/Kconfig.x86 +2 -0
index c59bdcb..ee285a8 100644
@@ -18,6 +18,7 @@ config X86_INTEL_PSTATE
 config X86_PCC_CPUFREQ
 	tristate "Processor Clocking Control interface driver"
 	depends on ACPI && ACPI_PROCESSOR
+	depends on ACPI_PSS && ACPI_CST
 	help
 	  This driver adds support for the PCC interface.
 
@@ -32,6 +33,7 @@ config X86_PCC_CPUFREQ
 config X86_ACPI_CPUFREQ
 	tristate "ACPI Processor P-States driver"
 	depends on ACPI_PROCESSOR
+	depends on ACPI_PSS && ACPI_CST
 	help
 	  This driver adds a CPUFreq driver which utilizes the ACPI
 	  Processor Performance States.
include/acpi/processor.h +85 -35

183 lines not on this page · raw message

Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
 	  This driver supports ACPI-controlled docking stations and removable
 	  drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-	tristate "Processor"
-	select THERMAL
-	select CPU_IDLE
+config ACPI_CST
+	bool "ACPI C states (CST) driver"
+	depends on ACPI_PROCESSOR
 	depends on X86 || IA64
+	select CPU_IDLE
 	default y
 	help
 	  This driver installs ACPI as the idle handler for Linux and uses
 	  ACPI C2 and C3 processor states to save power on systems that
-	  support it.  It is required by several flavors of cpufreq
+	  support it.
+
+config ACPI_PSS
+	bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+	depends on ACPI_PROCESSOR
+	depends on X86 || IA64
+	select THERMAL
+	default y
+	help
+	  This driver implements ACPI methods for controlling CPU performance
+	  using PSS methods as described in the ACPI spec. It also enables support
+	  for ACPI based performance throttling (TSS) and ACPI based thermal
+	  monitoring. It is required by several flavors of cpufreq
 	  performance-state drivers.

For starters, I don't like these new Kconfig options.

Isn't there a way to implement what you need without adding them?

Rafael

#4 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 70 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
        This driver supports ACPI-controlled docking stations and removable
        drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
      depends on X86 || IA64
+     select CPU_IDLE
      default y
      help
        This driver installs ACPI as the idle handler for Linux and uses
        ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
        performance-state drivers.

For starters, I don't like these new Kconfig options.

Quoted 1 line

Isn't there a way to implement what you need without adding them?

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue. I considered the alternative of adding a probe routine which matches ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like a better option. Do you have any other ideas?

Thanks,
Ashwin.

#5 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Hi Ashwin,

Quoted 71 lines · Ashwin Chaugule
Quoted 70 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
        This driver supports ACPI-controlled docking stations and removable
        drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
      depends on X86 || IA64
+     select CPU_IDLE
      default y
      help
        This driver installs ACPI as the idle handler for Linux and uses
        ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
        performance-state drivers.

For starters, I don't like these new Kconfig options.

Quoted 8 lines
Quoted 1 line

Isn't there a way to implement what you need without adding them?

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue. I considered the alternative of adding a probe routine which matches ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like a better option. Do you have any other ideas?

First of all, I don't see what _CST has to do with CPPC.

Second, it looks like the problem is that x86 probably won't use CPPC, while arm64 probably won't use _PSS.

That can be addressed by adding Kconfig options, but those options should not be user-selectable (because quite honestly users don't have to know what those things are and they don't care *and* things break if they make a wrong choice). Instead, I'd make architecture Kconfigs select those options automatically.

Thanks,
Rafael

#6 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Hello,

Quoted 77 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 73 lines · Ashwin Chaugule
Quoted 71 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
        This driver supports ACPI-controlled docking stations and removable
        drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
      depends on X86 || IA64
+     select CPU_IDLE
      default y
      help
        This driver installs ACPI as the idle handler for Linux and uses
        ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
        performance-state drivers.

For starters, I don't like these new Kconfig options.

Isn't there a way to implement what you need without adding them?

Quoted 8 lines
Quoted 6 lines

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue. I considered the alternative of adding a probe routine which matches ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like a better option. Do you have any other ideas?

First of all, I don't see what _CST has to do with CPPC.

Agree, it doesn't. I was implying that the current acpi processor driver is tied to CST as well. CST and CPPC can co-exist. But Sudeep's LPI patchwork would need to separate CST out of the processor driver anyway. He actually proposed a similar-ish solution a while back.

Quoted 3 lines

Second, it looks like the problem is that x86 probably won't use CPPC, while arm64 probably won't use _PSS.

Yep.

Quoted 6 lines

That can be addressed by adding Kconfig options, but those options should not be user-selectable (because quite honestly users don't have to know what those things are and they don't care *and* things break if they make a wrong choice). Instead, I'd make architecture Kconfigs select those options automatically.

Ok. I'll look into moving these config options into the ARCH_HAS_ .. sort of variants.

Thanks,
Ashwin.

#7 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

In reply to Rafael J. Wysocki

Hi Rafael,

Quoted 86 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 71 lines · Ashwin Chaugule
Quoted 70 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
        This driver supports ACPI-controlled docking stations and removable
        drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
      depends on X86 || IA64
+     select CPU_IDLE
      default y
      help
        This driver installs ACPI as the idle handler for Linux and uses
        ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
        performance-state drivers.

For starters, I don't like these new Kconfig options.

Quoted 8 lines
Quoted 1 line

Isn't there a way to implement what you need without adding them?

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue. I considered the alternative of adding a probe routine which matches ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like a better option. Do you have any other ideas?

First of all, I don't see what _CST has to do with CPPC.

Quoted 9 lines

Second, it looks like the problem is that x86 probably won't use CPPC, while arm64 probably won't use _PSS.

That can be addressed by adding Kconfig options, but those options should not be user-selectable (because quite honestly users don't have to know what those things are and they don't care *and* things break if they make a wrong choice). Instead, I'd make architecture Kconfigs select those options automatically.

I've made changes locally. Basically s/ACPI_PSS/HAVE_ACPI_PSS/ and in arch/x86/Kconfig; select HAVE_ACPI_PSS if ACPI. Similarly for CST. Just wanted to check if there were any other comments before sending out v7.

Thanks,
Ashwin.

#8 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Hi Ashwin,

Quoted 99 lines · Ashwin Chaugule

Hi Rafael,

Quoted 86 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 71 lines · Ashwin Chaugule
Quoted 70 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
        This driver supports ACPI-controlled docking stations and removable
        drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
      depends on X86 || IA64
+     select CPU_IDLE
      default y
      help
        This driver installs ACPI as the idle handler for Linux and uses
        ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
        performance-state drivers.

For starters, I don't like these new Kconfig options.

Quoted 8 lines
Quoted 1 line

Isn't there a way to implement what you need without adding them?

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue. I considered the alternative of adding a probe routine which matches ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like a better option. Do you have any other ideas?

First of all, I don't see what _CST has to do with CPPC.

Quoted 9 lines

Second, it looks like the problem is that x86 probably won't use CPPC, while arm64 probably won't use _PSS.

That can be addressed by adding Kconfig options, but those options should not be user-selectable (because quite honestly users don't have to know what those things are and they don't care *and* things break if they make a wrong choice). Instead, I'd make architecture Kconfigs select those options automatically.

Quoted 4 lines

I've made changes locally. Basically s/ACPI_PSS/HAVE_ACPI_PSS/ and in arch/x86/Kconfig; select HAVE_ACPI_PSS if ACPI. Similarly for CST. Just wanted to check if there were any other comments before sending out v7.

Can you please just send the new version of the $subject patch alone for now?

Also I'm still unsure what the connection between _CST and CPPC is.

Thanks,
Rafael

#9 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 103 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 99 lines · Ashwin Chaugule

Hi Rafael,

Quoted 95 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 71 lines · Ashwin Chaugule
Quoted 70 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
        This driver supports ACPI-controlled docking stations and removable
        drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
      depends on X86 || IA64
+     select CPU_IDLE
      default y
      help
        This driver installs ACPI as the idle handler for Linux and uses
        ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
        performance-state drivers.

For starters, I don't like these new Kconfig options.

Quoted 8 lines
Quoted 1 line

Isn't there a way to implement what you need without adding them?

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue. I considered the alternative of adding a probe routine which matches ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like a better option. Do you have any other ideas?

First of all, I don't see what _CST has to do with CPPC.

Second, it looks like the problem is that x86 probably won't use CPPC, while arm64 probably won't use _PSS.

That can be addressed by adding Kconfig options, but those options should not be user-selectable (because quite honestly users don't have to know what those things are and they don't care *and* things break if they make a wrong choice). Instead, I'd make architecture Kconfigs select those options automatically.

Quoted 6 lines
Quoted 4 lines

I've made changes locally. Basically s/ACPI_PSS/HAVE_ACPI_PSS/ and in arch/x86/Kconfig; select HAVE_ACPI_PSS if ACPI. Similarly for CST. Just wanted to check if there were any other comments before sending out v7.

Can you please just send the new version of the $subject patch alone for now?

Attached below. (hope that worked.)

Quoted 3 lines

Also I'm still unsure what the connection between _CST and CPPC is.

There isnt. But I'm missing where I've implied the dependency?

Thanks,
Ashwin.

From cd48987a681d6f6fcbdfe4da4a7b456abf5daa05 Mon Sep 17 00:00:00 2001
From: Ashwin Chaugule <[email protected]>
Date: Fri, 22 May 2015 14:55:30 -0400
Subject: [PATCH 2/7] ACPI: Make ACPI processor driver more extensible

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and the options are auto-selected by the architecture Kconfig files.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig options lets us make these two mutually exclusive at compile time.

---
 arch/x86/Kconfig                |   2 +
 drivers/acpi/Kconfig            |  31 ++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 +++++++++++++++++++---------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 122 +++++++++++++++++++++++++++++-----------
 7 files changed, 180 insertions(+), 72 deletions(-)
arch/x86/Kconfig +2 -0
index 226d569..a6a0740 100644
@@ -143,6 +143,8 @@ config X86
 	select ACPI_LEGACY_TABLES_LOOKUP if ACPI
 	select X86_FEATURE_NAMES if PROC_FS
 	select SRCU
+	select HAVE_ACPI_CST if ACPI
+	select HAVE_ACPI_PSS if ACPI
 
 config INSTRUCTION_DECODER
 	def_bool y
drivers/acpi/Kconfig +25 -6
index ab2cbb5..7ebb673 100644
@@ -166,18 +166,37 @@ config ACPI_DOCK
 	  This driver supports ACPI-controlled docking stations and removable
 	  drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-	tristate "Processor"
-	select THERMAL
-	select CPU_IDLE
+config HAVE_ACPI_CST
+	bool
+	depends on ACPI_PROCESSOR
 	depends on X86 || IA64
-	default y
+	select CPU_IDLE
 	help
 	  This driver installs ACPI as the idle handler for Linux and uses
 	  ACPI C2 and C3 processor states to save power on systems that
-	  support it.  It is required by several flavors of cpufreq
+	  support it.
+
+config HAVE_ACPI_PSS
+	bool
+	depends on ACPI_PROCESSOR
+	depends on X86 || IA64
+	select THERMAL
+	help
+	  This driver implements ACPI methods for controlling CPU performance
+	  using PSS methods as described in the ACPI spec. It also enables support
+	  for ACPI based performance throttling (TSS) and ACPI based thermal
+	  monitoring. It is required by several flavors of cpufreq
 	  performance-state drivers.
 
+config ACPI_PROCESSOR
+	tristate "Processor"
+	depends on X86 || IA64
+	default y
+	help
+	  This driver adds support for the ACPI Processor package. It is required
+	  by several flavors of cpufreq performance-state, thermal, throttling and
+	  idle drivers.
+
 	  To compile this driver as a module, choose M here:
 	  the module will be called processor.
 
drivers/acpi/Makefile +4 -3
index 8a063e2..3726725 100644
@@ -82,9 +82,10 @@ obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
 
 # processor has its own "processor." module_param namespace
-processor-y			:= processor_driver.o processor_throttling.o
-processor-y			+= processor_idle.o processor_thermal.o
-processor-$(CONFIG_CPU_FREQ)	+= processor_perflib.o
+processor-y			:= processor_driver.o
+processor-$(CONFIG_HAVE_ACPI_CST)	+= processor_idle.o
+processor-$(CONFIG_HAVE_ACPI_PSS)	+= processor_perflib.o	\
+	processor_throttling.o processor_thermal.o
 
 obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o
 
drivers/acpi/processor_driver.c +58 -28

130 lines not on this page · raw message

drivers/cpufreq/Kconfig +1 -1
index 659879a..d07944c 100644
@@ -223,7 +223,7 @@ endif
 if IA64
 config IA64_ACPI_CPUFREQ
 	tristate "ACPI Processor P-States driver"
-	depends on ACPI_PROCESSOR
+	depends on ACPI_PROCESSOR && HAVE_ACPI_PSS && HAVE_ACPI_CST
 	help
 	This driver adds a CPUFreq driver which utilizes the ACPI
 	Processor Performance States.
drivers/cpufreq/Kconfig.x86 +2 -0
index c59bdcb..76dd454 100644
@@ -18,6 +18,7 @@ config X86_INTEL_PSTATE
 config X86_PCC_CPUFREQ
 	tristate "Processor Clocking Control interface driver"
 	depends on ACPI && ACPI_PROCESSOR
+	depends on HAVE_ACPI_PSS && HAVE_ACPI_CST
 	help
 	  This driver adds support for the PCC interface.
 
@@ -32,6 +33,7 @@ config X86_PCC_CPUFREQ
 config X86_ACPI_CPUFREQ
 	tristate "ACPI Processor P-States driver"
 	depends on ACPI_PROCESSOR
+	depends on HAVE_ACPI_PSS && HAVE_ACPI_CST
 	help
 	  This driver adds a CPUFreq driver which utilizes the ACPI
 	  Processor Performance States.
include/acpi/processor.h +88 -34

186 lines not on this page · raw message

Signature · 1 line
1.9.1
#10 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 111 lines · Ashwin Chaugule
Quoted 103 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 99 lines · Ashwin Chaugule

Hi Rafael,

Quoted 95 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 71 lines · Ashwin Chaugule
Quoted 70 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
 drivers/acpi/Kconfig            |  31 +++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
 6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
        This driver supports ACPI-controlled docking stations and removable
        drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
      depends on X86 || IA64
+     select CPU_IDLE
      default y
      help
        This driver installs ACPI as the idle handler for Linux and uses
        ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
        performance-state drivers.

For starters, I don't like these new Kconfig options.

Quoted 8 lines
Quoted 1 line

Isn't there a way to implement what you need without adding them?

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue. I considered the alternative of adding a probe routine which matches ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like a better option. Do you have any other ideas?

First of all, I don't see what _CST has to do with CPPC.

Second, it looks like the problem is that x86 probably won't use CPPC, while arm64 probably won't use _PSS.

That can be addressed by adding Kconfig options, but those options should not be user-selectable (because quite honestly users don't have to know what those things are and they don't care *and* things break if they make a wrong choice). Instead, I'd make architecture Kconfigs select those options automatically.

Quoted 6 lines
Quoted 4 lines

I've made changes locally. Basically s/ACPI_PSS/HAVE_ACPI_PSS/ and in arch/x86/Kconfig; select HAVE_ACPI_PSS if ACPI. Similarly for CST. Just wanted to check if there were any other comments before sending out v7.

Can you please just send the new version of the $subject patch alone for now?

Quoted 7 lines

Attached below. (hope that worked.)

Quoted 3 lines

Also I'm still unsure what the connection between _CST and CPPC is.

There isnt. But I'm missing where I've implied the dependency?

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Thanks,
Ashwin.

#11 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Hi Ashwin,

Quoted 8 lines · Ashwin Chaugule
Quoted 7 lines · Ashwin Chaugule
Quoted 6 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 2 lines · Ashwin Chaugule

Hi Rafael,

[cut]

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Also I'm still unsure what the connection between _CST and CPPC is.

Quoted 8 lines
Quoted 1 line

There isnt. But I'm missing where I've implied the dependency?

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Yes, please. That would be much less confusing.

Thanks,
Rafael

#12 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 1 line · Rafael J. Wysocki

Hi Ashwin,

Hi,

Quoted 19 lines
Quoted 8 lines · Ashwin Chaugule
Quoted 7 lines · Ashwin Chaugule
Quoted 6 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 2 lines · Ashwin Chaugule

Hi Rafael,

[cut]

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Also I'm still unsure what the connection between _CST and CPPC is.

There isnt. But I'm missing where I've implied the dependency?

Quoted 8 lines
Quoted 6 lines

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Yes, please. That would be much less confusing.

Deja Vu. :)

When I let processor_driver and processor_idle compile on ARM64, I get a bunch of errors because processor_idle.c contains a lot of X86 specific defines. That is why I'd created the ACPI_CST option which we'd enable only on X86.

I'm not entirely sure what these enums and functions should default to, or what they should be on ARM specifically. Given that on ARM64 we're likely to use LPI as against CST, it seems the original approach is better. Thoughts?

------8<------

rivers/acpi/processor_idle.c: In function ‘disabled_by_idle_boot_param’:
drivers/acpi/processor_idle.c:73:9: error: ‘boot_option_idle_override’ undeclared (first use in this function)
return boot_option_idle_override == IDLE_POLL ||

         ^

drivers/acpi/processor_idle.c:73:9: note: each undeclared identifier is reported only once for each function it appears in drivers/acpi/processor_idle.c:73:38: error: ‘IDLE_POLL’ undeclared (first use in this function)
return boot_option_idle_override == IDLE_POLL ||

                                      ^
drivers/acpi/processor_idle.c:74:32: error: ‘IDLE_HALT’ undeclared
(first use in this function)
   boot_option_idle_override == IDLE_HALT;
                                ^

drivers/acpi/processor_idle.c: In function ‘acpi_safe_halt’:
drivers/acpi/processor_idle.c:121:3: error: implicit declaration of function ‘arch_safe_halt’ [-Werror=implicit-function-declaration]
safe_halt();
^
drivers/acpi/processor_idle.c: In function ‘acpi_processor_get_power_info_cst’:
drivers/acpi/processor_idle.c:435:9: error:
‘boot_option_idle_override’ undeclared (first use in this function)

        (boot_option_idle_override == IDLE_NOMWAIT)) {
         ^
drivers/acpi/processor_idle.c:435:38: error: ‘IDLE_NOMWAIT’ undeclared
(first use in this function)
        (boot_option_idle_override == IDLE_NOMWAIT)) {
                                      ^

drivers/acpi/processor_idle.c: In function ‘acpi_idle_enter_bm’:
drivers/acpi/processor_idle.c:749:2: error: implicit declaration of function ‘acpi_unlazy_tlb’ [-Werror=implicit-function-declaration]
acpi_unlazy_tlb(smp_processor_id());
^
drivers/acpi/processor_idle.c: In function ‘acpi_processor_power_init’:
drivers/acpi/processor_idle.c:1072:3: error: implicit declaration of function ‘acpi_processor_cstate_check’ [-Werror=implicit-function-declaration]
max_cstate = acpi_processor_cstate_check(max_cstate);
^
drivers/acpi/processor_idle.c: In function ‘disabled_by_idle_boot_param’:
drivers/acpi/processor_idle.c:75:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
------8<------

Regards,
Ashwin.

#13 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 40 lines · Ashwin Chaugule
Quoted 1 line · Rafael J. Wysocki

Hi Ashwin,

Hi,

Quoted 19 lines
Quoted 8 lines · Ashwin Chaugule
Quoted 7 lines · Ashwin Chaugule
Quoted 6 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 2 lines · Ashwin Chaugule

Hi Rafael,

[cut]

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Also I'm still unsure what the connection between _CST and CPPC is.

There isnt. But I'm missing where I've implied the dependency?

Quoted 8 lines
Quoted 6 lines

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Yes, please. That would be much less confusing.

Deja Vu. :)

When I let processor_driver and processor_idle compile on ARM64, I get a bunch of errors because processor_idle.c contains a lot of X86 specific defines. That is why I'd created the ACPI_CST option which we'd enable only on X86.

Quoted 4 lines

I'm not entirely sure what these enums and functions should default to, or what they should be on ARM specifically. Given that on ARM64 we're likely to use LPI as against CST, it seems the original approach is better. Thoughts?

Before we go anywhere deeper, have you checked what happens on ia64?

Rafael

#14 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 19 lines · Rafael J. Wysocki
Quoted 18 lines · Ashwin Chaugule
Quoted 9 lines · Rafael J. Wysocki
Quoted 7 lines

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Yes, please. That would be much less confusing.

Deja Vu. :)

When I let processor_driver and processor_idle compile on ARM64, I get a bunch of errors because processor_idle.c contains a lot of X86 specific defines. That is why I'd created the ACPI_CST option which we'd enable only on X86.

Quoted 6 lines
Quoted 4 lines

I'm not entirely sure what these enums and functions should default to, or what they should be on ARM specifically. Given that on ARM64 we're likely to use LPI as against CST, it seems the original approach is better. Thoughts?

Before we go anywhere deeper, have you checked what happens on ia64?

I dont have access, but I'm really not changing anything functionally.

Thanks,
Ashwin.

#15 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 20 lines · Ashwin Chaugule
Quoted 19 lines · Rafael J. Wysocki
Quoted 18 lines · Ashwin Chaugule
Quoted 9 lines · Rafael J. Wysocki
Quoted 7 lines

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Yes, please. That would be much less confusing.

Deja Vu. :)

When I let processor_driver and processor_idle compile on ARM64, I get a bunch of errors because processor_idle.c contains a lot of X86 specific defines. That is why I'd created the ACPI_CST option which we'd enable only on X86.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I'm not entirely sure what these enums and functions should default to, or what they should be on ARM specifically. Given that on ARM64 we're likely to use LPI as against CST, it seems the original approach is better. Thoughts?

Before we go anywhere deeper, have you checked what happens on ia64?

I dont have access, but I'm really not changing anything functionally.

I mean ia64 is a non-x86 architecture using ACPI. It very well may be doing things that you want to be doing.

It looks like the only reason you want ACPI_CST for is to avoid building processor_idle.c on ARM64. Then add something like this to the ACPI Kconfig:

config ACPI_PROCESSOR_IDLE

	def_bool Y
	depends on X86 || IA64

and don't make it user-selectable *and* under the ACPI_PROCESSOR config do

select CPU_IDLE if ACPI_PROCESSOR_IDLE

Then, make processor_idle.c conditional on ACPI_PROCESSOR_IDLE. That should do the trick and it may be changed by the LPI series as needed.

Also, I don't see a reason why the ACPI_PSS option should be user-selectable. I'd call it ACPI_CPU_FREQ_PSS, make it depend on CPU_FREQ and make architectures select it (or not) as appropriate.

Thanks,
Rafael

#16 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 40 lines · Rafael J. Wysocki
Quoted 20 lines · Ashwin Chaugule
Quoted 19 lines · Rafael J. Wysocki
Quoted 18 lines · Ashwin Chaugule
Quoted 9 lines · Rafael J. Wysocki
Quoted 7 lines

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Yes, please. That would be much less confusing.

Deja Vu. :)

When I let processor_driver and processor_idle compile on ARM64, I get a bunch of errors because processor_idle.c contains a lot of X86 specific defines. That is why I'd created the ACPI_CST option which we'd enable only on X86.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I'm not entirely sure what these enums and functions should default to, or what they should be on ARM specifically. Given that on ARM64 we're likely to use LPI as against CST, it seems the original approach is better. Thoughts?

Before we go anywhere deeper, have you checked what happens on ia64?

I dont have access, but I'm really not changing anything functionally.

I mean ia64 is a non-x86 architecture using ACPI. It very well may be doing things that you want to be doing.

It looks like the only reason you want ACPI_CST for is to avoid building processor_idle.c on ARM64. Then add something like this to the ACPI Kconfig:

config ACPI_PROCESSOR_IDLE

	def_bool Y
	depends on X86 || IA64
Quoted 6 lines

and don't make it user-selectable *and* under the ACPI_PROCESSOR config do

select CPU_IDLE if ACPI_PROCESSOR_IDLE

Then, make processor_idle.c conditional on ACPI_PROCESSOR_IDLE. That should do the trick and it may be changed by the LPI series as needed.

And do that in a separate patch with a clear changelog explaining why you're doing it.

Thanks,
Rafael

#17 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

In reply to Ashwin Chaugule
Quoted 40 lines · Ashwin Chaugule
Quoted 1 line · Rafael J. Wysocki

Hi Ashwin,

Hi,

Quoted 19 lines
Quoted 8 lines · Ashwin Chaugule
Quoted 7 lines · Ashwin Chaugule
Quoted 6 lines · Rafael J. Wysocki

Hi Ashwin,

Quoted 2 lines · Ashwin Chaugule

Hi Rafael,

[cut]

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Also I'm still unsure what the connection between _CST and CPPC is.

There isnt. But I'm missing where I've implied the dependency?

Quoted 8 lines
Quoted 6 lines

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Yes, please. That would be much less confusing.

Deja Vu. :)

When I let processor_driver and processor_idle compile on ARM64, I get a bunch of errors because processor_idle.c contains a lot of X86 specific defines. That is why I'd created the ACPI_CST option which we'd enable only on X86.

Quoted 4 lines

I'm not entirely sure what these enums and functions should default to, or what they should be on ARM specifically. Given that on ARM64 we're likely to use LPI as against CST, it seems the original approach is better. Thoughts?

Correct, I addressed this in my RFC posting[1] and wanted to get feedback from Rafael before proceeding. As I said in other email, I will try to rebase and repost that series ASAP.

Regards,
Sudeep

[1] https://lkml.org/lkml/2015/5/6/486

#18 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

In reply to Ashwin Chaugule

Hi,

Quoted 3 lines · Ashwin Chaugule
Quoted 2 lines · Ashwin Chaugule
Quoted 1 line · Rafael J. Wysocki

Hi Ashwin,

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

Can you please just send the new version of the $subject patch alone for now?

Attached below. (hope that worked.)

Quoted 3 lines

Also I'm still unsure what the connection between _CST and CPPC is.

Quoted 9 lines
Quoted 1 line

There isnt. But I'm missing where I've implied the dependency?

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Correct, I will handle it as a prerequisite for introducing _LPI support. I had posted an RFC long back, will revive those patches and repost them soon.

It's better to enable ACPI_PROCESSOR on ARM64 only after we have all these dependencies resolved. Until then we need to carry some patches locally for testing.

Regards,
Sudeep

#19 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Hi Sudeep,

Quoted 16 lines · Sudeep Holla

Hi,

Quoted 4 lines · Ashwin Chaugule
Quoted 1 line · Ashwin Chaugule
Quoted 8 lines
Quoted 1 line · Rafael J. Wysocki

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Quoted 7 lines

Correct, I will handle it as a prerequisite for introducing _LPI support. I had posted an RFC long back, will revive those patches and repost them soon.

It's better to enable ACPI_PROCESSOR on ARM64 only after we have all these dependencies resolved. Until then we need to carry some patches locally for testing.

With Rafaels latest suggestion of adding ACPI_PROCESSOR_IDLE, we dont need to wait until all dependencies are resolved to enable acpi_processor on ARM64. CPPC patchwork has been up for review for quite a long time and has been validated on hardware. There is no reason for it to be blocked until LPI is upstream ready.

Regards,
Ashwin.

#20 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Hi Ashwin.

Quoted 28 lines · Ashwin Chaugule

Hi Sudeep,

Quoted 16 lines · Sudeep Holla

Hi,

Quoted 4 lines · Ashwin Chaugule
Quoted 1 line · Ashwin Chaugule
Quoted 8 lines
Quoted 1 line · Rafael J. Wysocki

Perhaps the confusion is coming from the introduction of ACPI_CST in this file. I could leave it as it is and just separate out the ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST, since we know the LPI stuff is coming up soon as a CST alternative anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can address that as part of his LPI patchset?

Quoted 7 lines

Correct, I will handle it as a prerequisite for introducing _LPI support. I had posted an RFC long back, will revive those patches and repost them soon.

It's better to enable ACPI_PROCESSOR on ARM64 only after we have all these dependencies resolved. Until then we need to carry some patches locally for testing.

Quoted 6 lines

With Rafaels latest suggestion of adding ACPI_PROCESSOR_IDLE, we dont need to wait until all dependencies are resolved to enable acpi_processor on ARM64. CPPC patchwork has been up for review for quite a long time and has been validated on hardware. There is no reason for it to be blocked until LPI is upstream ready.

Agreed, by the way I didn't mean to block CPPC work. It can be merged when/if it's ready irrespective of _LPI support, what I meant is to enable ACPI_PROCESSOR on ARM64 when other dependencies are resolved rather than introducing just build fixes for time-being.

I think we still have one dependency for hotplug. I don't like the weak definitions introduced, but don't have a better solution either.

Regards,
Sudeep

#21 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

In reply to Ashwin Chaugule
Quoted 71 lines · Ashwin Chaugule
Quoted 70 lines · Rafael J. Wysocki
Quoted 56 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
  drivers/acpi/Kconfig            |  31 +++++++++--
  drivers/acpi/Makefile           |   7 ++-
  drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
  drivers/cpufreq/Kconfig         |   2 +-
  drivers/cpufreq/Kconfig.x86     |   2 +
  include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
  6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +8 -5
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
         This driver supports ACPI-controlled docking stations and removable
         drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
       depends on X86 || IA64
+     select CPU_IDLE
       default y
       help
         This driver installs ACPI as the idle handler for Linux and uses
         ACPI C2 and C3 processor states to save power on systems that
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"

drivers/acpi/Kconfig config ACPI_DOCK · line 191

Quoted 10 lines
drivers/acpi/Kconfig +9 -0
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU performance
+       using PSS methods as described in the ACPI spec. It also enables support
+       for ACPI based performance throttling (TSS) and ACPI based thermal
+       monitoring. It is required by several flavors of cpufreq
         performance-state drivers.

For starters, I don't like these new Kconfig options.

Quoted 5 lines
Quoted 1 line

Isn't there a way to implement what you need without adding them?

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue.

Ashwin, I am trying to keep Kconfig options minimum, iff necessary and selected by ARCH code(i.e. not user selectable). Also I am not entirely sure if we need to make PSS and CPPC mutually exclusive.

I had seen patches to support PSS on ARM and if we have to support single Image to handle both they can't be exclusive.

Regards,
Sudeep

#22 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Hi Sudeep,

Quoted 87 lines · Sudeep Holla
Quoted 84 lines · Ashwin Chaugule
Quoted 80 lines · Rafael J. Wysocki
Quoted 66 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
  drivers/acpi/Kconfig            |  31 +++++++++--
  drivers/acpi/Makefile           |   7 ++-
  drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
  drivers/cpufreq/Kconfig         |   2 +-
  drivers/cpufreq/Kconfig.x86     |   2 +
  include/acpi/processor.h        | 120
++++++++++++++++++++++++++++------------
  6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +0 -0
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
         This driver supports ACPI-controlled docking stations and

removable
drive bays such as the IBM Ultrabay and the Dell Module Bay.

drivers/acpi/Kconfig +4 -4
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
       depends on X86 || IA64
+     select CPU_IDLE
       default y
       help
         This driver installs ACPI as the idle handler for Linux and

uses
ACPI C2 and C3 processor states to save power on systems that

drivers/acpi/Kconfig +10 -1
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU
Quoted 7 lines

performance
+ using PSS methods as described in the ACPI spec. It also enables
support
+ for ACPI based performance throttling (TSS) and ACPI based
thermal
+ monitoring. It is required by several flavors of cpufreq
performance-state drivers.

For starters, I don't like these new Kconfig options.

Isn't there a way to implement what you need without adding them?

Quoted 8 lines
Quoted 3 lines

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue.

Ashwin, I am trying to keep Kconfig options minimum, iff necessary and selected by ARCH code(i.e. not user selectable). Also I am not entirely sure if we need to make PSS and CPPC mutually exclusive.

Agree. Moving this to ARCH does seem like a better option. I need to explore that some more. Per the ACPI spec, the OS is not expected to support PSS and CPPC at runtime. I want to avoid getting into whitelist/blacklist issues which would be inevitable if we keep both available at runtime. Some of the X86 drivers run into this already.

Quoted 3 lines

I had seen patches to support PSS on ARM and if we have to support single Image to handle both they can't be exclusive.

Theres been one attempt about 1.5 years ago and AFAIK those folks have completely backed out of the ARM64 Server space . ;) We can revisit when someone proposes a more recent solution for PSS on ARM64. It shouldn't be too hard to change the Kconfig dependencies accordingly.

Regards,
Ashwin.

#23 lore raw

Re: [PATCH v6 2/7] ACPI: Make ACPI processor driver more extensible

Quoted 99 lines · Ashwin Chaugule

Hi Sudeep,

Quoted 87 lines · Sudeep Holla
Quoted 84 lines · Ashwin Chaugule
Quoted 80 lines · Rafael J. Wysocki
Quoted 66 lines · Ashwin Chaugule

The ACPI processor driver is currently tied too closely to the ACPI C-states (CST), P-states (PSS) and other related constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces alternative methods to CST and PSS. These new mechanisms are described within each ACPI Processor object and so they need to be scanned whenever a new Processor object is detected. This patch introduces two new Kconfig symbols to allow for finer configurability among the various options for controlling CPU idle and performance states. There is no change in functionality and these options are defaulted to enabled to maintain previous behaviour.

The following patchwork introduces CPPC: A newer method of controlling CPU performance. The OS is not expected to support CPPC and PSS at runtime. So the kconfig option lets us make these two mutually exclusive at compile time.

---
   drivers/acpi/Kconfig            |  31 +++++++++--
   drivers/acpi/Makefile           |   7 ++-
   drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
   drivers/cpufreq/Kconfig         |   2 +-
   drivers/cpufreq/Kconfig.x86     |   2 +
   include/acpi/processor.h        | 120
++++++++++++++++++++++++++++------------
   6 files changed, 176 insertions(+), 72 deletions(-)
drivers/acpi/Kconfig +0 -0
index ab2cbb5..5942754 100644
@@ -166,18 +166,39 @@ config ACPI_DOCK
          This driver supports ACPI-controlled docking stations and

removable
drive bays such as the IBM Ultrabay and the Dell Module Bay.

drivers/acpi/Kconfig +4 -4
-config ACPI_PROCESSOR
-     tristate "Processor"
-     select THERMAL
-     select CPU_IDLE
+config ACPI_CST
+     bool "ACPI C states (CST) driver"
+     depends on ACPI_PROCESSOR
        depends on X86 || IA64
+     select CPU_IDLE
        default y
        help
          This driver installs ACPI as the idle handler for Linux and

uses
ACPI C2 and C3 processor states to save power on systems that

drivers/acpi/Kconfig +10 -1
-       support it.  It is required by several flavors of cpufreq
+       support it.
+
+config ACPI_PSS
+     bool "ACPI P States (PSS) driver"
+     depends on ACPI_PROCESSOR
+     depends on X86 || IA64
+     select THERMAL
+     default y
+     help
+       This driver implements ACPI methods for controlling CPU
Quoted 7 lines

performance
+ using PSS methods as described in the ACPI spec. It also enables
support
+ for ACPI based performance throttling (TSS) and ACPI based
thermal
+ monitoring. It is required by several flavors of cpufreq
performance-state drivers.

For starters, I don't like these new Kconfig options.

Isn't there a way to implement what you need without adding them?

Quoted 8 lines
Quoted 3 lines

We need to use the ACPI Processor driver for CPPC without including all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming LPI work from Sudeep will also face the same issue.

Ashwin, I am trying to keep Kconfig options minimum, iff necessary and selected by ARCH code(i.e. not user selectable). Also I am not entirely sure if we need to make PSS and CPPC mutually exclusive.

Quoted 6 lines

Agree. Moving this to ARCH does seem like a better option. I need to explore that some more. Per the ACPI spec, the OS is not expected to support PSS and CPPC at runtime. I want to avoid getting into whitelist/blacklist issues which would be inevitable if we keep both available at runtime. Some of the X86 drivers run into this already.

OK, but as you say, both still be enabled statically while only one of then should be active at run-time.

Quoted 9 lines
Quoted 3 lines

I had seen patches to support PSS on ARM and if we have to support single Image to handle both they can't be exclusive.

Theres been one attempt about 1.5 years ago and AFAIK those folks have completely backed out of the ARM64 Server space . ;) We can revisit when someone proposes a more recent solution for PSS on ARM64. It shouldn't be too hard to change the Kconfig dependencies accordingly.

While I too can only guess that they have backed off, since CPPC requires firmware, and if the hardware has PSS like interface, I can imagine vendors pushing for that for convenience, so I would not rule that out completely. But I agree as along as it can be changed easily, we can defer that until there's a real hardware.

Regards,
Sudeep

#24 lore raw

PATCH v6 3/7 ACPI: Introduce CPU performance controls using CPPC

In reply to 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.

---
 drivers/acpi/Kconfig     |  17 +
 drivers/acpi/Makefile    |   1 +
 drivers/acpi/cppc_acpi.c | 812 +++++++++++++++++++++++++++++++++++++++++++++++
 include/acpi/cppc_acpi.h | 137 ++++++++
 4 files changed, 967 insertions(+)
 create mode 100644 drivers/acpi/cppc_acpi.c
 create mode 100644 include/acpi/cppc_acpi.h
drivers/acpi/Kconfig +17 -0
index 5942754..937c7f0 100644
@@ -190,6 +190,23 @@ config ACPI_PSS
 	  monitoring. It is required by several flavors of cpufreq
 	  performance-state drivers.
 
+config ACPI_CPPC
+	bool "Common ACPI CPPC routines for CPU performance"
+	depends on ARM64 && ACPI_PROCESSOR
+	depends on !ACPI_PSS
+	select MAILBOX
+	select PCC
+	default n
+	help
+	  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.
+
+	  If in doubt, say N.
+
 config ACPI_PROCESSOR
 	tristate "Processor"
 	depends on X86 || IA64
drivers/acpi/Makefile +1 -0
index 30b2bfc..93ff805 100644
@@ -80,6 +80,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)		+= cppc_acpi.o
 
 # processor has its own "processor." module_param namespace
 processor-y			:= processor_driver.o
drivers/acpi/cppc_acpi.c new file +812 -0

812 lines not on this page · raw message

include/acpi/cppc_acpi.h new file +137 -0

137 lines not on this page · raw message

Signature · 1 line
1.9.1
#25 lore raw

PATCH v6 4/7 CPPC: Add a CPUFreq driver for use with CPPC

In reply to Ashwin Chaugule

This 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    |  16 ++++
 drivers/cpufreq/Makefile       |   2 +
 drivers/cpufreq/cppc_cpufreq.c | 197 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 215 insertions(+)
 create mode 100644 drivers/cpufreq/cppc_cpufreq.c
drivers/cpufreq/Kconfig.arm +16 -0
index 4f3dbc8..c45f389 100644
@@ -272,3 +272,19 @@ 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_CPPC
+	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
+	  for its operation.
+
+	  If in doubt, say N.
drivers/cpufreq/Makefile +2 -0
index cdce92a..ef3779b 100644
@@ -79,6 +79,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 +197 -0

197 lines not on this page · raw message

Signature · 1 line
1.9.1
#26 lore raw

PATCH v6 5/7 CPPC: Probe for CPPC tables for each ACPI Processor object

In reply to Ashwin Chaugule

For 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/Kconfig            | 2 +-
 drivers/acpi/processor_driver.c | 4 ++++
 include/acpi/processor.h        | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/acpi/Kconfig +1 -1
index 937c7f0..a600192 100644
@@ -209,7 +209,7 @@ config ACPI_CPPC
 
 config ACPI_PROCESSOR
 	tristate "Processor"
-	depends on X86 || IA64
+	depends on X86 || IA64 || ARM64
 	default y
 	help
 	  This driver adds support for the ACPI Processor package. It is required
drivers/acpi/processor_driver.c +4 -0
index 64aa638..ea9c93b 100644
@@ -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);
 
include/acpi/processor.h +9 -0
index b76d05b..c48684b 100644
@@ -328,6 +328,15 @@ 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
+extern int acpi_cppc_processor_probe(struct acpi_processor *pr);
+#else
+static inline int acpi_cppc_processor_probe(struct acpi_processor *pr)
+{
+	return 0;
+}
+#endif	/* CONFIG_ACPI_CPPC */
+
 /* in processor_pdc.c */
 void acpi_processor_set_pdc(acpi_handle handle);
 
Signature · 1 line
1.9.1
#27 lore raw

PATCH v6 6/7 PCC: Enable PCC only when needed

In reply to Ashwin Chaugule

CPPC is the first client to make use of the PCC Mailbox channel. So enable it only when CPPC is also enabled.

---
 drivers/mailbox/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/Kconfig +1 -1
index 84b0a2d..60c8da6 100644
@@ -45,7 +45,7 @@ config OMAP_MBOX_KFIFO_SIZE
 
 config PCC
 	bool "Platform Communication Channel Driver"
-	depends on ACPI
+	depends on ACPI && ACPI_CPPC
 	help
 	  ACPI 5.0+ spec defines a generic mode of communication
 	  between the OS and a platform such as the BMC. This medium
Signature · 1 line
1.9.1
#28 lore raw

PATCH v6 7/7 ACPI: Add weak routines for ACPI CPU Hotplug

In reply to Ashwin Chaugule

Add 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
index 58f335c..1fbf252 100644
@@ -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
#29 lore raw
In reply to Ashwin Chaugule

Hi Rafael,

Quoted 81 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.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 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/

Quoted 9 lines

Ashwin Chaugule (7):
PCC: Initialize PCC Mailbox earlier at boot
ACPI: Make ACPI processor driver more extensible
ACPI: Introduce CPU performance controls using CPPC
CPPC: Add a CPUFreq driver for use with CPPC
CPPC: Probe for CPPC tables for each ACPI Processor object
PCC: Enable PCC only when needed
ACPI: Add weak routines for ACPI CPU Hotplug

Any further comments/suggestions for these patches? Can they be picked up for merging in the next cycle?

Thanks,
Ashwin.