Re: [PATCH v3 10/19] x86/resctrl: Allow resctrl_arch_rmid_read() to sleep

From: Reinette Chatre
Date: Fri Mar 31 2023 - 19:26:25 EST


Hi James,

On 3/20/2023 10:26 AM, James Morse wrote:

...

> int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d,
> u32 closid, u32 rmid, enum resctrl_event_id eventid,
> u64 *val)
> {
> struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
> struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
> + struct __rmid_read_arg arg;
> struct arch_mbm_state *am;
> u64 msr_val, chunks;
> - int ret;
> + int err;
>
> - if (!cpumask_test_cpu(smp_processor_id(), &d->cpu_mask))
> - return -EINVAL;
> + arg.rmid = rmid;
> + arg.eventid = eventid;
>
> - ret = __rmid_read(rmid, eventid, &msr_val);
> - if (ret)
> - return ret;
> + err = smp_call_function_any(&d->cpu_mask, smp_call_rmid_read, &arg, true);
> + if (err)
> + return err;

This seems to break the assumption of expected return values. __mon_event_count()
does:
rr->err = resctrl_arch_rmid_read()

and later rdtgroup_mondata_show() only expects -EIO or -EINVAL as errors, with
default of success.


> + if (arg.err)
> + return arg.err;
> + msr_val = arg.msr_val;
>


Reinette