Hi Peter, On 4/21/2023 7:17 AM, Peter Newman wrote: > To implement soft RMIDs, context switch must detect when the current > soft RMID is changing and if so, flush the CPU's MBM event counts to the > outgoing soft RMID. > > To avoid impacting context switch performance in the non-soft RMID case, > protect the new logic with a static branch. > > Co-developed-by: Stephane Eranian <eranian@xxxxxxxxxx> > Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx> > Signed-off-by: Peter Newman <peternewman@xxxxxxxxxx> > --- > arch/x86/include/asm/resctrl.h | 27 +++++++++++++++++++++++++- > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 + > 2 files changed, 27 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h > index e7acf118d770..50d05e883dbb 100644 > --- a/arch/x86/include/asm/resctrl.h > +++ b/arch/x86/include/asm/resctrl.h > @@ -36,6 +36,9 @@ DECLARE_PER_CPU(struct resctrl_pqr_state, pqr_state); > DECLARE_STATIC_KEY_FALSE(rdt_enable_key); > DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key); > DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key); > +DECLARE_STATIC_KEY_FALSE(rdt_soft_rmid_enable_key); > + > +void resctrl_mbm_flush_cpu(void); > > /* > * __resctrl_sched_in() - Writes the task's CLOSid/RMID to IA32_PQR_MSR > @@ -75,9 +78,31 @@ static inline void __resctrl_sched_in(struct task_struct *tsk) > } > > if (closid != state->cur_closid || rmid != state->cur_rmid) { > + if (static_branch_likely(&rdt_soft_rmid_enable_key)) { Could you please elaborate on the choice of static_branch_likely() (as opposed to static_branch_unlikely())? Reinette