From: John Garry <john.garry@huawei.com>
To: <stable@vger.kernel.org>
Cc: <catalin.marinas@arm.com>, <will@kernel.org>, <rjw@rjwysocki.net>,
<lenb@kernel.org>, <sudeep.holla@arm.com>, <rrichter@marvell.com>,
<jeremy.linton@arm.com>, <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
<linuxarm@huawei.com>, <gregkh@linuxfoundation.org>,
<guohanjun@huawei.com>, <wanghuiqiang@huawei.com>,
John Garry <john.garry@huawei.com>
Subject: [PATCH for-stable-5.3 2/2] arm64: topology: Use PPTT to determine if PE is a thread
Date: Mon, 14 Oct 2019 19:56:02 +0800 [thread overview]
Message-ID: <1571054162-71090-3-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1571054162-71090-1-git-send-email-john.garry@huawei.com>
From: Jeremy Linton <jeremy.linton@arm.com>
Commit 98dc19902a0b2e5348e43d6a2c39a0a7d0fc639e upstream.
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>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Robert Richter <rrichter@marvell.com>
[will: made acpi_cpu_is_threaded() return 'bool']
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: John Garry <john.garry@huawei.com>
---
arch/arm64/kernel/topology.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index 0825c4a856e3..6106c49f84bc 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -340,17 +340,28 @@ void remove_cpu_topology(unsigned int cpu)
}
#ifdef CONFIG_ACPI
+static bool __init acpi_cpu_is_threaded(int cpu)
+{
+ int is_threaded = acpi_pptt_cpu_is_thread(cpu);
+
+ /*
+ * if the PPTT doesn't have thread information, assume a homogeneous
+ * machine and return the current CPU's thread state.
+ */
+ if (is_threaded < 0)
+ is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
+
+ return !!is_threaded;
+}
+
/*
* Propagate the topology information of the processor_topology_node tree to the
* cpu_topology array.
*/
static int __init parse_acpi_topology(void)
{
- bool is_threaded;
int cpu, topology_id;
- is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
-
for_each_possible_cpu(cpu) {
int i, cache_id;
@@ -358,7 +369,7 @@ static int __init parse_acpi_topology(void)
if (topology_id < 0)
return topology_id;
- if (is_threaded) {
+ if (acpi_cpu_is_threaded(cpu)) {
cpu_topology[cpu].thread_id = topology_id;
topology_id = find_acpi_cpu_topology(cpu, 1);
cpu_topology[cpu].core_id = topology_id;
--
2.17.1
prev parent reply other threads:[~2019-10-14 11:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 11:56 [PATCH for-stable-5.3 0/3] ACPI, arm64: Backport for ACPI PPTT 6.3 thread flag John Garry
2019-10-14 11:56 ` [PATCH for-stable-5.3 1/2] ACPI/PPTT: Add support for ACPI " John Garry
2019-10-14 23:29 ` Sasha Levin
2019-10-15 8:16 ` John Garry
2019-10-15 22:04 ` Sasha Levin
2019-10-14 11:56 ` John Garry [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1571054162-71090-3-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=guohanjun@huawei.com \
--cc=jeremy.linton@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=rjw@rjwysocki.net \
--cc=rrichter@marvell.com \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=wanghuiqiang@huawei.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox