Developer Guide

  • 2021.2
  • 06/11/2021
  • Public
Contents

Assign Classes of Service to Cores

All presets provided as part of cache configurator reserve one or more isolated regions of cache for real-time workloads. Isolating regions of cache is useful for minimizing the noisy neighbor effect, but must not be confused with allocating software SRAM buffers. Applications acquire access to these isolated regions of cache by setting the appropriate Class of Service (COS) for the CPU core on which they are scheduled to run. Follow the steps below to assign the Class of Service to a CPU core if you applied any of the provided presets.
If you applied a custom cache partitioning scheme that contains only software SRAM buffers (and did not use any of the existing presets), you may skip this page. The ability to access software SRAM buffers via the cache allocation library API does not depend on having any specific COS set.
By default, all cores initialize to COS 0. If a different COS is intended for a real-time workload, you need to associate that COS with the core that will run the real-time workload. Otherwise, your workload will not have dedicated cache resources.
After applying the new partitioning scheme and rebooting into it, associate the appropriate COS to the core as follows:
  1. Decide which core will run the real-time workload.
  2. Note the COS that is dedicated to real-time workloads.
    If you are using a preset provided by the tool:
    • Presets that contain dedicated cache for one real-time workload use COS 1
    • Presets that contain dedicated cache for two independent real-time workloads use COS 1 and 2
  3. To change the COS associated with a core, write the IA32_PQR_ASSOC model-specific register (MSR) with the desired COS. IA32_PQR_ASSOC defines the COS value to be in bits [63:32].
    Utilities to assist with reading and writing MSRs vary by OS. Download and copy msr-tools rdmsr/wrmsr binaries onto the target system. Msr-tools can be obtained from: https://github.com/intel/msr-tools. On Linux systems, use the
    wrmsr
    utility and specify the core to run on.
    For example, if the real-time workload will run on Core 2, and COS 1 is dedicated to real-time workloads, run the following command:
    wrmsr -p 2 0xC8F 0x100000000
    The example runs on Core 2 (
    -p 2
    ), writes IA32_PQR_ASSOC (
    0xC8F
    ), and assigns COS 1 (
    0x100000000
    ) to that core. After this point, Core 2 will use COS 1.
  4. If the system is being configured for multiple cores to run real-time workloads, repeat the above
    wrmsr
    command, adjusting the core (
    -p X
    ) and data value (
    0xY00000000
    ) as appropriate. For example, to assign COS 2 to Core 3, the
    wrmsr
    command becomes:
    wrmsr -p 3 0xC8F 0x200000000
See Chapter 17.19.4.4 “Class of Service to Cache Mask Association: Common Across Allocation Features” in Volume 3B of the Intel® 64 and IA-32 Architectures Software Developer’s Manual for details on the IA32_PQR_ASSOC MSR used to select the active Class of Service on a per-thread basis.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.