[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALPaoCisUdTzSP6E+9VVa4okjvcCjs6p7MhyLYpzxVGs7+8nNA@mail.gmail.com>
Date: Mon, 23 Jan 2023 14:54:53 +0100
From: Peter Newman <peternewman@...gle.com>
To: James Morse <james.morse@....com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
H Peter Anvin <hpa@...or.com>,
Babu Moger <Babu.Moger@....com>,
shameerali.kolothum.thodi@...wei.com,
D Scott Phillips OS <scott@...amperecomputing.com>,
carl@...amperecomputing.com, lcherian@...vell.com,
bobo.shaobowang@...wei.com, tan.shaopeng@...itsu.com,
xingxin.hx@...nanolis.org, baolin.wang@...ux.alibaba.com,
Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>
Subject: Re: [PATCH v2 09/18] x86/resctrl: Allow resctrl_arch_rmid_read() to sleep
Hi James,
On Fri, Jan 13, 2023 at 6:56 PM James Morse <james.morse@....com> wrote:
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index d309b830aeb2..d6ae4b713801 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -206,17 +206,19 @@ static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr, unsigned int width)
> return chunks >> shift;
> }
>
> -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 __rmid_read_arg
> {
> - struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
> - struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
> - struct arch_mbm_state *am;
> - u64 msr_val, chunks;
> + u32 rmid;
> + enum resctrl_event_id eventid;
>
> - if (!cpumask_test_cpu(smp_processor_id(), &d->cpu_mask))
> - return -EINVAL;
> + u64 msr_val;
> +};
> +
> +static void __rmid_read(void *arg)
> +{
> + enum resctrl_event_id eventid = ((struct __rmid_read_arg *)arg)->eventid;
> + u32 rmid = ((struct __rmid_read_arg *)arg)->rmid;
> + u64 msr_val;
>
> /*
> * As per the SDM, when IA32_QM_EVTSEL.EvtID (bits 7:0) is configured
> @@ -229,6 +231,28 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d,
> wrmsr(MSR_IA32_QM_EVTSEL, eventid, rmid);
> rdmsrl(MSR_IA32_QM_CTR, msr_val);
>
> + ((struct __rmid_read_arg *)arg)->msr_val = msr_val;
> +}
> +
> +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 err;
> +
> + arg.rmid = rmid;
> + arg.eventid = eventid;
> +
> + err = smp_call_function_any(&d->cpu_mask, __rmid_read, &arg, true);
> + if (err)
> + return err;
> +
> + msr_val = arg.msr_val;
These changes are conflicting now after v6.2-rc4 due to my recent
changes in resctrl_arch_rmid_read(), which include my own
reintroduction of __rmid_read():
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=2a81160d29d65b5876ab3f824fda99ae0219f05e
Fortunately it looks like our respective versions of __rmid_read()
aren't too much different from the original, but __rmid_read() does
have a new call site in resctrl_arch_reset_rmid() to record initial
event counts.
-Peter
Powered by blists - more mailing lists