arm: resctrl: L3 cache partitioning via CLUSTERPARTCR
Hi all,
L3 cache partitioning is an important feature for improving performance isolation of latency-sensitive tasks. While ARM MPAM provides a comprehensive solution, there exists another ARM register, CLUSTERPARTCR, which offers L3 cache partitioning functionality similar to MPAM's CPBM (Cache Portion BitMask) but is not part of the MPAM architecture.
CLUSTERPARTCR is a cluster-level register that allows software to partition L3 cache capacity among different workloads. Although its partitioning granularity and flexibility are more limited compared to full MPAM support, it remains a practically important interface for platforms that do not implement MPAM but still need L3 cache partitioning capability.
This raises the following questions for the community:
1. Is there interest in accommodating CLUSTERPARTCR-based L3 partitioning within the existing resctrl framework, given that it provides similar semantics to Intel RDT's cache allocation technology (CAT)?
2. Alternatively, would it be more appropriate to integrate it under the MPAM resctrl framework as a non-MPAM backend, given the functional similarity to MPAM CPBM?
3. Are there any concerns or constraints in the current resctrl/MPAM framework that would prevent such an integration?
Any comments, suggestions, or pointers to prior discussion on this topic are very much appreciated.
More references:
==========
Reference to [1], and more detailed information like below:
the CLUSTERPARTCR_EL1 to 0x00008601 to configure these three L3 cache partitions:
• Scheme ID 0 (1/4 of the cache).
• Scheme ID 2 (1/2 of the cache).
• Scheme ID 3 (1/4 of the cache).
The OS, running at EL1, can set the CLUSTERTHREADSID_EL1 to 0x0 or 0x1 to select between the two L3 cache partitions allocated to it. These would be mapped to scheme IDs 2 and 3 by the CLUSTERTHREADSIDOVR_EL1 register. The OS can update this register on context switches to select which partition each process has access to.
[1]
https://developer.arm.com/documentation/100453/0401/L3-cache/L3-cache-partitioning?lang=en
Signature · 2 lines
Thx and BRs, Aiqun(Maria) Yu
Hi Aiqun,
Quoted 5 lines · Aiqun(Maria) Yu
L3 cache partitioning is an important feature for improving performance isolation of latency-sensitive tasks. While ARM MPAM provides a comprehensive solution,
there exists another ARM register, CLUSTERPARTCR,
It's important to note this isn't an ARM architecture feature or register, it's part of one version of DSU, which is a shared-cache IP in some designs.
Quoted 2 lines
which offers L3 cache partitioning functionality similar to MPAM's CPBM (Cache Portion BitMask) but is not part of the MPAM architecture.
... and as its not part of any architectural feature, is going to be very hard to use.
Quoted 5 lines
CLUSTERPARTCR is a cluster-level register that allows software to partition L3 cache capacity among different workloads. Although its partitioning granularity and flexibility are more limited compared to full MPAM support, it remains a practically important interface for platforms that do not implement MPAM but still need L3 cache partitioning capability.
This stuff is designed for static SoC configurations. e.g. CPU-4 is running your modem stack. I don't this is going to work well with general purpose things like linux and resctrl.
Quoted 5 lines
This raises the following questions for the community:
1. Is there interest in accommodating CLUSTERPARTCR-based L3 partitioning within the existing resctrl framework, given that it provides similar semantics to Intel RDT's cache allocation technology (CAT)?
I'd say that is impossible.
This would rely on accessing implementation defined system registers, not just in some driver - but in the architecture's context-switch path. This has been a hard no in the past. For just the imp-def part, see: [0][1][2]
Doing this doesn't virtualise as all those registers are trapped by HCR_EL2.TIDCP, the hypervisor can't emulate these registers as they can behave differently on each CPU. The only option is to emulate an undefined instruction exception. This makes detecting the SoCs where this could be used very difficult.
Quoted 3 lines
2. Alternatively, would it be more appropriate to integrate it under the MPAM resctrl framework as a non-MPAM backend, given the functional similarity to MPAM CPBM?
I don't think its at all similar.
This doesn't map to the L3/CPBM bitmap schema. A group is 4 ways, and the control is only to make a group private to an 'ID'. You can't share a group between two resctrl groups - which the bitmap schema allows.
As an ugly corner case: if you tried to express the groups as a bitmap, a 12-way cache configuration would have 3 groups - meaning a two bit bitmap has invalid values.
This is all because its not really a bitmap in hardware.
The datasheet/TRM you linked doesn't say that the partition controls can be changed at runtime. Resctrl requires this.
While the document doesn't say either way - its very common for interconnect IP to expect configuration information to only be written to during power-on, when there is no traffic flowing in the system. Linux can't ever do this.
Quoted 2 lines
3. Are there any concerns or constraints in the current resctrl/MPAM framework that would prevent such an integration?
Not just the imp-def system registers: There is no way of detecting whether this is present in any particular SoC. You can't have a table of SoCs where it happens to be as it also depends on the EL3 firmware to turn this interface on, and a hypervisor not being present.
The system registers imply some knowledge of the topology, its not just which CPUs share a DSU, but where an 'ACP' goes, and what a 'STASH' is for.
It looks like there are 8 'partition scheme IDs', but only 'four private L3 cache partitions can be created' - so depending on what is written to the schema file, there may be only four control groups usable.
Quoted 2 lines
Any comments, suggestions, or pointers to prior discussion on this topic are very much appreciated.
I don't think this is workable for either resctrl or the architecture code.
DSU supports MPAM, so presumably this is for an older version that doesn't have the MPAM feature?
Thanks,
James
[0] https://lore.kernel.org/linux-arm-kernel/20151026124616.GB9740@leverpostej/
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[2] https://lore.kernel.org/linux-arm-kernel/[email protected]/