From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752819AbcBVTHR (ORCPT ); Mon, 22 Feb 2016 14:07:17 -0500 Received: from www.linutronix.de ([62.245.132.108]:35996 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752700AbcBVTHM (ORCPT ); Mon, 22 Feb 2016 14:07:12 -0500 Date: Mon, 22 Feb 2016 20:05:54 +0100 (CET) From: Thomas Gleixner To: Andi Kleen cc: LKML , Peter Zijlstra , x86@kernel.org, Borislav Petkov , Stephane Eranian , Harish Chegondi , Kan Liang , Andi Kleen , Jacob Pan Subject: Re: [patch V2 11/28] x86/topology: Create logical package id In-Reply-To: <87h9h0pody.fsf@tassilo.jf.intel.com> Message-ID: References: <20160222110337.198341739@linutronix.de> <20160222110441.100696947@linutronix.de> <87h9h0pody.fsf@tassilo.jf.intel.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andi, On Mon, 22 Feb 2016, Andi Kleen wrote: > Thomas Gleixner writes: > > + if (c->cpuid_level >= 0x00000001) { > > + u32 eax, ebx, ecx, edx; > > + > > + cpuid(0x00000001, &eax, &ebx, &ecx, &edx); > > Use cpuid_edx() That does not give me EBX ... > > + /* > > + * If HTT (EDX[28]) is set EBX[16:23] contain the number of > > + * apicids which are reserved per package. Store the resulting > > + * shift value for the package management code. > > + */ > > + if (edx & (1U << 28)) > > + c->x86_coreid_bits = get_count_order((ebx >> 16) & 0xff); > > + } > > +++ b/arch/x86/kernel/cpu/proc.c > > @@ -12,6 +12,7 @@ static void show_cpuinfo_core(struct seq > > { > > #ifdef CONFIG_SMP > > seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); > > + seq_printf(m, "logical id\t: %d\n", c->logical_proc_id); > > > I'm not sure it makes sense to export this. What good would it be for > the user? > > If it was it would need to be documented somewhere. But I would > just drop it and keep it kernel internal. You are right. We print already when we change the package number, so it can be retrieved from dmesg. > FWIW every time something is added to this file it usually breaks > some (dumb) programs. Ok, did not think about that. > > + /* > > + * Today neither Intel nor AMD support heterogenous systems. That > > + * might change in the future.... > > + */ > > + ncpus = boot_cpu_data.x86_max_cores * smp_num_siblings; > > + __max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus); > > FWIW Hypervisors can do nearly everything today. > > I assume your code handles it. It should. At least as long as nr_cpu_ids is sufficiently large. > Let's hope that the Hypervisors always set up the correct CPUID now > for their sibling configuration. If they don't with this change > some CPUs would be suddenly lost. The ones I looked at are doing is sane. Famous last words :) > Would it be worth to have a kernel option where the maximum can be overriden > in case this happens? Let's wait for it to happen. It's done in no time, but if not needed it's just ballast. Thanks, tglx