tools/power turbostat: Fix /dev/cpu_dma_latency warnings

[ Upstream commit 40aafc7d58d3544f152a863a0e9863014b6d5d8c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Prarit Bhargava
2022-12-15 10:18:16 -05:00
committed by Greg Kroah-Hartman
parent 5ec5680dc6
commit 038765a095
2 changed files with 3 additions and 1 deletions

View File

@@ -294,6 +294,8 @@ Alternatively, non-root users can be enabled to run turbostat this way:
# chmod +r /dev/cpu/*/msr # chmod +r /dev/cpu/*/msr
# chmod +r /dev/cpu_dma_latency
.B "turbostat " .B "turbostat "
reads hardware counters, but doesn't write them. reads hardware counters, but doesn't write them.
So it will not interfere with the OS or other programs, including So it will not interfere with the OS or other programs, including

View File

@@ -5004,7 +5004,7 @@ void print_dev_latency(void)
retval = read(fd, (void *)&value, sizeof(int)); retval = read(fd, (void *)&value, sizeof(int));
if (retval != sizeof(int)) { if (retval != sizeof(int)) {
warn("read %s\n", path); warn("read failed %s\n", path);
close(fd); close(fd);
return; return;
} }