Re: [PATCH] x86/resctrl: Add task resctrl information display

From: Yu Chen
Date: Thu Nov 14 2019 - 23:13:21 EST


Hi Boris,
Thanks for looking at the patch.
On Wed, Nov 13, 2019 at 07:23:07PM +0100, Borislav Petkov wrote:
> On Thu, Nov 07, 2019 at 11:27:31AM +0800, Chen Yu wrote:
> > Monitoring tools that want to find out which resctrl CTRL
> > and MONITOR groups a task belongs to must currently read
> > the "tasks" file in every group until they locate the process
> > ID.
> >
> > Add an additional file /proc/{pid}/resctrl to provide this
> > information.
> >
> > For example:
> > cat /proc/1193/resctrl
> > CTRL_MON:/ctrl_grp0
> > MON:/ctrl_grp0/mon_groups/mon_grp0
> >
> > If the resctrl filesystem has not been mounted,
> > reading /proc/{pid}/resctrl returns an error:
> > cat: /proc/1193/resctrl: No such device
> >
> > Tested-by: Jinshi Chen <jinshi.chen@xxxxxxxxx>
> > Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
> > Reviewed-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
> > Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
> > Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
> >
> > ---
> > arch/x86/include/asm/resctrl_sched.h | 4 +++
> > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 46 ++++++++++++++++++++++++++
> > fs/proc/base.c | 9 +++++
> ^^^^^^^^^^^^^^^
>
> So you're touching this file here and yet your Cc list doesn't have
> *anyone* who might be responsible for the proc fs (yeah, you have
> linux-fsdevel but I don't think that's enough). Have you heard of
> scripts/get_maintainer.pl?
>
> Use it in the future.
>
> Cc-ing some more people for the generic /proc bits.
>
Okay, thanks.
> > 3 files changed, 59 insertions(+)
> >
> > +
> > + if (rdtg->closid == tsk->closid) {
>
> Save an indentation level:
>
> if (rdtg->closid != tsk->closid)
> continue;
>
> seq_printf...
>
Okay.
> > +#ifdef CONFIG_X86_CPU_RESCTRL
> > +#include <asm/resctrl_sched.h>
> > +#endif
>
> If anything, this should be abstracted nicely into an
> include/linux/resctrl.h header. Other architectures would probably wanna
> use it too, I hear ARM64 has something like resctrl.
>
Okay, created this header in the next version.
> > +#endif
> > +#ifdef CONFIG_X86_CPU_RESCTRL
> > + ONE("resctrl", S_IRUGO, proc_resctrl_show),
> > #endif
>
> Same here. proc_resctrl_show() looks like a generic function but it
> is x86-only. Need to call the x86-specific one in a real generic
> proc_resctrl_show() which other arches can add their code to, too.
>
> Not like that.
>
Okay, in next version proc_resctrl_show() is declared in resctrl.h.
However since there's no common c source file for resctrl currently,
different architectures might need to implement proc_resctrl_show()
accordingly - currently only x86 needs to do that.

Thanks,
Chenyu
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette