On Tue, May 16, 2023 at 4:18 PM Peter Newman <peternewman@xxxxxxxxxx> wrote: > According to cpu_hotplug.rst, the startup callbacks are called before > a CPU is started and the teardown callbacks are called after the CPU > has become dysfunctional, so it should always be safe for a CPU to > access its own data, so all I need to do here is avoid walking domain > lists in resctrl_mbm_flush_cpu(). > > However, this also means that resctrl_{on,off}line_cpu() call > clear_closid_rmid() on a different CPU, so whichever CPU executes > these will zap its own pqr_state struct and PQR_ASSOC MSR. Sorry, I read the wrong section. I was looking at PREPARE section callbacks. ONLINE callbacks are called on the CPU, so calling clear_closid_rmid() is fine. It says the offline callback is called from the per-cpu hotplug thread, so I'm not sure if that means another context switch is possible after the teardown handler has run. To be safe, I can make resctrl_mbm_flush_cpu() check to see if it still has its domain state. -Peter