]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tools/power turbostat: Fix warning upon failed /dev/cpu_dma_latency read
authorLen Brown <len.brown@intel.com>
Fri, 19 Jan 2024 18:25:42 +0000 (12:25 -0600)
committerLen Brown <len.brown@intel.com>
Tue, 2 Apr 2024 16:50:04 +0000 (12:50 -0400)
Previously a failed read of /dev/cpu_dma_latency erroneously complained
turbostat: capget(CAP_SYS_ADMIN) failed, try "# setcap cap_sys_admin=ep ./turbostat

This went unnoticed because this file is typically visible to root,
and turbostat was typically run as root.

Going forward, when a non-root user can run turbostat...
Complain about failed read access to this file only if --debug is used.

Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c

index c35c48b6a99a7a1abe8eff87137ba18b719479d3..531f37e5f92ab31120236a80349f3ab33a35d683 100644 (file)
@@ -5545,7 +5545,8 @@ void print_dev_latency(void)
 
        fd = open(path, O_RDONLY);
        if (fd < 0) {
-               warnx("capget(CAP_SYS_ADMIN) failed, try \"# setcap cap_sys_admin=ep %s\"", progname);
+               if (debug)
+                       warnx("Read %s failed", path);
                return;
        }