From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753827AbcCSJdz (ORCPT ); Sat, 19 Mar 2016 05:33:55 -0400 Received: from [198.137.202.10] ([198.137.202.10]:58058 "EHLO terminus.zytor.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753436AbcCSJdn (ORCPT ); Sat, 19 Mar 2016 05:33:43 -0400 Date: Sat, 19 Mar 2016 02:30:35 -0700 From: tip-bot for Peter Zijlstra Message-ID: Cc: peterz@infradead.org, umgwanakikbuti@gmail.com, jencce.kernel@gmail.com, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de Reply-To: umgwanakikbuti@gmail.com, peterz@infradead.org, jencce.kernel@gmail.com, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de In-Reply-To: <20160318150538.482393396@infradead.org> References: <20160317095220.GO6344@twins.programming.kicks-ass.net> <20160318150538.482393396@infradead.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/topology: Fix logical package mapping Git-Commit-ID: b5d5f27d938fb6fc8d3202704e699d2694a02da6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: b5d5f27d938fb6fc8d3202704e699d2694a02da6 Gitweb: http://git.kernel.org/tip/b5d5f27d938fb6fc8d3202704e699d2694a02da6 Author: Peter Zijlstra AuthorDate: Fri, 18 Mar 2016 16:03:46 +0100 Committer: Thomas Gleixner 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 Signed-off-by: Peter Zijlstra (Intel) Cc: aherrmann@suse.com Cc: bp@alien8.de Cc: Mike Galbraith 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 --- 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;