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


Groups > linux.kernel > #1360718 > unrolled thread

[PATCH 1/3] x86/topology: Fix logical pkg mapping

Started byPeter Zijlstra <peterz@infradead.org>
First post2016-03-18 16:10 +0100
Last post2016-03-19 10:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/3] x86/topology: Fix logical pkg mapping Peter Zijlstra <peterz@infradead.org> - 2016-03-18 16:10 +0100
    [tip:x86/urgent] x86/topology: Fix logical package mapping tip-bot for Peter Zijlstra <tipbot@zytor.com> - 2016-03-19 10:40 +0100

#1360718 — [PATCH 1/3] x86/topology: Fix logical pkg mapping

FromPeter Zijlstra <peterz@infradead.org>
Date2016-03-18 16:10 +0100
Subject[PATCH 1/3] x86/topology: Fix logical pkg mapping
Message-ID<re4ci-8fa-7@gated-at.bofh.it>
That first branch testing pkg against __max_logical_packages is wrong,
because if the first pkg id is larger, then the find_first_zero will
find us logical package id 0. However, if the second pkg id is indeed
0, we'll again claim it without testing if it was already taken.

Also, it fails to print the mapping.

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andreas Herrmann <aherrmann@suse.com>
Reported-by: Xiong Zhou <jencce.kernel@gmail.com>
Fixes: 1f12e32f4cd5 ("x86/topology: Create logical package id")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160317095220.GO6344@twins.programming.kicks-ass.net
---
 arch/x86/kernel/cpu/amd.c |    8 ++++----
 arch/x86/kernel/smpboot.c |   11 ++++++-----
 2 files changed, 10 insertions(+), 9 deletions(-)

--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -274,11 +274,6 @@ int topology_update_package_map(unsigned
 	if (test_and_set_bit(pkg, physical_package_map))
 		goto found;
 
-	if (pkg < __max_logical_packages) {
-		set_bit(pkg, logical_package_map);
-		physical_to_logical_pkg[pkg] = pkg;
-		goto found;
-	}
 	new = find_first_zero_bit(logical_package_map, __max_logical_packages);
 	if (new >= __max_logical_packages) {
 		physical_to_logical_pkg[pkg] = -1;

[toc] | [next] | [standalone]


#1361069 — [tip:x86/urgent] x86/topology: Fix logical package mapping

Fromtip-bot for Peter Zijlstra <tipbot@zytor.com>
Date2016-03-19 10:40 +0100
Subject[tip:x86/urgent] x86/topology: Fix logical package mapping
Message-ID<relwu-6mG-15@gated-at.bofh.it>
In reply to#1360718
Commit-ID:  b5d5f27d938fb6fc8d3202704e699d2694a02da6
Gitweb:     http://git.kernel.org/tip/b5d5f27d938fb6fc8d3202704e699d2694a02da6
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Fri, 18 Mar 2016 16:03:46 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 19 Mar 2016 10:26:40 +0100

x86/topology: Fix logical package mapping

That first branch testing pkg against __max_logical_packages is wrong,
because if the first pkg id is larger, then the find_first_zero will
find us logical package id 0. However, if the second pkg id is indeed
0, we'll again claim it without testing if it was already taken.

Also, it fails to print the mapping.

Fixes: 1f12e32f4cd5 ("x86/topology: Create logical package id")
Reported-by: Xiong Zhou <jencce.kernel@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: aherrmann@suse.com
Cc: bp@alien8.de
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Link: http://lkml.kernel.org/r/20160317095220.GO6344@twins.programming.kicks-ass.net
Link: http://lkml.kernel.org/r/20160318150538.482393396@infradead.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/smpboot.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 643dbdc..64b669d 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -274,11 +274,6 @@ int topology_update_package_map(unsigned int apicid, unsigned int cpu)
 	if (test_and_set_bit(pkg, physical_package_map))
 		goto found;
 
-	if (pkg < __max_logical_packages) {
-		set_bit(pkg, logical_package_map);
-		physical_to_logical_pkg[pkg] = pkg;
-		goto found;
-	}
 	new = find_first_zero_bit(logical_package_map, __max_logical_packages);
 	if (new >= __max_logical_packages) {
 		physical_to_logical_pkg[pkg] = -1;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web