Bug 675743

Summary: cpufreq-aperf on 32-bit not working
Product: [Fedora] Fedora Reporter: Petr Šabata <psabata>
Component: cpufrequtilsAssignee: Petr Šabata <psabata>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 13CC: frank.arnold, kthiruma, psabata
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cpufrequtils-008-2.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 675734 Environment:
Last Closed: 2011-02-15 21:25:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 675734    
Bug Blocks:    

Description Petr Šabata 2011-02-07 15:38:57 UTC
+++ This bug was initially created as a clone of Bug #675734 +++

This is already fixed in RHEL 5 (bug 568754), and we need to get this into RHEL 6 too. The Fedora packages are also affected.

Upstream commit:

From d4490efed068a552e8b67d52a0726458a224c9a0 Mon Sep 17 00:00:00 2001
From: Frank Arnold <frank.arnold>
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>
Reviewed-by: Thomas Renninger <trenn>
Signed-off-by: Dominik Brodowski <linux>
---
 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

Comment 1 Fedora Update System 2011-02-07 16:10:40 UTC
cpufrequtils-008-2.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/cpufrequtils-008-2.fc13

Comment 2 Fedora Update System 2011-02-07 16:11:53 UTC
cpufrequtils-008-2.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/cpufrequtils-008-2.fc14

Comment 3 Fedora Update System 2011-02-07 19:53:15 UTC
cpufrequtils-008-2.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update cpufrequtils'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/cpufrequtils-008-2.fc14

Comment 4 Frank Arnold 2011-02-08 14:23:05 UTC
Tested both, Fedora 13 and Fedora 14  on a system with APERF/MPERF support (AMD Phenom II X6 1055T).

In both cases cpufreq-aperf from cpufrequtils-008-1.i686 showed all CPUs as offline. With the updated packages it showed the effective frequencies of all CPUs.

Comment 5 Petr Šabata 2011-02-08 14:48:43 UTC
Thank you for the tests, Arnold!

Comment 6 Fedora Update System 2011-02-15 21:25:23 UTC
cpufrequtils-008-2.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2011-02-15 21:27:30 UTC
cpufrequtils-008-2.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.