[PATCH v3 0/2] Add and use get_cpu_cacheinfo_level()

From: Tony Luck
Date: Thu Jun 06 2024 - 12:59:35 EST


This helper function came up in discussion of the resctrl patches
for Sub-NUMA Cluster (SNC) support. Reinette pointed out[1] that there
are already two places where it would clean things up by avoiding
open coding. The SNC patches will add two additional call sites.

So rather than have this jammed up as part of the SNC series, I'm
posting it as a simple standalone cleanup.

Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>

[1] https://lore.kernel.org/all/050c64b3-20b3-4db6-b782-f5124ebaab31@xxxxxxxxx/

---
Changes since v2:

Add lockdep_assert_cpus_held() to enforce what was simply a comment.

Combine patches 2 & 3. Both functions using get_cpu_cacheinfo_level()
are called inside rdtgroup_kn_lock_live()/rdtgroup_kn_unlock() code
blocks. So cpuhp lock is held.

Tony Luck (2):
cacheinfo: Add function to get cacheinfo for a given (cpu, cachelevel)
x86/resctrl: Replace open code cacheinfo searches

include/linux/cacheinfo.h | 25 ++++++++++++++++++-----
arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 17 ++++++---------
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 14 +++++--------
3 files changed, 31 insertions(+), 25 deletions(-)


base-commit: c3f38fa61af77b49866b006939479069cd451173
--
2.45.0