Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S971417AbdDTREw (ORCPT ); Thu, 20 Apr 2017 13:04:52 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:4838 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S971400AbdDTREs (ORCPT ); Thu, 20 Apr 2017 13:04:48 -0400 X-IronPort-AV: E=Sophos;i="5.37,225,1488844800"; d="scan'208";a="44677736" Subject: Re: [Xen-devel] [PATCH RFC] x86/smpboot: Set safer __max_logical_packages limit To: Peter Zijlstra , Vitaly Kuznetsov References: <20170420132453.19652-1-vkuznets@redhat.com> <20170420150615.ns3343rokvmc3kjt@hirez.programming.kicks-ass.net> CC: Prarit Bhargava , , , Ingo Molnar , "H. Peter Anvin" , , Thomas Gleixner , Borislav Petkov From: Andrew Cooper Message-ID: Date: Thu, 20 Apr 2017 18:04:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170420150615.ns3343rokvmc3kjt@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1622 Lines: 37 On 20/04/17 16:06, Peter Zijlstra wrote: > On Thu, Apr 20, 2017 at 03:24:53PM +0200, Vitaly Kuznetsov wrote: >> In this patch I suggest we set __max_logical_packages based on the >> max_physical_pkg_id and total_cpus, > So my 4 socket 144 CPU system will then get max_physical_pkg_id=144, > instead of 4. > > This wastes quite a bit of memory for the per-node arrays. Luckily most > are just pointer arrays, but still, wasting 140*8 bytes for each of > them. > >> this should be safe and cover all >> possible cases. Alternatively, we may think about eliminating the concept >> of __max_logical_packages completely and relying on max_physical_pkg_id/ >> total_cpus where we currently use topology_max_packages(). >> >> The issue could've been solved in Xen too I guess. CPUID returning >> x86_max_cores can be tweaked to be the lowerest(?) possible number of >> all logical packages of the guest. > This is getting ludicrous. Xen is plain broken, and instead of fixing > it, you propose to somehow deal with its obviously crack induced > behaviour :-( Xen is (and has been forever) plain broken in this specific regard. Fixing CPUID handling for guests has taken me 18 months and ~80 patches so far, and it still isn't complete. However, Linux needs to be able to function on existing production systems (which is every instance of Xen currently running). Linux shouldn't BUG() because something provided by the firmware looks wonky. This is conceptually no different from finding junk the APCI tables. (I fully agree that we shouldn't have got to this state, but we are 12 years too late in this respect.) ~Andrew