From 9138fa8377818f7681c89db8d0ef4278bc9c6f7f Mon Sep 17 00:00:00 2001 From: Ethan Zhao Date: Fri, 11 Sep 2015 08:51:49 -0700 Subject: [PATCH] uek-rpm: config: add turbostat into kernel pakackage for OL6 and OL7 Orabug: 21613769 Create shell wrapper for turbostat and add turbosat tool into kernel package. Signed-off-by: Ethan Zhao Signed-off-by: Santosh Shilimkar --- uek-rpm/ol6/kernel-uek.spec | 18 ++++++++++++++++++ uek-rpm/ol6/turbostat | 12 ++++++++++++ uek-rpm/ol7/kernel-uek.spec | 17 +++++++++++++++++ uek-rpm/ol7/turbostat | 12 ++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 uek-rpm/ol6/turbostat create mode 100644 uek-rpm/ol7/turbostat diff --git a/uek-rpm/ol6/kernel-uek.spec b/uek-rpm/ol6/kernel-uek.spec index 3f914c4263fb..ba6e82a540bd 100644 --- a/uek-rpm/ol6/kernel-uek.spec +++ b/uek-rpm/ol6/kernel-uek.spec @@ -447,6 +447,7 @@ Provides: kernel%{?variant}-uname-r = %{KVERREL}%{?1:.%{1}}\ Provides: oracleasm = 2.0.5\ %ifnarch sparc64\ Provides: x86_energy_perf_policy = %{KVERREL}%{?1:.%{1}}\ +Provides: turbostat = %{KVERREL}%{?1:.%{1}}\ %endif\ Provides: perf = %{KVERREL}%{?1:.%{1}}\ #Provides: libperf.a = %{KVERREL}%{?1:.%{1}}\ @@ -534,6 +535,7 @@ Source16: perf Source17: kabitool Source18: check-kabi Source20: x86_energy_perf_policy +Source21: turbostat Source1000: config-x86_64 Source1001: config-x86_64-debug @@ -1139,6 +1141,16 @@ hwcap 0 nosegneg" install -m 755 x86_energy_perf_policy $RPM_BUILD_ROOT/usr/libexec/x86_energy_perf_policy.$KernelVer cd ../../../../ fi + +# build tools/power/x86/turbostat: + if [ -d tools/power/x86/turbostat ]; then + cd tools/power/x86/turbostat + make +# and install it: + mkdir -p $RPM_BUILD_ROOT/usr/libexec/ + install -m 755 turbostat $RPM_BUILD_ROOT/usr/libexec/turbostat.$KernelVer + cd ../../../../ + fi %endif %endif @@ -1453,6 +1465,10 @@ chmod 0755 $RPM_BUILD_ROOT/usr/sbin/perf mkdir -p $RPM_BUILD_ROOT/usr/sbin/ cp $RPM_SOURCE_DIR/x86_energy_perf_policy $RPM_BUILD_ROOT/usr/sbin/x86_energy_perf_policy chmod 0755 $RPM_BUILD_ROOT/usr/sbin/x86_energy_perf_policy +# turbostat shell wrapper +mkdir -p $RPM_BUILD_ROOT/usr/sbin/ +cp $RPM_SOURCE_DIR/turbostat $RPM_BUILD_ROOT/usr/sbin/turbostat +chmod 0755 $RPM_BUILD_ROOT/usr/sbin/turbostat %endif @@ -1724,6 +1740,8 @@ fi %ifnarch sparc64\ /usr/libexec/x86_energy_perf_policy.%{KVERREL}%{?2:.%{2}}\ /usr/sbin/x86_energy_perf_policy\ +/usr/libexec/turbostat.%{KVERREL}%{?2:.%{2}}\ +/usr/sbin/turbostat\ %endif\ %ghost /boot/initramfs-%{KVERREL}%{?2:.%{2}}.img\ %{expand:%%files %{?2:%{2}-}devel}\ diff --git a/uek-rpm/ol6/turbostat b/uek-rpm/ol6/turbostat new file mode 100644 index 000000000000..97230e097199 --- /dev/null +++ b/uek-rpm/ol6/turbostat @@ -0,0 +1,12 @@ +#!/bin/sh + +# In pathological situations, this will print some error about uname. +kverrel="`uname -r`" || exit + +exec "/usr/libexec/turbostat.$kverrel" ${1+"$@"} +rc=$? + +# We're still here, so the exec failed. +echo >&2 "Sorry, your kernel ($kverrel) doesn't support turbostat." + +exit $rc diff --git a/uek-rpm/ol7/kernel-uek.spec b/uek-rpm/ol7/kernel-uek.spec index 0be844f48ead..48aefcc4e8a2 100644 --- a/uek-rpm/ol7/kernel-uek.spec +++ b/uek-rpm/ol7/kernel-uek.spec @@ -447,6 +447,7 @@ Provides: kernel%{?variant}-uname-r = %{KVERREL}%{?1:.%{1}}\ Provides: oracleasm = 2.0.5\ %ifnarch sparc64\ Provides: x86_energy_perf_policy = %{KVERREL}%{?1:.%{1}}\ +Provides: turbostat = %{KVERREL}%{?1:.%{1}}\ %endif\ Provides: perf = %{KVERREL}%{?1:.%{1}}\ #Provides: libperf.a = %{KVERREL}%{?1:.%{1}}\ @@ -536,6 +537,7 @@ Source18: check-kabi Source20: x86_energy_perf_policy Source21: securebootca.cer Source22: secureboot.cer +Source23: turbostat Source1000: config-x86_64 Source1001: config-x86_64-debug @@ -1126,6 +1128,15 @@ hwcap 0 nosegneg" install -m 755 x86_energy_perf_policy $RPM_BUILD_ROOT/usr/libexec/x86_energy_perf_policy.$KernelVer cd ../../../../ fi +# build tools/power/x86/turbostat: + if [ -d tools/power/x86/turbostat ]; then + cd tools/power/x86/turbostat + make +# and install it: + mkdir -p $RPM_BUILD_ROOT/usr/libexec/ + install -m 755 turbostat $RPM_BUILD_ROOT/usr/libexec/turbostat.$KernelVer + cd ../../../../ + fi %endif %endif @@ -1440,6 +1451,10 @@ chmod 0755 $RPM_BUILD_ROOT/usr/sbin/perf mkdir -p $RPM_BUILD_ROOT/usr/sbin/ cp $RPM_SOURCE_DIR/x86_energy_perf_policy $RPM_BUILD_ROOT/usr/sbin/x86_energy_perf_policy chmod 0755 $RPM_BUILD_ROOT/usr/sbin/x86_energy_perf_policy +# turbostat shell wrapper +mkdir -p $RPM_BUILD_ROOT/usr/sbin/ +cp $RPM_SOURCE_DIR/turbostat $RPM_BUILD_ROOT/usr/sbin/turbostat +chmod 0755 $RPM_BUILD_ROOT/usr/sbin/turbostat %endif @@ -1711,6 +1726,8 @@ fi %ifnarch sparc64\ /usr/libexec/x86_energy_perf_policy.%{KVERREL}%{?2:.%{2}}\ /usr/sbin/x86_energy_perf_policy\ +/usr/libexec/turbostat.%{KVERREL}%{?2:.%{2}}\ +/usr/sbin/turbostat\ %endif\ %ghost /boot/initramfs-%{KVERREL}%{?2:.%{2}}.img\ %{expand:%%files %{?2:%{2}-}devel}\ diff --git a/uek-rpm/ol7/turbostat b/uek-rpm/ol7/turbostat new file mode 100644 index 000000000000..97230e097199 --- /dev/null +++ b/uek-rpm/ol7/turbostat @@ -0,0 +1,12 @@ +#!/bin/sh + +# In pathological situations, this will print some error about uname. +kverrel="`uname -r`" || exit + +exec "/usr/libexec/turbostat.$kverrel" ${1+"$@"} +rc=$? + +# We're still here, so the exec failed. +echo >&2 "Sorry, your kernel ($kverrel) doesn't support turbostat." + +exit $rc -- 2.50.1