Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp447736lqg; Thu, 11 Apr 2024 07:43:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3Z83FuCrRcgKbd5afL1ixhF6wiAuZjLs8yxhqTpFPu4H/NFqn6JGPJW3+CGA/j8MSuuK3D0hrujbU6ge+xuYEBcdLY00b2PerbTCmZw== X-Google-Smtp-Source: AGHT+IHaM6/5IC5Bt1GhiOw757a0xY5TbL72NPX1W919B9PFkoS16S8OKxq1kL44HKEH948egye2 X-Received: by 2002:a17:90b:50ce:b0:2a5:fb3a:32e8 with SMTP id sb14-20020a17090b50ce00b002a5fb3a32e8mr3508550pjb.38.1712846633261; Thu, 11 Apr 2024 07:43:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712846633; cv=pass; d=google.com; s=arc-20160816; b=NwqZXwzu2oVpUkAJg/AiXyAhneiR5Cux1gtFDd2oJQkYuinlbi10J/jUhk/sC/Imh0 ArZt5CDnKoT0mfpOL+6KAavNaRp2UAsAJbHUKrwjGGPEgHOPmh7Hn5bQlGNxHKXASQVC kNLAeXPUuQ0pMQmGM+rtPs0IqgOLiVjnFvCQUqPOwq8rRNZp7k/uJ9tleUc5uZTAfXRT 4KVyvgjS51oIVUeN07zX0pJFCAOwmQcmNa9NavAKUEwUhhaM94gXCD21x44vwPZa8mwP s7Jp6iNiT2/nrorQRJh4o5Z7WFuMuzymmxavtYd0YB69hpLEuwLetaAbkhBz8zV79xD8 DJQg== 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=MTSUq1gFtEpsZi/u1tCumh7vMGEwnbbylvlGNMvVMJc=; fh=16RTrL4O4dV4wsANasVwHAMOabshasPr7EDWXC+LxOs=; b=SUnfA6P/9j49Mmh0wosFDYoa8IJCzWjF/mFCmkkfmtOgbp3Dv5hAQR6cH7MR7qojou gsLDMAXFanLXZ/DMbBGiYhWGL5h4sQFw0HLN6IhgGgobrXPl3FBJIdFlTpxCPP5j+TNy pb0eOs3HXkRgvyNGtCIqe/v949HxN4KHbNExhVoNeel/StfVJc1sdql/FZLkt9i28G0T qk3Z3kB2FyDNmEKVutAh/WRKm2NrlmYPwvlZuG/JmCp5Zx38pP6L6Do5nbgHwrgIhhqA zL5t6tq4CYnWG4pPh+/af2VHXSsJoDifN6ojhMvvMvIQp5gfjyldwm0z36Y7fhoY65H3 xx9g==; 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-140610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140610-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p3-20020a17090ad30300b002a03fca83e0si1473174pju.24.2024.04.11.07.43.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 07:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; 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-140610-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140610-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A7717B285F2 for ; Thu, 11 Apr 2024 14:14:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7395A14EC5E; Thu, 11 Apr 2024 14:13:58 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8DC014E2F4 for ; Thu, 11 Apr 2024 14:13:56 +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=1712844838; cv=none; b=V+VTLeikPDibc3Q2t2foQblWs2/0oF5MaCAApbhe8+Q2JqqbX5p+shUiOTO9enqyacDh87k6DDnAJf34DJA4niMuCTZKLetTNP9jODP64JaFmxKCpALSf+LY6vOMXzJE6oEgW1UXAXz0vSIjxDob7AX2gg509fTrN2XI9n95U/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712844838; c=relaxed/simple; bh=NByPv6yv5P75S9oumtguMO6kDK+RUnXUMoQAexiicwk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Pxa4ZseSZsyiILind4tAZ/wZLnDEPKeOyU7rGx+hl/wO4oWraW5jxK0i4EorUiisvoSQJnA/n464dDLaiGKj6xdmi9lGnW/c0v99E24fL/b7RItlM3KayZJPLshnI9ocmMoQhl8A4Jubm+ocYfnjOXeoM06y0OV4MUnRmk6GkpM= 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 A018C339; Thu, 11 Apr 2024 07:14:25 -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 533E83F64C; Thu, 11 Apr 2024 07:13:53 -0700 (PDT) Date: Thu, 11 Apr 2024 15:13:50 +0100 From: Dave Martin To: David Hildenbrand Cc: James Morse , x86@kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu , Reinette Chatre , 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, Rex Nie Subject: Re: [PATCH v1 02/31] x86/resctrl: Add a helper to avoid reaching into the arch code resource list Message-ID: References: <20240321165106.31602-1-james.morse@arm.com> <20240321165106.31602-3-james.morse@arm.com> <1488fa2e-9552-4f52-bcf9-aeef68049ce0@redhat.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: <1488fa2e-9552-4f52-bcf9-aeef68049ce0@redhat.com> On Tue, Apr 09, 2024 at 10:09:20AM +0200, David Hildenbrand wrote: > On 21.03.24 17:50, James Morse wrote: > > Resctrl occasionally wants to know something about a specific resource, > > in these cases it reaches into the arch code's rdt_resources_all[] > > array. > > > > Once the filesystem parts of resctrl are moved to /fs/, this means it > > will need visibility of the architecture specific struct > > resctrl_hw_resource definition, and the array of all resources. > > All architectures would also need a r_resctrl member in this struct. > > > > Instead, abstract this via a helper to allow architectures to do > > different things here. Move the level enum to the resctrl header and > > add a helper to retrieve the struct rdt_resource by 'rid'. > > > > resctrl_arch_get_resource() should not return NULL for any value in > > the enum, it may instead return a dummy resource that is > > !alloc_enabled && !mon_enabled. > > > > Signed-off-by: James Morse > > --- > > Reviewed-by: David Hildenbrand > > -- > Cheers, > > David / dhildenb Thanks; noted for James' attention. Cheers ---Dave > >