From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757495AbcCRPIW (ORCPT ); Fri, 18 Mar 2016 11:08:22 -0400 Received: from [198.137.202.9] ([198.137.202.9]:52145 "EHLO bombadil.infradead.org" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1757460AbcCRPIQ (ORCPT ); Fri, 18 Mar 2016 11:08:16 -0400 Message-Id: <20160318150538.611014173@infradead.org> User-Agent: quilt/0.61-1 Date: Fri, 18 Mar 2016 16:03:48 +0100 From: Peter Zijlstra To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, bp@alien8.de, aherrmann@suse.com, peterz@infradead.org, jencce.kernel@gmail.com Subject: [PATCH 3/3] x86/topology: Fix Intel HT disable References: <20160318150345.146716865@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-x86-fix-ht-siblings.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As per the comment below; due to BIOS it is sometimes impossible to know if there actually are smp siblings until the machine is fully enumerated. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/kernel/smpboot.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -312,8 +312,21 @@ static void __init smp_init_package_map( /* * Today neither Intel nor AMD support heterogenous systems. That * might change in the future.... + * + * While ideally we'd want '* smp_num_siblings' in the below @ncpus + * computation, this won't actually work since some Intel BIOSes + * report inconsistent HT data when they disable HT. + * + * In particular, they reduce the APIC-IDs to only include the cores, + * but leave the CPUID topology to say there are (2) siblings. + * This means we don't know how many threads there will be until + * after the APIC enumeration. + * + * By not including this we'll sometimes over-estimate the number of + * logical packages by the amount of !present siblings, but this is + * still better than MAX_LOCAL_APIC. */ - ncpus = boot_cpu_data.x86_max_cores * smp_num_siblings; + ncpus = boot_cpu_data.x86_max_cores; __max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus); /*