Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp429683lqg; Thu, 11 Apr 2024 07:17:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVyMCDwklL2lhxNTASDd0h8EolHDVJ8DQOjR2mMpVbygg41R+ZvBNcbmYZMytQJWB97xXxBf4Kv9ZxNh/A79SfIN/b/0OPVJ8oeyOiXyA== X-Google-Smtp-Source: AGHT+IGkrVoH8LTPWidD2FPX4qL8RSNeNDFRp/ynXFFQvW6NJl5yhlKY/YYEb3k0qAzOQ2W0Qoid X-Received: by 2002:a50:a69a:0:b0:56e:63d3:cb3e with SMTP id e26-20020a50a69a000000b0056e63d3cb3emr3583402edc.41.1712845041823; Thu, 11 Apr 2024 07:17:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712845041; cv=pass; d=google.com; s=arc-20160816; b=Cu4aRyNRC41TT2o0A2WZ6c9rnJ9A23Tf8WkKw1NpVfCkQzOw0il9rR+GKTl0pccuKj b0eAXQe3fx+h8i+mdY5TuNwGaYgEB9sISrW+lA78WR4aijzacNmaccqE2zZY+z0UkUQp PGodluq9Emu8os23AGZjRRgt7p/pUXI65dWu/Rzy3SNiJegQ9ZbX/rmrytSP+GgDEVrD uxV/481BF7VvVMWXYCGjMfPw6oG89jJGamXgXu0mGbMcS9KxtGVoOpcWBgnTUCiHva5q EZYF+NRyCtA4RC8JaWNrZ/P9RfgvVGtKfErf4Wb3g9Va6GEMZFr+fOn8Suesj1jTC0tT JHwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=lI6sjq3FOFokUxMa256vwdx+4EOHSW5pbHKsoxFDjtM=; fh=QpfXcl1MWRNwK/PrSFDaf8vyLNOqSjtq+qtJ/l97qlo=; b=ypXArMG2EYnDsbgpTr3UxglNukIzjaxpc4uAZ6ubjsHMc+MBsTgwt9V6kwB1eXPg1X rYcZV3aOFl70EhcTdfJgrVm9quvh4j68cEwI8rZS13V2Sy1NgT0oxN7078jX4R8cMgQD byyhHtfSTo1TG9Oo0hPaNF9evwL3X/pMCDXVwy0gThFGzrR6lOWicMdPa0xqHhqM3TGv buWBGFr1fTN+f5Lo4YkehYY1wICBydNvTHUNu/anYCGOGB6d2pl3oerQdvi8mn9fok8N VBCIpQ7t7lpYG2bcmkMFp1JYWDPub00C0mTqg1q/PfrNEQQ4ajNbBNMeUOLWV1E03JYg F0Ag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-140621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t6-20020a056402524600b0056fde9c51easi809425edd.459.2024.04.11.07.17.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 07:17:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-140621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 84F8F1F22295 for ; Thu, 11 Apr 2024 14:17:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04CC814F9D5; Thu, 11 Apr 2024 14:16:09 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 475CA14EC7D for ; Thu, 11 Apr 2024 14:16:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712844968; cv=none; b=ddhQuZ7Klcv9+O4Oe670lGMVUrFqFRYNkWBskRxRPIFoXQki6DXgNfvP57axc3OT45P9Ikmn6F0/GzDAIFa3Bx96Jb2St/gH3mx6dUWm4rymlS+pmEi5UnWQMzUdeIQcHA6nIjMS36hRGpo6OIpDd5NPkecFhpCfTaBnH2Omun0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712844968; c=relaxed/simple; bh=VURZfbujbR/cSK3LncKJi7+/qsd91o8bKnsDkv60Vew=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=vGogGcZ/ShXDyHnvYYBiK+bcaalIwDYGARLifXKFqVdTEXteAAGwiJjSv8oeDcM4CHkUQjQpkhj4NrZ+Vi08rE/MCSrlabSukdCYH3hcUd9CBiHgImmNnZQI6CmQfxjAGXHwMURON8ArT09HAp2dwdAqp5P/sIrF0rAHxiWfkRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 65397339; Thu, 11 Apr 2024 07:16:36 -0700 (PDT) Received: from e133380.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 17B9D3F64C; Thu, 11 Apr 2024 07:16:03 -0700 (PDT) Date: Thu, 11 Apr 2024 15:16:01 +0100 From: Dave Martin To: Reinette Chatre Cc: James Morse , x86@kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Rex Nie Subject: Re: [PATCH v1 13/31] x86/resctrl: Stop using the for_each_*_rdt_resource() walkers Message-ID: References: <20240321165106.31602-1-james.morse@arm.com> <20240321165106.31602-14-james.morse@arm.com> <9d339257-97c3-4d9f-aa02-c43713fd33df@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d339257-97c3-4d9f-aa02-c43713fd33df@intel.com> On Mon, Apr 08, 2024 at 08:19:40PM -0700, Reinette Chatre wrote: > Hi James, > > On 3/21/2024 9:50 AM, James Morse wrote: > > The for_each_*_rdt_resource() helpers walk the architectures array > > architecture's ? Noted. > > of structures, using the resctrl visible part as an iterator. These > > became over-complex when the structures were split into a > > filesystem and architecture-specific struct. This approach avoided > > the need to touch every call site. > > > > Once the filesystem parts of resctrl are moved to /fs/, both the > > architecture's resource array, and the definition of those structures > > is no longer accessible. To support resctrl, each architecture would > > have to provide equally complex macros. > > > > Change the resctrl code that uses these to walk through the resource_level > > enum and check the mon/alloc capable flags instead. Instances in core.c, > > and resctrl_arch_reset_resources() remain part of x86's architecture > > specific code. > > > > Signed-off-by: James Morse > > --- > > arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 7 +++++- > > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 30 +++++++++++++++++++---- > > 2 files changed, 31 insertions(+), 6 deletions(-) [...] > > diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > index e736e4d20f63..3f16e7854411 100644 > > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c [...] > > @@ -2205,8 +2211,12 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) > > goto out_destroy; > > } > > > > - for_each_mon_capable_rdt_resource(r) { > > - fflags = r->fflags | RFTYPE_MON_INFO; > > + for (i = 0; i < RDT_NUM_RESOURCES; i++) { > > + r = resctrl_arch_get_resource(i); > > + if (!r->mon_capable) > > + continue; > > + > > + fflags = r->fflags | RFTYPE_MON_INFO; > > Please check spacing. [...] > Reinette Noted, thanks. Cheers ---Dave