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 97DED21CFFA for ; Fri, 20 Dec 2024 18:11:00 +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=1734718263; cv=none; b=nmSO4+kwyDnvby5vP+N/LPdXp2YiXHSq2cd0oOpuewtmH8GQzdaqDGEnf8oxmPlvljuLYbP36QL8XmRkYwkkEXkZXOPlrsAF7BY7eOlssVJlZfvACt+lfpSeS3Ebguv4Jd40Cmr7YDaW7EyW94oQQOFQ6aWvA/6N6xqVWMMUDLo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734718263; c=relaxed/simple; bh=8vn2SkqEDHG+dAyNt4RuBN7VeBY2Fvg3arrA65jGuMc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FNXoQve7y6HjqOAtFfrwL1D5wNPSbb5wWQoMnaptk7U71VOFyzOfusszx2la/I5IX9u5LRu9/uvWoromJ4brrNBGT5Lmj+T6lCF9j6/jwMxP+YmlS9MOIHDb6M2peCuFi0igaNoZmbuxuvH0P3OoQUB/HPBnBM757DN6UpsjEIQ= 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 195151E7D; Fri, 20 Dec 2024 10:11:28 -0800 (PST) Received: from [10.1.196.57] (eglon.cambridge.arm.com [10.1.196.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E84703F720; Fri, 20 Dec 2024 10:10:56 -0800 (PST) Message-ID: <16348abf-44b3-4de5-88ee-adf6d0352c5e@arm.com> Date: Fri, 20 Dec 2024 18:10:50 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 03/40] x86/resctrl: Remove fflags from struct rdt_resource To: Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org Cc: 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 , Dave Martin , Shaopeng Tan References: <20241004180347.19985-1-james.morse@arm.com> <20241004180347.19985-4-james.morse@arm.com> <8d4896ea-9bb5-4565-b678-51a63c560747@intel.com> Content-Language: en-GB From: James Morse In-Reply-To: <8d4896ea-9bb5-4565-b678-51a63c560747@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Reinette, On 23/10/2024 22:03, Reinette Chatre wrote: > On 10/4/24 11:03 AM, James Morse wrote: >> The resctrl arch code specifies whether a resource controls a cache or >> memory using the fflags field. This field is then used by resctrl to >> determine which files should be exposed in the filesystem. >> >> Allowing the architecture to pick this value means the RFTYPE_ >> flags have to be in a shared header, and allows an architecture >> to create a combination that resctrl does not support. >> >> Remove the fflags field, and pick the value based on the resource >> id. >> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> index 6225d0b7e9ee..2abe17574407 100644 >> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> @@ -2160,6 +2160,20 @@ static int rdtgroup_mkdir_info_resdir(void *priv, char *name, >> return ret; >> } >> >> +static u32 fflags_from_resource(struct rdt_resource *r) > > What is motivation for the return type of u32? I am trying to understand why this is needed > considering the value returned, variable it is assigned to, and the functions that use it > (rdtgroup_mkdir_info_resdir() and rdtgroup_add_files()) all use unsigned long. There are only 10 bits defined, it looks like I just auto-typed int, then corrected it to u32, with the intention of the compiler generating a warning if it ever attempts to mask in a values larger than the return type. I've changed it to unsigned-long. >> +{ >> + switch (r->rid) { >> + case RDT_RESOURCE_L3: >> + case RDT_RESOURCE_L2: >> + return RFTYPE_RES_CACHE; >> + case RDT_RESOURCE_MBA: >> + case RDT_RESOURCE_SMBA: >> + return RFTYPE_RES_MB; >> + } >> + >> + return WARN_ON_ONCE(1); >> +} >> + >> static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) >> { >> struct resctrl_schema *s; >> @@ -2180,14 +2194,14 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) >> /* loop over enabled controls, these are all alloc_capable */ >> list_for_each_entry(s, &resctrl_schema_all, list) { >> r = s->res; >> - fflags = r->fflags | RFTYPE_CTRL_INFO; >> + fflags = fflags_from_resource(r) | RFTYPE_CTRL_INFO; >> ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags); >> if (ret) >> goto out_destroy; >> } >> >> for_each_mon_capable_rdt_resource(r) { >> - fflags = r->fflags | RFTYPE_MON_INFO; >> + fflags = fflags_from_resource(r) | RFTYPE_MON_INFO; > > Fixup did not make it here. Fixed, Thanks, James