Re: [PATCH v8 17/21] x86,fs/resctrl: Move the resctrl filesystem code to live in /fs/resctrl

Fenghua Yu
2025-04-14T23:21:08Z

Hi, James,

This comment was buried in the middle of this huge patch.

To see my previous comment easily, I cut all other irrelevant code.

On 4/11/25 17:18, Fenghua Yu wrote:
> Hi, James,
>
> On 4/11/25 09:42, James Morse wrote:
>> Resctrl is a filesystem interface to hardware that provides cache
>> allocation policy and bandwidth control for groups of tasks or CPUs.
>>
>> To support more than one architecture, resctrl needs to live in /fs/.
>>
>> Move the code that is concerned with the filesystem interface to
>> /fs/resctrl.
>>
>> Signed-off-by: James Morse <james.morse@arm.com>
>> ---
>> Changes since *:
>>   * This patch is generated by a script.
>> ---
>>   arch/x86/kernel/cpu/resctrl/ctrlmondata.c     |  636 ---
>>   arch/x86/kernel/cpu/resctrl/internal.h        |  380 +-
>>   arch/x86/kernel/cpu/resctrl/monitor.c         |  902 +---
>>   arch/x86/kernel/cpu/resctrl/monitor_trace.h   |   18 +-
>>   arch/x86/kernel/cpu/resctrl/pseudo_lock.c     | 1080 +---
>>   .../kernel/cpu/resctrl/pseudo_lock_trace.h    |    2 +
>>   arch/x86/kernel/cpu/resctrl/rdtgroup.c        | 4556 +----------------
>>   fs/resctrl/ctrlmondata.c                      |  660 +++
>>   fs/resctrl/internal.h                         |  442 ++
>>   fs/resctrl/monitor.c                          |  932 ++++
>>   fs/resctrl/monitor_trace.h                    |   33 +
>>   fs/resctrl/pseudo_lock.c                      | 1115 ++++
>>   fs/resctrl/pseudo_lock_trace.h                |   17 +
>>   fs/resctrl/rdtgroup.c                         | 4313 ++++++++++++++++
>>   14 files changed, 7668 insertions(+), 7418 deletions(-)

[SNIP]

>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> index 326b3048d728..c7a7f0ae373a 100644
>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c

[SNIP]

>> -static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
>> -                 const char *name, umode_t mode,
>> -                 enum rdt_group_type rtype, struct rdtgroup **r)
>> -{
>> -    struct rdtgroup *prdtgrp, *rdtgrp;
>> -    unsigned long files = 0;
>> -    struct kernfs_node *kn;
>> -    int ret;
>> -
>> -    prdtgrp = rdtgroup_kn_lock_live(parent_kn);
>> -    if (!prdtgrp) {
>> -        ret = -ENODEV;
>> -        goto out_unlock;
>> -    }
>> -
>> -    /*
>> -     * Check that the parent directory for a monitor group is a
>> -     * "mon_groups" directory.

The follow is my previous original comment on the merge conflict and the
fix:

> Due to the slight difference between here and the upstream commit
> 45c2e30bbd64 ("x86/resctrl: Fix rdtgroup_mkdir()'s unlocked use of
> kernfs_node::name"), merge conflicts.
>
> You may consider to add the following patch in patch #17 to fix the
> conflict?
>
>         /*
> -        * Check that the parent directory for a monitor group is a
> "mon_groups"
> -        * directory.
> +        * Check that the parent directory for a monitor group is a
> +        * "mon_groups" directory.
>          */
>
[SNIP]

Thanks.

-Fenghua