* [PATCH v4 0/2] arm64/PPTT ACPI 6.3 thread flag support
@ 2019-08-01 3:46 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 3:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-acpi, catalin.marinas, will, rjw, lenb, lorenzo.pieralisi,
sudeep.holla, Jeremy Linton
ACPI 6.3 adds a flag to the CPU node to indicate whether
the given CPU is a thread. Add a function to return that
information for a given linux logical CPU and then utilize
it while building the arm64 topology.
v3->v4: Remove table revision cache as this code path is only
called during boot and there aren't any
indications that it presents a perf issue.
Rebase to 5.3
v2->v3: Clarify and tweak the return from check_acpi_cpu_flag()
Cache the PPTT table revision to avoid repeat
acpi_table_get/put calls in the case of
missing or old PPTT tables.
v1->v2:
Return ENOENT instead on ENONET.
Jeremy Linton (2):
ACPI/PPTT: Add support for ACPI 6.3 thread flag
arm64: topology: Use PPTT to determine if PE is a thread
arch/arm64/kernel/topology.c | 8 ++++--
drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++-
include/linux/acpi.h | 5 ++++
3 files changed, 63 insertions(+), 4 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v4 0/2] arm64/PPTT ACPI 6.3 thread flag support
@ 2019-08-01 3:46 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 3:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: lorenzo.pieralisi, catalin.marinas, rjw, Jeremy Linton,
linux-acpi, sudeep.holla, will, lenb
ACPI 6.3 adds a flag to the CPU node to indicate whether
the given CPU is a thread. Add a function to return that
information for a given linux logical CPU and then utilize
it while building the arm64 topology.
v3->v4: Remove table revision cache as this code path is only
called during boot and there aren't any
indications that it presents a perf issue.
Rebase to 5.3
v2->v3: Clarify and tweak the return from check_acpi_cpu_flag()
Cache the PPTT table revision to avoid repeat
acpi_table_get/put calls in the case of
missing or old PPTT tables.
v1->v2:
Return ENOENT instead on ENONET.
Jeremy Linton (2):
ACPI/PPTT: Add support for ACPI 6.3 thread flag
arm64: topology: Use PPTT to determine if PE is a thread
arch/arm64/kernel/topology.c | 8 ++++--
drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++-
include/linux/acpi.h | 5 ++++
3 files changed, 63 insertions(+), 4 deletions(-)
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-01 3:46 ` Jeremy Linton
@ 2019-08-01 3:46 ` Jeremy Linton
-1 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 3:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-acpi, catalin.marinas, will, rjw, lenb, lorenzo.pieralisi,
sudeep.holla, Jeremy Linton
ACPI 6.3 adds a flag to the CPU node to indicate whether
the given PE is a thread. Add a function to return that
information for a given linux logical CPU.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
include/linux/acpi.h | 5 ++++
2 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
index 1e7ac0bd0d3a..84718f6cb741 100644
--- a/drivers/acpi/pptt.c
+++ b/drivers/acpi/pptt.c
@@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
return retval;
}
+/**
+ * check_acpi_cpu_flag() - Determine if CPU node has a flag set
+ * @cpu: Kernel logical CPU number
+ * @rev: The PPTT revision defining the flag
+ * @flag: The flag itself
+ *
+ * Check the node representing a CPU for a given flag.
+ *
+ * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ * 1, any passed flag set
+ * 0, flag unset
+ */
+static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
+{
+ struct acpi_table_header *table;
+ acpi_status status;
+ u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+ struct acpi_pptt_processor *cpu_node = NULL;
+ int ret = -ENOENT;
+
+ status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
+ if (ACPI_FAILURE(status)) {
+ acpi_pptt_warn_missing();
+ return ret;
+ }
+
+ if (table->revision >= rev)
+ cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
+
+ if (cpu_node)
+ ret = (cpu_node->flags & flag) != 0;
+
+ acpi_put_table(table);
+
+ return ret;
+}
+
/**
* acpi_find_last_cache_level() - Determines the number of cache levels for a PE
* @cpu: Kernel logical CPU number
@@ -604,6 +642,21 @@ int cache_setup_acpi(unsigned int cpu)
return status;
}
+/**
+ * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
+ * @cpu: Kernel logical CPU number
+ *
+ *
+ * Return: 1, a thread
+ * 0, not a thread
+ * -ENOENT ,if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ */
+int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD);
+}
+
/**
* find_acpi_cpu_topology() - Determine a unique topology value for a given CPU
* @cpu: Kernel logical CPU number
@@ -664,7 +717,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
return ret;
}
-
/**
* find_acpi_cpu_topology_package() - Determine a unique CPU package value
* @cpu: Kernel logical CPU number
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 9426b9aaed86..9d0e20a2ac83 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
#endif
#ifdef CONFIG_ACPI_PPTT
+int acpi_pptt_cpu_is_thread(unsigned int cpu);
int find_acpi_cpu_topology(unsigned int cpu, int level);
int find_acpi_cpu_topology_package(unsigned int cpu);
int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
#else
+static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return -EINVAL;
+}
static inline int find_acpi_cpu_topology(unsigned int cpu, int level)
{
return -EINVAL;
--
2.21.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-01 3:46 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 3:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: lorenzo.pieralisi, catalin.marinas, rjw, Jeremy Linton,
linux-acpi, sudeep.holla, will, lenb
ACPI 6.3 adds a flag to the CPU node to indicate whether
the given PE is a thread. Add a function to return that
information for a given linux logical CPU.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
include/linux/acpi.h | 5 ++++
2 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
index 1e7ac0bd0d3a..84718f6cb741 100644
--- a/drivers/acpi/pptt.c
+++ b/drivers/acpi/pptt.c
@@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
return retval;
}
+/**
+ * check_acpi_cpu_flag() - Determine if CPU node has a flag set
+ * @cpu: Kernel logical CPU number
+ * @rev: The PPTT revision defining the flag
+ * @flag: The flag itself
+ *
+ * Check the node representing a CPU for a given flag.
+ *
+ * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ * 1, any passed flag set
+ * 0, flag unset
+ */
+static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
+{
+ struct acpi_table_header *table;
+ acpi_status status;
+ u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+ struct acpi_pptt_processor *cpu_node = NULL;
+ int ret = -ENOENT;
+
+ status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
+ if (ACPI_FAILURE(status)) {
+ acpi_pptt_warn_missing();
+ return ret;
+ }
+
+ if (table->revision >= rev)
+ cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
+
+ if (cpu_node)
+ ret = (cpu_node->flags & flag) != 0;
+
+ acpi_put_table(table);
+
+ return ret;
+}
+
/**
* acpi_find_last_cache_level() - Determines the number of cache levels for a PE
* @cpu: Kernel logical CPU number
@@ -604,6 +642,21 @@ int cache_setup_acpi(unsigned int cpu)
return status;
}
+/**
+ * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
+ * @cpu: Kernel logical CPU number
+ *
+ *
+ * Return: 1, a thread
+ * 0, not a thread
+ * -ENOENT ,if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ */
+int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD);
+}
+
/**
* find_acpi_cpu_topology() - Determine a unique topology value for a given CPU
* @cpu: Kernel logical CPU number
@@ -664,7 +717,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
return ret;
}
-
/**
* find_acpi_cpu_topology_package() - Determine a unique CPU package value
* @cpu: Kernel logical CPU number
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 9426b9aaed86..9d0e20a2ac83 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
#endif
#ifdef CONFIG_ACPI_PPTT
+int acpi_pptt_cpu_is_thread(unsigned int cpu);
int find_acpi_cpu_topology(unsigned int cpu, int level);
int find_acpi_cpu_topology_package(unsigned int cpu);
int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
#else
+static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return -EINVAL;
+}
static inline int find_acpi_cpu_topology(unsigned int cpu, int level)
{
return -EINVAL;
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
2019-08-01 3:46 ` Jeremy Linton
@ 2019-08-01 3:46 ` Jeremy Linton
-1 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 3:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-acpi, catalin.marinas, will, rjw, lenb, lorenzo.pieralisi,
sudeep.holla, Jeremy Linton
ACPI 6.3 adds a thread flag to represent if a CPU/PE is
actually a thread. Given that the MPIDR_MT bit may not
represent this information consistently on homogeneous machines
we should prefer the PPTT flag if its available.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
arch/arm64/kernel/topology.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index 0825c4a856e3..cbbedb53cf06 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -346,11 +346,9 @@ void remove_cpu_topology(unsigned int cpu)
*/
static int __init parse_acpi_topology(void)
{
- bool is_threaded;
+ int is_threaded;
int cpu, topology_id;
- is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
-
for_each_possible_cpu(cpu) {
int i, cache_id;
@@ -358,6 +356,10 @@ static int __init parse_acpi_topology(void)
if (topology_id < 0)
return topology_id;
+ is_threaded = acpi_pptt_cpu_is_thread(cpu);
+ if (is_threaded < 0)
+ is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
+
if (is_threaded) {
cpu_topology[cpu].thread_id = topology_id;
topology_id = find_acpi_cpu_topology(cpu, 1);
--
2.21.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
@ 2019-08-01 3:46 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 3:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: lorenzo.pieralisi, catalin.marinas, rjw, Jeremy Linton,
linux-acpi, sudeep.holla, will, lenb
ACPI 6.3 adds a thread flag to represent if a CPU/PE is
actually a thread. Given that the MPIDR_MT bit may not
represent this information consistently on homogeneous machines
we should prefer the PPTT flag if its available.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
arch/arm64/kernel/topology.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index 0825c4a856e3..cbbedb53cf06 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -346,11 +346,9 @@ void remove_cpu_topology(unsigned int cpu)
*/
static int __init parse_acpi_topology(void)
{
- bool is_threaded;
+ int is_threaded;
int cpu, topology_id;
- is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
-
for_each_possible_cpu(cpu) {
int i, cache_id;
@@ -358,6 +356,10 @@ static int __init parse_acpi_topology(void)
if (topology_id < 0)
return topology_id;
+ is_threaded = acpi_pptt_cpu_is_thread(cpu);
+ if (is_threaded < 0)
+ is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
+
if (is_threaded) {
cpu_topology[cpu].thread_id = topology_id;
topology_id = find_acpi_cpu_topology(cpu, 1);
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-01 3:46 ` Jeremy Linton
@ 2019-08-01 15:57 ` Sudeep Holla
-1 siblings, 0 replies; 34+ messages in thread
From: Sudeep Holla @ 2019-08-01 15:57 UTC (permalink / raw)
To: Jeremy Linton
Cc: linux-arm-kernel, linux-acpi, catalin.marinas, will, rjw, lenb,
lorenzo.pieralisi, Sudeep Holla
Hi Jeremy,
On Wed, Jul 31, 2019 at 10:46:33PM -0500, Jeremy Linton wrote:
> ACPI 6.3 adds a flag to the CPU node to indicate whether
> the given PE is a thread. Add a function to return that
> information for a given linux logical CPU.
>
Apart from few minor nits,
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
> drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
> include/linux/acpi.h | 5 ++++
> 2 files changed, 58 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
> index 1e7ac0bd0d3a..84718f6cb741 100644
> --- a/drivers/acpi/pptt.c
> +++ b/drivers/acpi/pptt.c
> @@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
> return retval;
> }
>
> +/**
> + * check_acpi_cpu_flag() - Determine if CPU node has a flag set
> + * @cpu: Kernel logical CPU number
> + * @rev: The PPTT revision defining the flag
[nit] I would rather put it as minimum PPTT revision that supports the
flag. It aligns with the code too as we are not looking for exact match.
> + * @flag: The flag itself
> + *
> + * Check the node representing a CPU for a given flag.
> + *
> + * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
> + * the table revision isn't new enough.
> + * 1, any passed flag set
> + * 0, flag unset
> + */
> +static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
> +{
> + struct acpi_table_header *table;
> + acpi_status status;
> + u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
> + struct acpi_pptt_processor *cpu_node = NULL;
> + int ret = -ENOENT;
> +
> + status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
> + if (ACPI_FAILURE(status)) {
> + acpi_pptt_warn_missing();
> + return ret;
> + }
> +
> + if (table->revision >= rev)
> + cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
> +
> + if (cpu_node)
> + ret = (cpu_node->flags & flag) != 0;
> +
> + acpi_put_table(table);
> +
> + return ret;
> +}
> +
> /**
> * acpi_find_last_cache_level() - Determines the number of cache levels for a PE
> * @cpu: Kernel logical CPU number
> @@ -604,6 +642,21 @@ int cache_setup_acpi(unsigned int cpu)
> return status;
> }
>
> +/**
> + * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
> + * @cpu: Kernel logical CPU number
> + *
[nit] If you spin the patch again, you can drop extra line space here.
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-01 15:57 ` Sudeep Holla
0 siblings, 0 replies; 34+ messages in thread
From: Sudeep Holla @ 2019-08-01 15:57 UTC (permalink / raw)
To: Jeremy Linton
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi,
Sudeep Holla, will, linux-arm-kernel, lenb
Hi Jeremy,
On Wed, Jul 31, 2019 at 10:46:33PM -0500, Jeremy Linton wrote:
> ACPI 6.3 adds a flag to the CPU node to indicate whether
> the given PE is a thread. Add a function to return that
> information for a given linux logical CPU.
>
Apart from few minor nits,
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
> drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
> include/linux/acpi.h | 5 ++++
> 2 files changed, 58 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
> index 1e7ac0bd0d3a..84718f6cb741 100644
> --- a/drivers/acpi/pptt.c
> +++ b/drivers/acpi/pptt.c
> @@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
> return retval;
> }
>
> +/**
> + * check_acpi_cpu_flag() - Determine if CPU node has a flag set
> + * @cpu: Kernel logical CPU number
> + * @rev: The PPTT revision defining the flag
[nit] I would rather put it as minimum PPTT revision that supports the
flag. It aligns with the code too as we are not looking for exact match.
> + * @flag: The flag itself
> + *
> + * Check the node representing a CPU for a given flag.
> + *
> + * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
> + * the table revision isn't new enough.
> + * 1, any passed flag set
> + * 0, flag unset
> + */
> +static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
> +{
> + struct acpi_table_header *table;
> + acpi_status status;
> + u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
> + struct acpi_pptt_processor *cpu_node = NULL;
> + int ret = -ENOENT;
> +
> + status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
> + if (ACPI_FAILURE(status)) {
> + acpi_pptt_warn_missing();
> + return ret;
> + }
> +
> + if (table->revision >= rev)
> + cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
> +
> + if (cpu_node)
> + ret = (cpu_node->flags & flag) != 0;
> +
> + acpi_put_table(table);
> +
> + return ret;
> +}
> +
> /**
> * acpi_find_last_cache_level() - Determines the number of cache levels for a PE
> * @cpu: Kernel logical CPU number
> @@ -604,6 +642,21 @@ int cache_setup_acpi(unsigned int cpu)
> return status;
> }
>
> +/**
> + * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
> + * @cpu: Kernel logical CPU number
> + *
[nit] If you spin the patch again, you can drop extra line space here.
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
2019-08-01 3:46 ` Jeremy Linton
@ 2019-08-01 15:58 ` Sudeep Holla
-1 siblings, 0 replies; 34+ messages in thread
From: Sudeep Holla @ 2019-08-01 15:58 UTC (permalink / raw)
To: Jeremy Linton
Cc: linux-arm-kernel, linux-acpi, catalin.marinas, will, rjw, lenb,
lorenzo.pieralisi, Sudeep Holla
On Wed, Jul 31, 2019 at 10:46:34PM -0500, Jeremy Linton wrote:
> ACPI 6.3 adds a thread flag to represent if a CPU/PE is
> actually a thread. Given that the MPIDR_MT bit may not
> represent this information consistently on homogeneous machines
> we should prefer the PPTT flag if its available.
>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
@ 2019-08-01 15:58 ` Sudeep Holla
0 siblings, 0 replies; 34+ messages in thread
From: Sudeep Holla @ 2019-08-01 15:58 UTC (permalink / raw)
To: Jeremy Linton
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi,
Sudeep Holla, will, linux-arm-kernel, lenb
On Wed, Jul 31, 2019 at 10:46:34PM -0500, Jeremy Linton wrote:
> ACPI 6.3 adds a thread flag to represent if a CPU/PE is
> actually a thread. Given that the MPIDR_MT bit may not
> represent this information consistently on homogeneous machines
> we should prefer the PPTT flag if its available.
>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-01 15:57 ` Sudeep Holla
@ 2019-08-01 16:10 ` Jeremy Linton
-1 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 16:10 UTC (permalink / raw)
To: Sudeep Holla
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi, will,
linux-arm-kernel, lenb
Hi,
Thanks for looking at this.
On 8/1/19 10:57 AM, Sudeep Holla wrote:
>
> Hi Jeremy,
>
> On Wed, Jul 31, 2019 at 10:46:33PM -0500, Jeremy Linton wrote:
>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>> the given PE is a thread. Add a function to return that
>> information for a given linux logical CPU.
>>
>
> Apart from few minor nits,
>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>
>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>> ---
>> drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
>> include/linux/acpi.h | 5 ++++
>> 2 files changed, 58 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
>> index 1e7ac0bd0d3a..84718f6cb741 100644
>> --- a/drivers/acpi/pptt.c
>> +++ b/drivers/acpi/pptt.c
>> @@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
>> return retval;
>> }
>>
>> +/**
>> + * check_acpi_cpu_flag() - Determine if CPU node has a flag set
>> + * @cpu: Kernel logical CPU number
>> + * @rev: The PPTT revision defining the flag
>
> [nit] I would rather put it as minimum PPTT revision that supports the
> flag. It aligns with the code too as we are not looking for exact match.
Ok, sure.
>
>> + * @flag: The flag itself
>> + *
>> + * Check the node representing a CPU for a given flag.
>> + *
>> + * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
>> + * the table revision isn't new enough.
>> + * 1, any passed flag set
>> + * 0, flag unset
>> + */
>> +static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
>> +{
>> + struct acpi_table_header *table;
>> + acpi_status status;
>> + u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
>> + struct acpi_pptt_processor *cpu_node = NULL;
>> + int ret = -ENOENT;
>> +
>> + status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
>> + if (ACPI_FAILURE(status)) {
>> + acpi_pptt_warn_missing();
>> + return ret;
>> + }
>> +
>> + if (table->revision >= rev)
>> + cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
>> +
>> + if (cpu_node)
>> + ret = (cpu_node->flags & flag) != 0;
>> +
>> + acpi_put_table(table);
>> +
>> + return ret;
>> +}
>> +
>> /**
>> * acpi_find_last_cache_level() - Determines the number of cache levels for a PE
>> * @cpu: Kernel logical CPU number
>> @@ -604,6 +642,21 @@ int cache_setup_acpi(unsigned int cpu)
>> return status;
>> }
>>
>> +/**
>> + * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
>> + * @cpu: Kernel logical CPU number
>> + *
>
> [nit] If you spin the patch again, you can drop extra line space here.
Sure..
>
> --
> Regards,
> Sudeep
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-01 16:10 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-01 16:10 UTC (permalink / raw)
To: Sudeep Holla
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi, will,
linux-arm-kernel, lenb
Hi,
Thanks for looking at this.
On 8/1/19 10:57 AM, Sudeep Holla wrote:
>
> Hi Jeremy,
>
> On Wed, Jul 31, 2019 at 10:46:33PM -0500, Jeremy Linton wrote:
>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>> the given PE is a thread. Add a function to return that
>> information for a given linux logical CPU.
>>
>
> Apart from few minor nits,
>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>
>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>> ---
>> drivers/acpi/pptt.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
>> include/linux/acpi.h | 5 ++++
>> 2 files changed, 58 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
>> index 1e7ac0bd0d3a..84718f6cb741 100644
>> --- a/drivers/acpi/pptt.c
>> +++ b/drivers/acpi/pptt.c
>> @@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
>> return retval;
>> }
>>
>> +/**
>> + * check_acpi_cpu_flag() - Determine if CPU node has a flag set
>> + * @cpu: Kernel logical CPU number
>> + * @rev: The PPTT revision defining the flag
>
> [nit] I would rather put it as minimum PPTT revision that supports the
> flag. It aligns with the code too as we are not looking for exact match.
Ok, sure.
>
>> + * @flag: The flag itself
>> + *
>> + * Check the node representing a CPU for a given flag.
>> + *
>> + * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
>> + * the table revision isn't new enough.
>> + * 1, any passed flag set
>> + * 0, flag unset
>> + */
>> +static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
>> +{
>> + struct acpi_table_header *table;
>> + acpi_status status;
>> + u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
>> + struct acpi_pptt_processor *cpu_node = NULL;
>> + int ret = -ENOENT;
>> +
>> + status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
>> + if (ACPI_FAILURE(status)) {
>> + acpi_pptt_warn_missing();
>> + return ret;
>> + }
>> +
>> + if (table->revision >= rev)
>> + cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
>> +
>> + if (cpu_node)
>> + ret = (cpu_node->flags & flag) != 0;
>> +
>> + acpi_put_table(table);
>> +
>> + return ret;
>> +}
>> +
>> /**
>> * acpi_find_last_cache_level() - Determines the number of cache levels for a PE
>> * @cpu: Kernel logical CPU number
>> @@ -604,6 +642,21 @@ int cache_setup_acpi(unsigned int cpu)
>> return status;
>> }
>>
>> +/**
>> + * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
>> + * @cpu: Kernel logical CPU number
>> + *
>
> [nit] If you spin the patch again, you can drop extra line space here.
Sure..
>
> --
> Regards,
> Sudeep
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-01 3:46 ` Jeremy Linton
@ 2019-08-02 13:05 ` Robert Richter
-1 siblings, 0 replies; 34+ messages in thread
From: Robert Richter @ 2019-08-02 13:05 UTC (permalink / raw)
To: Jeremy Linton
Cc: linux-arm-kernel, lorenzo.pieralisi, catalin.marinas, rjw,
linux-acpi, sudeep.holla, will, lenb
On 31.07.19 22:46:33, Jeremy Linton wrote:
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 9426b9aaed86..9d0e20a2ac83 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
> #endif
>
> #ifdef CONFIG_ACPI_PPTT
> +int acpi_pptt_cpu_is_thread(unsigned int cpu);
> int find_acpi_cpu_topology(unsigned int cpu, int level);
> int find_acpi_cpu_topology_package(unsigned int cpu);
> int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
> int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
All those functions (exept hetero_id) are used only in
parse_acpi_topology(). So how about creating a struct with thread_id,
core_id, and cache_id (and hetero_id (?)) and have a single pptt table
parsing function that fills in all of this into that struct? This
simplifies the api and also the code.
This also shows that hetid (see arm_pmu_acpi.c) better should be
stored in cpu_topology[] too and thus being parsed with the other
parameters as well and made accessible from there by a helper.
-Robert
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-02 13:05 ` Robert Richter
0 siblings, 0 replies; 34+ messages in thread
From: Robert Richter @ 2019-08-02 13:05 UTC (permalink / raw)
To: Jeremy Linton
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi,
sudeep.holla, will, linux-arm-kernel, lenb
On 31.07.19 22:46:33, Jeremy Linton wrote:
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 9426b9aaed86..9d0e20a2ac83 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
> #endif
>
> #ifdef CONFIG_ACPI_PPTT
> +int acpi_pptt_cpu_is_thread(unsigned int cpu);
> int find_acpi_cpu_topology(unsigned int cpu, int level);
> int find_acpi_cpu_topology_package(unsigned int cpu);
> int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
> int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
All those functions (exept hetero_id) are used only in
parse_acpi_topology(). So how about creating a struct with thread_id,
core_id, and cache_id (and hetero_id (?)) and have a single pptt table
parsing function that fills in all of this into that struct? This
simplifies the api and also the code.
This also shows that hetid (see arm_pmu_acpi.c) better should be
stored in cpu_topology[] too and thus being parsed with the other
parameters as well and made accessible from there by a helper.
-Robert
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
2019-08-01 3:46 ` Jeremy Linton
@ 2019-08-02 13:44 ` Robert Richter
-1 siblings, 0 replies; 34+ messages in thread
From: Robert Richter @ 2019-08-02 13:44 UTC (permalink / raw)
To: Jeremy Linton
Cc: linux-arm-kernel, lorenzo.pieralisi, catalin.marinas, rjw,
linux-acpi, sudeep.holla, will, lenb
On 31.07.19 22:46:34, Jeremy Linton wrote:
> @@ -358,6 +356,10 @@ static int __init parse_acpi_topology(void)
> if (topology_id < 0)
> return topology_id;
>
> + is_threaded = acpi_pptt_cpu_is_thread(cpu);
> + if (is_threaded < 0)
> + is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
> +
I think the return code handling is error-prone, as in the kernel such
functions are typically used like:
if (something_is_thread) { ... }
I see this is due to acpi and arch code separation so we cannot simply
move the fallback to pptt code.
So maybe we have a static function cpu_is_thread() in this file that
handles all the logic and directly use check_acpi_cpu_flag() from
there. However, code may change here in case of a rework as I
suggested in patch #1. In both cases the acpi api is more straight
then.
-Robert
> if (is_threaded) {
> cpu_topology[cpu].thread_id = topology_id;
> topology_id = find_acpi_cpu_topology(cpu, 1);
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
@ 2019-08-02 13:44 ` Robert Richter
0 siblings, 0 replies; 34+ messages in thread
From: Robert Richter @ 2019-08-02 13:44 UTC (permalink / raw)
To: Jeremy Linton
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi,
sudeep.holla, will, linux-arm-kernel, lenb
On 31.07.19 22:46:34, Jeremy Linton wrote:
> @@ -358,6 +356,10 @@ static int __init parse_acpi_topology(void)
> if (topology_id < 0)
> return topology_id;
>
> + is_threaded = acpi_pptt_cpu_is_thread(cpu);
> + if (is_threaded < 0)
> + is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
> +
I think the return code handling is error-prone, as in the kernel such
functions are typically used like:
if (something_is_thread) { ... }
I see this is due to acpi and arch code separation so we cannot simply
move the fallback to pptt code.
So maybe we have a static function cpu_is_thread() in this file that
handles all the logic and directly use check_acpi_cpu_flag() from
there. However, code may change here in case of a rework as I
suggested in patch #1. In both cases the acpi api is more straight
then.
-Robert
> if (is_threaded) {
> cpu_topology[cpu].thread_id = topology_id;
> topology_id = find_acpi_cpu_topology(cpu, 1);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-02 13:05 ` Robert Richter
@ 2019-08-02 15:36 ` Jeremy Linton
-1 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-02 15:36 UTC (permalink / raw)
To: Robert Richter
Cc: linux-arm-kernel, lorenzo.pieralisi, catalin.marinas, rjw,
linux-acpi, sudeep.holla, will, lenb
Hi,
Thanks for taking a look at this.
On 8/2/19 8:05 AM, Robert Richter wrote:
> On 31.07.19 22:46:33, Jeremy Linton wrote:
>
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index 9426b9aaed86..9d0e20a2ac83 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
>> #endif
>>
>> #ifdef CONFIG_ACPI_PPTT
>> +int acpi_pptt_cpu_is_thread(unsigned int cpu);
>> int find_acpi_cpu_topology(unsigned int cpu, int level);
>> int find_acpi_cpu_topology_package(unsigned int cpu);
>> int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
>> int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
>
> All those functions (exept hetero_id) are used only in
> parse_acpi_topology(). So how about creating a struct with thread_id,
> core_id, and cache_id (and hetero_id (?)) and have a single pptt table
> parsing function that fills in all of this into that struct? This
> simplifies the api and also the code.
>
> This also shows that hetid (see arm_pmu_acpi.c) better should be
> stored in cpu_topology[] too and thus being parsed with the other
> parameters as well and made accessible from there by a helper.
I think the idea here was to avoid an additional set of intermediate
data structures between the PPTT table/structure and the final arch
specific data structures (which themselves are used to feed other
things, like the scheduler, note the llc parsing). Rather the attempt is
to provide a set of tools to retrieve information and let the policy for
how that information is used be dictated by the consumer.
In the future, if we can further unify the arch specific cpu_topology
structures it would make sense to parse directly into them, but until
that happens I don't think we should try. The existing code does parse
directly into the cache structures, but the cpu topology is subtly arm64
at the moment. If another arch decided to use this, i'm not sure they
would want or need it parsed in exactly the same way.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-02 15:36 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-02 15:36 UTC (permalink / raw)
To: Robert Richter
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi,
sudeep.holla, will, linux-arm-kernel, lenb
Hi,
Thanks for taking a look at this.
On 8/2/19 8:05 AM, Robert Richter wrote:
> On 31.07.19 22:46:33, Jeremy Linton wrote:
>
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index 9426b9aaed86..9d0e20a2ac83 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
>> #endif
>>
>> #ifdef CONFIG_ACPI_PPTT
>> +int acpi_pptt_cpu_is_thread(unsigned int cpu);
>> int find_acpi_cpu_topology(unsigned int cpu, int level);
>> int find_acpi_cpu_topology_package(unsigned int cpu);
>> int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
>> int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
>
> All those functions (exept hetero_id) are used only in
> parse_acpi_topology(). So how about creating a struct with thread_id,
> core_id, and cache_id (and hetero_id (?)) and have a single pptt table
> parsing function that fills in all of this into that struct? This
> simplifies the api and also the code.
>
> This also shows that hetid (see arm_pmu_acpi.c) better should be
> stored in cpu_topology[] too and thus being parsed with the other
> parameters as well and made accessible from there by a helper.
I think the idea here was to avoid an additional set of intermediate
data structures between the PPTT table/structure and the final arch
specific data structures (which themselves are used to feed other
things, like the scheduler, note the llc parsing). Rather the attempt is
to provide a set of tools to retrieve information and let the policy for
how that information is used be dictated by the consumer.
In the future, if we can further unify the arch specific cpu_topology
structures it would make sense to parse directly into them, but until
that happens I don't think we should try. The existing code does parse
directly into the cache structures, but the cpu topology is subtly arm64
at the moment. If another arch decided to use this, i'm not sure they
would want or need it parsed in exactly the same way.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
2019-08-02 13:44 ` Robert Richter
@ 2019-08-02 16:04 ` Jeremy Linton
-1 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-02 16:04 UTC (permalink / raw)
To: Robert Richter
Cc: linux-arm-kernel, lorenzo.pieralisi, catalin.marinas, rjw,
linux-acpi, sudeep.holla, will, lenb
Hi,
On 8/2/19 8:44 AM, Robert Richter wrote:
> On 31.07.19 22:46:34, Jeremy Linton wrote:
>
>> @@ -358,6 +356,10 @@ static int __init parse_acpi_topology(void)
>> if (topology_id < 0)
>> return topology_id;
>>
>> + is_threaded = acpi_pptt_cpu_is_thread(cpu);
>> + if (is_threaded < 0)
>> + is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
>> +
>
> I think the return code handling is error-prone, as in the kernel such
> functions are typically used like:
>
> if (something_is_thread) { ... }
I don't really understand why this keeps getting repeated. The negative
error code return is used by huge swaths of the kernel API. A couple
lines up the exact same paradigm is used in get_cpu_for_node() and a few
other places.
>
> I see this is due to acpi and arch code separation so we cannot simply
> move the fallback to pptt code.
Right, the PPTT->arch data structure translation is arch specific.
During the initial PPTT drop a lot of discussion when into how arm64 was
doing that translation, as well as the corresponding translation to the
core scheduler/etc.
>
> So maybe we have a static function cpu_is_thread() in this file that
> handles all the logic and directly use check_acpi_cpu_flag() from
> there. However, code may change here in case of a rework as I
> suggested in patch #1. In both cases the acpi api is more straight
> then.
I'm ok with that, it effectively only moves those three lines to a
standalone single call-site function. To be clear, that isn't a generic
routine for anyone to call. Functions that need to know if the core is a
threaded should be checking the topology thread_id directly rather than
re-coding the acpi/dt/mpidr logic which populates it.
>
> -Robert
>
>> if (is_threaded) {
>> cpu_topology[cpu].thread_id = topology_id;
>> topology_id = find_acpi_cpu_topology(cpu, 1);
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread
@ 2019-08-02 16:04 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-02 16:04 UTC (permalink / raw)
To: Robert Richter
Cc: lorenzo.pieralisi, catalin.marinas, rjw, linux-acpi,
sudeep.holla, will, linux-arm-kernel, lenb
Hi,
On 8/2/19 8:44 AM, Robert Richter wrote:
> On 31.07.19 22:46:34, Jeremy Linton wrote:
>
>> @@ -358,6 +356,10 @@ static int __init parse_acpi_topology(void)
>> if (topology_id < 0)
>> return topology_id;
>>
>> + is_threaded = acpi_pptt_cpu_is_thread(cpu);
>> + if (is_threaded < 0)
>> + is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
>> +
>
> I think the return code handling is error-prone, as in the kernel such
> functions are typically used like:
>
> if (something_is_thread) { ... }
I don't really understand why this keeps getting repeated. The negative
error code return is used by huge swaths of the kernel API. A couple
lines up the exact same paradigm is used in get_cpu_for_node() and a few
other places.
>
> I see this is due to acpi and arch code separation so we cannot simply
> move the fallback to pptt code.
Right, the PPTT->arch data structure translation is arch specific.
During the initial PPTT drop a lot of discussion when into how arm64 was
doing that translation, as well as the corresponding translation to the
core scheduler/etc.
>
> So maybe we have a static function cpu_is_thread() in this file that
> handles all the logic and directly use check_acpi_cpu_flag() from
> there. However, code may change here in case of a rework as I
> suggested in patch #1. In both cases the acpi api is more straight
> then.
I'm ok with that, it effectively only moves those three lines to a
standalone single call-site function. To be clear, that isn't a generic
routine for anyone to call. Functions that need to know if the core is a
threaded should be checking the topology thread_id directly rather than
re-coding the acpi/dt/mpidr logic which populates it.
>
> -Robert
>
>> if (is_threaded) {
>> cpu_topology[cpu].thread_id = topology_id;
>> topology_id = find_acpi_cpu_topology(cpu, 1);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-21 13:20 ` Jeremy Linton
@ 2019-08-21 13:25 ` John Garry
-1 siblings, 0 replies; 34+ messages in thread
From: John Garry @ 2019-08-21 13:25 UTC (permalink / raw)
To: Jeremy Linton, Will Deacon, Rafael J. Wysocki
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, linux-acpi,
Robert Richter, sudeep.holla, linux-arm-kernel, lenb,
wanghuiqiang
On 21/08/2019 14:20, Jeremy Linton wrote:
> Hi,
>
> On 8/20/19 4:01 AM, John Garry wrote:
>> On 12/08/2019 12:59, Will Deacon wrote:
>>> On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
>>>> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter
>>>> <rrichter@marvell.com> wrote:
>>>>>
>>>>> On 08.08.19 15:40:06, Jeremy Linton wrote:
>>>>>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>>>>>> the given PE is a thread. Add a function to return that
>>>>>> information for a given linux logical CPU.
>>>>>>
>>>>>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>>>>>> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>>>>>> ---
>>>>>> drivers/acpi/pptt.c | 53
>>>>>> +++++++++++++++++++++++++++++++++++++++++++-
>>>>>> include/linux/acpi.h | 5 +++++
>>>>>> 2 files changed, 57 insertions(+), 1 deletion(-)
>>>>>
>>>>> Reviewed-by: Robert Richter <rrichter@marvell.com>
>>>>
>>>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>>
>>>> and please push it through ARM64 along with the second patch.
>>>
>>> Thanks. I'll push these into -next shortly.
>>
>>
>> Hi Jeremy,
>>
>> We're considering requesting this support is backported to stable. We
>> have a platform which incorrectly sets the MT bit. To update our
>> firmware to PPTT v2, we need the kernel to support PPTT v2 also.
>>
>> Please let me know if you anticipate an issue in this.
>
> No I don't see any issues with that once it lands.
>
> I believe the ball is rolling in the case of some older distro kernel's
> as well.
Cool.
Cheers,
John
>
> Thanks,
>
> .
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-21 13:25 ` John Garry
0 siblings, 0 replies; 34+ messages in thread
From: John Garry @ 2019-08-21 13:25 UTC (permalink / raw)
To: Jeremy Linton, Will Deacon, Rafael J. Wysocki
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, linux-acpi,
Robert Richter, wanghuiqiang, sudeep.holla, linux-arm-kernel,
lenb
On 21/08/2019 14:20, Jeremy Linton wrote:
> Hi,
>
> On 8/20/19 4:01 AM, John Garry wrote:
>> On 12/08/2019 12:59, Will Deacon wrote:
>>> On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
>>>> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter
>>>> <rrichter@marvell.com> wrote:
>>>>>
>>>>> On 08.08.19 15:40:06, Jeremy Linton wrote:
>>>>>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>>>>>> the given PE is a thread. Add a function to return that
>>>>>> information for a given linux logical CPU.
>>>>>>
>>>>>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>>>>>> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>>>>>> ---
>>>>>> drivers/acpi/pptt.c | 53
>>>>>> +++++++++++++++++++++++++++++++++++++++++++-
>>>>>> include/linux/acpi.h | 5 +++++
>>>>>> 2 files changed, 57 insertions(+), 1 deletion(-)
>>>>>
>>>>> Reviewed-by: Robert Richter <rrichter@marvell.com>
>>>>
>>>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>>
>>>> and please push it through ARM64 along with the second patch.
>>>
>>> Thanks. I'll push these into -next shortly.
>>
>>
>> Hi Jeremy,
>>
>> We're considering requesting this support is backported to stable. We
>> have a platform which incorrectly sets the MT bit. To update our
>> firmware to PPTT v2, we need the kernel to support PPTT v2 also.
>>
>> Please let me know if you anticipate an issue in this.
>
> No I don't see any issues with that once it lands.
>
> I believe the ball is rolling in the case of some older distro kernel's
> as well.
Cool.
Cheers,
John
>
> Thanks,
>
> .
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-20 9:01 ` John Garry
@ 2019-08-21 13:20 ` Jeremy Linton
-1 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-21 13:20 UTC (permalink / raw)
To: John Garry, Will Deacon, Rafael J. Wysocki
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, linux-acpi,
Robert Richter, sudeep.holla, linux-arm-kernel, lenb,
wanghuiqiang
Hi,
On 8/20/19 4:01 AM, John Garry wrote:
> On 12/08/2019 12:59, Will Deacon wrote:
>> On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
>>> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com>
>>> wrote:
>>>>
>>>> On 08.08.19 15:40:06, Jeremy Linton wrote:
>>>>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>>>>> the given PE is a thread. Add a function to return that
>>>>> information for a given linux logical CPU.
>>>>>
>>>>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>>>>> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>>>>> ---
>>>>> drivers/acpi/pptt.c | 53
>>>>> +++++++++++++++++++++++++++++++++++++++++++-
>>>>> include/linux/acpi.h | 5 +++++
>>>>> 2 files changed, 57 insertions(+), 1 deletion(-)
>>>>
>>>> Reviewed-by: Robert Richter <rrichter@marvell.com>
>>>
>>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>
>>> and please push it through ARM64 along with the second patch.
>>
>> Thanks. I'll push these into -next shortly.
>
>
> Hi Jeremy,
>
> We're considering requesting this support is backported to stable. We
> have a platform which incorrectly sets the MT bit. To update our
> firmware to PPTT v2, we need the kernel to support PPTT v2 also.
>
> Please let me know if you anticipate an issue in this.
No I don't see any issues with that once it lands.
I believe the ball is rolling in the case of some older distro kernel's
as well.
Thanks,
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-21 13:20 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-21 13:20 UTC (permalink / raw)
To: John Garry, Will Deacon, Rafael J. Wysocki
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, linux-acpi,
Robert Richter, wanghuiqiang, sudeep.holla, linux-arm-kernel,
lenb
Hi,
On 8/20/19 4:01 AM, John Garry wrote:
> On 12/08/2019 12:59, Will Deacon wrote:
>> On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
>>> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com>
>>> wrote:
>>>>
>>>> On 08.08.19 15:40:06, Jeremy Linton wrote:
>>>>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>>>>> the given PE is a thread. Add a function to return that
>>>>> information for a given linux logical CPU.
>>>>>
>>>>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>>>>> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>>>>> ---
>>>>> drivers/acpi/pptt.c | 53
>>>>> +++++++++++++++++++++++++++++++++++++++++++-
>>>>> include/linux/acpi.h | 5 +++++
>>>>> 2 files changed, 57 insertions(+), 1 deletion(-)
>>>>
>>>> Reviewed-by: Robert Richter <rrichter@marvell.com>
>>>
>>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>
>>> and please push it through ARM64 along with the second patch.
>>
>> Thanks. I'll push these into -next shortly.
>
>
> Hi Jeremy,
>
> We're considering requesting this support is backported to stable. We
> have a platform which incorrectly sets the MT bit. To update our
> firmware to PPTT v2, we need the kernel to support PPTT v2 also.
>
> Please let me know if you anticipate an issue in this.
No I don't see any issues with that once it lands.
I believe the ball is rolling in the case of some older distro kernel's
as well.
Thanks,
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-12 11:59 ` Will Deacon
@ 2019-08-20 9:01 ` John Garry
-1 siblings, 0 replies; 34+ messages in thread
From: John Garry @ 2019-08-20 9:01 UTC (permalink / raw)
To: Will Deacon, Rafael J. Wysocki, Jeremy Linton
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, linux-acpi,
Robert Richter, sudeep.holla, linux-arm-kernel, lenb,
wanghuiqiang
On 12/08/2019 12:59, Will Deacon wrote:
> On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
>> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com> wrote:
>>>
>>> On 08.08.19 15:40:06, Jeremy Linton wrote:
>>>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>>>> the given PE is a thread. Add a function to return that
>>>> information for a given linux logical CPU.
>>>>
>>>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>>>> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>>>> ---
>>>> drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
>>>> include/linux/acpi.h | 5 +++++
>>>> 2 files changed, 57 insertions(+), 1 deletion(-)
>>>
>>> Reviewed-by: Robert Richter <rrichter@marvell.com>
>>
>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> and please push it through ARM64 along with the second patch.
>
> Thanks. I'll push these into -next shortly.
Hi Jeremy,
We're considering requesting this support is backported to stable. We
have a platform which incorrectly sets the MT bit. To update our
firmware to PPTT v2, we need the kernel to support PPTT v2 also.
Please let me know if you anticipate an issue in this.
Cheers,
John
>
> Will
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-20 9:01 ` John Garry
0 siblings, 0 replies; 34+ messages in thread
From: John Garry @ 2019-08-20 9:01 UTC (permalink / raw)
To: Will Deacon, Rafael J. Wysocki, Jeremy Linton
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, linux-acpi,
Robert Richter, wanghuiqiang, sudeep.holla, linux-arm-kernel,
lenb
On 12/08/2019 12:59, Will Deacon wrote:
> On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
>> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com> wrote:
>>>
>>> On 08.08.19 15:40:06, Jeremy Linton wrote:
>>>> ACPI 6.3 adds a flag to the CPU node to indicate whether
>>>> the given PE is a thread. Add a function to return that
>>>> information for a given linux logical CPU.
>>>>
>>>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>>>> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>>>> ---
>>>> drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
>>>> include/linux/acpi.h | 5 +++++
>>>> 2 files changed, 57 insertions(+), 1 deletion(-)
>>>
>>> Reviewed-by: Robert Richter <rrichter@marvell.com>
>>
>> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> and please push it through ARM64 along with the second patch.
>
> Thanks. I'll push these into -next shortly.
Hi Jeremy,
We're considering requesting this support is backported to stable. We
have a platform which incorrectly sets the MT bit. To update our
firmware to PPTT v2, we need the kernel to support PPTT v2 also.
Please let me know if you anticipate an issue in this.
Cheers,
John
>
> Will
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-12 9:06 ` Rafael J. Wysocki
@ 2019-08-12 11:59 ` Will Deacon
-1 siblings, 0 replies; 34+ messages in thread
From: Will Deacon @ 2019-08-12 11:59 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Robert Richter, Jeremy Linton, linux-arm-kernel, linux-acpi,
catalin.marinas, rjw, lenb, lorenzo.pieralisi, sudeep.holla,
rric
On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com> wrote:
> >
> > On 08.08.19 15:40:06, Jeremy Linton wrote:
> > > ACPI 6.3 adds a flag to the CPU node to indicate whether
> > > the given PE is a thread. Add a function to return that
> > > information for a given linux logical CPU.
> > >
> > > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> > > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > > ---
> > > drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
> > > include/linux/acpi.h | 5 +++++
> > > 2 files changed, 57 insertions(+), 1 deletion(-)
> >
> > Reviewed-by: Robert Richter <rrichter@marvell.com>
>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> and please push it through ARM64 along with the second patch.
Thanks. I'll push these into -next shortly.
Will
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-12 11:59 ` Will Deacon
0 siblings, 0 replies; 34+ messages in thread
From: Will Deacon @ 2019-08-12 11:59 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, Jeremy Linton,
linux-acpi, Robert Richter, sudeep.holla, linux-arm-kernel, lenb
On Mon, Aug 12, 2019 at 11:06:07AM +0200, Rafael J. Wysocki wrote:
> On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com> wrote:
> >
> > On 08.08.19 15:40:06, Jeremy Linton wrote:
> > > ACPI 6.3 adds a flag to the CPU node to indicate whether
> > > the given PE is a thread. Add a function to return that
> > > information for a given linux logical CPU.
> > >
> > > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> > > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > > ---
> > > drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
> > > include/linux/acpi.h | 5 +++++
> > > 2 files changed, 57 insertions(+), 1 deletion(-)
> >
> > Reviewed-by: Robert Richter <rrichter@marvell.com>
>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> and please push it through ARM64 along with the second patch.
Thanks. I'll push these into -next shortly.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-08 22:25 ` Robert Richter
@ 2019-08-12 9:06 ` Rafael J. Wysocki
-1 siblings, 0 replies; 34+ messages in thread
From: Rafael J. Wysocki @ 2019-08-12 9:06 UTC (permalink / raw)
To: Robert Richter
Cc: Jeremy Linton, linux-arm-kernel, linux-acpi, catalin.marinas,
will, rjw, lenb, lorenzo.pieralisi, sudeep.holla, rric
On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com> wrote:
>
> On 08.08.19 15:40:06, Jeremy Linton wrote:
> > ACPI 6.3 adds a flag to the CPU node to indicate whether
> > the given PE is a thread. Add a function to return that
> > information for a given linux logical CPU.
> >
> > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> > drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
> > include/linux/acpi.h | 5 +++++
> > 2 files changed, 57 insertions(+), 1 deletion(-)
>
> Reviewed-by: Robert Richter <rrichter@marvell.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
and please push it through ARM64 along with the second patch.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-12 9:06 ` Rafael J. Wysocki
0 siblings, 0 replies; 34+ messages in thread
From: Rafael J. Wysocki @ 2019-08-12 9:06 UTC (permalink / raw)
To: Robert Richter
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, Jeremy Linton,
linux-acpi, sudeep.holla, will, linux-arm-kernel, lenb
On Fri, Aug 9, 2019 at 12:25 AM Robert Richter <rrichter@marvell.com> wrote:
>
> On 08.08.19 15:40:06, Jeremy Linton wrote:
> > ACPI 6.3 adds a flag to the CPU node to indicate whether
> > the given PE is a thread. Add a function to return that
> > information for a given linux logical CPU.
> >
> > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> > drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
> > include/linux/acpi.h | 5 +++++
> > 2 files changed, 57 insertions(+), 1 deletion(-)
>
> Reviewed-by: Robert Richter <rrichter@marvell.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
and please push it through ARM64 along with the second patch.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-08 20:40 ` Jeremy Linton
@ 2019-08-08 22:25 ` Robert Richter
-1 siblings, 0 replies; 34+ messages in thread
From: Robert Richter @ 2019-08-08 22:25 UTC (permalink / raw)
To: Jeremy Linton
Cc: linux-arm-kernel, linux-acpi, catalin.marinas, will, rjw, lenb,
lorenzo.pieralisi, sudeep.holla, rric
On 08.08.19 15:40:06, Jeremy Linton wrote:
> ACPI 6.3 adds a flag to the CPU node to indicate whether
> the given PE is a thread. Add a function to return that
> information for a given linux logical CPU.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
> drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
> include/linux/acpi.h | 5 +++++
> 2 files changed, 57 insertions(+), 1 deletion(-)
Reviewed-by: Robert Richter <rrichter@marvell.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-08 22:25 ` Robert Richter
0 siblings, 0 replies; 34+ messages in thread
From: Robert Richter @ 2019-08-08 22:25 UTC (permalink / raw)
To: Jeremy Linton
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, linux-acpi,
sudeep.holla, will, linux-arm-kernel, lenb
On 08.08.19 15:40:06, Jeremy Linton wrote:
> ACPI 6.3 adds a flag to the CPU node to indicate whether
> the given PE is a thread. Add a function to return that
> information for a given linux logical CPU.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
> drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
> include/linux/acpi.h | 5 +++++
> 2 files changed, 57 insertions(+), 1 deletion(-)
Reviewed-by: Robert Richter <rrichter@marvell.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
2019-08-08 20:40 [PATCH v4 0/2] arm64/PPTT ACPI 6.3 thread flag support Jeremy Linton
@ 2019-08-08 20:40 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-08 20:40 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-acpi, catalin.marinas, will, rjw, lenb, lorenzo.pieralisi,
sudeep.holla, rric, Jeremy Linton
ACPI 6.3 adds a flag to the CPU node to indicate whether
the given PE is a thread. Add a function to return that
information for a given linux logical CPU.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
include/linux/acpi.h | 5 +++++
2 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
index 1e7ac0bd0d3a..f31544d3656e 100644
--- a/drivers/acpi/pptt.c
+++ b/drivers/acpi/pptt.c
@@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
return retval;
}
+/**
+ * check_acpi_cpu_flag() - Determine if CPU node has a flag set
+ * @cpu: Kernel logical CPU number
+ * @rev: The minimum PPTT revision defining the flag
+ * @flag: The flag itself
+ *
+ * Check the node representing a CPU for a given flag.
+ *
+ * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ * 1, any passed flag set
+ * 0, flag unset
+ */
+static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
+{
+ struct acpi_table_header *table;
+ acpi_status status;
+ u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+ struct acpi_pptt_processor *cpu_node = NULL;
+ int ret = -ENOENT;
+
+ status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
+ if (ACPI_FAILURE(status)) {
+ acpi_pptt_warn_missing();
+ return ret;
+ }
+
+ if (table->revision >= rev)
+ cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
+
+ if (cpu_node)
+ ret = (cpu_node->flags & flag) != 0;
+
+ acpi_put_table(table);
+
+ return ret;
+}
+
/**
* acpi_find_last_cache_level() - Determines the number of cache levels for a PE
* @cpu: Kernel logical CPU number
@@ -604,6 +642,20 @@ int cache_setup_acpi(unsigned int cpu)
return status;
}
+/**
+ * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
+ * @cpu: Kernel logical CPU number
+ *
+ * Return: 1, a thread
+ * 0, not a thread
+ * -ENOENT ,if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ */
+int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD);
+}
+
/**
* find_acpi_cpu_topology() - Determine a unique topology value for a given CPU
* @cpu: Kernel logical CPU number
@@ -664,7 +716,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
return ret;
}
-
/**
* find_acpi_cpu_topology_package() - Determine a unique CPU package value
* @cpu: Kernel logical CPU number
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 9426b9aaed86..9d0e20a2ac83 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
#endif
#ifdef CONFIG_ACPI_PPTT
+int acpi_pptt_cpu_is_thread(unsigned int cpu);
int find_acpi_cpu_topology(unsigned int cpu, int level);
int find_acpi_cpu_topology_package(unsigned int cpu);
int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
#else
+static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return -EINVAL;
+}
static inline int find_acpi_cpu_topology(unsigned int cpu, int level)
{
return -EINVAL;
--
2.21.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag
@ 2019-08-08 20:40 ` Jeremy Linton
0 siblings, 0 replies; 34+ messages in thread
From: Jeremy Linton @ 2019-08-08 20:40 UTC (permalink / raw)
To: linux-arm-kernel
Cc: lorenzo.pieralisi, rric, catalin.marinas, rjw, Jeremy Linton,
linux-acpi, sudeep.holla, will, lenb
ACPI 6.3 adds a flag to the CPU node to indicate whether
the given PE is a thread. Add a function to return that
information for a given linux logical CPU.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++-
include/linux/acpi.h | 5 +++++
2 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c
index 1e7ac0bd0d3a..f31544d3656e 100644
--- a/drivers/acpi/pptt.c
+++ b/drivers/acpi/pptt.c
@@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
return retval;
}
+/**
+ * check_acpi_cpu_flag() - Determine if CPU node has a flag set
+ * @cpu: Kernel logical CPU number
+ * @rev: The minimum PPTT revision defining the flag
+ * @flag: The flag itself
+ *
+ * Check the node representing a CPU for a given flag.
+ *
+ * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ * 1, any passed flag set
+ * 0, flag unset
+ */
+static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
+{
+ struct acpi_table_header *table;
+ acpi_status status;
+ u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+ struct acpi_pptt_processor *cpu_node = NULL;
+ int ret = -ENOENT;
+
+ status = acpi_get_table(ACPI_SIG_PPTT, 0, &table);
+ if (ACPI_FAILURE(status)) {
+ acpi_pptt_warn_missing();
+ return ret;
+ }
+
+ if (table->revision >= rev)
+ cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
+
+ if (cpu_node)
+ ret = (cpu_node->flags & flag) != 0;
+
+ acpi_put_table(table);
+
+ return ret;
+}
+
/**
* acpi_find_last_cache_level() - Determines the number of cache levels for a PE
* @cpu: Kernel logical CPU number
@@ -604,6 +642,20 @@ int cache_setup_acpi(unsigned int cpu)
return status;
}
+/**
+ * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
+ * @cpu: Kernel logical CPU number
+ *
+ * Return: 1, a thread
+ * 0, not a thread
+ * -ENOENT ,if the PPTT doesn't exist, the CPU cannot be found or
+ * the table revision isn't new enough.
+ */
+int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD);
+}
+
/**
* find_acpi_cpu_topology() - Determine a unique topology value for a given CPU
* @cpu: Kernel logical CPU number
@@ -664,7 +716,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
return ret;
}
-
/**
* find_acpi_cpu_topology_package() - Determine a unique CPU package value
* @cpu: Kernel logical CPU number
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 9426b9aaed86..9d0e20a2ac83 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address)
#endif
#ifdef CONFIG_ACPI_PPTT
+int acpi_pptt_cpu_is_thread(unsigned int cpu);
int find_acpi_cpu_topology(unsigned int cpu, int level);
int find_acpi_cpu_topology_package(unsigned int cpu);
int find_acpi_cpu_topology_hetero_id(unsigned int cpu);
int find_acpi_cpu_cache_topology(unsigned int cpu, int level);
#else
+static inline int acpi_pptt_cpu_is_thread(unsigned int cpu)
+{
+ return -EINVAL;
+}
static inline int find_acpi_cpu_topology(unsigned int cpu, int level)
{
return -EINVAL;
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 34+ messages in thread
end of thread, other threads:[~2019-08-21 13:25 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 3:46 [PATCH v4 0/2] arm64/PPTT ACPI 6.3 thread flag support Jeremy Linton
2019-08-01 3:46 ` Jeremy Linton
2019-08-01 3:46 ` [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag Jeremy Linton
2019-08-01 3:46 ` Jeremy Linton
2019-08-01 15:57 ` Sudeep Holla
2019-08-01 15:57 ` Sudeep Holla
2019-08-01 16:10 ` Jeremy Linton
2019-08-01 16:10 ` Jeremy Linton
2019-08-02 13:05 ` Robert Richter
2019-08-02 13:05 ` Robert Richter
2019-08-02 15:36 ` Jeremy Linton
2019-08-02 15:36 ` Jeremy Linton
2019-08-01 3:46 ` [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread Jeremy Linton
2019-08-01 3:46 ` Jeremy Linton
2019-08-01 15:58 ` Sudeep Holla
2019-08-01 15:58 ` Sudeep Holla
2019-08-02 13:44 ` Robert Richter
2019-08-02 13:44 ` Robert Richter
2019-08-02 16:04 ` Jeremy Linton
2019-08-02 16:04 ` Jeremy Linton
2019-08-08 20:40 [PATCH v4 0/2] arm64/PPTT ACPI 6.3 thread flag support Jeremy Linton
2019-08-08 20:40 ` [PATCH v4 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag Jeremy Linton
2019-08-08 20:40 ` Jeremy Linton
2019-08-08 22:25 ` Robert Richter
2019-08-08 22:25 ` Robert Richter
2019-08-12 9:06 ` Rafael J. Wysocki
2019-08-12 9:06 ` Rafael J. Wysocki
2019-08-12 11:59 ` Will Deacon
2019-08-12 11:59 ` Will Deacon
2019-08-20 9:01 ` John Garry
2019-08-20 9:01 ` John Garry
2019-08-21 13:20 ` Jeremy Linton
2019-08-21 13:20 ` Jeremy Linton
2019-08-21 13:25 ` John Garry
2019-08-21 13:25 ` John Garry
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.