Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp427874lqg; Thu, 11 Apr 2024 07:14:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXMe8eIl95sr9VxXa8mJBR/neu34N78Nb1K4GawoIW97UzsLUDe/9nyk86t+xT7WObgygpQ62YdP171vvS9zuwVvXDer1v3CVj1c+V22A== X-Google-Smtp-Source: AGHT+IFKTYi7IE9XHV+xlACBIcEFIlaSeHgeeRKNxRDRlSi78tu/IJdd8jI0vnfQgRSRB+tMEy67 X-Received: by 2002:a17:907:3da3:b0:a52:ec:811c with SMTP id he35-20020a1709073da300b00a5200ec811cmr4526045ejc.6.1712844898023; Thu, 11 Apr 2024 07:14:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712844898; cv=pass; d=google.com; s=arc-20160816; b=iOeGs4eumjm+TzjVXUEPrpkBJIOGsLjltFTje2nk8dhinSlCNkpIdEGVj5QcrxaBuP uMHRXmetTh43HuNGH+f7xST+oEYTslwWm13jJ8WIaMXiLN3SDU71WGMn0IfVP/56CJg9 V7cNiCqvzKGynNCMjw/nrKroM0SQfPbUGNeQBe0QYzzsyHKHvtoqNrMqLPSuWN/oIgAb 6Q++Xi+bPMhuP8g6Sc86ZqhXCrUx2k6Jykx1sp8bkJqYIGf9oc5OZ+u3ArNjFHA/7ZLX WquGlBUE+4HrRgNvBRJqKGfupMs9hwNhaVU83TthWYakDhE5eGmjYYm8bOIstl/TRwoy YR8w== 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=/kZOHObO7O9+B/ZYNWAAFLXEDVhuOO4vfX/hecK70cM=; fh=QpfXcl1MWRNwK/PrSFDaf8vyLNOqSjtq+qtJ/l97qlo=; b=VMNfFHajS1rR0ax0fAQ0XTyeDlcFlRYKvEQF8xgcuGqEXNWpOlgeDq6/4piVVfQr/u nBb8ICpSYf9uq8Ns7QzJKUgfxCuvkxUApSYaJmGPSLufEbYhfChN49hbir2kWqC/MWgJ yckAFNGEhDnb8/tXMxiQpKncUPT5//fNyaF1+fwm6XFdU354eNB/RSmZrmAWbLI61llz 3fvRCT31p/mu4npI6DyMbImdbhY27m7xk/MJCiNWPAkPPlywnc4CkLxUaJETA+3gZk/Q SJ3HpjHTUmIPqPYCw/4DaDuVXqLP3WzeJFKS452MNJMGYcbVJZhESLSy0vwNxN+f4UgY apaQ==; 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-140612-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140612-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 lw20-20020a170906bcd400b00a51dd500070si787533ejb.139.2024.04.11.07.14.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 07:14:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140612-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-140612-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140612-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 B23481F21E73 for ; Thu, 11 Apr 2024 14:14:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA79214EC52; Thu, 11 Apr 2024 14:14:13 +0000 (UTC) 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