Re: [PATCH v3 09/26] x86/resctrl: Change generic monitor functions to use struct rdt_domain_hdr

Reinette Chatre
2025-04-18T22:42:23Z

Hi Tony,

On 4/7/25 4:40 PM, Tony Luck wrote:
> @@ -4074,10 +4097,13 @@ int resctrl_online_ctrl_domain(struct rdt_resource *r, struct rdt_ctrl_domain *d
> return err;
> }
>
> -int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_mon_domain *d)
> +int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *hdr)
> {
> + struct rdt_mon_domain *d;
> int err;
>
> + WARN_ON_ONCE(hdr->type != DOMTYPE(r->rid, DOMTYPE_MON));
> + d = container_of(hdr, struct rdt_mon_domain, hdr);
> mutex_lock(&rdtgroup_mutex);

It is a bit unexpected to see code added outside of the mutex_lock(). This looks
fine since it is accessing domain list from the hotplug handlers but since it is fs
code that is jumped to by arch code and fs code relies on arch code for the locking
I'd like to suggest a:
lockdep_assert_cpus_held();

Reinette