diff --git a/.gitignore b/.gitignore index e69de29..7fda419 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/rt-setup-2.0.tar.bz2 diff --git a/.rt-setup.metadata b/.rt-setup.metadata index e69de29..e46ce8f 100644 --- a/.rt-setup.metadata +++ b/.rt-setup.metadata @@ -0,0 +1 @@ +bbe0665ea86f1b6ac9931f7fc04cb4f038aab50c SOURCES/rt-setup-2.0.tar.bz2 diff --git a/SOURCES/kernel-is-rt b/SOURCES/kernel-is-rt deleted file mode 100644 index 85b644c..0000000 --- a/SOURCES/kernel-is-rt +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -e -[ -e /sys/kernel/realtime ] diff --git a/SOURCES/realtime.conf b/SOURCES/realtime.conf deleted file mode 100644 index 237f3ed..0000000 --- a/SOURCES/realtime.conf +++ /dev/null @@ -1,10 +0,0 @@ -# This file specifies reasonable default limits for users -# who should be able to run realtime processes. -# -# Such users must be added to group 'realtime' to be -# affected by these limits. - -@realtime soft cpu unlimited -@realtime - rtprio 99 -@realtime - nice -20 -@realtime - memlock unlimited diff --git a/SOURCES/rhel-rt.rules b/SOURCES/rhel-rt.rules deleted file mode 100644 index 5084f69..0000000 --- a/SOURCES/rhel-rt.rules +++ /dev/null @@ -1,19 +0,0 @@ -# udev rules specific to RHEL-RT Realtime kernel - -# insure /dev/rtc points to /dev/rtc0 -# we use PROGRAM rather than SYMLINK because there is -# a (good) possibility that a /dev/rtc device file -# already exists and we want to replace it (hence the -# ln -sf) -KERNEL=="rtc0", PROGRAM+="/bin/ln -sf rtc0 /dev/rtc" - -# Give permission to the realtime group to write a zero to /dev/cpu_dma_latency -# This will tell the power management system not to transition to a high cstate -KERNEL=="cpu_dma_latency", GROUP="realtime" - -# Give permission to the realtime group to read the per cpu msr and cpuid -# registers. This is needed by cyclictest in rt-tests when using the new -# feature to read the smi counters. This is necessary but not sufficient -# A program that wants to access these registers will also need CAP_SYS_RAWIO -SUBSYSTEM=="msr", GROUP="realtime", MODE="0640" -SUBSYSTEM=="cpuid", GROUP="realtime", MODE="0640" diff --git a/SOURCES/rt-setup-kdump b/SOURCES/rt-setup-kdump deleted file mode 100644 index 5f04573..0000000 --- a/SOURCES/rt-setup-kdump +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/sh -# -# script to update /etc/sysconfig/kdump to use the latest -# kernel package as the dump kernel -# -# optional argument --grub causes kdump kernel cmdline to -# be added to rt kernel grub entries -# - -me=$(basename $0) -rpmcmd='rpm -q --last' - -function fatal () { - echo "$me: " $1 - exit -1 -} - -function usage () { - echo "usage: $me [-g|--grub] [-r|--rhel] [-v|--verbose] [-h|--help]" - echo " --grub - add crashkernel arg to rt grub entries" - echo " --rhel - use the RHEL-7.1 kernel as the kdump kernel" - echo " (the default is to use the RHEL-RT kernel)" - echo " --verbose - print out actions" - echo " --help - print this message" - exit -1 -} - -function report() { - [ $verbose -eq 1 ] && echo $1 -} - -# return the latest package version of specified package name -function latest_package_ver() { - local pkg=$1 - local ver=$($rpmcmd $pkg | head -1 | awk '{print $1}') - - if [ $? -ne 0 ]; then - fatal " error fetching version for $pkg" - fi - echo ${ver#$pkg-} - return 0 -} - -# get the kernel version of hhe latest installed kernel -function vmlinux_ver() { - local ver=$1 - local vmver='' - for i in $(cd /boot; echo vmlinuz-*); do - if [ "${i#vmlinuz-$ver}" != "$i" ]; then - vmver=${i#vmlinuz-} - echo $vmver - return 0 - fi - done - return 1 -} - -# find all the grub indexs for installed rhel-rt kernels -# returns a comma-separated list of indices for use -# by the grubby command -function find_rt_kernel_indexes_rhel_rt() { - local awkscript='BEGIN{FS="="; ORS=","} $1 ~ /^index/{idx=$2;} - $2 ~ /.rt.*.el7.x86_64/ && - $1 ~ /^kernel/ {print idx}' - local rt_idx_list=$(/sbin/grubby --info=ALL | /usr/bin/awk "$awkscript") - - echo $rt_idx_list | sed -e 's/,$//' - return 0 -} - -############################################################################# - -# make sure we're root -if [ $UID -ne 0 ]; then - echo " must be root to run $me!" - usage -fi - -# process options -dogrub=0 -userhel=0 -verbose=0 -TEMP=$(getopt --options "grvh" --longoptions="grub,rhel,verbose,help" -- "$@") -if [ $? -ne 0 ]; then - usage -fi -eval set -- "$TEMP" -while true; do - case "$1" in - -g|--grub) - dogrub=1 - shift - ;; - -r|--rhel) - userhel=1 - shift - ;; - -v|--verbose) - verbose=1 - shift - ;; - -h|--help) - usage - ;; - --) shift ; break ;; - *) - echo "internal error!" - usage - ;; - esac -done - -# warn if /etc/sysconfig/kdump does not exist -if [ ! -f /etc/sysconfig/kdump ]; then - echo " File /etc/sysconfig/kdump not found." - echo " Please, check your kexec-tools installation." - exit 1 -fi - -if [ $dogrub = 0 ]; then - echo "Not performing changes to /etc/grub.conf" - echo - # check if there is memory reserved for the kexec kernel - if ! cat /proc/cmdline | grep -e crashkernel > /dev/null; then - echo " Kernel DOES NOT have memory reserved for kdump kernel..." - echo " Use --grub option to enable crashkernel option on kernel command line" - echo - fi -fi - -# select the right kdump kernel -if [ $userhel -eq 1 ]; then - KDUMP_KERNEL="kernel" -else - KDUMP_KERNEL="kernel-rt" -fi -# get the version of the latest installed kernel -kver=$(latest_package_ver $KDUMP_KERNEL) -if [ -z "$kver" ]; then - fatal " Can't find $KDUMP_KERNEL package information!" -fi - -report " making kernel-$kver the kdump kernel" - -# find the vmlinux version info for the latest kernel package -vmlinux_version=$(vmlinux_ver $kver) -if [ -z "$vmlinux_version" ]; then - fatal " Can't get vmlinux version!" -fi - -# now edit the /etc/sysconfig/kdump file -sed -e "s/^KDUMP_KERNELVER.*$/KDUMP_KERNELVER=\"$vmlinux_version\"/" \ - /etc/sysconfig/kdump >/tmp/kdump.$$ -mv /etc/sysconfig/kdump /etc/sysconfig/kdump.save && \ - mv /tmp/kdump.$$ /etc/sysconfig/kdump - -# if requested, update the grub entries for the rt kernels -if [ $dogrub = 1 ]; then - rtver=$(latest_package_ver kernel-rt) - if [ -z "$rtver" ]; then - fatal " Can't find kernel-rt package information!" - fi - # RHEL-RT kernel - kernels=$(find_rt_kernel_indexes_rhel_rt) - if [ ! -z $kernels ]; then - report " adding 'crashkernel=auto' arg to grub entries: $kernels" - /sbin/grubby --update-kernel=$kernels --args="crashkernel=auto" - fi -fi - -exit $? diff --git a/SOURCES/rt-setup.service b/SOURCES/rt-setup.service deleted file mode 100644 index bea403e..0000000 --- a/SOURCES/rt-setup.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=RHEL-RT environment details setup -After=syslog.target - -## Not a daemon -[Service] -Type=simple -ExecStart=/usr/bin/rt-setup - -[Install] -WantedBy=multi-user.target - diff --git a/SOURCES/rt-setup.sysconfig b/SOURCES/rt-setup.sysconfig deleted file mode 100644 index 41e3842..0000000 --- a/SOURCES/rt-setup.sysconfig +++ /dev/null @@ -1,4 +0,0 @@ -# -# Decide whether to turn off SLUB cpu_partial support -# -SLUB_CPU_PARTIAL="off" diff --git a/SOURCES/rt-setup.systemd b/SOURCES/rt-setup.systemd deleted file mode 100755 index 249a5ac..0000000 --- a/SOURCES/rt-setup.systemd +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -on_rt () { - if [ -f /sys/kernel/realtime ]; then - return 0 - fi - return 1 -} - -prog="rt-setup" - -[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog - -# is this a rhel-rt kernel? -if ! on_rt; then - echo "Not running on a RHEL-RT kernel!" - exit 0 -fi - -# make sure that cpusets are mounted -if ! grep cpuset /proc/mounts >/dev/null 2>&1; then - echo "cpusets not mounted!" - exit 2 -fi - -# if not running, start it up here, usually something like "daemon $exec" -if [ "$SLUB_CPU_PARTIAL" == "off" ]; then - slub_cpu_partial_off - slub_retval=$? -else - slub_retval=0 -fi - -exit $slub_retval - diff --git a/SOURCES/slub_cpu_partial_off b/SOURCES/slub_cpu_partial_off deleted file mode 100755 index 2dd7a89..0000000 --- a/SOURCES/slub_cpu_partial_off +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# shell script to turn SLUB cpu_partial logic off -# for improved determinism -# - -if [ "$UID" != "0" ]; then - echo "Must be root to run $(basename $0)" - exit -1 -fi -find /sys/kernel/slab -name 'cpu_partial' -print | \ - while read f; do echo 0 > $f; done diff --git a/SPECS/rt-setup.spec b/SPECS/rt-setup.spec index 21e97c1..5957de2 100644 --- a/SPECS/rt-setup.spec +++ b/SPECS/rt-setup.spec @@ -1,61 +1,47 @@ Name: rt-setup -Version: 1.59 -Release: 5%{?dist} +Version: 2.0 +Release: 6%{?dist} License: GPL+ Summary: Setup RHEL-RT environment details Group: System Environment/Base -Source: realtime.conf -Source1: rt-setup-kdump -Source2: rhel-rt.rules -Source3: kernel-is-rt -Source4: rt-setup.sysconfig -Source5: slub_cpu_partial_off -Source6: rt-setup.service -Source7: rt-setup.systemd - -BuildArch: noarch +Source: rt-setup-%{version}.tar.bz2 + +ExclusiveArch: x86_64 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: gcc -Requires: rtctl +BuildRequires: systemd Requires: pam >= 0.99.6.2-3.26 Requires: /usr/sbin/groupadd Requires: kexec-tools -Requires: libcgroup -Requires: python-libs Requires: tuna Requires: tuned Requires: tuned-profiles-realtime +Requires: systemd + +%global debug_package %{nil} %description The 'rt-setup' package configures details required by RHEL-RT environment. - creates realtime group - adds realtime limits configuration for PAM - adds /usr/bin/rt-setup-kdump to config kdump in RT - - disables irqbalance by default - adds udev specific rules for threaded irqs and /dev/rtc access - adds /usr/bin/slub_cpu_partial_off to turn off cpu_partials in SLUB + - adds net-socket timestamp static key daemon (rt-entsk) %prep +%setup %build +make all %install rm -Rf %{buildroot} -install -m 644 -D %{SOURCE0} %{buildroot}%{_sysconfdir}/security/limits.d/realtime.conf -install -m 755 -D %{SOURCE1} %{buildroot}%{_bindir}/rt-setup-kdump -install -m 755 -D %{SOURCE5} %{buildroot}%{_bindir}/slub_cpu_partial_off -install -m 644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/udev/rules.d/99-rhel-rt.rules -install -m 755 -D %{SOURCE3} %{buildroot}%{_sbindir}/kernel-is-rt -install -m 755 -D %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/rt-setup -install -m 644 -D %{SOURCE6} %{buildroot}%{_sysconfdir}/systemd/system/rt-setup.service -install -m 755 -D %{SOURCE7} %{buildroot}%{_bindir}/rt-setup +make DEST=%{buildroot} install %post /usr/sbin/groupadd -f -g 71 realtime -# do not disable irqbalance on RHEL-RT 7.2 -#systemctl disable irqbalance - if grep kernel.hung_task_panic /etc/sysctl.conf >/dev/null 2>&1 then : @@ -100,11 +86,46 @@ rm -rf %{buildroot} %config(noreplace) %{_sysconfdir}/sysconfig/rt-setup %attr(0755, root, root) %{_bindir}/rt-setup-kdump %attr(0755, root, root) %{_bindir}/slub_cpu_partial_off +%attr(0755, root, root) %{_sbindir}/rt-entsk %attr(0755, root, root) %{_sbindir}/kernel-is-rt -%attr(0644, root, root) %{_sysconfdir}/systemd/system/rt-setup.service +%attr(0644, root, root) %{_unitdir}/rt-setup.service %attr(0755, root, root) %{_bindir}/rt-setup +%attr(0644, root, root) %{_unitdir}/rt-entsk.service %changelog +* Fri Aug 24 2018 Clark Williams 2.0.6 +- check return value of open in rt-entsk to keep coverity happy +Resolves: rhbz#1616038 + +* Fri Aug 24 2018 Clark Williams 2.0.5 +- move pid-file write to after we daemonize rt-entask +Resolves: rhbz#1616038 + +* Wed Aug 22 2018 Clark Williams 2.0.4 +- add logic to write a pid file in rt-entsk (keep systemd happy) +Resolves: rhbz#1616038 + +* Wed Aug 22 2018 Clark Williams 2.0.3 +- fix errors with rt-entsk installation +Resolves: rhbz#1616038 + +* Wed Aug 22 2018 Clark Williams 2.0.2 +- fix installation of rt-entsk +Resolves: rhbz#1616038 + +* Mon Aug 20 2018 Clark Williams 2.0.1 +- build for RHEL 8.0.0 +- add rt-entsk program for forcing network timestamps enabled +Resolves: rhbz#1616038 + +* Wed Aug 08 2018 Clark Williams 1.59-8 +- remove libcgroup requirement +- remove comment about irqbalance + +* Fri Jun 01 2018 Luis Claudio R. Goncalves 1.59-7 +- rt-setup no longer rrequires rtctl (1585198) +Resolves: rhbz#1585198 + * Tue Jul 05 2016 John Kacur - 1.59-5 - Rebuild for rhel-7.3 Resolves: rhbz#1341783