From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932458AbcIHGbY (ORCPT ); Thu, 8 Sep 2016 02:31:24 -0400 Received: from terminus.zytor.com ([198.137.202.10]:34376 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754584AbcIHGbW (ORCPT ); Thu, 8 Sep 2016 02:31:22 -0400 Date: Wed, 7 Sep 2016 23:29:13 -0700 From: tip-bot for Dou Liyang Message-ID: Cc: torvalds@linux-foundation.org, rientjes@google.com, douly.fnst@cn.fujitsu.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org Reply-To: mingo@kernel.org, hpa@zytor.com, rientjes@google.com, torvalds@linux-foundation.org, peterz@infradead.org, douly.fnst@cn.fujitsu.com, tglx@linutronix.de, linux-kernel@vger.kernel.org In-Reply-To: <1473214893-16481-1-git-send-email-douly.fnst@cn.fujitsu.com> References: <1473214893-16481-1-git-send-email-douly.fnst@cn.fujitsu.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/apic: Fix num_processors value in case of failure Git-Commit-ID: c291b015158577be533dd5a959dfc09bab119eed 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: c291b015158577be533dd5a959dfc09bab119eed Gitweb: http://git.kernel.org/tip/c291b015158577be533dd5a959dfc09bab119eed Author: Dou Liyang AuthorDate: Wed, 7 Sep 2016 10:21:33 +0800 Committer: Ingo Molnar CommitDate: Thu, 8 Sep 2016 08:11:03 +0200 x86/apic: Fix num_processors value in case of failure If the topology package map check of the APIC ID and the CPU is a failure, we don't generate the processor info for that APIC ID yet we increase disabled_cpus by one - which is buggy. Only increase num_processors once we are sure we don't fail. Signed-off-by: Dou Liyang Acked-by: David Rientjes Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1473214893-16481-1-git-send-email-douly.fnst@cn.fujitsu.com [ Rewrote the changelog. ] Signed-off-by: Ingo Molnar --- arch/x86/kernel/apic/apic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 50c95af..f3e9b2d 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version) return -EINVAL; } - num_processors++; if (apicid == boot_cpu_physical_apicid) { /* * x86_bios_cpu_apicid is required to have processors listed @@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version) pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", thiscpu, apicid); + disabled_cpus++; return -ENOSPC; } + num_processors++; + /* * Validate version */