Messages in this thread | | | Date | Thu, 27 Apr 2023 15:12:21 +0100 | Subject | Re: [PATCH v3 10/19] x86/resctrl: Allow resctrl_arch_rmid_read() to sleep | From | James Morse <> |
| |
Hi Reinette,
On 01/04/2023 00:26, Reinette Chatre wrote: > 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.
Yes, looks like I dithered on whether cpus_read_lock() should be held over this function, or it should tolerate the error. This is protected by rdtgroup_mutex, which means the hotplug callbacks can't run concurrently, so the error can't occur.
I'll change it to ignore the return value.
Thanks,
James
| |