linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sudeep.holla@arm.com (Sudeep Holla)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] arm64: topology: refactor reset_cpu_topology to add support for removing topology
Date: Mon,  4 Jun 2018 11:39:53 +0100	[thread overview]
Message-ID: <1528108797-13743-2-git-send-email-sudeep.holla@arm.com> (raw)
In-Reply-To: <1528108797-13743-1-git-send-email-sudeep.holla@arm.com>

Currently reset_cpu_topology clears all the CPU topology information
and resets to default values. However we may need to just clear the
information when we hotplig out the CPU. In preparation to add the
support the same, let's refactor reset_cpu_topology to clear out the
information and reset them only if explicitly requested.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/arm64/kernel/topology.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index 7415c166281f..f10babcc112b 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -296,28 +296,35 @@ void store_cpu_topology(unsigned int cpuid)
 	update_siblings_masks(cpuid);
 }
 
-static void __init reset_cpu_topology(void)
+static void clear_cpu_topology(int cpu, bool reset)
 {
-	unsigned int cpu;
+	struct cpu_topology *cpu_topo = &cpu_topology[cpu];
 
-	for_each_possible_cpu(cpu) {
-		struct cpu_topology *cpu_topo = &cpu_topology[cpu];
+	cpu_topo->core_id = -1;
+	cpu_topo->thread_id = -1;
+	cpu_topo->package_id = -1;
+	cpu_topo->llc_id = -1;
 
-		cpu_topo->thread_id = -1;
-		cpu_topo->core_id = 0;
-		cpu_topo->package_id = -1;
+	cpumask_clear(&cpu_topo->llc_siblings);
+	cpumask_clear(&cpu_topo->core_sibling);
+	cpumask_clear(&cpu_topo->thread_sibling);
 
-		cpu_topo->llc_id = -1;
-		cpumask_clear(&cpu_topo->llc_siblings);
+	if (reset) {
+		cpu_topo->core_id = 0;
 		cpumask_set_cpu(cpu, &cpu_topo->llc_siblings);
-
-		cpumask_clear(&cpu_topo->core_sibling);
 		cpumask_set_cpu(cpu, &cpu_topo->core_sibling);
-		cpumask_clear(&cpu_topo->thread_sibling);
 		cpumask_set_cpu(cpu, &cpu_topo->thread_sibling);
 	}
 }
 
+static void __init reset_cpu_topology(void)
+{
+	unsigned int cpu;
+
+	for_each_possible_cpu(cpu)
+		clear_cpu_topology(cpu, true);
+}
+
 #ifdef CONFIG_ACPI
 /*
  * Propagate the topology information of the processor_topology_node tree to the
-- 
2.7.4

  reply	other threads:[~2018-06-04 10:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04 10:39 [PATCH 0/5] arm64: numa/topology/smp: fix the cpumasks for CPU hotplug Sudeep Holla
2018-06-04 10:39 ` Sudeep Holla [this message]
2018-06-04 14:58   ` [PATCH 1/5] arm64: topology: refactor reset_cpu_topology to add support for removing topology Jeffrey Hugo
2018-06-04 10:39 ` [PATCH 2/5] arm64: topology: add support to remove cpu topology Sudeep Holla
2018-06-04 10:39 ` [PATCH 3/5] arm64: numa: separate out updates to percpu nodeid and NUMA node cpumap Sudeep Holla
2018-06-04 10:39 ` [PATCH 4/5] arm64: smp: remove cpu and numa topology information when hotplugging out CPU Sudeep Holla
2018-06-04 10:39 ` [PATCH 5/5] arm64: topology: rename llc_siblings to align with other struct members Sudeep Holla
2018-06-12  1:14 ` [PATCH 0/5] arm64: numa/topology/smp: fix the cpumasks for CPU hotplug Hanjun Guo
2018-06-12  9:06   ` Sudeep Holla

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=1528108797-13743-2-git-send-email-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).