[v4,2/7] x86/resctrl: Remove unnecessary rftype flags

Message ID 168177445556.1758847.5029687867896978170.stgit@bmoger-ubuntu
State New
Headers
Series x86/resctrl: Miscellaneous resctrl features |

Commit Message

Moger, Babu April 17, 2023, 11:34 p.m. UTC
  Remove unnecessary rftype flags to avoid multiple indirection.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
 arch/x86/kernel/cpu/resctrl/internal.h |    9 +++------
 arch/x86/kernel/cpu/resctrl/rdtgroup.c |    6 +++++-
 2 files changed, 8 insertions(+), 7 deletions(-)
  

Comments

Reinette Chatre May 4, 2023, 6:58 p.m. UTC | #1
Hi Babu,

On 4/17/2023 4:34 PM, Babu Moger wrote:
> Remove unnecessary rftype flags to avoid multiple indirection.

Could you please elaborate what makes these flags unnecessary?


Reinette
  
Moger, Babu May 5, 2023, 6:31 p.m. UTC | #2
[AMD Official Use Only - General]

Hi Reinette,

> -----Original Message-----
> From: Reinette Chatre <reinette.chatre@intel.com>
> Sent: Thursday, May 4, 2023 1:59 PM
> To: Moger, Babu <Babu.Moger@amd.com>; corbet@lwn.net;
> tglx@linutronix.de; mingo@redhat.com; bp@alien8.de
> Cc: fenghua.yu@intel.com; dave.hansen@linux.intel.com; x86@kernel.org;
> hpa@zytor.com; paulmck@kernel.org; akpm@linux-foundation.org;
> quic_neeraju@quicinc.com; rdunlap@infradead.org;
> damien.lemoal@opensource.wdc.com; songmuchun@bytedance.com;
> peterz@infradead.org; jpoimboe@kernel.org; pbonzini@redhat.com;
> chang.seok.bae@intel.com; pawan.kumar.gupta@linux.intel.com;
> jmattson@google.com; daniel.sneddon@linux.intel.com; Das1, Sandipan
> <Sandipan.Das@amd.com>; tony.luck@intel.com; james.morse@arm.com;
> linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org;
> bagasdotme@gmail.com; eranian@google.com; christophe.leroy@csgroup.eu;
> jarkko@kernel.org; adrian.hunter@intel.com; quic_jiles@quicinc.com;
> peternewman@google.com
> Subject: Re: [PATCH v4 2/7] x86/resctrl: Remove unnecessary rftype flags
> 
> Hi Babu,
> 
> On 4/17/2023 4:34 PM, Babu Moger wrote:
> > Remove unnecessary rftype flags to avoid multiple indirection.
> 
> Could you please elaborate what makes these flags unnecessary?

Yea. Probably should not say unnecessary.
How about this ?
"rftype flags have two prefixes, RFTYPE_ and RF_. Remove the flag names with suffix RF_ and avoid indirection."

Thanks
Babu
  
Reinette Chatre May 5, 2023, 6:54 p.m. UTC | #3
Hi Babu,

On 5/5/2023 11:31 AM, Moger, Babu wrote:
> [AMD Official Use Only - General]
> 
> Hi Reinette,
> 
>> -----Original Message-----
>> From: Reinette Chatre <reinette.chatre@intel.com>
>> Sent: Thursday, May 4, 2023 1:59 PM
>> To: Moger, Babu <Babu.Moger@amd.com>; corbet@lwn.net;
>> tglx@linutronix.de; mingo@redhat.com; bp@alien8.de
>> Cc: fenghua.yu@intel.com; dave.hansen@linux.intel.com; x86@kernel.org;
>> hpa@zytor.com; paulmck@kernel.org; akpm@linux-foundation.org;
>> quic_neeraju@quicinc.com; rdunlap@infradead.org;
>> damien.lemoal@opensource.wdc.com; songmuchun@bytedance.com;
>> peterz@infradead.org; jpoimboe@kernel.org; pbonzini@redhat.com;
>> chang.seok.bae@intel.com; pawan.kumar.gupta@linux.intel.com;
>> jmattson@google.com; daniel.sneddon@linux.intel.com; Das1, Sandipan
>> <Sandipan.Das@amd.com>; tony.luck@intel.com; james.morse@arm.com;
>> linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org;
>> bagasdotme@gmail.com; eranian@google.com; christophe.leroy@csgroup.eu;
>> jarkko@kernel.org; adrian.hunter@intel.com; quic_jiles@quicinc.com;
>> peternewman@google.com
>> Subject: Re: [PATCH v4 2/7] x86/resctrl: Remove unnecessary rftype flags
>>
>> Hi Babu,
>>
>> On 4/17/2023 4:34 PM, Babu Moger wrote:
>>> Remove unnecessary rftype flags to avoid multiple indirection.
>>
>> Could you please elaborate what makes these flags unnecessary?
> 
> Yea. Probably should not say unnecessary.
> How about this ?
> "rftype flags have two prefixes, RFTYPE_ and RF_. Remove the flag names with suffix RF_ and avoid indirection."

