public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-power/cpufrequtils/files: cpufrequtils-008-fix-msr-read.patch cpufrequtils-008-increase-MAX_LINE_LEN.patch cpufrequtils-008-cpuid.patch
@ 2011-07-21 20:04 Matt Turner (mattst88)
  0 siblings, 0 replies; only message in thread
From: Matt Turner (mattst88) @ 2011-07-21 20:04 UTC (permalink / raw
  To: gentoo-commits

mattst88    11/07/21 20:04:49

  Added:                cpufrequtils-008-fix-msr-read.patch
                        cpufrequtils-008-increase-MAX_LINE_LEN.patch
                        cpufrequtils-008-cpuid.patch
  Log:
  Add a few upstream fixes patches, one of which allows us to use cpufrequtils on mips.
  
  (Portage version: 2.1.10.3/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  sys-power/cpufrequtils/files/cpufrequtils-008-fix-msr-read.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-fix-msr-read.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-fix-msr-read.patch?rev=1.1&content-type=text/plain

Index: cpufrequtils-008-fix-msr-read.patch
===================================================================
From d4490efed068a552e8b67d52a0726458a224c9a0 Mon Sep 17 00:00:00 2001
From: Frank Arnold <frank.arnold@amd.com>
Date: Wed, 8 Dec 2010 17:39:14 +0100
Subject: [PATCH] cpufrequtils aperf: Fix MSR read on 32-bit

The cpufreq-aperf command does not work on 32-bit systems. The reason
for that is a wrong count argument passed to the read() call. Instead
of the buffer size, the size of the pointer to the buffer is used. On
64-bit systems this just happened to work, because we need to read an
8 byte value and a pointer has a size of 8 bytes on 64-bit. On 32-bit
systems only 4 bytes are read, which then triggers the error path.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
Reviewed-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
 utils/aperf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils/aperf.c b/utils/aperf.c
index 1c64501..6302f5a 100644
--- a/utils/aperf.c
+++ b/utils/aperf.c
@@ -100,7 +100,7 @@ static int read_msr(int cpu, unsigned int idx, unsigned long long *val)
 		return -1;
 	if (lseek(fd, idx, SEEK_CUR) == -1)
 		goto err;
-	if (read(fd, val, sizeof val) != sizeof *val)
+	if (read(fd, val, sizeof *val) != sizeof *val)
 		goto err;
 	close(fd);
 	return 0;
-- 
1.7.4.4




1.1                  sys-power/cpufrequtils/files/cpufrequtils-008-increase-MAX_LINE_LEN.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-increase-MAX_LINE_LEN.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-increase-MAX_LINE_LEN.patch?rev=1.1&content-type=text/plain

Index: cpufrequtils-008-increase-MAX_LINE_LEN.patch
===================================================================
From 9f2efa7bc6969c10562ac2c720d50ff77083e5c2 Mon Sep 17 00:00:00 2001
From: Roman Vasiyarov <rvasiyarov@gmail.com>
Date: Mon, 25 Apr 2011 21:34:23 +0400
Subject: [PATCH] cpufrequtils sysfs: increase MAX_LINE_LEN

larger sysfs data (>255 bytes) was truncated and thus used improperly

Signed-off-by: Roman Vasiyarov <rvasiyarov@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
 lib/sysfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sysfs.c b/lib/sysfs.c
index 4e0edab..24dd563 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -18,7 +18,7 @@
 #include "cpufreq.h"
 
 #define PATH_TO_CPU "/sys/devices/system/cpu/"
-#define MAX_LINE_LEN 255
+#define MAX_LINE_LEN 4096
 #define SYSFS_PATH_MAX 255
 
 /* helper function to read file from /sys into given buffer */
-- 
1.7.4.4




1.1                  sys-power/cpufrequtils/files/cpufrequtils-008-cpuid.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-cpuid.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-008-cpuid.patch?rev=1.1&content-type=text/plain

Index: cpufrequtils-008-cpuid.patch
===================================================================
From f1b6bccf08f53295b2f7f448f28bbd37533c14a2 Mon Sep 17 00:00:00 2001
From: Zhang Le <r0bertz@gentoo.org>
Date: Sun, 18 Jul 2010 02:05:28 +0800
Subject: [PATCH 1/1] Only x86 has cpuid instruction

Signed-off-by: Zhang Le <r0bertz@gentoo.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
 utils/aperf.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/utils/aperf.c b/utils/aperf.c
index 627fb17..1c64501 100644
--- a/utils/aperf.c
+++ b/utils/aperf.c
@@ -68,11 +68,15 @@ struct avg_perf_cpu_info
 
 static int cpu_has_effective_freq()
 {
+#if defined(__i386__) || defined(__x86_64__)
 	/* largest base level */
 	if (cpuid_eax(0) < 6)
 		return 0;
 
 	return cpuid_ecx(6) & 0x1;
+#else
+	return 0;
+#endif
 }
 
 /*
-- 
1.7.4.4







^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-21 20:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-21 20:04 [gentoo-commits] gentoo-x86 commit in sys-power/cpufrequtils/files: cpufrequtils-008-fix-msr-read.patch cpufrequtils-008-increase-MAX_LINE_LEN.patch cpufrequtils-008-cpuid.patch Matt Turner (mattst88)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox