On 10/31/23 15:46, Anthony Harivel wrote:
+
+static uint64_t vmsr_read_msr(uint32_t reg, unsigned int cpu_id)
+{
+    int fd;
+    uint64_t data;
+
+    char path[MAX_PATH_LEN];
+    snprintf(path, MAX_PATH_LEN, "/dev/cpu/%u/msr", cpu_id);

If you allow any CPU here, the thread id is really unused. You can however call sched_getaffinity(), and check that the CPU id is included in the thread's affinity. sched_getaffinity() does not need any extra capability.

Paolo


Reply via email to