[v4,0/7] x86/resctrl: Miscellaneous resctrl features

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

Message

Moger, Babu April 17, 2023, 11:33 p.m. UTC
  These series adds support few minor features.
1. Support assigning multiple tasks to control/mon groups in one command.
2. Add debug mount option for resctrl interface.
3. Add RMID and CLOSID in resctrl interface when mounted with debug option.
4. While doing these above changes, found that rftype flags needed some cleanup.
   They were named inconsistently. Re-arranged them much more cleanly now.
   Hope it can help future additions.

---
v4: Changes since v3
    Addressed comments from Reinette and others.
    Removed newline requirement when adding tasks.
    Dropped one of the changes on flags. Kept the flag names mostly same.
    Changed the names of closid and rmid to ctrl_hw_id and mon_hw_id respectively.
    James had some concerns about adding these files. But I thing it is big problem.
    Please comment back if we can do better. 
    Tried to address Reinette's comment on patch 7. But due to current code design
    I could not do it exact way. But changed it little bit to make it easy debug
    file additions in the future.  

v3: Changes since v2
    Still waiting for more comments. While waiting, addressed few comments from Fenghua.
    Added few more texts in the documentation about multiple tasks assignment feature.
    Added pid in last_cmd_status when applicable.
    Introduced static resctrl_debug to save the debug option.
    Few minor text changes.
  
v2: Changes since v1
  a. Removed the changes to add the task's threads automatically. It required
     book keeping to handle the failures and gets complicated. Removed that change
     for now.
  b. Added -o debug option to mount in debug mode(comment from Fenghua)
  c. Added debug files rmid and closid. Stephane wanted to rename them more
     generic to accommodate ARM. It kind of loses meaning if is renamed differently.
     Kept it same for now. Will change if he feels strong about it. 

v3: https://lore.kernel.org/lkml/167778850105.1053859.14596357862185564029.stgit@bmoger-ubuntu/
v2: https://lore.kernel.org/lkml/167537433143.647488.9641864719195184123.stgit@bmoger-ubuntu/
v1: https://lore.kernel.org/lkml/167278351577.34228.12803395505584557101.stgit@bmoger-ubuntu/

Babu Moger (7):
      x86/resctrl: Add multiple tasks to the resctrl group at once
      x86/resctrl: Remove unnecessary rftype flags
      x86/resctrl: Rename rftype flags for consistency
      x86/resctrl: Re-arrange RFTYPE flags and add more comments
      x86/resctrl: Introduce "-o debug" mount option
      x86/resctrl: Display CLOSID and RMID for the resctrl groups
      x86/resctrl: Add debug files when mounted with debug option


 Documentation/x86/resctrl.rst          |  29 +++-
 arch/x86/kernel/cpu/resctrl/internal.h |  62 ++++++--
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 188 ++++++++++++++++++++++---
 3 files changed, 243 insertions(+), 36 deletions(-)

--
  

Comments

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

On 4/17/2023 4:33 PM, Babu Moger wrote:
> These series adds support few minor features.
> 1. Support assigning multiple tasks to control/mon groups in one command.
> 2. Add debug mount option for resctrl interface.
> 3. Add RMID and CLOSID in resctrl interface when mounted with debug option.
> 4. While doing these above changes, found that rftype flags needed some cleanup.
>    They were named inconsistently. Re-arranged them much more cleanly now.
>    Hope it can help future additions.
> 
> ---
> v4: Changes since v3
>     Addressed comments from Reinette and others.
>     Removed newline requirement when adding tasks.
>     Dropped one of the changes on flags. Kept the flag names mostly same.
>     Changed the names of closid and rmid to ctrl_hw_id and mon_hw_id respectively.
>     James had some concerns about adding these files. But I thing it is big problem.
>     Please comment back if we can do better. 

From what I understand the primary concern was the naming of the
files, which you address in this version. 

