[PATCH 00/10] x86/CPU and x86/resctrl: Support pseudo-lock regions spanning L2 and L3 cache

From: Reinette Chatre
Date: Wed Jun 26 2019 - 13:51:10 EST

Dear Maintainers,

Cache pseudo-locking involves preloading a region of physical memory into a
reserved portion of cache that no task or CPU can subsequently fill into and
from that point on will only serve cache hits. At this time it is only
possible to create cache pseudo-locked regions in either L2 or L3 cache,
supporting systems that support either L2 Cache Allocation Technology (CAT)
or L3 CAT because CAT is the mechanism used to manage reservations of cache

This series introduces support for cache pseudo-locked regions that can span
L2 and L3 cache in preparation for systems that may support CAT on L2 and
L3 cache. Only systems with L3 inclusive cache is supported at this time
because if the L3 cache is not inclusive then pseudo-locked memory within
the L3 cache would be evicted when migrated to L2. Because of this
constraint the first patch in this series introduces support in cacheinfo.c
for resctrl to discover if the L3 cache is inclusive. All other patches in
this series are to the resctrl subsystem.

In support of cache pseudo-locked regions spanning L2 and L3 cache the term
"cache pseudo-lock portion" is introduced. Each portion of a cache
pseudo-locked region spans one level of cache and a cache pseudo-locked
region can be made up of one or two cache pseudo-lock portions.

On systems supporting L2 and L3 CAT where L3 cache is inclusive it is
possible to create two types of pseudo-locked regions:
1) A pseudo-locked region spanning just L3 cache, consisting out of a
single pseudo-locked portion.
2) A pseudo-locked region spanning L2 and L3 cache, consisting out of two
pseudo-locked portions.

In an L3 inclusive cache system a L2 pseudo-locked portion is required to
be matched with an L3 pseudo-locked portion to prevent a cache line from
being evicted from L2 when it is evicted from L3.

Patches 2 to 8 to the resctrl subsystem are preparing for the new feature
and should result in no functional change, but some comments do refer to
the new feature. Support for pseudo-locked regions spanning L2 and L3 cache
is introduced in patches 9 and 10.

Your feedback will be greatly appreciated.



Reinette Chatre (10):
x86/CPU: Expose if cache is inclusive of lower level caches
x86/resctrl: Remove unnecessary size compute
x86/resctrl: Constrain C-states during pseudo-lock region init
x86/resctrl: Set cache line size using new utility
x86/resctrl: Associate pseudo-locked region's cache instance by id
x86/resctrl: Introduce utility to return pseudo-locked cache portion
x86/resctrl: Remove unnecessary pointer to pseudo-locked region
x86/resctrl: Support pseudo-lock regions spanning resources
x86/resctrl: Pseudo-lock portions of multiple resources
x86/resctrl: Only pseudo-lock L3 cache when inclusive

arch/x86/kernel/cpu/cacheinfo.c | 42 +-
arch/x86/kernel/cpu/resctrl/core.c | 7 -
arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 37 +-
arch/x86/kernel/cpu/resctrl/internal.h | 39 +-
arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 444 +++++++++++++++++++---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 61 ++-
include/linux/cacheinfo.h | 4 +
7 files changed, 512 insertions(+), 122 deletions(-)