* Re: [Powertop] [PATCH] MSR is valid for x86_32/x86_64 only
@ 2016-07-21 1:45 Stewart Smith
0 siblings, 0 replies; 2+ messages in thread
From: Stewart Smith @ 2016-07-21 1:45 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
Daniel Black <daniel.black(a)au1.ibm.com> writes:
> As such we compile guard the portions of code related to msr
> modprobing, reads and writes.
>
> Signed-off-by: Daniel Black <daniel.black(a)au1.ibm.com>
Tested-by: Stewart Smith <stewart(a)linux.vnet.ibm.com>
Acked-by: Stewart Smith <stewart(a)linux.vnet.ibm.com>
--
Stewart Smith
OPAL Architect, IBM.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Powertop] [PATCH] MSR is valid for x86_32/x86_64 only
@ 2016-07-21 0:55 Daniel Black
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Black @ 2016-07-21 0:55 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]
As such we compile guard the portions of code related to msr
modprobing, reads and writes.
Signed-off-by: Daniel Black <daniel.black(a)au1.ibm.com>
---
src/lib.cpp | 8 ++++++++
src/main.cpp | 2 ++
2 files changed, 10 insertions(+)
diff --git a/src/lib.cpp b/src/lib.cpp
index cdbd0cd..5e48f37 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -497,6 +497,7 @@ int get_user_input(char *buf, unsigned sz)
int read_msr(int cpu, uint64_t offset, uint64_t *value)
{
+#if defined(__i386__) || defined(__x86_64__)
ssize_t retval;
uint64_t msr;
int fd;
@@ -526,10 +527,14 @@ int read_msr(int cpu, uint64_t offset, uint64_t *value)
*value = msr;
return retval;
+#else
+ return -1;
+#endif
}
int write_msr(int cpu, uint64_t offset, uint64_t value)
{
+#if defined(__i386__) || defined(__x86_64__)
ssize_t retval;
int fd;
char msr_path[256];
@@ -557,6 +562,9 @@ int write_msr(int cpu, uint64_t offset, uint64_t value)
}
return retval;
+#else
+ return -1;
+#endif
}
#define UI_NOTIFY_BUFF_SZ 2048
diff --git a/src/main.cpp b/src/main.cpp
index f2569c1..31e3e71 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -328,8 +328,10 @@ static void powertop_init(void)
if (system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1"))
fprintf(stderr, _("modprobe cpufreq_stats failed"));
+#if defined(__i386__) || defined(__x86_64__)
if (system("/sbin/modprobe msr > /dev/null 2>&1"))
fprintf(stderr, _("modprobe msr failed"));
+#endif
statfs("/sys/kernel/debug", &st_fs);
if (st_fs.f_type != (long) DEBUGFS_MAGIC) {
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-21 1:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-21 1:45 [Powertop] [PATCH] MSR is valid for x86_32/x86_64 only Stewart Smith
-- strict thread matches above, loose matches on Subject: below --
2016-07-21 0:55 Daniel Black
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.