- If root, try to load msr driver on x86 if /dev/cpu/0/msr is not avail
Add cpupower-always_try_to_load_msr_driver_as_root.patch OBS-URL: https://build.opensuse.org/package/show/hardware/cpupower?expand=0&rev=39
This commit is contained in:
parent
c0bb91be65
commit
4a964b90ae
43
cpupower-always_try_to_load_msr_driver_as_root.patch
Normal file
43
cpupower-always_try_to_load_msr_driver_as_root.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
cpupower: If root, try to load msr driver on x86 if /dev/cpu/0/msr is not avail
|
||||||
|
|
||||||
|
Signed-off-by: Thomas Renninger <trenn@suse.de>
|
||||||
|
|
||||||
|
diff --git a/utils/cpupower.c b/utils/cpupower.c
|
||||||
|
index 7efc570..7cdcf88 100644
|
||||||
|
--- a/utils/cpupower.c
|
||||||
|
+++ b/utils/cpupower.c
|
||||||
|
@@ -12,6 +12,9 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
+#include <sys/utsname.h>
|
||||||
|
|
||||||
|
#include "builtin.h"
|
||||||
|
#include "helpers/helpers.h"
|
||||||
|
@@ -169,6 +172,8 @@ int main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
const char *cmd;
|
||||||
|
unsigned int i, ret;
|
||||||
|
+ struct stat statbuf;
|
||||||
|
+ struct utsname uts;
|
||||||
|
|
||||||
|
cpus_chosen = bitmask_alloc(sysconf(_SC_NPROCESSORS_CONF));
|
||||||
|
|
||||||
|
@@ -195,6 +200,15 @@ int main(int argc, const char *argv[])
|
||||||
|
|
||||||
|
get_cpu_info(0, &cpupower_cpu_info);
|
||||||
|
run_as_root = !getuid();
|
||||||
|
+ if (run_as_root) {
|
||||||
|
+ ret = uname(&uts);
|
||||||
|
+ if (!ret && !strcmp(uts.machine, "x86_64") &&
|
||||||
|
+ stat("/dev/cpu/0/msr", &statbuf) != 0) {
|
||||||
|
+ if (system("modprobe msr") == -1)
|
||||||
|
+ fprintf(stderr, _("MSR access not available.\n"));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(commands); i++) {
|
||||||
|
struct cmd_struct *p = commands + i;
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 31 15:27:14 UTC 2014 - trenn@suse.de
|
||||||
|
|
||||||
|
- If root, try to load msr driver on x86 if /dev/cpu/0/msr is not avail
|
||||||
|
Add cpupower-always_try_to_load_msr_driver_as_root.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Mar 28 19:35:10 UTC 2014 - trenn@suse.de
|
Fri Mar 28 19:35:10 UTC 2014 - trenn@suse.de
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ Source1: turbostat-%{tsversion}.tar.bz2
|
|||||||
Source2: cpupower_export_tarball_from_git.sh
|
Source2: cpupower_export_tarball_from_git.sh
|
||||||
Patch1: cpupower_disable_by_latency.patch
|
Patch1: cpupower_disable_by_latency.patch
|
||||||
Patch2: add_idle_manpages_in_Makefile.patch
|
Patch2: add_idle_manpages_in_Makefile.patch
|
||||||
|
Patch3: cpupower-always_try_to_load_msr_driver_as_root.patch
|
||||||
Patch20: turbostat_fix_man_perm.patch
|
Patch20: turbostat_fix_man_perm.patch
|
||||||
Patch21: make_header_file_passable_from_outside.patch
|
Patch21: make_header_file_passable_from_outside.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
@ -81,6 +82,7 @@ powersave module.
|
|||||||
%setup -D -b 1
|
%setup -D -b 1
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
cd ../turbostat-%{tsversion}
|
cd ../turbostat-%{tsversion}
|
||||||
%patch20 -p1
|
%patch20 -p1
|
||||||
%patch21 -p1
|
%patch21 -p1
|
||||||
|
Loading…
Reference in New Issue
Block a user