New version

Resolves: rhbz#1279872
- Dropped tunable-overflow-fix, auto-tune-crash-fix, navigate-hint
  patches (all upstreamed)
- Dropped bytrail-no-c7 patch (following upstream)
- Fixed linkage with pthreads (by pthreads-cflags-fix patch)
- Added bundled(kernel-event-lib)
  Resolves: rhbz#1041323
This commit is contained in:
Jaroslav Škarvada 2015-11-10 16:08:50 +01:00
parent 5223ad6513
commit df6409a0f2
6 changed files with 76 additions and 331 deletions

View File

@ -1,48 +0,0 @@
From 6fd9ecebd3bc277bd91ce057f85f8e54b09bb0a9 Mon Sep 17 00:00:00 2001
From: Michael Mullin <masmullin@hush.com>
Date: Thu, 22 Jan 2015 16:50:10 -0500
Subject: [PATCH] Powertop crashes with 'powertop --auto-tune'
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Please see the following patch to address the reported crash
- ---
- From e994a414f619410877023fce35ade12d1cfce68d Mon Sep 17 00:00:00 2001
From: Michael Mullin <masmullin@hush.com>
Date: Thu, 22 Jan 2015 16:33:31 -0500
Subject: [PATCH] If "dir" is closed early inside create_add_devfreq_devices()
then there is a potential double free due to a second close during the
cleanup phase in clear_all_devfreq()
Signed-off-by: Michael Mullin <masmullin@hush.com>
- ---
src/devices/devfreq.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
src/devices/devfreq.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/devices/devfreq.cpp b/src/devices/devfreq.cpp
index d2e56e3..f652a57 100644
--- a/src/devices/devfreq.cpp
+++ b/src/devices/devfreq.cpp
@@ -247,6 +247,7 @@ void create_all_devfreq_devices(void)
fprintf(stderr, "Devfreq not enabled\n");
is_enabled = false;
closedir(dir);
+ dir = NULL;
return;
}
@@ -327,6 +328,8 @@ void clear_all_devfreq()
}
all_devfreq.clear();
/* close /sys/class/devfreq */
- if (dir != NULL)
+ if (dir != NULL) {
closedir(dir);
+ dir = NULL;
+ }
}

View File

