|
|
DescriptionTelemetry: Implement MSR power monitoring on Linux.
BUG=336556
Committed: https://crrev.com/b6e00ac9e417148d6d1e2022d858fb5f3956da67
Cr-Commit-Position: refs/heads/master@{#296325}
Patch Set 1 #Patch Set 2 : rebase, use rdmsr binary to read the MSRs #
Messages
Total messages: 21 (6 generated)
thestig@chromium.org changed reviewers: + dtu@chromium.org
My workstation doesn't support power MSRs, so I can't actually test this. Can you take a look? I'll find a newer machine in the meantime.
On 2014/09/17 05:44:25, Lei Zhang wrote: > My workstation doesn't support power MSRs, so I can't actually test this. Can > you take a look? I'll find a newer machine in the meantime. I did this: $ sudo modprobe msr $ sudo chmod 644 /dev/cpu/*/msr $ tools/perf/run_benchmark tab_switching.top_10 --browser=release And got this: ... _LinuxReadMsr at tools/telemetry/telemetry/core/platform/power_monitor/msr_power_monitor.py:220 with open(LINUX_MSR_PATH, 'rb', buffering=0) as msr: IOError: [Errno 1] Operation not permitted: '/dev/cpu/0/msr' Locals: msr_number : 1553 Here're the permissions on the file: $ ls -l /dev/cpu/0/msr crw-r--r-- 1 root root 202, 0 Sep 17 15:59 /dev/cpu/0/msr
On 2014/09/17 23:11:44, tonyg wrote: > And got this: > ... > _LinuxReadMsr at > tools/telemetry/telemetry/core/platform/power_monitor/msr_power_monitor.py:220 > with open(LINUX_MSR_PATH, 'rb', buffering=0) as msr: > IOError: [Errno 1] Operation not permitted: '/dev/cpu/0/msr' Doh, I took that code straight from dtu's sample. I'll find a computer to test + debug this soon.
On 2014/09/17 23:33:07, Lei Zhang wrote: > On 2014/09/17 23:11:44, tonyg wrote: > > And got this: > > ... > > _LinuxReadMsr at > > tools/telemetry/telemetry/core/platform/power_monitor/msr_power_monitor.py:220 > > with open(LINUX_MSR_PATH, 'rb', buffering=0) as msr: > > IOError: [Errno 1] Operation not permitted: '/dev/cpu/0/msr' > > Doh, I took that code straight from dtu's sample. I'll find a computer to test + > debug this soon. chmod is not sufficient to give you privileges to access this. You need to run with sudo. I'm going to move ReadMsr from msr_power_monitor into *_platform_backend. I think this is a cleaner way to implement multiple platforms - msr_power_monitor will become OS-independent. https://codereview.chromium.org/578123002/
On 2014/09/18 00:01:43, dtu wrote: > On 2014/09/17 23:33:07, Lei Zhang wrote: > > On 2014/09/17 23:11:44, tonyg wrote: > > > And got this: > > > ... > > > _LinuxReadMsr at > > > > tools/telemetry/telemetry/core/platform/power_monitor/msr_power_monitor.py:220 > > > with open(LINUX_MSR_PATH, 'rb', buffering=0) as msr: > > > IOError: [Errno 1] Operation not permitted: '/dev/cpu/0/msr' > > > > Doh, I took that code straight from dtu's sample. I'll find a computer to test > + > > debug this soon. > > chmod is not sufficient to give you privileges to access this. You need to run > with sudo. One can read the MSR as a regular user, but the executable that runs must have the right capabilities. i.e. setcap cap_sys_rawio+ep /path/to/executable. It can't be an interpreted script because such a script will be executed by the python binary. The reason this was added was due to a security exploit, which the kernel fixed. [1] However, the exploit requires writing to the MSR. If we grant a program that only reads the MSR CAP_SYS_RAWIO, we should be ok since the msr files are still read-only due to the file system permissions. [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c90...
See patch set 2. I sent out a separate CL to change our bot configuration to allow MSR reading.
lgtm with the bot change
On 2014/09/19 07:04:19, dtu wrote: > lgtm with the bot change Bots update CL went in.
The CQ bit was checked by thestig@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/577893003/20001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios_dbg_simulator on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator...) ios_rel_device on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device/bu...) ios_rel_device_ninja on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ni...)
The CQ bit was checked by thestig@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/577893003/20001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios_dbg_simulator on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator...) ios_rel_device_ninja on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ni...)
The CQ bit was checked by thestig@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/577893003/20001
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as ba94b800dbde4db6a8c6d456645b8c6816c21485
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/b6e00ac9e417148d6d1e2022d858fb5f3956da67 Cr-Commit-Position: refs/heads/master@{#296325} |