Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1275432 > unrolled thread
| Started by | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| First post | 2015-11-23 15:30 +0100 |
| Last post | 2015-11-30 11:00 +0100 |
| Articles | 9 — 3 participants |
Back to article view | Back to linux.kernel
[RFC PATCH 0/8] CPUs capacity information for heterogeneous systems Juri Lelli <juri.lelli@arm.com> - 2015-11-23 15:30 +0100
[RFC PATCH 4/8] arm, dts: add TC2 cpu capacity information Juri Lelli <juri.lelli@arm.com> - 2015-11-23 15:30 +0100
[RFC PATCH 6/8] arm64, dts: add Juno cpu capacity information Juri Lelli <juri.lelli@arm.com> - 2015-11-23 15:30 +0100
[RFC PATCH 3/8] arm: parse cpu capacity from DT Juri Lelli <juri.lelli@arm.com> - 2015-11-23 15:40 +0100
[RFC PATCH 8/8] arm64: add sysfs cpu_capacity attribute Juri Lelli <juri.lelli@arm.com> - 2015-11-23 15:40 +0100
[RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings Juri Lelli <juri.lelli@arm.com> - 2015-11-23 15:40 +0100
Re: [RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings Rob Herring <robh@kernel.org> - 2015-11-24 03:10 +0100
Re: [RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings Juri Lelli <juri.lelli@arm.com> - 2015-11-24 12:00 +0100
Re: [RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings Vincent Guittot <vincent.guittot@linaro.org> - 2015-11-30 11:00 +0100
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-11-23 15:30 +0100 |
| Subject | [RFC PATCH 0/8] CPUs capacity information for heterogeneous systems |
| Message-ID | <qy0hX-2Wb-3@gated-at.bofh.it> |
Hi all, ARM systems may be configured to have CPUs with different power/performance characteristics within the same chip. In this case, additional information has to be made available to the kernel (the scheduler in particular) for it to be aware of such differences and take decisions accordingly. This posting stems from the ongoing discussion about introducing a simple platform energy cost model to guide scheduling decisions (a.k.a Energy Aware Scheduling [1]), but also aims to be an independent track aimed to standardise the way we make the scheduler aware of heterogenous CPU systems. With these patches and in addition patches from [1] (that make the scheduler wakeup paths aware of heterogenous CPU systems) we enable the scheduler to have good default performance on such systems. In addition, we get a clearly defined way of providing the scheduler with needed information about CPU capacity on such systems. CPU capacity is defined in this context as a number that provides the scheduler information about CPUs heterogeneity. Such heterogeneity can come from micro-architectural differences (e.g., ARM big.LITTLE systems) or maximum frequency at which CPUs can run (e.g., SMP systems with multiple frequency domains and different max frequencies). Heterogeneity in this context is about differing performance characteristics; in practice, the binding that we propose in this RFC tries to capture a first-order approximation of the relative performance of CPUs. This RFC proposes a solution to the problem of how do we init CPUs original capacity. The way it works today, and for arm A15/A7 systems only, is that we rely on cpu_efficiency magic numbers from arch/arm/kernel/topology.c and the existence of clock-frequency dtb properties; having those values available, we then do some math to come up with capacities we know from measurement (e.g., EAS energy model), e.g. for TC2 they are 430 for A7 and 1024 for A15. Currently, arm64 doesn't have such a feature at all. With this patchset we provide CPUs capacity information either from DT or from sysfs interface. Such information is standardized for both arm and arm64. Patches high level description: o 01/08 cleans up how cpu_scale is initialized in arm o 02/08 introduces documentation for the new optional DT binding o [03-06]/08 add cpu-capacity attribute to TC2 and Juno DTs and provide parsing of such information at boot time o [07-08]/08 introduce sysfs attribute The patchset is based on top of tip/sched/core as of today. In case you would like to test this out, I pushed a branch here: git://linux-arm.org/linux-jl.git upstream/default_caps_dt This branch contains additional patches, useful to better understand how CPU capacity information is actually used by the scheduler. Discussion regarding these additional patches will be started with a different posting in the future. We just didn't want to make discussion too broad, as we realize that this set can be controversial already on its own. Comments, concerns and rants are more than welcome! Best, - Juri Juri Lelli (8): ARM: initialize cpu_scale to its default Documentation: arm: define DT cpu capacity bindings arm: parse cpu capacity from DT arm, dts: add TC2 cpu capacity information arm64: parse cpu capacity from DT arm64, dts: add Juno cpu capacity information arm: add sysfs cpu_capacity attribute arm64: add sysfs cpu_capacity attribute .../devicetree/bindings/arm/cpu-capacity.txt | 227 +++++++++++++++++++++ Documentation/devicetree/bindings/arm/cpus.txt | 17 ++ arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 6 + arch/arm/kernel/topology.c | 122 ++++++++++- arch/arm64/boot/dts/arm/juno.dts | 7 + arch/arm64/kernel/topology.c | 114 +++++++++++ 6 files changed, 489 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/cpu-capacity.txt -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-11-23 15:30 +0100 |
| Subject | [RFC PATCH 4/8] arm, dts: add TC2 cpu capacity information |
| Message-ID | <qy0hY-2Wb-31@gated-at.bofh.it> |
| In reply to | #1275432 |
Add TC2 cpu capacity binding information.
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: devicetree@vger.kernel.org
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index 17f63f7..4596481 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -32,6 +32,7 @@
cpus {
#address-cells = <1>;
#size-cells = <0>;
+ capacity-scale = <1024>;
cpu0: cpu@0 {
device_type = "cpu";
@@ -39,6 +40,7 @@
reg = <0>;
cci-control-port = <&cci_control1>;
cpu-idle-states = <&CLUSTER_SLEEP_BIG>;
+ capacity = <1024>;
};
cpu1: cpu@1 {
@@ -47,6 +49,7 @@
reg = <1>;
cci-control-port = <&cci_control1>;
cpu-idle-states = <&CLUSTER_SLEEP_BIG>;
+ capacity = <1024>;
};
cpu2: cpu@2 {
@@ -55,6 +58,7 @@
reg = <0x100>;
cci-control-port = <&cci_control2>;
cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>;
+ capacity = <430>;
};
cpu3: cpu@3 {
@@ -63,6 +67,7 @@
reg = <0x101>;
cci-control-port = <&cci_control2>;
cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>;
+ capacity = <430>;
};
cpu4: cpu@4 {
@@ -71,6 +76,7 @@
reg = <0x102>;
cci-control-port = <&cci_control2>;
cpu-idle-states = <&CLUSTER_SLEEP_LITTLE>;
+ capacity = <430>;
};
idle-states {
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-11-23 15:30 +0100 |
| Subject | [RFC PATCH 6/8] arm64, dts: add Juno cpu capacity information |
| Message-ID | <qy0hY-2Wb-33@gated-at.bofh.it> |
| In reply to | #1275432 |
Add Juno cpu capacity bindings information.
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jon Medhurst <tixy@linaro.org>
Cc: Olof Johansson <olof@lixom.net>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm64/boot/dts/arm/juno.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/arm/juno.dts b/arch/arm64/boot/dts/arm/juno.dts
index d7cbdd4..06f6d2b 100644
--- a/arch/arm64/boot/dts/arm/juno.dts
+++ b/arch/arm64/boot/dts/arm/juno.dts
@@ -33,6 +33,7 @@
cpus {
#address-cells = <2>;
#size-cells = <0>;
+ capacity-scale = <1024>;
A57_0: cpu@0 {
compatible = "arm,cortex-a57","arm,armv8";
@@ -40,6 +41,7 @@
device_type = "cpu";
enable-method = "psci";
next-level-cache = <&A57_L2>;
+ capacity = <1024>;
};
A57_1: cpu@1 {
@@ -48,6 +50,7 @@
device_type = "cpu";
enable-method = "psci";
next-level-cache = <&A57_L2>;
+ capacity = <1024>;
};
A53_0: cpu@100 {
@@ -56,6 +59,7 @@
device_type = "cpu";
enable-method = "psci";
next-level-cache = <&A53_L2>;
+ capacity = <447>;
};
A53_1: cpu@101 {
@@ -64,6 +68,7 @@
device_type = "cpu";
enable-method = "psci";
next-level-cache = <&A53_L2>;
+ capacity = <447>;
};
A53_2: cpu@102 {
@@ -72,6 +77,7 @@
device_type = "cpu";
enable-method = "psci";
next-level-cache = <&A53_L2>;
+ capacity = <447>;
};
A53_3: cpu@103 {
@@ -80,6 +86,7 @@
device_type = "cpu";
enable-method = "psci";
next-level-cache = <&A53_L2>;
+ capacity = <447>;
};
A57_L2: l2-cache0 {
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-11-23 15:40 +0100 |
| Subject | [RFC PATCH 3/8] arm: parse cpu capacity from DT |
| Message-ID | <qy0rD-30z-9@gated-at.bofh.it> |
| In reply to | #1275432 |
With the introduction of cpu capacity bindings, CPU capacities can now be
extracted from DT. Add parsing of such information at boot time. We keep
code that can produce same information, based on different DT properties
and hard-coded values, as fall-back for backward compatibility.
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm/kernel/topology.c | 50 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index ec279d1..ecbff03 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -78,6 +78,35 @@ static unsigned long *__cpu_capacity;
#define cpu_capacity(cpu) __cpu_capacity[cpu]
static unsigned long middle_capacity = 1;
+static bool capacity_from_dt = true;
+static u32 capacity_scale = SCHED_CAPACITY_SCALE;
+
+static int __init parse_cpu_capacity(struct device_node *cpu_node, int cpu)
+{
+ int ret = 1;
+ u32 cpu_capacity;
+
+ ret = of_property_read_u32(cpu_node,
+ "capacity",
+ &cpu_capacity);
+ if (!ret) {
+ u64 capacity;
+
+ /*
+ * Enforce capacity <= capacity-scale.
+ */
+ cpu_capacity = cpu_capacity <= capacity_scale ? cpu_capacity :
+ capacity_scale;
+ capacity = (cpu_capacity << SCHED_CAPACITY_SHIFT) /
+ capacity_scale;
+
+ set_capacity_scale(cpu, capacity);
+ pr_info("CPU%d: DT cpu capacity %lu\n",
+ cpu, arch_scale_cpu_capacity(NULL, cpu));
+ }
+
+ return !ret;
+}
/*
* Iterate all CPUs' descriptor in DT and compute the efficiency
@@ -99,6 +128,18 @@ static void __init parse_dt_topology(void)
__cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity),
GFP_NOWAIT);
+ cn = of_find_node_by_path("/cpus");
+ if (!cn) {
+ pr_err("No CPU information found in DT\n");
+ return;
+ }
+
+ if (!of_property_read_u32(cn, "capacity-scale", &capacity_scale))
+ pr_info("DT cpus capacity-scale %u\n", capacity_scale);
+ else
+ pr_debug("DT cpus capacity-scale not found: assuming %u\n",
+ capacity_scale);
+
for_each_possible_cpu(cpu) {
const u32 *rate;
int len;
@@ -110,6 +151,13 @@ static void __init parse_dt_topology(void)
continue;
}
+ if (parse_cpu_capacity(cn, cpu)) {
+ of_node_put(cn);
+ continue;
+ }
+
+ capacity_from_dt = false;
+
for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++)
if (of_device_is_compatible(cn, cpu_eff->compatible))
break;
@@ -160,7 +208,7 @@ static void __init parse_dt_topology(void)
*/
static void update_cpu_capacity(unsigned int cpu)
{
- if (!cpu_capacity(cpu))
+ if (!cpu_capacity(cpu) || capacity_from_dt)
return;
set_capacity_scale(cpu, cpu_capacity(cpu) / middle_capacity);
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-11-23 15:40 +0100 |
| Subject | [RFC PATCH 8/8] arm64: add sysfs cpu_capacity attribute |
| Message-ID | <qy0rE-30z-17@gated-at.bofh.it> |
| In reply to | #1275432 |
Add a sysfs cpu_capacity attribute with which it is possible to read and
write (thus over-writing default values) CPUs capacity. This might be
useful in situation where there is no way to get proper default values
at boot time.
The new attribute shows up as:
/sys/devices/system/cpu/cpu*/cpu_capacity
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Brown <broonie@linaro.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
arch/arm64/kernel/topology.c | 68 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index 4423cc5..5c9e477 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -35,6 +35,74 @@ static void set_capacity_scale(unsigned int cpu, unsigned long capacity)
per_cpu(cpu_scale, cpu) = capacity;
}
+#ifdef CONFIG_PROC_SYSCTL
+#include <asm/cpu.h>
+#include <linux/string.h>
+static ssize_t show_cpu_capacity(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct cpu *cpu = container_of(dev, struct cpu, dev);
+ ssize_t rc;
+ int cpunum = cpu->dev.id;
+ unsigned long capacity = arch_scale_cpu_capacity(NULL, cpunum);
+
+ rc = sprintf(buf, "%lu\n", capacity);
+
+ return rc;
+}
+
+static ssize_t store_cpu_capacity(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
+{
+ struct cpu *cpu = container_of(dev, struct cpu, dev);
+ int this_cpu = cpu->dev.id, i;
+ unsigned long new_capacity;
+ ssize_t ret;
+
+ if (count) {
+ char *p = (char *) buf;
+
+ ret = kstrtoul(p, 0, &new_capacity);
+ if (ret)
+ return ret;
+ if (new_capacity > SCHED_CAPACITY_SCALE)
+ return -EINVAL;
+
+ for_each_cpu(i, &cpu_topology[this_cpu].core_sibling)
+ set_capacity_scale(i, new_capacity);
+ }
+
+ return count;
+}
+
+static DEVICE_ATTR(cpu_capacity,
+ 0644,
+ show_cpu_capacity,
+ store_cpu_capacity);
+
+static int register_cpu_capacity_sysctl(void)
+{
+ int i;
+ struct device *cpu;
+
+ for_each_possible_cpu(i) {
+ cpu = get_cpu_device(i);
+ if (!cpu) {
+ pr_err("%s: too early to get CPU%d device!\n",
+ __func__, i);
+ continue;
+ }
+ device_create_file(cpu, &dev_attr_cpu_capacity);
+ }
+
+ return 0;
+}
+late_initcall(register_cpu_capacity_sysctl);
+#endif
+
static u32 capacity_scale = SCHED_CAPACITY_SCALE;
static void __init parse_cpu_capacity(struct device_node *cpu_node, int cpu)
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-11-23 15:40 +0100 |
| Subject | [RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings |
| Message-ID | <qy0rE-30z-15@gated-at.bofh.it> |
| In reply to | #1275432 |
ARM systems may be configured to have cpus with different power/performance
characteristics within the same chip. In this case, additional information
has to be made available to the kernel (the scheduler in particular) for it
to be aware of such differences and take decisions accordingly.
Therefore, this patch aims at standardizing cpu capacities device tree
bindings for ARM platforms. Bindings define cpu capacity parameter, to
allow operating systems to retrieve such information from the device tree
and initialize related kernel structures, paving the way for common code in
the kernel to deal with heterogeneity.
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Olof Johansson <olof@lixom.net>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
.../devicetree/bindings/arm/cpu-capacity.txt | 227 +++++++++++++++++++++
Documentation/devicetree/bindings/arm/cpus.txt | 17 ++
2 files changed, 244 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/cpu-capacity.txt
diff --git a/Documentation/devicetree/bindings/arm/cpu-capacity.txt b/Documentation/devicetree/bindings/arm/cpu-capacity.txt
new file mode 100644
index 0000000..2a00af0
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/cpu-capacity.txt
@@ -0,0 +1,227 @@
+==========================================
+ARM CPUs capacity bindings
+==========================================
+
+==========================================
+1 - Introduction
+==========================================
+
+ARM systems may be configured to have cpus with different power/performance
+characteristics within the same chip. In this case, additional information
+has to be made available to the kernel (the scheduler in particular) for
+it to be aware of such differences and take decisions accordingly.
+
+==========================================
+2 - CPU capacity definition
+==========================================
+
+CPU capacity is a number that provides the scheduler information about CPUs
+heterogeneity. Such heterogeneity can come from micro-architectural differences
+(e.g., ARM big.LITTLE systems) or maximum frequency at which CPUs can run
+(e.g., SMP systems with multiple frequency domains). Heterogeneity in this
+context is about differing performance characteristics; this binding tries to
+capture a first-order approximation of the relative performance of CPUs.
+
+One simple way to estimate CPU capacities is to iteratively run a well-known
+CPU user space benchmark (e.g, sysbench, dhrystone, etc.) on each CPU at
+maximum frequency and then normalize values w.r.t. the best performing CPU.
+One can also do a statistically significant study of a wide collection of
+benchmarks, but pros of such an approach are not really evident at the time of
+writing.
+
+==========================================
+3 - capacity-scale
+==========================================
+
+CPUs capacities are defined with respect to capacity-scale property in the cpus
+node [1]. The property is optional; if not defined a 1024 capacity-scale is
+assumed. This property defines both the highest CPU capacity present in the
+system and granularity of CPU capacity values.
+
+==========================================
+4 - capacity
+==========================================
+
+capacity is an optional cpu node [1] property: u32 value representing CPU
+capacity, relative to capacity-scale. It is required and enforced that capacity
+<= capacity-scale.
+
+===========================================
+5 - Examples
+===========================================
+
+Example 1 (ARM 64-bit, 6-cpu system, two clusters):
+capacity-scale is not defined, so it is assumed to be 1024
+
+cpus {
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ cpu-map {
+ cluster0 {
+ core0 {
+ cpu = <&A57_0>;
+ };
+ core1 {
+ cpu = <&A57_1>;
+ };
+ };
+
+ cluster1 {
+ core0 {
+ cpu = <&A53_0>;
+ };
+ core1 {
+ cpu = <&A53_1>;
+ };
+ core2 {
+ cpu = <&A53_2>;
+ };
+ core3 {
+ cpu = <&A53_3>;
+ };
+ };
+ };
+
+ idle-states {
+ entry-method = "arm,psci";
+
+ CPU_SLEEP_0: cpu-sleep-0 {
+ compatible = "arm,idle-state";
+ arm,psci-suspend-param = <0x0010000>;
+ local-timer-stop;
+ entry-latency-us = <100>;
+ exit-latency-us = <250>;
+ min-residency-us = <150>;
+ };
+
+ CLUSTER_SLEEP_0: cluster-sleep-0 {
+ compatible = "arm,idle-state";
+ arm,psci-suspend-param = <0x1010000>;
+ local-timer-stop;
+ entry-latency-us = <800>;
+ exit-latency-us = <700>;
+ min-residency-us = <2500>;
+ };
+ };
+
+ A57_0: cpu@0 {
+ compatible = "arm,cortex-a57","arm,armv8";
+ reg = <0x0 0x0>;
+ device_type = "cpu";
+ enable-method = "psci";
+ next-level-cache = <&A57_L2>;
+ clocks = <&scpi_dvfs 0>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity = <1024>;
+ };
+
+ A57_1: cpu@1 {
+ compatible = "arm,cortex-a57","arm,armv8";
+ reg = <0x0 0x1>;
+ device_type = "cpu";
+ enable-method = "psci";
+ next-level-cache = <&A57_L2>;
+ clocks = <&scpi_dvfs 0>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity = <1024>;
+ };
+
+ A53_0: cpu@100 {
+ compatible = "arm,cortex-a53","arm,armv8";
+ reg = <0x0 0x100>;
+ device_type = "cpu";
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ clocks = <&scpi_dvfs 1>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity = <447>;
+ };
+
+ A53_1: cpu@101 {
+ compatible = "arm,cortex-a53","arm,armv8";
+ reg = <0x0 0x101>;
+ device_type = "cpu";
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ clocks = <&scpi_dvfs 1>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity = <447>;
+ };
+
+ A53_2: cpu@102 {
+ compatible = "arm,cortex-a53","arm,armv8";
+ reg = <0x0 0x102>;
+ device_type = "cpu";
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ clocks = <&scpi_dvfs 1>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity = <447>;
+ };
+
+ A53_3: cpu@103 {
+ compatible = "arm,cortex-a53","arm,armv8";
+ reg = <0x0 0x103>;
+ device_type = "cpu";
+ enable-method = "psci";
+ next-level-cache = <&A53_L2>;
+ clocks = <&scpi_dvfs 1>;
+ cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>;
+ capacity = <447>;
+ };
+
+ A57_L2: l2-cache0 {
+ compatible = "cache";
+ };
+
+ A53_L2: l2-cache1 {
+ compatible = "cache";
+ };
+};
+
+Example 2 (ARM 32-bit, 4-cpu system, two clusters,
+ cpus 0,1@1GHz, cpus 2,3@500MHz):
+capacity-scale is equal to 2, so first cluster is twice faster than second
+cluster (which matches with clock frequencies)
+
+cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ capacity-scale = <2>;
+
+ cpu0: cpu@0 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a15";
+ reg = <0>;
+ capacity = <2>;
+ };
+
+ cpu1: cpu@1 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a15";
+ reg = <1>;
+ capacity = <2>;
+ };
+
+ cpu2: cpu@2 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a15";
+ reg = <0x100>;
+ capacity = <1>;
+ };
+
+ cpu3: cpu@3 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a15";
+ reg = <0x101>;
+ capacity = <1>;
+ };
+};
+
+===========================================
+6 - References
+===========================================
+
+[1] ARM Linux Kernel documentation - CPUs bindings
+ Documentation/devicetree/bindings/arm/cpus.txt
diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index 91e6e5c..7593584 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -62,6 +62,14 @@ nodes to be present and contain the properties described below.
Value type: <u32>
Definition: must be set to 0
+ A cpus node may also define the following optional property:
+
+ - capacity-scale
+ Usage: optional
+ Value type: <u32>
+ Definition: value used as a reference for CPU capacity [3]
+ (see below).
+
- cpu node
Description: Describes a CPU in an ARM based system
@@ -231,6 +239,13 @@ nodes to be present and contain the properties described below.
# List of phandles to idle state nodes supported
by this cpu [3].
+ - capacity
+ Usage: Optional
+ Value type: <u32>
+ Definition:
+ # u32 value representing CPU capacity [3], relative to
+ capacity-scale (see above).
+
- rockchip,pmu
Usage: optional for systems that have an "enable-method"
property value of "rockchip,rk3066-smp"
@@ -437,3 +452,5 @@ cpus {
[2] arm/msm/qcom,kpss-acc.txt
[3] ARM Linux kernel documentation - idle states bindings
Documentation/devicetree/bindings/arm/idle-states.txt
+[3] ARM Linux kernel documentation - cpu capacity bindings
+ Documentation/devicetree/bindings/arm/cpu-capacity.txt
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2015-11-24 03:10 +0100 |
| Subject | Re: [RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings |
| Message-ID | <qybdn-1Lp-3@gated-at.bofh.it> |
| In reply to | #1275442 |
On Mon, Nov 23, 2015 at 02:28:35PM +0000, Juri Lelli wrote: > ARM systems may be configured to have cpus with different power/performance > characteristics within the same chip. In this case, additional information > has to be made available to the kernel (the scheduler in particular) for it > to be aware of such differences and take decisions accordingly. > > Therefore, this patch aims at standardizing cpu capacities device tree > bindings for ARM platforms. Bindings define cpu capacity parameter, to > allow operating systems to retrieve such information from the device tree > and initialize related kernel structures, paving the way for common code in > the kernel to deal with heterogeneity. > > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Pawel Moll <pawel.moll@arm.com> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: Ian Campbell <ijc+devicetree@hellion.org.uk> > Cc: Kumar Gala <galak@codeaurora.org> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > Cc: Olof Johansson <olof@lixom.net> > Cc: Gregory CLEMENT <gregory.clement@free-electrons.com> > Cc: Paul Walmsley <paul@pwsan.com> > Cc: Linus Walleij <linus.walleij@linaro.org> > Cc: Chen-Yu Tsai <wens@csie.org> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> > Cc: devicetree@vger.kernel.org > Signed-off-by: Juri Lelli <juri.lelli@arm.com> > --- > .../devicetree/bindings/arm/cpu-capacity.txt | 227 +++++++++++++++++++++ > Documentation/devicetree/bindings/arm/cpus.txt | 17 ++ > 2 files changed, 244 insertions(+) > create mode 100644 Documentation/devicetree/bindings/arm/cpu-capacity.txt > > diff --git a/Documentation/devicetree/bindings/arm/cpu-capacity.txt b/Documentation/devicetree/bindings/arm/cpu-capacity.txt > new file mode 100644 > index 0000000..2a00af0 > --- /dev/null > +++ b/Documentation/devicetree/bindings/arm/cpu-capacity.txt > @@ -0,0 +1,227 @@ > +========================================== > +ARM CPUs capacity bindings > +========================================== > + > +========================================== > +1 - Introduction > +========================================== > + > +ARM systems may be configured to have cpus with different power/performance > +characteristics within the same chip. In this case, additional information > +has to be made available to the kernel (the scheduler in particular) for > +it to be aware of such differences and take decisions accordingly. > + > +========================================== > +2 - CPU capacity definition > +========================================== > + > +CPU capacity is a number that provides the scheduler information about CPUs > +heterogeneity. Such heterogeneity can come from micro-architectural differences > +(e.g., ARM big.LITTLE systems) or maximum frequency at which CPUs can run > +(e.g., SMP systems with multiple frequency domains). Heterogeneity in this > +context is about differing performance characteristics; this binding tries to > +capture a first-order approximation of the relative performance of CPUs. > + > +One simple way to estimate CPU capacities is to iteratively run a well-known > +CPU user space benchmark (e.g, sysbench, dhrystone, etc.) on each CPU at > +maximum frequency and then normalize values w.r.t. the best performing CPU. > +One can also do a statistically significant study of a wide collection of > +benchmarks, but pros of such an approach are not really evident at the time of > +writing. > + > +========================================== > +3 - capacity-scale > +========================================== > + > +CPUs capacities are defined with respect to capacity-scale property in the cpus > +node [1]. The property is optional; if not defined a 1024 capacity-scale is > +assumed. This property defines both the highest CPU capacity present in the > +system and granularity of CPU capacity values. I don't really see the point of this vs. having an absolute scale. > + > +========================================== > +4 - capacity > +========================================== > + > +capacity is an optional cpu node [1] property: u32 value representing CPU > +capacity, relative to capacity-scale. It is required and enforced that capacity > +<= capacity-scale. I think you need something absolute and probably per MHz (like dynamic-power-coefficient property). Perhaps the IPC (instructions per clock) value? In other words, I want to see these numbers have a defined method of determining them and don't want to see random values from every vendor. ARM, Ltd. says core X has a value of Y would be good enough for me. Vendor X's A57 having a value of 2 and Vendor Y's A57 having a value of 1024 is not what I want to see. Of course things like cache sizes can vary the performance, but is a baseline value good enough? However, no vendor will want to publish their values if these are absolute values relative to other vendors. If you expect these to need frequent tuning, then don't put them in DT. Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2015-11-24 12:00 +0100 |
| Subject | Re: [RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings |
| Message-ID | <qyjui-72V-5@gated-at.bofh.it> |
| In reply to | #1276016 |
Hi, On 23/11/15 20:06, Rob Herring wrote: > On Mon, Nov 23, 2015 at 02:28:35PM +0000, Juri Lelli wrote: > > ARM systems may be configured to have cpus with different power/performance > > characteristics within the same chip. In this case, additional information > > has to be made available to the kernel (the scheduler in particular) for it > > to be aware of such differences and take decisions accordingly. > > > > Therefore, this patch aims at standardizing cpu capacities device tree > > bindings for ARM platforms. Bindings define cpu capacity parameter, to > > allow operating systems to retrieve such information from the device tree > > and initialize related kernel structures, paving the way for common code in > > the kernel to deal with heterogeneity. > > > > Cc: Rob Herring <robh+dt@kernel.org> > > Cc: Pawel Moll <pawel.moll@arm.com> > > Cc: Mark Rutland <mark.rutland@arm.com> > > Cc: Ian Campbell <ijc+devicetree@hellion.org.uk> > > Cc: Kumar Gala <galak@codeaurora.org> > > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > > Cc: Olof Johansson <olof@lixom.net> > > Cc: Gregory CLEMENT <gregory.clement@free-electrons.com> > > Cc: Paul Walmsley <paul@pwsan.com> > > Cc: Linus Walleij <linus.walleij@linaro.org> > > Cc: Chen-Yu Tsai <wens@csie.org> > > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> > > Cc: devicetree@vger.kernel.org > > Signed-off-by: Juri Lelli <juri.lelli@arm.com> > > --- > > .../devicetree/bindings/arm/cpu-capacity.txt | 227 +++++++++++++++++++++ > > Documentation/devicetree/bindings/arm/cpus.txt | 17 ++ > > 2 files changed, 244 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/arm/cpu-capacity.txt > > > > diff --git a/Documentation/devicetree/bindings/arm/cpu-capacity.txt b/Documentation/devicetree/bindings/arm/cpu-capacity.txt > > new file mode 100644 > > index 0000000..2a00af0 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/arm/cpu-capacity.txt > > @@ -0,0 +1,227 @@ > > +========================================== > > +ARM CPUs capacity bindings > > +========================================== > > + > > +========================================== > > +1 - Introduction > > +========================================== > > + > > +ARM systems may be configured to have cpus with different power/performance > > +characteristics within the same chip. In this case, additional information > > +has to be made available to the kernel (the scheduler in particular) for > > +it to be aware of such differences and take decisions accordingly. > > + > > +========================================== > > +2 - CPU capacity definition > > +========================================== > > + > > +CPU capacity is a number that provides the scheduler information about CPUs > > +heterogeneity. Such heterogeneity can come from micro-architectural differences > > +(e.g., ARM big.LITTLE systems) or maximum frequency at which CPUs can run > > +(e.g., SMP systems with multiple frequency domains). Heterogeneity in this > > +context is about differing performance characteristics; this binding tries to > > +capture a first-order approximation of the relative performance of CPUs. > > + > > +One simple way to estimate CPU capacities is to iteratively run a well-known > > +CPU user space benchmark (e.g, sysbench, dhrystone, etc.) on each CPU at > > +maximum frequency and then normalize values w.r.t. the best performing CPU. > > +One can also do a statistically significant study of a wide collection of > > +benchmarks, but pros of such an approach are not really evident at the time of > > +writing. > > + > > +========================================== > > +3 - capacity-scale > > +========================================== > > + > > +CPUs capacities are defined with respect to capacity-scale property in the cpus > > +node [1]. The property is optional; if not defined a 1024 capacity-scale is > > +assumed. This property defines both the highest CPU capacity present in the > > +system and granularity of CPU capacity values. > > I don't really see the point of this vs. having an absolute scale. > IMHO, we need this for several reasons, one being to address one of your concerns below: vendors are free to choose their scale without being forced to publish absolute data. Another reason is that it might make life easier in certain cases; for example, someone could implement a system with a few clusters of, say, A57s, but some run at half the clock of the others (e.g., you have a 1.2GHz cluster and a 600MHz cluster); in this case I think it is just easier to define capacity-scale as 1200 and capacities as 1200 and 600. Last reason that I can think of right now is that we don't probably want to bound ourself to some particular range from the beginning, as that range might be enough now, but it could change in the future (as in, right now [1-1024] looks fine for scheduling purposes, but that might change). > > + > > +========================================== > > +4 - capacity > > +========================================== > > + > > +capacity is an optional cpu node [1] property: u32 value representing CPU > > +capacity, relative to capacity-scale. It is required and enforced that capacity > > +<= capacity-scale. > > I think you need something absolute and probably per MHz (like > dynamic-power-coefficient property). Perhaps the IPC (instructions per > clock) value? > > In other words, I want to see these numbers have a defined method > of determining them and don't want to see random values from every > vendor. ARM, Ltd. says core X has a value of Y would be good enough for > me. Vendor X's A57 having a value of 2 and Vendor Y's A57 having a > value of 1024 is not what I want to see. Of course things like cache > sizes can vary the performance, but is a baseline value good enough? > A standard reference baseline is what we advocate with this set, but making this baseline work for every vendor's implementation is hardly achievable, IMHO. I don't think we can come up with any number that applies to each and every implementation; you can have different revisions of the same core and vendors might make implementation choices that end up with different peak performance. > However, no vendor will want to publish their values if these are > absolute values relative to other vendors. > Right. That is why I think we need to abstract numbers, as we do with capacity-scale. > If you expect these to need frequent tuning, then don't put them in DT. > I expect that it is possible to come up with a sensible baseline number for a specific platform implementation, so there is value in standardizing how we specify this value and how it is then consumed. Finer grained tuning might then happen both offline (with changes to the mainline DT) and online (using the sysfs interface), but that should only apply to a narrow set of use cases. Thanks, - Juri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Vincent Guittot <vincent.guittot@linaro.org> |
|---|---|
| Date | 2015-11-30 11:00 +0100 |
| Subject | Re: [RFC PATCH 2/8] Documentation: arm: define DT cpu capacity bindings |
| Message-ID | <qAtpx-1UE-23@gated-at.bofh.it> |
| In reply to | #1276315 |
Hi Juri, On 24 November 2015 at 11:54, Juri Lelli <juri.lelli@arm.com> wrote: > Hi, > > On 23/11/15 20:06, Rob Herring wrote: >> On Mon, Nov 23, 2015 at 02:28:35PM +0000, Juri Lelli wrote: >> > ARM systems may be configured to have cpus with different power/performance >> > characteristics within the same chip. In this case, additional information >> > has to be made available to the kernel (the scheduler in particular) for it >> > to be aware of such differences and take decisions accordingly. >> > [snip] >> > +========================================== >> > +2 - CPU capacity definition >> > +========================================== >> > + >> > +CPU capacity is a number that provides the scheduler information about CPUs >> > +heterogeneity. Such heterogeneity can come from micro-architectural differences >> > +(e.g., ARM big.LITTLE systems) or maximum frequency at which CPUs can run >> > +(e.g., SMP systems with multiple frequency domains). Heterogeneity in this >> > +context is about differing performance characteristics; this binding tries to >> > +capture a first-order approximation of the relative performance of CPUs. >> > + >> > +One simple way to estimate CPU capacities is to iteratively run a well-known >> > +CPU user space benchmark (e.g, sysbench, dhrystone, etc.) on each CPU at >> > +maximum frequency and then normalize values w.r.t. the best performing CPU. >> > +One can also do a statistically significant study of a wide collection of >> > +benchmarks, but pros of such an approach are not really evident at the time of >> > +writing. >> > + >> > +========================================== >> > +3 - capacity-scale >> > +========================================== >> > + >> > +CPUs capacities are defined with respect to capacity-scale property in the cpus >> > +node [1]. The property is optional; if not defined a 1024 capacity-scale is >> > +assumed. This property defines both the highest CPU capacity present in the >> > +system and granularity of CPU capacity values. >> >> I don't really see the point of this vs. having an absolute scale. >> > > IMHO, we need this for several reasons, one being to address one of your > concerns below: vendors are free to choose their scale without being > forced to publish absolute data. Another reason is that it might make > life easier in certain cases; for example, someone could implement a > system with a few clusters of, say, A57s, but some run at half the clock > of the others (e.g., you have a 1.2GHz cluster and a 600MHz cluster); in > this case I think it is just easier to define capacity-scale as 1200 and > capacities as 1200 and 600. Last reason that I can think of right now is > that we don't probably want to bound ourself to some particular range > from the beginning, as that range might be enough now, but it could > change in the future (as in, right now [1-1024] looks fine for > scheduling purposes, but that might change). Like Rob, i don't really see the benefit of this optional capacity-scale property. Parsing the capacity of all cpu nodes should give you a range as well. IMHO, this property looks like an optimization of the code that will parse the dt more than a HW description > >> > + >> > +========================================== >> > +4 - capacity >> > +========================================== >> > + >> > +capacity is an optional cpu node [1] property: u32 value representing CPU >> > +capacity, relative to capacity-scale. It is required and enforced that capacity >> > +<= capacity-scale. >> >> I think you need something absolute and probably per MHz (like >> dynamic-power-coefficient property). Perhaps the IPC (instructions per >> clock) value? >> >> In other words, I want to see these numbers have a defined method >> of determining them and don't want to see random values from every >> vendor. ARM, Ltd. says core X has a value of Y would be good enough for >> me. Vendor X's A57 having a value of 2 and Vendor Y's A57 having a >> value of 1024 is not what I want to see. Of course things like cache >> sizes can vary the performance, but is a baseline value good enough? >> > > A standard reference baseline is what we advocate with this set, but > making this baseline work for every vendor's implementation is hardly > achievable, IMHO. I don't think we can come up with any number that > applies to each and every implementation; you can have different > revisions of the same core and vendors might make implementation choices > that end up with different peak performance. > >> However, no vendor will want to publish their values if these are >> absolute values relative to other vendors. >> > > Right. That is why I think we need to abstract numbers, as we do with > capacity-scale. > >> If you expect these to need frequent tuning, then don't put them in DT. >> > > I expect that it is possible to come up with a sensible baseline number > for a specific platform implementation, so there is value in > standardizing how we specify this value and how it is then consumed. > Finer grained tuning might then happen both offline (with changes to the > mainline DT) and online (using the sysfs interface), but that should > only apply to a narrow set of use cases. > > Thanks, > > - Juri -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web