@ -1,16 +0,0 @@
diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
index 167f1a7..e019484 100644
--- a/src/cpu/intel_cpus.cpp
+++ b/src/cpu/intel_cpus.cpp
@@ -131,11 +131,6 @@ nhm_core::nhm_core(int model)
if (model == 0x37) {
has_c3_res = 0;
has_c1_res = 1;
- this->byt_has_ahci();
- if ((this->get_byt_ahci_support()) == 0)
- has_c7_res = 1;/*BYT-T PC7 <- S0iX*/
- else
- has_c7_res = 0;
} else {
has_c3_res = 1;
has_c1_res = 0;

View File

@ -1,15 +0,0 @@
diff --git a/src/display.cpp b/src/display.cpp
index b6c9200..c051520 100644
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -127,7 +127,9 @@ void show_tab(unsigned int tab)
if (c && strlen(c) > 0)
mvwprintw(bottom_line, 0,0, c);
else
- mvwprintw(bottom_line, 0,0,"<ESC> %s | ",_("Exit"));
+ mvwprintw(bottom_line, 0, 0,
+ "<ESC> %s | <TAB> / <Shift + TAB> %s | ", _("Exit"),
+ _("Navigate"));
current_tab = tab;

View File

@ -1,226 +0,0 @@
diff --git a/src/tuning/bluetooth.cpp b/src/tuning/bluetooth.cpp
index 9be327e..52a9278 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"))
{
sprintf(desc, _("Bluetooth device interface status"));
- strcpy(toggle_bad, "/usr/sbin/hciconfig hci0 up &> /dev/null &");
- strcpy(toggle_good, "/usr/sbin/hciconfig hci0 down &> /dev/null");
+ toggle_bad = "/usr/sbin/hciconfig hci0 up &> /dev/null &";
+ toggle_good = "/usr/sbin/hciconfig hci0 down &> /dev/null";
}
@@ -190,9 +190,9 @@ const char *bt_tunable::toggle_script(void)
good = good_bad();
if (good == TUNE_GOOD) {
- return toggle_bad;
+ return toggle_bad.c_str();
}
- 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
+++ b/src/tuning/ethernet.cpp
@@ -49,11 +49,13 @@ extern void create_all_nics(callback fn);
ethernet_tunable::ethernet_tunable(const char *iface) : tunable("", 0.3, _("Good"), _("Bad"), _("Unknown"))
{
+ char tmp[4096];
+
memset(interf, 0, sizeof(interf));
strncpy(interf, iface, sizeof(interf));
sprintf(desc, _("Wake-on-lan status for device %s"), iface);
- sprintf(toggle_good, "ethtool -s %s wol d;", iface);
-
+ snprintf(tmp, 4096, "ethtool -s %s wol d;", iface);
+ toggle_good = tmp;
}
@@ -134,7 +136,7 @@ const char *ethernet_tunable::toggle_script(void)
good = good_bad();
if (good != TUNE_GOOD) {
- return toggle_good;
+ return toggle_good.c_str();
}
return NULL;
diff --git a/src/tuning/runtime.cpp b/src/tuning/runtime.cpp
index 3201fdd..6d6bb98 100644
--- a/src/tuning/runtime.cpp
+++ b/src/tuning/runtime.cpp
@@ -42,6 +42,7 @@ runtime_tunable::runtime_tunable(const char *path, const char *bus, const char *
{
ifstream file;
sprintf(runtime_path, "%s/power/control", path);
+ char tmp[4096];
sprintf(desc, _("Runtime PM for %s device %s"), bus, dev);
@@ -77,8 +78,10 @@ runtime_tunable::runtime_tunable(const char *path, const char *bus, const char *
}
- sprintf(toggle_good, "echo 'auto' > '%s';", runtime_path);
- sprintf(toggle_bad, "echo 'on' > '%s';", runtime_path);
+ snprintf(tmp, 4096, "echo 'auto' > '%s';", runtime_path);
+ toggle_good = tmp;
+ snprintf(tmp, 4096, "echo 'on' > '%s';", runtime_path);
+ toggle_bad = tmp;
}
int runtime_tunable::good_bad(void)
@@ -112,10 +115,10 @@ const char *runtime_tunable::toggle_script(void)
good = good_bad();
if (good == TUNE_GOOD) {
- return toggle_bad;
+ return toggle_bad.c_str();
}
- return toggle_good;
+ return toggle_good.c_str();
}
diff --git a/src/tuning/tunable.h b/src/tuning/tunable.h
index 3372378..8f90ee2 100644
--- a/src/tuning/tunable.h
+++ b/src/tuning/tunable.h
@@ -26,6 +26,7 @@
#define _INCLUDE_GUARD_TUNABLE_H
#include <vector>
+#include <string>
#include "../lib.h"
@@ -43,8 +44,8 @@ class tunable {
char bad_string[128];
char neutral_string[128];
protected:
- char toggle_good[4096];
- char toggle_bad[4096];
+ string toggle_good;
+ string toggle_bad;
public:
char desc[4096];
double score;
diff --git a/src/tuning/tuningsysfs.cpp b/src/tuning/tuningsysfs.cpp
index 0859a0c..3bfe0e3 100644
--- a/src/tuning/tuningsysfs.cpp
+++ b/src/tuning/tuningsysfs.cpp
@@ -43,11 +43,15 @@
sysfs_tunable::sysfs_tunable(const char *str, const char *_sysfs_path, const char *_target_content) : tunable(str, 1.0, _("Good"), _("Bad"), _("Unknown"))
{
+ char tmp[4096];
+
strcpy(sysfs_path, _sysfs_path);
strcpy(target_value, _target_content);
bad_value[0] = 0;
- sprintf(toggle_good, "echo '%s' > '%s';", target_value, sysfs_path);
- sprintf(toggle_bad, "echo '%s' > '%s';", bad_value, sysfs_path);
+ snprintf(tmp, 4096, "echo '%s' > '%s';", target_value, sysfs_path);
+ toggle_good = tmp;
+ snprintf(tmp, 4096, "echo '%s' > '%s';", bad_value, sysfs_path);
+ toggle_bad = tmp;
}
int sysfs_tunable::good_bad(void)
@@ -92,11 +96,11 @@ const char *sysfs_tunable::toggle_script(void) {
if (good == TUNE_GOOD) {
if (strlen(bad_value) > 0)
- return toggle_bad;
+ return toggle_bad.c_str();
return NULL;
}
- return toggle_good;
+ return toggle_good.c_str();
}
diff --git a/src/tuning/tuningusb.cpp b/src/tuning/tuningusb.cpp
index d2a0c11..ec869ec 100644
--- a/src/tuning/tuningusb.cpp
+++ b/src/tuning/tuningusb.cpp
@@ -41,6 +41,7 @@ usb_tunable::usb_tunable(const char *path, const char *name) : tunable("", 0.9,
char filename[4096];
char vendor[2048];
char product[2048];
+ char tmp[4096];
string str1, str2;
sprintf(usb_path, "%s/power/control", path);
@@ -73,8 +74,10 @@ usb_tunable::usb_tunable(const char *path, const char *name) : tunable("", 0.9,
else if (strlen(vendor))
sprintf(desc, _("Autosuspend for USB device %s [%s]"), vendor, name);
- sprintf(toggle_good, "echo 'auto' > '%s';", usb_path);
- sprintf(toggle_bad, "echo 'on' > '%s';", usb_path);
+ snprintf(tmp, 4096, "echo 'auto' > '%s';", usb_path);
+ toggle_good = tmp;
+ snprintf(tmp, 4096, "echo 'on' > '%s';", usb_path);
+ toggle_bad = tmp;
}
int usb_tunable::good_bad(void)
@@ -108,10 +111,10 @@ const char *usb_tunable::toggle_script(void)
good = good_bad();
if (good == TUNE_GOOD) {
- return toggle_bad;
+ return toggle_bad.c_str();
}
- return toggle_good;
+ return toggle_good.c_str();
}
static void add_usb_callback(const char *d_name)
diff --git a/src/tuning/wifi.cpp b/src/tuning/wifi.cpp
index 77cdfcc..2cc01b8 100644
--- a/src/tuning/wifi.cpp
+++ b/src/tuning/wifi.cpp
@@ -44,11 +44,15 @@ extern "C" {
wifi_tunable::wifi_tunable(const char *_iface) : tunable("", 1.5, _("Good"), _("Bad"), _("Unknown"))
{
+ char tmp[4096];
+
strcpy(iface, _iface);
sprintf(desc, _("Wireless Power Saving for interface %s"), iface);
- sprintf(toggle_good, "iw dev %s set power_save on", iface);
- sprintf(toggle_bad, "iw dev %s set power_save off", iface);
+ snprintf(tmp, 4096, "iw dev %s set power_save on", iface);
+ toggle_good = tmp;
+ snprintf(tmp, 4096, "iw dev %s set power_save off", iface);
+ toggle_bad = tmp;
}
int wifi_tunable::good_bad(void)
@@ -78,10 +82,10 @@ const char *wifi_tunable::toggle_script(void)
good = good_bad();
if (good == TUNE_GOOD) {
- return toggle_bad;
+ return toggle_bad.c_str();
}
- return toggle_good;
+ return toggle_good.c_str();
}
void add_wifi_tunables(void)

View File

@ -0,0 +1,48 @@
diff --git a/src/Makefile.am b/src/Makefile.am
index d7132c0..87d8469 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -133,7 +133,8 @@ powertop_CXXFLAGS = \
$(GLIB2_CFLAGS) \
$(LIBNL_CFLAGS) \
$(NCURSES_CFLAGS) \
- $(PCIUTILS_CFLAGS)
+ $(PCIUTILS_CFLAGS) \
+ $(PTHREAD_CFLAGS)
powertop_CPPFLAGS = \
@@ -142,7 +143,8 @@ powertop_CPPFLAGS = \
$(LIBNL_CFLAGS) \
$(LIBZ_CFLAGS) \
$(NCURSES_CFLAGS) \
- $(PCIUTILS_CFLAGS)
+ $(PCIUTILS_CFLAGS) \
+ $(PTHREAD_CFLAGS)
powertop_LDADD = \
../traceevent/libtraceevnet.la
diff --git a/src/Makefile.in b/src/Makefile.in
index 564ce5c..88d81e7 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -533,7 +533,8 @@ powertop_CXXFLAGS = \
$(GLIB2_CFLAGS) \
$(LIBNL_CFLAGS) \
$(NCURSES_CFLAGS) \
- $(PCIUTILS_CFLAGS)
+ $(PCIUTILS_CFLAGS) \
+ $(PTHREAD_CFLAGS)
powertop_CPPFLAGS = \
-DLOCALEDIR=\"$(localedir)\" \
@@ -541,7 +542,8 @@ powertop_CPPFLAGS = \
$(LIBNL_CFLAGS) \
$(LIBZ_CFLAGS) \
$(NCURSES_CFLAGS) \
- $(PCIUTILS_CFLAGS)
+ $(PCIUTILS_CFLAGS) \
+ $(PTHREAD_CFLAGS)
powertop_LDADD = \
../traceevent/libtraceevnet.la

View File

@ -1,29 +1,24 @@
Name: powertop
Version: 2.7
Release: 6%{?dist}
Summary: Power consumption monitor
Name: powertop
Version: 2.8
Release: 1%{?dist}
Summary: Power consumption monitor
Group: Applications/System
License: GPLv2
URL: http://01.org/powertop/
Source0: http://01.org/powertop/sites/default/files/downloads/%{name}-%{version}.tar.gz
Source1: powertop.service
Group: Applications/System
License: GPLv2
URL: http://01.org/powertop/
Source0: http://01.org/powertop/sites/default/files/downloads/%{name}-%{version}.tar.gz
Source1: powertop.service
# Sent upstream
Patch0: powertop-2.7-always-create-params.patch
Patch1: powertop-2.7-tunable-overflow-fix.patch
# Taken from upstream
Patch2: powertop-2.7-auto-tune-crash-fix.patch
# Sent upstream, patch by Pierre-Yves Chibon <pingou@pingoured.fr>
Patch3: powertop-2.7-navigate-hint.patch
# Backported from upstream
Patch4: powertop-2.7-baytrail-no-c7.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel
BuildRequires: systemd
Requires(post): systemd, coreutils
Requires(preun): systemd
Patch0: powertop-2.7-always-create-params.patch
# Sent upstream
Patch1: powertop-2.8-pthreads-cflags-fix.patch
BuildRequires: gettext-devel, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel
BuildRequires: systemd
Requires(post): systemd, coreutils
Requires(preun): systemd
Requires(postun): systemd
Provides: bundled(kernel-event-lib)
%description
PowerTOP is a tool that finds the software component(s) that make your
@ -32,10 +27,7 @@ computer use more power than necessary while it is idle.
%prep
%setup -q
%patch0 -p1 -b .always-create-params
%patch1 -p1 -b .tunable-overfow-fix
%patch2 -p1 -b .autotune-crash-fix
%patch3 -p1 -b .navigate-hint
%patch4 -p1 -b .baytrail-no-c7
%patch1 -p1 -b .pthreads-cflags-fix
%build
%configure
@ -76,6 +68,16 @@ rm -rf %{buildroot}
%{_unitdir}/powertop.service
%changelog
* Tue Nov 10 2015 Jaroslav Škarvada <jskarvad@redhat.com> - 2.8-1
- New version
Resolves: rhbz#1279872
- Dropped tunable-overflow-fix, auto-tune-crash-fix, navigate-hint
patches (all upstreamed)
- Dropped bytrail-no-c7 patch (following upstream)
- Fixed linkage with pthreads (by pthreads-cflags-fix patch)
- Added bundled(kernel-event-lib)
Resolves: rhbz#1041323
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild