Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1683215pxb; Wed, 10 Feb 2021 14:14:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/IfHSpN8vWCPyy0ms0S+/a5k+QOpeIFwLXjpedTkDVxyjj8e8UXjftlIMr9dN5eIMVV4n X-Received: by 2002:a17:906:1712:: with SMTP id c18mr5214091eje.417.1612995281444; Wed, 10 Feb 2021 14:14:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995281; cv=none; d=google.com; s=arc-20160816; b=qjAwqB44GwqSubPxcjc7ZsQPLtVbeKZ3VxwWn/v1UAC4kO6oTgyLB5NTe/m5lBdL/p NtBQaqkKsU/JnZzr6uj6R8vVM2Kw8j3TazhwuVi2aJ70Jki9JLjE564qf7osBlcKy/IX 7RPxDK4P6wHzJAcWZytVuFzKS6HVK9zeMtpkL1raj8icLuMXzdj50TTwioiPCJcEhgzH brLqXTkj9WWD2yEBkvlQFBeuIsE4CyD8/T6sumF1YXlb2RWaC95Nk3L5SLJ2REWAgWX6 mTnqy8rWrNlRsOqU/kAp9a3ouYBac2feIw0URcUnmJMyMqHjw9ilBuP6qS+Ax3TQx6WL zj/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=MsuE2zDP6E6z2g5F7QrOUGIdkYKFihfFRUTuvntLuwc=; b=cp6JFXINDmA50L4hKPvaAj1oRAmocbOduczGgUIzuwhmEkCvCTL8uspPp9rWBrvnAo RK+N5c7NVmpd741eG3ahjBxtEn7bFyb1TiiS8IdmvX/7lrKCzaYNSm3ou6HndUhlPfkq zbJ11fm4cp/2WBIvlWeZbbSfK/b09cM+0j/mwPmwxOF2tLHNipUl0SjDX6qx8rfQmWo5 e5xOp3Ou2EI4hp3f+e0sxqbIl0yjDsykvtYlw4sDI6Mx3pMpDSej1FDLVUyVp6pRTZdU iCUR6Z2fUd6Gwp1Irnb9Nsj631PeLChjL1ZeDQbWUhB2ZQS+LTWMjftan8v7pgnjWo4R ircw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si2504401edm.557.2021.02.10.14.14.17; Wed, 10 Feb 2021 14:14:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232554AbhBJWK7 (ORCPT + 99 others); Wed, 10 Feb 2021 17:10:59 -0500 Received: from mga12.intel.com ([192.55.52.136]:55736 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232813AbhBJWKy (ORCPT ); Wed, 10 Feb 2021 17:10:54 -0500 IronPort-SDR: M9CPr5fIEnip2sK+OAzEFH03lweS0hJVdOPKnfYD4NrCmc1cIzBS86LtNFkGXgkpiH92CwCSQ5 tuq73FJfwPAg== X-IronPort-AV: E=McAfee;i="6000,8403,9891"; a="161305879" X-IronPort-AV: E=Sophos;i="5.81,169,1610438400"; d="scan'208";a="161305879" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2021 14:10:11 -0800 IronPort-SDR: 9gI3u5umNx/Ddanw0oR+u0CKPd3wlANZvY/NiacXkBBm8lbXyh0e1YEPDRJgYNdZSTvyY1mAOY kw3h5TTLSzTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,169,1610438400"; d="scan'208";a="362293535" Received: from alison-desk.jf.intel.com (HELO alison-desk) ([10.54.74.53]) by orsmga006.jf.intel.com with ESMTP; 10 Feb 2021 14:10:11 -0800 Date: Wed, 10 Feb 2021 14:11:34 -0800 From: Alison Schofield To: Peter Zijlstra Cc: Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, Dave Hansen , Tony Luck , Tim Chen , "H. Peter Anvin" , David Rientjes , Igor Mammedov , Prarit Bhargava , brice.goglin@gmail.com Subject: Re: [PATCH] x86, sched: Allow NUMA nodes to share an LLC on Intel platforms Message-ID: <20210210221134.GA12410@alison-desk> References: <20210209223943.9834-1-alison.schofield@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 08:38:42PM +0100, Peter Zijlstra wrote: > On Wed, Feb 10, 2021 at 07:22:03AM -0800, Dave Hansen wrote: > > On 2/10/21 12:05 AM, Peter Zijlstra wrote: > > >> + if (IS_ENABLED(CONFIG_NUMA)) > > >> + set_cpu_bug(c, X86_BUG_NUMA_SHARES_LLC); > > >> } > > > This seens wrong too, it shouldn't be allowed pre SKX. And ideally only > > > be allowed when SNC is enabled. > > > > Originally, this just added a few more models to the list of CPUs with > > SNC. I was hoping for something a bit more durable that we wouldn't > > have to go back and poke at every year or two. > > It's not like we don't have to update a gazillion FMS tables for each > new instance anyway :-( > > > > Please make this more specific than: all Intel CPUs. Ofcourse, since you > > > all knew this was an issue, you could've made it discoverable > > > _somewhere_ :-( > > > > You're totally right, of course. The hardware could enumerate SNC as a > > feature explicitly somewhere. But, that's a little silly because all of > > the information that it's enumerating about the CPU caches and NUMA > > nodes present and correct is *correct*. The secondary information would > > only be for the CPU to say, "yeah, I'm really sure about that other stuff". > > > > I think this sanity check has outlived its usefulness. > > Maybe BIOS monkeys got better, but I'm not sure I trust it all. > > So SNC is all on-package, do all those nodes have the same pkg id? That > is, I'm trying to find something to restrict topological madness. > > > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c > index 88cd0064d1f8..de1010dd0bba 100644 > --- a/arch/x86/kernel/smpboot.c > +++ b/arch/x86/kernel/smpboot.c > @@ -458,6 +458,26 @@ static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) > return false; > } > > +static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) > +{ > + if ((c->phys_proc_id == o->phys_proc_id) && > + (c->cpu_die_id == o->cpu_die_id)) > + return true; > + return false; > +} > + > +/* > + * Unlike the other levels, we do not enforce keeping a > + * multicore group inside a NUMA node. If this happens, we will > + * discard the MC level of the topology later. > + */ > +static bool match_pkg(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) > +{ > + if (c->phys_proc_id == o->phys_proc_id) > + return true; > + return false; > +} > + > /* > * Define snc_cpu[] for SNC (Sub-NUMA Cluster) CPUs. > * > @@ -495,33 +515,12 @@ static bool match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) > * means 'c' does not share the LLC of 'o'. This will be > * reflected to userspace. > */ > - if (!topology_same_node(c, o) && x86_match_cpu(snc_cpu)) > + if (!topology_same_node(c, o) && x86_match_cpu(snc_cpu) && match_pkg(c, o)) > return false; > > return topology_sane(c, o, "llc"); > } > This is equivalent to determining if x86_has_numa_in_package. Do you think there is an opportunity to set x86_has_numa_in_package earlier, and use it here and in set_cpu_sibling_map()? With that additional info (match_pkg()) how about - Instead of this: - if (!topology_same_node(c, o) && x86_match_cpu(snc_cpu)) + if (!topology_same_node(c, o) && x86_match_cpu(snc_cpu) && match_pkg(c, o)) Do this: - if (!topology_same_node(c, o) && x86_match_cpu(snc_cpu)) + if (!topology_same_node(c, o) && match_pkg(c, o)) Looking at Commit 316ad248307f ("sched/x86: Rewrite set_cpu_sibling_map()) which reworked topology WARNINGs, the intent was to "make sure to only warn when the check changes the end result" This check doesn't change the end result. It returns false directly and if it were bypassed completely, it would still return false with a WARNING. If we add that additional match_pkg() check is removing the WARNING for all cases possible? -snip