I do not think that having a different prefix is a motivation
for a flag to be removed. Having a different prefix could
rather be a motivation for a flag to be renamed to a consistent
name.

Could you please describe the problem being solved?
That will help to clarify if this patch is really needed.

Reinette
  
Moger, Babu May 5, 2023, 7:04 p.m. UTC | #4
[AMD Official Use Only - General]

Hi Reinette,

> -----Original Message-----
> From: Reinette Chatre <reinette.chatre@intel.com>
> Sent: Friday, May 5, 2023 1:54 PM
> To: Moger, Babu <Babu.Moger@amd.com>; corbet@lwn.net;
> tglx@linutronix.de; mingo@redhat.com; bp@alien8.de
> Cc: fenghua.yu@intel.com; dave.hansen@linux.intel.com; x86@kernel.org;
> hpa@zytor.com; paulmck@kernel.org; akpm@linux-foundation.org;
> quic_neeraju@quicinc.com; rdunlap@infradead.org;
> damien.lemoal@opensource.wdc.com; songmuchun@bytedance.com;
> peterz@infradead.org; jpoimboe@kernel.org; pbonzini@redhat.com;
> chang.seok.bae@intel.com; pawan.kumar.gupta@linux.intel.com;
> jmattson@google.com; daniel.sneddon@linux.intel.com; Das1, Sandipan
> <Sandipan.Das@amd.com>; tony.luck@intel.com; james.morse@arm.com;
> linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org;
> bagasdotme@gmail.com; eranian@google.com; christophe.leroy@csgroup.eu;
> jarkko@kernel.org; adrian.hunter@intel.com; quic_jiles@quicinc.com;
> peternewman@google.com
> Subject: Re: [PATCH v4 2/7] x86/resctrl: Remove unnecessary rftype flags
> 
> Hi Babu,
> 
> On 5/5/2023 11:31 AM, Moger, Babu wrote:
> > [AMD Official Use Only - General]
> >
> > Hi Reinette,
> >
> >> -----Original Message-----
> >> From: Reinette Chatre <reinette.chatre@intel.com>
> >> Sent: Thursday, May 4, 2023 1:59 PM
> >> To: Moger, Babu <Babu.Moger@amd.com>; corbet@lwn.net;
> >> tglx@linutronix.de; mingo@redhat.com; bp@alien8.de
> >> Cc: fenghua.yu@intel.com; dave.hansen@linux.intel.com;
> >> x86@kernel.org; hpa@zytor.com; paulmck@kernel.org;
> >> akpm@linux-foundation.org; quic_neeraju@quicinc.com;
> >> rdunlap@infradead.org; damien.lemoal@opensource.wdc.com;
> >> songmuchun@bytedance.com; peterz@infradead.org;
> jpoimboe@kernel.org;
> >> pbonzini@redhat.com; chang.seok.bae@intel.com;
> >> pawan.kumar.gupta@linux.intel.com;
> >> jmattson@google.com; daniel.sneddon@linux.intel.com; Das1, Sandipan
> >> <Sandipan.Das@amd.com>; tony.luck@intel.com; james.morse@arm.com;
> >> linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org;
> >> bagasdotme@gmail.com; eranian@google.com;
> >> christophe.leroy@csgroup.eu; jarkko@kernel.org;
> >> adrian.hunter@intel.com; quic_jiles@quicinc.com;
> >> peternewman@google.com
> >> Subject: Re: [PATCH v4 2/7] x86/resctrl: Remove unnecessary rftype
> >> flags
> >>
> >> Hi Babu,
> >>
> >> On 4/17/2023 4:34 PM, Babu Moger wrote:
> >>> Remove unnecessary rftype flags to avoid multiple indirection.
> >>
> >> Could you please elaborate what makes these flags unnecessary?
> >
> > Yea. Probably should not say unnecessary.
> > How about this ?
> > "rftype flags have two prefixes, RFTYPE_ and RF_. Remove the flag names
> with suffix RF_ and avoid indirection."
> 
> I do not think that having a different prefix is a motivation for a flag to be
> removed. Having a different prefix could rather be a motivation for a flag to be
> renamed to a consistent name.
> 
> Could you please describe the problem being solved?

