From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2B7514E2DF for ; Thu, 11 Apr 2024 14:14:11 +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=1712844853; cv=none; b=Rj+bsj97Jxj1Zade6YBlRBBL9oDMlQDq0T0yvM61YODivunUR6Dg8DatXGuWSJyuC52/mID0ptpni+ydHEv273GqoEGkxaATBbwqZix3RZ1avn78VAv8oW7KHt5T7jMdsnYRhsb346yB34phj/7DdyydLvKVNOb8mzOxLRGlmJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712844853; c=relaxed/simple; bh=lrH2+J0XXKxV+8Kj3RIW5S9eewJKSiihEZArAe73xUE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B+Rt/c+sAS89IzM8sOY8fd4jlUZ1bZjwPyRK9X020oe96iYbp5r1IbUCEZ9KGYPQV4jujTf7mpFhMkqK01jgd2nmaRly8uYO18vgWZCdgXmDXqgnJ6889H/X1/0r9FwT4OJlDnYxTbPJp6zfXtSSm/n5EEL+53FOkJZ2Fp2NFVE= 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 D2823339; Thu, 11 Apr 2024 07:14:40 -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 8537C3F64C; Thu, 11 Apr 2024 07:14:08 -0700 (PDT) Date: Thu, 11 Apr 2024 15:14:06 +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 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> <65e1a55f-eac7-4804-900e-abf1bc0a9041@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: <65e1a55f-eac7-4804-900e-abf1bc0a9041@intel.com> On Mon, Apr 08, 2024 at 08:13:58PM -0700, Reinette Chatre wrote: > Hi James, > > On 3/21/2024 9:50 AM, 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. > > rdt_hw_resource? Looks like it. Noted for James' attention. > > 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 > > --- > > Patch looks good to me. > > Reinette > Noted, thanks. Cheers ---Dave