RE: [PATCH 00/12] Cqm2: Intel Cache quality monitoring fixes

From: Luck, Tony
Date: Mon Feb 06 2017 - 13:54:47 EST


Digging through the e-mails from last week to generate a new version
of the requirements I looked harder at this:

> 12) Whatever fs or syscall is provided instead of perf syscalls, it
> should provide total_time_enabled in the way perf does, otherwise is
> hard to interpret MBM values.

This looks tricky if we are piggy-backing on the CAT code to switch
RMID along with CLOSID at context switch time. We could get an
approximation by adding:

if (newRMID != oldRMID) {
now = grab current time in some format
atomic_add(rmid_enabled_time[oldRMID], now - this_cpu_read(rmid_time));
this_cpu_write(rmid_time, now);
}

but:

1) that would only work on a single socket machine (we'd really want rmid_enabled_time
separately for each socket)
2) when we want to read that enabled time, we'd really need to add time for all the
threads currently running on CPUs across the system since we last switched RMID
3) reading the time and doing atomic ops in context switch code won't be popular

:-(

-Tony