A second point I saw was a request for insight into why user space may need this
(James recommended obfuscation when value is only shared between kernel interfaces).
You did answer this in your response and since there was no follow-up I currently
assume that this has been answered.

Unless we hear otherwise from James I thus believe that his feedback is
addressed.

>     Tried to address Reinette's comment on patch 7. But due to current code design
>     I could not do it exact way. But changed it little bit to make it easy debug
>     file additions in the future.  

Could you please elaborate? It actually looks like you may be headed there next
according to:
https://lore.kernel.org/lkml/933d8ae2-d8b7-7436-5918-f639405c9ecb@amd.com/

Reinette
  
Moger, Babu May 5, 2023, 3:43 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: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 0/7] x86/resctrl: Miscellaneous resctrl features
> 
> Hi Babu,
> 
> On 4/17/2023 4:33 PM, Babu Moger wrote:
> > These series adds support few minor features.
> > 1. Support assigning multiple tasks to control/mon groups in one command.
> > 2. Add debug mount option for resctrl interface.
> > 3. Add RMID and CLOSID in resctrl interface when mounted with debug
> option.
> > 4. While doing these above changes, found that rftype flags needed some
> cleanup.
> >    They were named inconsistently. Re-arranged them much more cleanly
> now.
> >    Hope it can help future additions.
> >
> > ---
> > v4: Changes since v3
> >     Addressed comments from Reinette and others.
> >     Removed newline requirement when adding tasks.
> >     Dropped one of the changes on flags. Kept the flag names mostly same.
> >     Changed the names of closid and rmid to ctrl_hw_id and mon_hw_id
> respectively.
> >     James had some concerns about adding these files. But I thing it is big
> problem.
> >     Please comment back if we can do better.
> 
> From what I understand the primary concern was the naming of the files, which
> you address in this version.
> 
> A second point I saw was a request for insight into why user space may need
> this (James recommended obfuscation when value is only shared between
> kernel interfaces).
> You did answer this in your response and since there was no follow-up I
> currently assume that this has been answered.
> 
> Unless we hear otherwise from James I thus believe that his feedback is
> addressed.

Ok. Sounds good.

> 
> >     Tried to address Reinette's comment on patch 7. But due to current code
> design
> >     I could not do it exact way. But changed it little bit to make it easy debug
> >     file additions in the future.
> 
> Could you please elaborate? It actually looks like you may be headed there next
> according to:
> https://lore.kernel.org/lkml/933d8ae2-d8b7-7436-5918-
> f639405c9ecb@amd.com/

Sorry, I was talking about this comment.
https://lore.kernel.org/lkml/fef12c9e-7d6f-bcd4-f92e-e776eb9e673b@intel.com/

I tried to address it here. 
https://lore.kernel.org/lkml/168177451010.1758847.568218491528297451.stgit@bmoger-ubuntu/

This may not be the exact way you mentioned.  Reason is, adding the flags before rdtgroup_add_files cannot be done. It does not update the resctrl root filesystem.
These files have to added by calling rdtgroup_add_file and kernfs_activate in rdt_enable_ctx.
Thanks
Babu
  
Reinette Chatre May 5, 2023, 5:47 p.m. UTC | #3
Hi Babu,

On 5/5/2023 8:43 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: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 0/7] x86/resctrl: Miscellaneous resctrl features
>>

...

