New version

Resolves: rhbz#1100724
- Dropped ondemand-check patch (upstream dropped the functionality)
This commit is contained in:
Jaroslav Škarvada 2014-05-26 15:27:48 +02:00
parent 879378332a
commit 01a6c98ec5
5 changed files with 12 additions and 97 deletions

View File

@ -1,42 +0,0 @@
diff -up powertop-2.3/src/tuning/cpufreq.cpp.orig powertop-2.3/src/tuning/cpufreq.cpp
--- powertop-2.3/src/tuning/cpufreq.cpp.orig 2013-01-31 22:39:27.000000000 +0100
+++ powertop-2.3/src/tuning/cpufreq.cpp 2013-06-28 14:05:04.254925669 +0200
@@ -63,6 +63,7 @@ int cpufreq_tunable::good_bad(void)
char gov[1024];
int ret = TUNE_GOOD;
+ unsigned long int ld;
gov[0] = 0;
@@ -91,6 +92,30 @@ int cpufreq_tunable::good_bad(void)
if (strcmp(gov, line))
ret = TUNE_BAD;
fclose(file);
+
+ /* check if ondemand governor is available */
+ sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_available_governors", dirent->d_name);
+ file = fopen(filename, "r");
+ if (!file)
+ continue;
+ memset(line, 0, 1024);
+ if (fgets(line, 1023,file)==NULL || strstr(line, "ondemand")==NULL) {
+ fclose(file);
+ continue;
+ }
+ fclose(file);
+
+ /* check if cpu transition latency is not higher than ondemand governor max_transition_latency */
+ sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/cpuinfo_transition_latency", dirent->d_name);
+ file = fopen(filename, "r");
+ if (!file)
+ continue;
+ if (fscanf(file, "%lu", &ld) != 1 || ld > 10000000)
+ {
+ fclose(file);
+ continue;
+ }
+ fclose(file);
}
closedir(dir);

View File

@ -9,5 +9,5 @@ diff -up powertop-2.3/doc/powertop.8.orig powertop-2.3/doc/powertop.8
+file to execute for workload.
+.TP
\fB\-\-quiet
supress stderr output.
suppress stderr output.
.TP

View File

@ -3,7 +3,7 @@ index e0bdf12..01c673d 100644
--- a/src/tuning/bluetooth.cpp
+++ b/src/tuning/bluetooth.cpp
@@ -46,8 +46,8 @@
bt_tunable::bt_tunable(void) : tunable("", 1.0, "Good", "Bad", "Unknown")
bt_tunable::bt_tunable(void) : tunable("", 1.0, _("Good"), _("Bad"), _("Unknown"))
{
sprintf(desc, _("Bluetooth device interface status"));
- strcpy(toggle_bad, "/usr/sbin/hciconfig hci0 up &> /dev/null &");
@ -25,51 +25,6 @@ index e0bdf12..01c673d 100644
}
diff --git a/src/tuning/cpufreq.cpp b/src/tuning/cpufreq.cpp
index c169e6e..f696c89 100644
--- a/src/tuning/cpufreq.cpp
+++ b/src/tuning/cpufreq.cpp
@@ -189,7 +189,7 @@ const char *cpufreq_tunable::toggle_script(void) {
int good;
good = good_bad();
- strcpy(toggle_good, "/sbin/modprobe cpufreq_ondemand > /dev/null 2>&1\n");
+ toggle_good = "/sbin/modprobe cpufreq_ondemand > /dev/null 2>&1\n";
if (good == TUNE_GOOD) {
dir = opendir("/sys/devices/system/cpu");
@@ -202,12 +202,12 @@ const char *cpufreq_tunable::toggle_script(void) {
sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name);
if (stat(filename, &statbuf) == -1)
continue;
- sprintf(tmp, "echo '%s' > '%s';\n", original, filename);
- strcat(toggle_good, tmp);
+ snprintf(tmp, 4096, "echo '%s' > '%s';\n", original, filename);
+ toggle_good += tmp;
}
closedir(dir);
- return toggle_good;
+ return toggle_good.c_str();
}
dir = opendir("/sys/devices/system/cpu");
@@ -220,12 +220,12 @@ const char *cpufreq_tunable::toggle_script(void) {
sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name);
if (stat(filename, &statbuf) == -1)
continue;
- sprintf(tmp, "echo 'ondemand' > '%s';\n", filename);
- strcat(toggle_good, tmp);
+ snprintf(tmp, 4096, "echo 'ondemand' > '%s';\n", filename);
+ toggle_good += tmp;
}
closedir(dir);
- return toggle_good;
+ return toggle_good.c_str();
}
diff --git a/src/tuning/ethernet.cpp b/src/tuning/ethernet.cpp
index 3d36112..f3f0224 100644
--- a/src/tuning/ethernet.cpp

View File

@ -1,6 +1,6 @@
Name: powertop
Version: 2.5
Release: 2%{?dist}
Version: 2.6.1
Release: 1%{?dist}
Summary: Power consumption monitor
Group: Applications/System
@ -11,10 +11,8 @@ Source0: http://01.org/powertop/sites/default/files/downloads/%{name}-%{v
# Sent upstream
Patch0: powertop-2.3-always-create-params.patch
# Sent upstream (http://github.com/fenrus75/powertop/pull/11)
Patch1: powertop-2.3-man-fix.patch
# Sent upstream (http://github.com/fenrus75/powertop/pull/12)
Patch2: powertop-2.3-ondemand-check.patch
Patch3: powertop-2.5-tunable-overflow-fix.patch
Patch1: powertop-2.6.1-man-fix.patch
Patch3: powertop-2.6.1-tunable-overflow-fix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel
Requires(post): coreutils
@ -27,7 +25,6 @@ computer use more power than necessary while it is idle.
%setup -q
%patch0 -p1 -b .always-create-params
%patch1 -p1 -b .man-fix
%patch2 -p1 -b .ondemand-check
%patch3 -p1 -b .tunable-overfow-fix
# remove left over object files
@ -61,6 +58,11 @@ rm -rf %{buildroot}
%{_mandir}/man8/powertop.8*
%changelog
* Mon May 26 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 2.6.1-1
- New version
Resolves: rhbz#1100724
- Dropped ondemand-check patch (upstream dropped the functionality)
* Tue Mar 25 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 2.5-2
- Fixed buffer overflow in cpufreq tunables on systems with many CPUs
(by tunable-overflow-fix patch)

View File

@ -1 +1 @@
806bbcbd44fcea1f807c9582fc1f7d3e powertop-2.5.tar.gz
705e091fa9e79a12d16bc3cb0c688280 powertop-2.6.1.tar.gz