cache line locking on AMD x86_64 utilising L3 CAT pseudo-locking
1#!/bin/bash
2
3set -e
4
5RESCTRL_MOUNT="/sys/fs/resctrl"
6
7if [ "$(id -u)" -ne 0 ]; then
8 echo "error: this script must be run as root"
9 exit 1
10fi
11
12if ! grep -q "resctrl" /proc/filesystems 2>/dev/null; then
13 echo "error: resctrl filesystem not supported by this kernel"
14 echo "ensure config_x86_cpu_resctrl is enabled"
15 exit 1
16fi
17
18if mount | grep -q "resctrl"; then
19 echo "resctrl already mounted at:"
20 mount | grep resctrl
21 exit 0
22fi
23
24mkdir -p "$RESCTRL_MOUNT"
25
26echo "mounting resctrl filesystem..."
27mount -t resctrl resctrl "$RESCTRL_MOUNT"
28
29echo "resctrl mounted successfully at $RESCTRL_MOUNT"
30echo
31echo "l3 cat info:"
32if [ -d "$RESCTRL_MOUNT/info/L3" ]; then
33 echo " cbm mask: $(cat $RESCTRL_MOUNT/info/L3/cbm_mask)"
34 echo " min cbm: $(cat $RESCTRL_MOUNT/info/L3/min_cbm_bits)"
35 echo " num clos: $(cat $RESCTRL_MOUNT/info/L3/num_closids)"
36else
37 echo " l3 cat info not available"
38fi