Motivation for these changes.
1. Remove the naming inconsistency
2. Remove the indirection
3. Make it easier for adding new flags

Thanks
Babu
 
> That will help to clarify if this patch is really needed.
> 
> Reinette
  
Reinette Chatre May 5, 2023, 9:28 p.m. UTC | #5
Hi Babu,

On 5/5/2023 12:04 PM, Moger, Babu wrote:
> [AMD Official Use Only - General]
> 
> Hi Reinette,
> 
>> -----Original Message-----
>> From: Reinette Chatre <reinette.chatre@intel.com>
>> Sent: Friday, May 5, 2023 1:54 PM
>> To: Moger, Babu <Babu.Moger@amd.com>; corbet@lwn.net;
>> tglx@linutronix.de; mingo@redhat.com; bp@alien8.de
>> Cc: fenghua.yu@intel.com; dave.hansen@linux.intel.com; x86@kernel.org;
>> hpa@zytor.com; paulmck@kernel.org; akpm@linux-foundation.org;
>> quic_neeraju@quicinc.com; rdunlap@infradead.org;
>> damien.lemoal@opensource.wdc.com; songmuchun@bytedance.com;
>> peterz@infradead.org; jpoimboe@kernel.org; pbonzini@redhat.com;
>> chang.seok.bae@intel.com; pawan.kumar.gupta@linux.intel.com;
>> jmattson@google.com; daniel.sneddon@linux.intel.com; Das1, Sandipan
>> <Sandipan.Das@amd.com>; tony.luck@intel.com; james.morse@arm.com;
>> linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org;
>> bagasdotme@gmail.com; eranian@google.com; christophe.leroy@csgroup.eu;
>> jarkko@kernel.org; adrian.hunter@intel.com; quic_jiles@quicinc.com;
>> peternewman@google.com
>> Subject: Re: [PATCH v4 2/7] x86/resctrl: Remove unnecessary rftype flags

(is it possible to trim the headers in your replies?)

...

>>>> On 4/17/2023 4:34 PM, Babu Moger wrote:
>>>>> Remove unnecessary rftype flags to avoid multiple indirection.
>>>>
>>>> Could you please elaborate what makes these flags unnecessary?
>>>
>>> Yea. Probably should not say unnecessary.
>>> How about this ?
>>> "rftype flags have two prefixes, RFTYPE_ and RF_. Remove the flag names
>> with suffix RF_ and avoid indirection."
>>
>> I do not think that having a different prefix is a motivation for a flag to be
>> removed. Having a different prefix could rather be a motivation for a flag to be
>> renamed to a consistent name.
>>
>> Could you please describe the problem being solved?
> 
> Motivation for these changes.
> 1. Remove the naming inconsistency
> 2. Remove the indirection
> 3. Make it easier for adding new flags
> 

Could you please create a coherent changelog that follows the guidance
of the maintainer doc? Some details about why the indirection needs to be
removed and how this makes it easier to add new flags?

Reinette
  
Moger, Babu May 9, 2023, 6:54 p.m. UTC | #6
Hi Reinette,

