Package init
This commit is contained in:
commit
d12390636a
35
powertop-2.7-always-create-params.patch
Normal file
35
powertop-2.7-always-create-params.patch
Normal file
@ -0,0 +1,35 @@
|
||||
diff --git a/src/parameters/persistent.cpp b/src/parameters/persistent.cpp
|
||||
index 9a5688a..6a232cd 100644
|
||||
--- a/src/parameters/persistent.cpp
|
||||
+++ b/src/parameters/persistent.cpp
|
||||
@@ -145,9 +145,6 @@ void save_parameters(const char *filename)
|
||||
|
||||
// printf("result size is %i, #parameters is %i \n", (int)past_results.size(), (int)all_parameters.parameters.size());
|
||||
|
||||
- if (!global_power_valid())
|
||||
- return;
|
||||
-
|
||||
pathname = get_param_directory(filename);
|
||||
|
||||
file.open(pathname, ios::out);
|
||||
@@ -156,12 +153,15 @@ void save_parameters(const char *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
- map<string, int>::iterator it;
|
||||
+ if (global_power_valid())
|
||||
+ {
|
||||
+ map<string, int>::iterator it;
|
||||
|
||||
- for (it = param_index.begin(); it != param_index.end(); it++) {
|
||||
- int index;
|
||||
- index = it->second;
|
||||
- file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n";
|
||||
+ for (it = param_index.begin(); it != param_index.end(); it++) {
|
||||
+ int index;
|
||||
+ index = it->second;
|
||||
+ file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n";
|
||||
+ }
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
41
powertop-2.9-cstates-rewrite-fix.patch
Normal file
41
powertop-2.9-cstates-rewrite-fix.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From f3f350f138912dc89abb37676f7e65fc6057ec53 Mon Sep 17 00:00:00 2001
|
||||
From: Gautam Paranjape <gautam.paranjape@intel.com>
|
||||
Date: Fri, 21 Jul 2017 07:02:13 -0700
|
||||
Subject: [PATCH] Some c-states exposed by the intel_idle driver are assigned
|
||||
the same line_level, which means that the most recent one assigned can
|
||||
overwrite another c-state. For example, the C1-SKL c-state is overwritten by
|
||||
the C1E-SKL c-state because both have a "1" in the name and are assigned the
|
||||
same line level. To fix this, check if a "sub c-state" (ex. C1E-SKL) is being
|
||||
inserted. If so, check the vector of c-states if a c-state with similar name
|
||||
(ex. C1-SKL) exists, and increment the line level.
|
||||
|
||||
Signed-off-by: Gautam Paranjape <gautam.paranjape@intel.com>
|
||||
---
|
||||
src/cpu/abstract_cpu.cpp | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/abstract_cpu.cpp b/src/cpu/abstract_cpu.cpp
|
||||
index bc32336..c59721c 100644
|
||||
--- a/src/cpu/abstract_cpu.cpp
|
||||
+++ b/src/cpu/abstract_cpu.cpp
|
||||
@@ -218,6 +218,17 @@ void abstract_cpu::insert_cstate(const char *linux_name, const char *human_name,
|
||||
}
|
||||
if (*c >= '0' && *c <='9') {
|
||||
state->line_level = strtoull(c, NULL, 10);
|
||||
+ if(*(c+1) != '-'){
|
||||
+ int greater_line_level = strtoull(c, NULL, 10);
|
||||
+ for(unsigned int pos = 0; pos < cstates.size(); pos++){
|
||||
+ if(*c == cstates[pos]->human_name[1]){
|
||||
+ if(*(c+1) != cstates[pos]->human_name[2]){
|
||||
+ greater_line_level = max(greater_line_level, cstates[pos]->line_level);
|
||||
+ state->line_level = greater_line_level + 1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
c++;
|
||||
--
|
||||
2.14.3
|
||||
|
||||
51
powertop-2.9-intel-cnluy-support.patch
Normal file
51
powertop-2.9-intel-cnluy-support.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 0d3a1cda2a95484fa41cc4c35294a4153b3a5e97 Mon Sep 17 00:00:00 2001
|
||||
From: Nivedita Swaminathan <nivedita.swaminathan@intel.com>
|
||||
Date: Wed, 31 Jan 2018 14:53:28 -0800
|
||||
Subject: [PATCH] Enable support for Intel CNL-U/Y
|
||||
|
||||
This commit adds support for Intel CNL-U/Y platforms
|
||||
|
||||
Signed-off-by: Nivedita Swaminathan <nivedita.swaminathan@intel.com>
|
||||
---
|
||||
src/cpu/intel_cpus.cpp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
|
||||
index 4980516..4c7b315 100644
|
||||
--- a/src/cpu/intel_cpus.cpp
|
||||
+++ b/src/cpu/intel_cpus.cpp
|
||||
@@ -68,6 +68,7 @@ static int intel_cpu_models[] = {
|
||||
0x5E, /* SKY */
|
||||
0x56, /* BDX-DE */
|
||||
0x5c, /* BXT-P */
|
||||
+ 0x66, /* CNL-U/Y */
|
||||
0x7A, /* GLK */
|
||||
0x8E, /* KBL */
|
||||
0x9E, /* KBL */
|
||||
@@ -166,6 +167,7 @@ nhm_core::nhm_core(int model)
|
||||
case 0x5E: /* SKY */
|
||||
case 0x3D: /* BDW */
|
||||
case 0x5c: /* BXT-P */
|
||||
+ case 0x66: /* CNL-U/Y */
|
||||
case 0x7A: /* GLK */
|
||||
case 0x8E: /* KBL */
|
||||
case 0x9E: /* KBL */
|
||||
@@ -347,6 +349,7 @@ nhm_package::nhm_package(int model)
|
||||
case 0x5E: /* SKY */
|
||||
case 0x3D: /* BDW */
|
||||
case 0x5c: /* BXT-P */
|
||||
+ case 0x66: /* CNL-U/Y */
|
||||
case 0x7A: /* GLK */
|
||||
case 0x8E: /* KBL */
|
||||
case 0x9E: /* KBL */
|
||||
@@ -380,6 +383,7 @@ nhm_package::nhm_package(int model)
|
||||
case 0x4E: /* SKY */
|
||||
case 0x5E: /* SKY */
|
||||
case 0x5c: /* BXT-P */
|
||||
+ case 0x66: /* CNL-U/Y */
|
||||
case 0x7A: /* GLK */
|
||||
case 0x8E: /* KBL */
|
||||
case 0x9E: /* KBL */
|
||||
--
|
||||
2.14.3
|
||||
|
||||
66
powertop-2.9-intel-cpu-check-aperf.patch
Normal file
66
powertop-2.9-intel-cpu-check-aperf.patch
Normal file
@ -0,0 +1,66 @@
|
||||
diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
|
||||
index f3711f5..019d922 100644
|
||||
--- a/src/cpu/cpu.cpp
|
||||
+++ b/src/cpu/cpu.cpp
|
||||
@@ -68,7 +68,7 @@ static class abstract_cpu * new_package(int package, int cpu, char * vendor, int
|
||||
char packagename[128];
|
||||
if (strcmp(vendor, "GenuineIntel") == 0)
|
||||
if (family == 6)
|
||||
- if (is_supported_intel_cpu(model))
|
||||
+ if (is_supported_intel_cpu(model, cpu))
|
||||
ret = new class nhm_package(model);
|
||||
|
||||
if (!ret)
|
||||
@@ -105,7 +105,7 @@ static class abstract_cpu * new_core(int core, int cpu, char * vendor, int famil
|
||||
|
||||
if (strcmp(vendor, "GenuineIntel") == 0)
|
||||
if (family == 6)
|
||||
- if (is_supported_intel_cpu(model))
|
||||
+ if (is_supported_intel_cpu(model, cpu))
|
||||
ret = new class nhm_core(model);
|
||||
|
||||
if (!ret)
|
||||
@@ -134,7 +134,7 @@ static class abstract_cpu * new_cpu(int number, char * vendor, int family, int m
|
||||
|
||||
if (strcmp(vendor, "GenuineIntel") == 0)
|
||||
if (family == 6)
|
||||
- if (is_supported_intel_cpu(model))
|
||||
+ if (is_supported_intel_cpu(model, number))
|
||||
ret = new class nhm_cpu;
|
||||
|
||||
if (!ret)
|
||||
diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
|
||||
index 4c7b315..0030dba 100644
|
||||
--- a/src/cpu/intel_cpus.cpp
|
||||
+++ b/src/cpu/intel_cpus.cpp
|
||||
@@ -77,13 +77,15 @@ static int intel_cpu_models[] = {
|
||||
|
||||
static int intel_pstate_driver_loaded = -1;
|
||||
|
||||
-int is_supported_intel_cpu(int model)
|
||||
+int is_supported_intel_cpu(int model, int cpu)
|
||||
{
|
||||
int i;
|
||||
+ uint64_t msr;
|
||||
|
||||
for (i = 0; intel_cpu_models[i] != 0; i++)
|
||||
if (model == intel_cpu_models[i])
|
||||
- return 1;
|
||||
+ if (cpu < 0 || read_msr(cpu, MSR_APERF, &msr) >= 0)
|
||||
+ return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/src/cpu/intel_cpus.h b/src/cpu/intel_cpus.h
|
||||
index d20db9a..79afb98 100644
|
||||
--- a/src/cpu/intel_cpus.h
|
||||
+++ b/src/cpu/intel_cpus.h
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
-int is_supported_intel_cpu(int model);
|
||||
+int is_supported_intel_cpu(int model, int cpu);
|
||||
int byt_has_ahci();
|
||||
|
||||
int is_intel_pstate_driver_loaded();
|
||||
51
powertop-2.9-intel-glk-support.patch
Normal file
51
powertop-2.9-intel-glk-support.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 523b15bd892f036bb6b777ad6c88f334f0980347 Mon Sep 17 00:00:00 2001
|
||||
From: Nivedita Swaminathan <nivedita.swaminathan@intel.com>
|
||||
Date: Wed, 31 Jan 2018 14:41:18 -0800
|
||||
Subject: [PATCH] Enable support for Intel GLK
|
||||
|
||||
This commit enables support for Intel GLK platforms
|
||||
|
||||
Signed-off-by: Nivedita Swaminathan <nivedita.saminathan@intel.com>
|
||||
---
|
||||
src/cpu/intel_cpus.cpp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
|
||||
index 3901342..4980516 100644
|
||||
--- a/src/cpu/intel_cpus.cpp
|
||||
+++ b/src/cpu/intel_cpus.cpp
|
||||
@@ -68,6 +68,7 @@ static int intel_cpu_models[] = {
|
||||
0x5E, /* SKY */
|
||||
0x56, /* BDX-DE */
|
||||
0x5c, /* BXT-P */
|
||||
+ 0x7A, /* GLK */
|
||||
0x8E, /* KBL */
|
||||
0x9E, /* KBL */
|
||||
0 /* last entry must be zero */
|
||||
@@ -165,6 +166,7 @@ nhm_core::nhm_core(int model)
|
||||
case 0x5E: /* SKY */
|
||||
case 0x3D: /* BDW */
|
||||
case 0x5c: /* BXT-P */
|
||||
+ case 0x7A: /* GLK */
|
||||
case 0x8E: /* KBL */
|
||||
case 0x9E: /* KBL */
|
||||
has_c7_res = 1;
|
||||
@@ -345,6 +347,7 @@ nhm_package::nhm_package(int model)
|
||||
case 0x5E: /* SKY */
|
||||
case 0x3D: /* BDW */
|
||||
case 0x5c: /* BXT-P */
|
||||
+ case 0x7A: /* GLK */
|
||||
case 0x8E: /* KBL */
|
||||
case 0x9E: /* KBL */
|
||||
has_c2c6_res=1;
|
||||
@@ -377,6 +380,7 @@ nhm_package::nhm_package(int model)
|
||||
case 0x4E: /* SKY */
|
||||
case 0x5E: /* SKY */
|
||||
case 0x5c: /* BXT-P */
|
||||
+ case 0x7A: /* GLK */
|
||||
case 0x8E: /* KBL */
|
||||
case 0x9E: /* KBL */
|
||||
has_c8c9c10_res = 1;
|
||||
--
|
||||
2.14.3
|
||||
|
||||
BIN
powertop-v2.9.tar.gz
Normal file
BIN
powertop-v2.9.tar.gz
Normal file
Binary file not shown.
9
powertop.service
Normal file
9
powertop.service
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=PowerTOP autotuner
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/powertop --auto-tune
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
80
powertop.spec
Normal file
80
powertop.spec
Normal file
@ -0,0 +1,80 @@
|
||||
Name: powertop
|
||||
Version: 2.9
|
||||
Release: 11
|
||||
Summary: Power consumption tool for Linux
|
||||
License: GPLv2
|
||||
URL: http://01.org/powertop/
|
||||
Source0: http://01.org/sites/default/files/downloads/powertop/%{name}-v%{version}.tar.gz
|
||||
Source1: powertop.service
|
||||
|
||||
Patch0: powertop-2.7-always-create-params.patch
|
||||
Patch1: powertop-2.9-cstates-rewrite-fix.patch
|
||||
Patch2: powertop-2.9-intel-glk-support.patch
|
||||
Patch3: powertop-2.9-intel-cnluy-support.patch
|
||||
Patch4: powertop-2.9-intel-cpu-check-aperf.patch
|
||||
|
||||
BuildRequires: gcc gcc-c++ git systemd
|
||||
BuildRequires: gettext-devel ncurses-devel pciutils-devel zlib-devel libnl3-devel
|
||||
Requires(post): coreutils
|
||||
%{?systemd_requires}
|
||||
Provides: bundled(kernel-event-lib)
|
||||
|
||||
%description
|
||||
Powertop is a Linux tool to diagnose issues with power consumption and
|
||||
power management.In addition to being a diagnostic tool, powertop also
|
||||
has an interactive mode where the user can experiment various power
|
||||
management settings for cases where the Linux distribution has not enabled these settings.
|
||||
|
||||
%package_help
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-v%{version} -p1 -Sgit
|
||||
|
||||
%build
|
||||
%configure
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
install -Dd $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name}
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name}/{saved_parameters.powertop,saved_results.powertop}
|
||||
%find_lang %{name}
|
||||
|
||||
install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/powertop.service
|
||||
|
||||
%pre
|
||||
|
||||
%preun
|
||||
%systemd_preun %{SOURCE1}
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart %{SOURCE1}
|
||||
|
||||
%post
|
||||
%systemd_post %{SOURCE1}
|
||||
|
||||
touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop} &> /dev/null || :
|
||||
|
||||
%files -f %{name}.lang
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING README TODO
|
||||
%{_sbindir}/powertop
|
||||
%{_unitdir}/powertop.service
|
||||
%dir %{_localstatedir}/cache/powertop
|
||||
%ghost %{_localstatedir}/cache/powertop/saved_parameters.powertop
|
||||
%ghost %{_localstatedir}/cache/powertop/saved_results.powertop
|
||||
|
||||
%files help
|
||||
%{_mandir}/man8/powertop.8*
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Sep 27 2019 chengquan<chengquan3@huawei.com> - 2.9-11
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:fix spec rule in openeuler
|
||||
|
||||
* Fri Sep 06 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.9-10
|
||||
- Package init
|
||||
Loading…
x
Reference in New Issue
Block a user