tools/power turbostat: Fix /dev/cpu_dma_latency warnings
authorPrarit Bhargava <prarit@redhat.com>
Thu, 15 Dec 2022 15:18:16 +0000 (10:18 -0500)
committerLen Brown <len.brown@intel.com>
Fri, 17 Mar 2023 15:23:38 +0000 (11:23 -0400)
When running as non-root the following error is seen in turbostat:

turbostat: fopen /dev/cpu_dma_latency
: Permission denied

turbostat and the man page have information on how to avoid other
permission errors, so these can be fixed the same way.

Provide better /dev/cpu_dma_latency warnings that provide instructions on
how to avoid the error, and update the man page.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.8
tools/power/x86/turbostat/turbostat.c

index 7dcb4f4f3d55a00ea82cb91c49c77f8eac05b61e..8f08c3fd498d5b81185519728fc1c28a8a0d4d5f 100644 (file)
@@ -344,6 +344,8 @@ Alternatively, non-root users can be enabled to run turbostat this way:
 
 # chmod +r /dev/cpu/*/msr
 
+# chmod +r /dev/cpu_dma_latency
+
 .B "turbostat "
 reads hardware counters, but doesn't write them.
 So it will not interfere with the OS or other programs, including
index d246ef6153dc9856681db850575224439fe61824..9aed2620a2d2d669798f9c61e73b88de6ab841c1 100644 (file)
@@ -5482,7 +5482,7 @@ void print_dev_latency(void)
 
        retval = read(fd, (void *)&value, sizeof(int));
        if (retval != sizeof(int)) {
-               warn("read %s\n", path);
+               warn("read failed %s\n", path);
                close(fd);
                return;
        }