Consolidated scripts and spec file regarding tscdeadline-latency
Related: rhbz#1504680 Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
10a59112c0
commit
b532e9291d
4 changed files with 85 additions and 47 deletions
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
QEMU=$(type -P qemu-kvm || echo /usr/libexec/qemu-kvm)
|
||||
|
||||
if [ ! -f /sys/module/kvm/parameters/lapic_timer_advance_ns ]; then
|
||||
echo "/sys/module/kvm/parameters/lapic_timer_advance_ns not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dir=`mktemp -d`
|
||||
|
||||
for i in `seq 1000 500 7000`; do
|
||||
echo $i > /sys/module/kvm/parameters/lapic_timer_advance_ns
|
||||
chrt -f 1 taskset -c $1 $QEMU -enable-kvm -device pc-testdev \
|
||||
-device isa-debug-exit,iobase=0xf4,iosize=0x4 \
|
||||
-display none -serial stdio -device pci-testdev \
|
||||
-kernel /usr/share/tuned/tscdeadline_latency.flat \
|
||||
-cpu host | grep latency | cut -f 2 -d ":" > $dir/out
|
||||
|
||||
A=0
|
||||
while read l; do
|
||||
A=$(($A+$l))
|
||||
done < $dir/out
|
||||
|
||||
lines=`wc -l $dir/out | cut -f 1 -d " "`; ans=$(($A/$lines));
|
||||
echo $i: $ans
|
||||
done
|
||||
|
|
@ -4,6 +4,40 @@
|
|||
|
||||
ltanfile=/sys/module/kvm/parameters/lapic_timer_advance_ns
|
||||
|
||||
QEMU=$(type -P qemu-kvm || echo /usr/libexec/qemu-kvm)
|
||||
TSCDEADLINE_LATENCY="/usr/share/qemu-kvm/tscdeadline_latency.flat"
|
||||
if [ ! -f "$TSCDEADLINE_LATENCY" ]; then
|
||||
TSCDEADLINE_LATENCY="/usr/share/tuned/tscdeadline_latency.flat"
|
||||
fi
|
||||
|
||||
run_tsc_deadline_latency()
|
||||
{
|
||||
if [ ! -f /sys/module/kvm/parameters/lapic_timer_advance_ns ]; then
|
||||
echo "/sys/module/kvm/parameters/lapic_timer_advance_ns not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
dir=`mktemp -d`
|
||||
|
||||
for i in `seq 1000 500 7000`; do
|
||||
echo $i > /sys/module/kvm/parameters/lapic_timer_advance_ns
|
||||
chrt -f 1 taskset -c $1 $QEMU -enable-kvm -device pc-testdev \
|
||||
-device isa-debug-exit,iobase=0xf4,iosize=0x4 \
|
||||
-display none -serial stdio -device pci-testdev \
|
||||
-kernel "$TSCDEADLINE_LATENCY" \
|
||||
-cpu host | grep latency | cut -f 2 -d ":" > $dir/out
|
||||
|
||||
A=0
|
||||
while read l; do
|
||||
A=$(($A+$l))
|
||||
done < $dir/out
|
||||
|
||||
lines=`wc -l $dir/out | cut -f 1 -d " "`
|
||||
ans=$(($A/$lines))
|
||||
echo $i: $ans
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
python /usr/libexec/tuned/defirqaffinity.py "remove" "$TUNED_isolated_cores_expanded" &&
|
||||
retval = "$?"
|
||||
|
|
@ -26,10 +60,10 @@ start() {
|
|||
|
||||
|
||||
if [ -f $ltanfile -a ! -f ./lapic_timer_adv_ns ]; then
|
||||
if [ -f /usr/share/tuned/tscdeadline_latency.flat ]; then
|
||||
if [ -f "$TSCDEADLINE_LATENCY" ]; then
|
||||
tempdir=`mktemp -d`
|
||||
isolatedcpu=`echo "$TUNED_isolated_cores_expanded" | cut -f 1 -d ","`
|
||||
sh ./run-tscdeadline-latency.sh $isolatedcpu > $tempdir/lat.out
|
||||
run_tscdeadline_latency $isolatedcpu > $tempdir/lat.out
|
||||
sh ./find-lapictscdeadline-optimal.sh $tempdir/lat.out > $tempdir/opt.out
|
||||
if [ $? -eq 0 ]; then
|
||||
echo `cat $tempdir/opt.out | cut -f 2 -d ":"` > ./lapic_timer_adv_ns
|
||||
|
|
|
|||
|
|
@ -6,18 +6,6 @@
|
|||
# - tuna
|
||||
# - awk
|
||||
# - wc
|
||||
#
|
||||
# Packaging:
|
||||
#
|
||||
# tscdeadline_latency.flat must be included in the profile directory
|
||||
# so as to calculate optimal tsc deadline latency advancement value.
|
||||
#
|
||||
# How to build:
|
||||
#
|
||||
# git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
|
||||
# cd kvm-unit-tests/
|
||||
# ./configure && make
|
||||
|
||||
|
||||
[main]
|
||||
summary=Optimize for KVM guests running realtime workloads
|
||||
|
|
|
|||
55
tuned.spec
55
tuned.spec
|
|
@ -1,5 +1,13 @@
|
|||
%global _binaries_in_noarch_packages_terminate_build 0
|
||||
|
||||
%bcond_with snapshot
|
||||
|
||||
%if 0%{?fedora}
|
||||
%bcond_without tscdeadline_latency
|
||||
%else
|
||||
%bcond_with tscdeadline_latency
|
||||
%endif
|
||||
|
||||
%if %{with snapshot}
|
||||
%if 0%{!?git_short_commit:1}
|
||||
%global git_short_commit %(git rev-parse --short=8 --verify HEAD)
|
||||
|
|
@ -8,6 +16,8 @@
|
|||
%global git_suffix %{git_date}git%{git_short_commit}
|
||||
%endif
|
||||
|
||||
%global kvm_tests_snap 20171020
|
||||
|
||||
#%%global prerelease rc
|
||||
#%%global prereleasenum 2
|
||||
|
||||
|
|
@ -19,10 +29,16 @@ Name: tuned
|
|||
Version: 2.9.0
|
||||
Release: 1%{?prerel1}%{?with_snapshot:.%{git_suffix}}%{?dist}
|
||||
License: GPLv2+
|
||||
Source: https://github.com/redhat-performance/%{name}/archive/v%{version}%{?prerel2}.tar.gz#/%{name}-%{version}%{?prerel1}.tar.gz
|
||||
Source0: https://github.com/redhat-performance/%{name}/archive/v%{version}%{?prerel2}.tar.gz#/%{name}-%{version}%{?prerel1}.tar.gz
|
||||
%if %{with tscdeadline_latency}
|
||||
Source1: https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git/snapshot/kvm-unit-tests-%{kvm_tests_snap}.tar.gz
|
||||
%endif
|
||||
URL: http://www.tuned-project.org/
|
||||
BuildArch: noarch
|
||||
BuildRequires: python, systemd, desktop-file-utils
|
||||
%if %{with tscdeadline_latency}
|
||||
BuildRequires: gcc-x86_64-linux-gnu
|
||||
%endif
|
||||
Requires(post): systemd, virt-what
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
|
|
@ -128,16 +144,26 @@ Summary: Additional tuned profile(s) targeted to Network Function Virtualization
|
|||
Requires: %{name} = %{version}
|
||||
Requires: %{name}-profiles-realtime = %{version}
|
||||
Requires: tuna
|
||||
%if 0%{?fedora} > 22
|
||||
Recommends: qemu-kvm-tools-rhev
|
||||
%if %{with tscdeadline_latency}
|
||||
Requires: %{name}-profiles-nfv-host-bin = %{version}
|
||||
%endif
|
||||
%if 0%{?rhel} == 7
|
||||
%if 0%{?rhel} >= 7 && %{without tscdeadline_latency}
|
||||
Requires: qemu-kvm-tools-rhev
|
||||
%endif
|
||||
|
||||
%description profiles-nfv-host
|
||||
Additional tuned profile(s) targeted to Network Function Virtualization (NFV) host.
|
||||
|
||||
%if %{with tscdeadline_latency}
|
||||
%package profiles-nfv-host-bin
|
||||
Summary: Binaries that are needed for the Network Function Virtualization (NFV) host tuned profile.
|
||||
Requires: %{name} = %{version}
|
||||
ExclusiveArch: %{ix86} x86_64
|
||||
|
||||
%description profiles-nfv-host-bin
|
||||
Binaries that are needed for the Network Function Virtualization (NFV) host tuned profile.
|
||||
%endif
|
||||
|
||||
# this is kept for backward compatibility, it should be dropped for RHEL-8
|
||||
%package profiles-nfv
|
||||
Summary: Additional tuned profile(s) targeted to Network Function Virtualization (NFV)
|
||||
|
|
@ -165,10 +191,17 @@ It can be also used to fine tune your system for specific scenarios.
|
|||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?prerel2}
|
||||
|
||||
%if %{with tscdeadline_latency}
|
||||
cd .. && tar xf %{SOURCE1}
|
||||
%endif
|
||||
|
||||
%build
|
||||
|
||||
%if %{with tscdeadline_latency}
|
||||
cd ../kvm-unit-tests-%{kvm_tests_snap}
|
||||
./configure --cross-prefix=x86_64-linux-gnu-
|
||||
make x86/tscdeadline_latency.flat
|
||||
x86_64-linux-gnu-strip x86/tscdeadline_latency.flat
|
||||
%endif
|
||||
|
||||
%install
|
||||
make install DESTDIR=%{buildroot} DOCDIR=%{docdir}
|
||||
|
|
@ -182,6 +215,10 @@ mkdir -p %{buildroot}%{_datadir}/tuned/grub2
|
|||
mv %{buildroot}%{_sysconfdir}/grub.d/00_tuned %{buildroot}%{_datadir}/tuned/grub2/00_tuned
|
||||
rmdir %{buildroot}%{_sysconfdir}/grub.d
|
||||
|
||||
%if %{with tscdeadline_latency}
|
||||
install -m 0644 ../kvm-unit-tests-%{kvm_tests_snap}/x86/tscdeadline_latency.flat %{buildroot}%{_datadir}/tuned
|
||||
%endif
|
||||
|
||||
# ghost for persistent storage
|
||||
mkdir -p %{buildroot}%{_var}/lib/tuned
|
||||
|
||||
|
|
@ -386,6 +423,12 @@ fi
|
|||
%{_prefix}/lib/tuned/realtime-virtual-host
|
||||
%{_mandir}/man7/tuned-profiles-nfv-host.7*
|
||||
|
||||
%if %{with tscdeadline_latency}
|
||||
%files profiles-nfv-host-bin
|
||||
%defattr(-,root,root,-)
|
||||
%{_datadir}/tuned/tscdeadline_latency.flat
|
||||
%endif
|
||||
|
||||
%files profiles-nfv
|
||||
%defattr(-,root,root,-)
|
||||
%doc %{docdir}/README.NFV
|
||||
|
|
|
|||
Loading…
Reference in a new issue