>>>     Tried to address Reinette's comment on patch 7. But due to current code
>> design
>>>     I could not do it exact way. But changed it little bit to make it easy debug
>>>     file additions in the future.
>>
>> Could you please elaborate? It actually looks like you may be headed there next
>> according to:
>> https://lore.kernel.org/lkml/933d8ae2-d8b7-7436-5918-
>> f639405c9ecb@amd.com/
> 
> Sorry, I was talking about this comment.
> https://lore.kernel.org/lkml/fef12c9e-7d6f-bcd4-f92e-e776eb9e673b@intel.com/
> 
> I tried to address it here. 
> https://lore.kernel.org/lkml/168177451010.1758847.568218491528297451.stgit@bmoger-ubuntu/
> 
> This may not be the exact way you mentioned.  Reason is, adding the
> flags before rdtgroup_add_files cannot be done. It does not update
> the resctrl root filesystem. These files have to added by calling
> rdtgroup_add_file and kernfs_activate in rdt_enable_ctx.
I think what you are referring to is files not appearing in the default
resource group? From what I can tell the files should appear when new resource
groups are created. Could the default resource group's files not also
be added on resctrl mount (moved from rdtgroup_setup_root() to rdt_get_tree())?
I do not see why the files belonging to the default group are required to be
added before resctrl mount and with the move the resctrl_debug flag can
continue to be set in rdt_enable_ctx() and available to rdtgroup_add_files()
when adding the default resource group's files.

To me this sounds simpler since there is no duplicate file add/remove code,
and the debug files are just another file type.

Reinette
  
Moger, Babu May 5, 2023, 6:03 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 12:47 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 0/7] x86/resctrl: Miscellaneous resctrl features
> 
> Hi Babu,
> 
> On 5/5/2023 8:43 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: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 0/7] x86/resctrl: Miscellaneous resctrl
> >> features
> >>
> 
> ...
> 
> >>>     Tried to address Reinette's comment on patch 7. But due to
> >>> current code
> >> design
> >>>     I could not do it exact way. But changed it little bit to make it easy debug
> >>>     file additions in the future.
> >>
> >> Could you please elaborate? It actually looks like you may be headed
> >> there next according to:
> >> https://lore.kernel.org/lkml/933d8ae2-d8b7-7436-5918-
> >> f639405c9ecb@amd.com/
> >
> > Sorry, I was talking about this comment.
> > https://lore.kernel.org/lkml/fef12c9e-7d6f-bcd4-f92e-e776eb9e673b@inte
> > l.com/
> >
> > I tried to address it here.
> > https://lore.kernel.org/lkml/168177451010.1758847.568218491528297451.s
> > tgit@bmoger-ubuntu/
> >
> > This may not be the exact way you mentioned.  Reason is, adding the
> > flags before rdtgroup_add_files cannot be done. It does not update the
> > resctrl root filesystem. These files have to added by calling
> > rdtgroup_add_file and kernfs_activate in rdt_enable_ctx.
> I think what you are referring to is files not appearing in the default resource
> group? From what I can tell the files should appear when new resource groups
> are created. Could the default resource group's files not also be added on
> resctrl mount (moved from rdtgroup_setup_root() to rdt_get_tree())?

Yes. I can try that.

> I do not see why the files belonging to the default group are required to be
> added before resctrl mount and with the move the resctrl_debug flag can
> continue to be set in rdt_enable_ctx() and available to rdtgroup_add_files()
> when adding the default resource group's files.
> 
> To me this sounds simpler since there is no duplicate file add/remove code, and
> the debug files are just another file type.

Yes. If it works then It will make code simple. Will try and let you know.
Thanks
Babu
  
Shaopeng Tan (Fujitsu) May 29, 2023, 10:18 a.m. UTC | #5
Hi Babu,

> These series adds support few minor features.
> 1. Support assigning multiple tasks to control/mon groups in one command.
> 2. Add debug mount option for resctrl interface.
> 3. Add RMID and CLOSID in resctrl interface when mounted with debug option.
> 4. While doing these above changes, found that rftype flags needed some
> cleanup.
>    They were named inconsistently. Re-arranged them much more cleanly
> now.
>    Hope it can help future additions.

I tested these features and ran the selftests/resctrl test set,
it seems to be fine.

Maybe the next version will come soon with some fixes,
I will test it again.

<Tested-by:tan.shaopeng@jp.fujitsu.com>

Best regards,
Shaopeng TAN