On 5/5/23 16:28, Reinette Chatre wrote:
> Hi Babu,
> 
> On 5/5/2023 12:04 PM, Moger, Babu wrote:
>> [AMD Official Use Only - General]
>>
>> Hi Reinette,
>>
>>> -----Original Message-----
>>> From: Reinette Chatre <reinette.chatre@intel.com>
>>> Sent: Friday, May 5, 2023 1:54 PM
>>> To: Moger, Babu <Babu.Moger@amd.com>; corbet@lwn.net;
>>> tglx@linutronix.de; mingo@redhat.com; bp@alien8.de
>>> Cc: fenghua.yu@intel.com; dave.hansen@linux.intel.com; x86@kernel.org;
>>> hpa@zytor.com; paulmck@kernel.org; akpm@linux-foundation.org;
>>> quic_neeraju@quicinc.com; rdunlap@infradead.org;
>>> damien.lemoal@opensource.wdc.com; songmuchun@bytedance.com;
>>> peterz@infradead.org; jpoimboe@kernel.org; pbonzini@redhat.com;
>>> chang.seok.bae@intel.com; pawan.kumar.gupta@linux.intel.com;
>>> jmattson@google.com; daniel.sneddon@linux.intel.com; Das1, Sandipan
>>> <Sandipan.Das@amd.com>; tony.luck@intel.com; james.morse@arm.com;
>>> linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org;
>>> bagasdotme@gmail.com; eranian@google.com; christophe.leroy@csgroup.eu;
>>> jarkko@kernel.org; adrian.hunter@intel.com; quic_jiles@quicinc.com;
>>> peternewman@google.com
>>> Subject: Re: [PATCH v4 2/7] x86/resctrl: Remove unnecessary rftype flags
> 
> (is it possible to trim the headers in your replies?)
> 
You mean Company Header..  Sure.. Will do.

> ...
> 
>>>>> On 4/17/2023 4:34 PM, Babu Moger wrote:
>>>>>> Remove unnecessary rftype flags to avoid multiple indirection.
>>>>>
>>>>> Could you please elaborate what makes these flags unnecessary?
>>>>
>>>> Yea. Probably should not say unnecessary.
>>>> How about this ?
>>>> "rftype flags have two prefixes, RFTYPE_ and RF_. Remove the flag names
>>> with suffix RF_ and avoid indirection."
>>>
>>> I do not think that having a different prefix is a motivation for a flag to be
>>> removed. Having a different prefix could rather be a motivation for a flag to be
>>> renamed to a consistent name.
>>>
>>> Could you please describe the problem being solved?
>>
>> Motivation for these changes.
>> 1. Remove the naming inconsistency
>> 2. Remove the indirection
>> 3. Make it easier for adding new flags
>>
> 
> Could you please create a coherent changelog that follows the guidance
> of the maintainer doc? Some details about why the indirection needs to be
> removed and how this makes it easier to add new flags?

Sure. Will try to address it next revision.
  
Moger, Babu May 9, 2023, 7:31 p.m. UTC | #7
On 5/5/23 16:28, Reinette Chatre wrote:
> 
> (is it possible to trim the headers in your replies?)

Sure. Got it. Thanks
Babu
  

Patch

diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 85ceaf9a31ac..62767774810d 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -243,12 +243,9 @@  struct rdtgroup {
  */
 #define RFTYPE_INFO			BIT(0)
 #define RFTYPE_BASE			BIT(1)
-#define RF_CTRLSHIFT			4
-#define RF_MONSHIFT			5
-#define RF_TOPSHIFT			6
-#define RFTYPE_CTRL			BIT(RF_CTRLSHIFT)
-#define RFTYPE_MON			BIT(RF_MONSHIFT)
-#define RFTYPE_TOP			BIT(RF_TOPSHIFT)
+#define RFTYPE_CTRL			BIT(4)
+#define RFTYPE_MON			BIT(5)
+#define RFTYPE_TOP			BIT(6)
 #define RFTYPE_RES_CACHE		BIT(8)
 #define RFTYPE_RES_MB			BIT(9)
 #define RF_CTRL_INFO			(RFTYPE_INFO | RFTYPE_CTRL)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index df5bd13440b0..6cd0a8396f30 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -3239,7 +3239,11 @@  static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
 		goto out_destroy;
 	}
 
-	files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype);
+	if (rtype == RDTCTRL_GROUP)
+		files = RFTYPE_BASE | RFTYPE_CTRL;
+	else
+		files = RFTYPE_BASE | RFTYPE_MON;
+
 	ret = rdtgroup_add_files(kn, files);
 	if (ret) {
 		rdt_last_cmd_puts("kernfs fill error\n");