Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733577

[PATCH for 4.9 27/39] x86/acpi: Restore the order of CPU IDs

From "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Newsgroups linux.kernel
Subject [PATCH for 4.9 27/39] x86/acpi: Restore the order of CPU IDs
Date 2017-09-18 02:50 +0200
Message-ID <uqSq6-72l-21@gated-at.bofh.it> (permalink)
References <uqSq5-72l-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Dou Liyang <douly.fnst@cn.fujitsu.com>

[ Upstream commit 2b85b3d22920db7473e5fed5719e7955c0ec323e ]

The following commits:

  f7c28833c2 ("x86/acpi: Enable acpi to register all possible cpus at
boot time") and 8f54969dc8 ("x86/acpi: Introduce persistent storage
for cpuid <-> apicid mapping")

... registered all the possible CPUs at boot time via ACPI tables to
make the mapping of cpuid <-> apicid fixed. Both enabled and disabled
CPUs could have a logical CPU ID after boot time.

But, ACPI tables are unreliable. the number amd order of Local APIC
entries which depends on the firmware is often inconsistent with the
physical devices. Even if they are consistent, The disabled CPUs which
take up some logical CPU IDs will also make the order discontinuous.

Revert the part of disabled CPUs registration, keep the allocation
logic of logical CPU IDs and also keep some code location changes.

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Tested-by: Xiaolong Ye <xiaolong.ye@intel.com>
Cc: rjw@rjwysocki.net
Cc: linux-acpi@vger.kernel.org
Cc: guzheng1@huawei.com
Cc: izumi.taku@jp.fujitsu.com
Cc: lenb@kernel.org
Link: http://lkml.kernel.org/r/1488528147-2279-4-git-send-email-douly.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 arch/x86/kernel/acpi/boot.c |  7 ++++++-
 arch/x86/kernel/apic/apic.c | 26 +++++++-------------------
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index d3e0d049a0c2..b89bef95f63b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -176,10 +176,15 @@ static int acpi_register_lapic(int id, u32 acpiid, u8 enabled)
 		return -EINVAL;
 	}
 
+	if (!enabled) {
+		++disabled_cpus;
+		return -EINVAL;
+	}
+
 	if (boot_cpu_physical_apicid != -1U)
 		ver = boot_cpu_apic_version;
 
-	cpu = __generic_processor_info(id, ver, enabled);
+	cpu = generic_processor_info(id, ver);
 	if (cpu >= 0)
 		early_per_cpu(x86_cpu_to_acpiid, cpu) = acpiid;
 
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index f2234918e494..e2ead34da465 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2070,7 +2070,7 @@ static int allocate_logical_cpuid(int apicid)
 	return nr_logical_cpuids++;
 }
 
-int __generic_processor_info(int apicid, int version, bool enabled)
+int generic_processor_info(int apicid, int version)
 {
 	int cpu, max = nr_cpu_ids;
 	bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
@@ -2128,11 +2128,9 @@ int __generic_processor_info(int apicid, int version, bool enabled)
 	if (num_processors >= nr_cpu_ids) {
 		int thiscpu = max + disabled_cpus;
 
-		if (enabled) {
-			pr_warning("APIC: NR_CPUS/possible_cpus limit of %i "
-				   "reached. Processor %d/0x%x ignored.\n",
-				   max, thiscpu, apicid);
-		}
+		pr_warning("APIC: NR_CPUS/possible_cpus limit of %i "
+			   "reached. Processor %d/0x%x ignored.\n",
+			   max, thiscpu, apicid);
 
 		disabled_cpus++;
 		return -EINVAL;
@@ -2184,23 +2182,13 @@ int __generic_processor_info(int apicid, int version, bool enabled)
 		apic->x86_32_early_logical_apicid(cpu);
 #endif
 	set_cpu_possible(cpu, true);
-
-	if (enabled) {
-		num_processors++;
-		physid_set(apicid, phys_cpu_present_map);
-		set_cpu_present(cpu, true);
-	} else {
-		disabled_cpus++;
-	}
+	physid_set(apicid, phys_cpu_present_map);
+	set_cpu_present(cpu, true);
+	num_processors++;
 
 	return cpu;
 }
 
-int generic_processor_info(int apicid, int version)
-{
-	return __generic_processor_info(apicid, version, true);
-}
-
 int hard_smp_processor_id(void)
 {
 	return read_apic_id();
-- 
2.11.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH for 4.9 18/39] iommu/exynos: Block SYSMMU while invalidating  FLPD cache "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 27/39] x86/acpi: Restore the order of CPU IDs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 22/39] netfilter: nfnl_cthelper: fix incorrect  helper->expect_class_max "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 35/39] xfs: remove kmem_zalloc_greedy "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 31/39] rds: ib: add error handle "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 24/39] nfs: make nfs4_cb_sv_ops static "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 32/39] md/raid10: submit bio directly to replacement  disk "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 38/39] ARM: dts: BCM5301X: Fix memory start address "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 29/39] arm64: kasan: avoid bad virt_to_pfn() "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 39/39] tools/power turbostat: bugfix: GFXMHz column  not changing "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 20/39] MIPS: smp-cps: Fix retrieval of VPE mask on big  endian CPUs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 28/39] iommu/io-pgtable-arm: Check for leaf entry  before dereferencing it "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 23/39] parisc: perf: Fix potential NULL pointer  dereference "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 34/39] i2c: meson: fix wrong variable usage in  meson_i2c_put_data "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 36/39] ASoC: wm_adsp: Return an error on write to a  disabled volatile control "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 25/39] ibmvnic: Free tx/rx scrq pointer array when  releasing sub-crqs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 33/39] netfilter: nf_tables: set pktinfo->thoff at AH  header if found "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200
  [PATCH for 4.9 37/39] libata: transport: Remove circular dependency  at free time "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-18 02:50 +0200

csiph-web