Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp243849rdb; Sat, 30 Sep 2023 02:51:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGNaqtt56EsRJWKF7kYs+pE9Pn0W4gb/Y8SSUKMkpxvRp6DtJnclL476wsTuAXou+6B0A4 X-Received: by 2002:a17:90b:383:b0:26d:416a:b027 with SMTP id ga3-20020a17090b038300b0026d416ab027mr6655144pjb.31.1696067506603; Sat, 30 Sep 2023 02:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696067506; cv=none; d=google.com; s=arc-20160816; b=mU6G7qE4TFw0ui8bEiSuQmORbEIYvkxiQFy9PGd/p+nWoamtVvzWF7QyXyo9geF2Fy Esl1V7ve/8TyWAst3EoR9WHVvxrQLJrxsjioJC2LZgK/u0s9wteb5Sb13Oe45zCdWhWu D1yY2oocuV8Gq+SkNXsel9vybNjAILVD7r7nQuMHOWkBgHyThE16W9qyPlLD7UVppWAu aAFNGBT15XDkm5aZYDQdW1U/sTN4nXMDglWNjUXXnRax2untybZujvKt3Xskip+BQPCa YayFy0AQqi/ssHFkEqRh5ZYv1uiBQDitRgPAYbYsLxyVF0YpupKucaay28bEjUrntRrK gQzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yFveOKVQSCam1UBm5teYfMQjqyWN+ywxVl+5HAF7chI=; fh=ptkWKGWlQNIik+BEoFpIdNhogIbzLH4KDmABrVZ+/f0=; b=w1w7foNZS8swJwr9lwejAIBSn8dohDlWzlatobdD2avjualv8iwvmzhI9fR36VwiEQ Ff0u9ew0y8tmFKdhn6GnBrP/iMw/0e6hs7Jf7/G/OJzG1lbogQPe5yfs3e7m1e3SxQG8 +sLT0oAAd3JEkDNvPMR4Vh1PJHRaHk5LlB8XADR1v2YuZ3JqvWNZZ1P4wO69ngwTq7Qw XO6OT02C3owOGUMo1dt98KSK/JH87xXVoTXMhnuR5yM/LYxBbpVrb6DBlG6lQPFOBGd+ Rc8IC5HaW5h3yOB+2wtASHWTFInDm2pxdzEKF/WrwavvQVf9fVbubBC9XvnUzD08TgZS t7jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eiEiMrw6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id nv7-20020a17090b1b4700b002743b58483asi3525698pjb.66.2023.09.30.02.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 02:51:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eiEiMrw6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D2EAA8311BDB; Fri, 29 Sep 2023 13:21:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233081AbjI2UVv (ORCPT + 99 others); Fri, 29 Sep 2023 16:21:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232748AbjI2UVu (ORCPT ); Fri, 29 Sep 2023 16:21:50 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C898DB4; Fri, 29 Sep 2023 13:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696018907; x=1727554907; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=bvppsW8w/SZogF5ijdNbZ+Z5nbrwIwzbhRFXCXCD3R0=; b=eiEiMrw66g0t8MP/dKH1SbYjwx1L1URKEB9C6Cui3L0RWSbxcJJA8DBM QhNdcqQ0U8KYABM9C+8hFC0XiyxVmkZPYjrWexqsbRYpsIIggLIuPcHyX HJpsD6xWcCEh+ItwbWl6K2pQZUmJ3pVwUl+pFYvoH9sTPai82ERmUqdm3 3NZCbhrga0YdzhCj2YquKxfySY8TMQhSGyfD4vVXs23VZMCG/kB9K7th9 iQj9i1DS/9wzqWYjvUUoWpGhRm5hPp2YrOtMmpHNvdnmTQO2pT1Tsd2w5 e49y/RffnrPrpqQ2jkIRgrgQezdKCXHXERxMEKwSQXwG2SkA1CH/qfFEM w==; X-IronPort-AV: E=McAfee;i="6600,9927,10848"; a="372713233" X-IronPort-AV: E=Sophos;i="6.03,188,1694761200"; d="scan'208";a="372713233" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 11:38:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10848"; a="1081014613" X-IronPort-AV: E=Sophos;i="6.03,188,1694761200"; d="scan'208";a="1081014613" Received: from agluck-desk3.sc.intel.com (HELO agluck-desk3) ([172.25.222.74]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 11:38:40 -0700 Date: Fri, 29 Sep 2023 11:38:39 -0700 From: Tony Luck To: Peter Newman Cc: Fenghua Yu , Reinette Chatre , Jonathan Corbet , Shuah Khan , x86@kernel.org, Shaopeng Tan , James Morse , Jamie Iles , Babu Moger , Randy Dunlap , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH v6 1/8] x86/resctrl: Prepare for new domain scope Message-ID: References: <20230829234426.64421-1-tony.luck@intel.com> <20230928191350.205703-1-tony.luck@intel.com> <20230928191350.205703-2-tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 13:21:56 -0700 (PDT) On Fri, Sep 29, 2023 at 02:09:42PM +0200, Peter Newman wrote: > Hi Tony, > > On Thu, Sep 28, 2023 at 9:14 PM Tony Luck wrote: > > > > Resctrl resources operate on subsets of CPUs in the system with the > > defining attribute of each subset being an instance of a particular > > level of cache. E.g. all CPUs sharing an L3 cache would be part of the > > same domain. > > > > In preparation for features that are scoped at the NUMA node level > > change the code from explicit references to "cache_level" to a more > > generic scope. At this point the only options for this scope are groups > > of CPUs that share an L2 cache or L3 cache. > > > > Provide a more detailed warning message if a domain id cannot be found > > when adding a CPU. Just check and silent return if the domain id can't > > be found when removing a CPU. > > > > No functional change. > > I see a number of diagnostic checks added below. Are you sure there's > no functional change? Those checks should be for "can't happen" cases where some "scope" that isn't attached to a cache_level somehow made its way down to a routine that is only expecting cache scoped. But I'll remove the "No functional change" from the commit. comment. > > > > diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c > > index 8f559eeae08e..8c5f932bc00b 100644 > > --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c > > +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c > > @@ -292,10 +292,14 @@ static void pseudo_lock_region_clear(struct pseudo_lock_region *plr) > > */ > > static int pseudo_lock_region_init(struct pseudo_lock_region *plr) > > { > > + int scope = plr->s->res->scope; > > struct cpu_cacheinfo *ci; > > int ret; > > int i; > > > > + if (WARN_ON_ONCE(scope != RESCTRL_L2_CACHE && scope != RESCTRL_L3_CACHE)) > > + return -ENODEV; > > Functional change? > > > > diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > index 725344048f85..1cf2b36f5bf8 100644 > > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > @@ -1345,10 +1345,13 @@ unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, > > unsigned int size = 0; > > int num_b, i; > > > > + if (WARN_ON_ONCE(r->scope != RESCTRL_L2_CACHE && r->scope != RESCTRL_L3_CACHE)) > > + return -EINVAL; > > This function returns unsigned int. That's a huge region! I wondered for a bit what value to return for this "can't happen" case and initially went with an error code. But the function can already fail (in ways that won't happen) and in that case the return is "0". I'l update to return 0 here too. > -Peter Thanks for the review. -Tony