[rtirq] Initial import of SRPM
Brendan Jones
bsjones at fedoraproject.org
Tue Jul 24 14:05:20 UTC 2012
commit d01cbf963c18926da8d12807a7ee11602deb7723
Author: Brendan Jones <brendan.jones.it at gmail.com>
Date: Tue Jul 24 16:05:09 2012 +0200
Initial import of SRPM
.gitignore | 1 +
rtirq-minprio.patch | 66 +++++++++++++++++++
rtirq-power | 47 ++++++++++++++
rtirq-udev | 53 +++++++++++++++
rtirq-udev-rules | 2 +
rtirq-udevprio.patch | 15 ++++
rtirq.spec | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++
sources | 1 +
8 files changed, 359 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..aeac5ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/rtirq-20120505.tar.gz
diff --git a/rtirq-minprio.patch b/rtirq-minprio.patch
new file mode 100644
index 0000000..0bae43b
--- /dev/null
+++ b/rtirq-minprio.patch
@@ -0,0 +1,66 @@
+--- rtirq.sh-old 2012-05-04 15:56:30.000000000 -0700
++++ rtirq.sh 2012-05-23 11:59:29.862878412 -0700
+@@ -172,6 +168,7 @@
+ ;;
+ esac
+ PRI2=$((${PRI2} - 1))
++ [ ${PRI2} -le ${PRI0_LOW} ] && PRI2=${PRI0_LOW}
+ done
+ fi
+ }
+@@ -190,6 +187,7 @@
+ do
+ rtirq_exec_num ${ACTION} "${NAME1}" "${NAME2}" ${PRI1} ${IRQ}
+ PRI1=$((${PRI1} - 1))
++ [ ${PRI1} -le ${PRI0_LOW} ] && PRI1=${PRI0_LOW}
+ done
+ }
+
+@@ -240,6 +238,10 @@
+ DECR=${RTIRQ_PRIO_DECR:-5}
+ [ $((${DECR})) -gt 10 ] && DECR=10
+ [ $((${DECR})) -lt 1 ] && DECR=1
++ # Check configured lower limit of priority.
++ PRI0_LOW=${RTIRQ_PRIO_LOW:-51}
++ [ $((${PRI0_LOW})) -gt $((${PRI0})) ] && PRI0_LOW=${PRI0}
++ [ $((${PRI0_LOW})) -lt 51 ] && PRI0_LOW=51
+ # (Re)set all softirq-timer/s to highest priority.
+ rtirq_exec_high ${ACTION}
+ # Process all configured service names...
+@@ -248,7 +250,7 @@
+ case ${NAME} in
+ snd)
+ PRI1=${PRI0}
+- grep irq /proc/asound/cards | tac | \
++ grep irq /proc/asound/cards | \
+ sed 's/\(.*\) at .* irq \(.*\)/\2 \1/' | \
+ while read IRQ NAME1
+ do
+@@ -258,6 +260,7 @@
+ do
+ rtirq_exec_num ${ACTION} "${NAME}" "${NAME2}" ${PRI1} ${IRQ}
+ PRI1=$((${PRI1} - 1))
++ [ ${PRI1} -le ${PRI0_LOW} ] && PRI1=${PRI0_LOW}
+ done
+ done
+ ;;
+@@ -271,6 +274,7 @@
+ ;;
+ esac
+ [ ${PRI0} -gt ${DECR} ] && PRI0=$((${PRI0} - ${DECR}))
++ [ ${PRI0} -le ${PRI0_LOW} ] && PRI0=${PRI0_LOW}
+ done
+ }
+
+--- rtirq.conf~ 2012-05-04 04:20:31.000000000 -0700
++++ rtirq.conf 2012-05-23 12:40:11.738278138 -0700
+@@ -35,6 +35,9 @@
+ # Priority decrease step.
+ RTIRQ_PRIO_DECR=5
+
++# Lowest priority.
++RTIRQ_PRIO_LOW=51
++
+ # Whether to reset all IRQ threads to SCHED_OTHER.
+ RTIRQ_RESET_ALL=0
+
diff --git a/rtirq-power b/rtirq-power
new file mode 100644
index 0000000..a4f67e4
--- /dev/null
+++ b/rtirq-power
@@ -0,0 +1,47 @@
+#!/bin/bash
+#
+# rtirq_power: save and restore irq process priorities
+#
+# This script is called when power status changes, when suspending
+# it saves a list of all irq process priorities, when resuming
+# it changes the priorities of the proper irq processes to the saved values
+#
+# Copyright (c) 2012 Fernando Lopez-Lezcano
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+. "${PM_FUNCTIONS}"
+
+case $1 in
+ hibernate|suspend)
+ /bin/ps -eo rtprio=,comm= --sort -rtprio | /bin/egrep ' irq/[0-9]*' | savestate rtirq
+ ;;
+ thaw|resume)
+ restorestate rtirq | while read IRQPRIO IRQCOMM ; do
+ if [ -n "${IRQPRIO}" -a -n "${IRQCOMM}" ] ; then
+ IRQPID=`/bin/ps -e -o pid,comm | grep " ${IRQCOMM}" | awk '{print $1}'`
+ if [ -n "${IRQPID}" ] ; then
+ PRIO=`/bin/ps -p ${IRQPID} -o rtprio=`
+ if [ ${PRIO} -ne ${IRQPRIO} ] ; then
+ /usr/bin/chrt -f -p ${IRQPRIO} ${IRQPID}
+ fi
+ fi
+ fi
+ done
+ ;;
+ *) exit $NA
+ ;;
+esac
+
diff --git a/rtirq-udev b/rtirq-udev
new file mode 100644
index 0000000..6f67c1e
--- /dev/null
+++ b/rtirq-udev
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# rtirq_usb: change irq priority for soundcards detected by udev
+#
+# This script is called from a udev rule that detects the insertion
+# or removal of a soundcard. It works when the name of the irq process
+# coincides with the name of the kernel module for the card. For pci cards
+# that is the case for kernels > 3.2.x. It also works for usb soundcards.
+#
+# arguments
+# $1: irq of soundcard
+# $2: name of kernel module
+#
+# An example udev rule:
+#
+# SUBSYSTEM=="sound", ATTRS{irq}=="[0-9]*", DRIVERS=="*", RUN+="/usr/bin/rtirq_udev $attr{irq} $driver"
+#
+# Copyright (c) 2012 Fernando Lopez-Lezcano
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+IRQ=${1}
+DRIVER=${2}
+
+if [ -n "${IRQ}" -a -n "${DRIVER}" ] ; then
+ if [ -r /etc/sysconfig/rtirq ] ; then
+ source /etc/sysconfig/rtirq
+ fi
+ IRQPID=`/bin/ps -e -o pid,comm | /bin/egrep "irq.${IRQ}.${DRIVER:0:8}" | /usr/bin/awk '{print $1}'`
+ if [ -n "${IRQPID}" ] ; then
+ if [ "${ACTION}" == "remove" ] ; then
+ IRQPRIO=${RTIRQ_PRIO_DEFAULT:-50}
+ else
+ IRQPRIO=${RTIRQ_PRIO_UDEV:-70}
+ fi
+ PRIO=`/bin/ps -p ${IRQPID} -o rtprio=`
+ if [ ${PRIO} -ne ${IRQPRIO} ] ; then
+ /usr/bin/chrt -f -p ${IRQPRIO} ${IRQPID}
+ fi
+ fi
+fi
diff --git a/rtirq-udev-rules b/rtirq-udev-rules
new file mode 100644
index 0000000..f42f3ef
--- /dev/null
+++ b/rtirq-udev-rules
@@ -0,0 +1,2 @@
+# Change irq priority for soundcards
+SUBSYSTEM=="sound", ATTRS{irq}=="[0-9]*", DRIVERS=="*", RUN+="/usr/bin/rtirq-udev $attr{irq} $driver"
diff --git a/rtirq-udevprio.patch b/rtirq-udevprio.patch
new file mode 100644
index 0000000..959bf99
--- /dev/null
+++ b/rtirq-udevprio.patch
@@ -0,0 +1,15 @@
+--- rtirq.conf~ 2012-05-04 04:20:31.000000000 -0700
++++ rtirq.conf 2012-05-29 13:08:08.000000000 -0700
+@@ -35,6 +35,12 @@
+ # Lowest priority.
+ RTIRQ_PRIO_LOW=51
+
++# Priority for udev rules
++RTIRQ_PRIO_UDEV=85
++
++# Default priority for irq processes
++RTIRQ_PRIO_DEFAULT=50
++
+ # Whether to reset all IRQ threads to SCHED_OTHER.
+ RTIRQ_RESET_ALL=0
+
diff --git a/rtirq.spec b/rtirq.spec
new file mode 100644
index 0000000..f18e7ae
--- /dev/null
+++ b/rtirq.spec
@@ -0,0 +1,174 @@
+%global debug_package %{nil}
+
+Summary: Realtime IRQ thread system tuning
+Name: rtirq
+Version: 20120505
+Release: 5%{?dist}
+License: GPLv2+
+Group: System Environment/Base
+URL: http://www.rncbc.org/jack/
+Source0: http://www.rncbc.org/jack/%{name}-%{version}.tar.gz
+# sources for udev and power management additions
+Source1: rtirq-udev
+Source2: rtirq-udev-rules
+Source3: rtirq-power
+# add configuration option for a minimum priority in rtirq script
+Patch0: rtirq-minprio.patch
+# patch to add udev options to rtirq configuration
+Patch1: rtirq-udevprio.patch
+BuildArch: noarch
+
+%description
+Start-up scripts for tuning the realtime scheduling policy and priority
+of relevant IRQ service threads, featured for a realtime-preempt enabled
+kernel configuration.
+
+%prep
+%setup -q
+%patch0 -p0
+%patch1 -p0
+
+%build
+
+%install
+rm -rf %{buildroot}
+install -D rtirq.sh -m 0755 %{buildroot}%{_sysconfdir}/rc.d/init.d/rtirq
+install -D rtirq.conf -m 0644 %{buildroot}%{_sysconfdir}/sysconfig/rtirq
+
+# fix order of interrupts, tac was reversing the priority of the soundcards
+perl -p -i -e "s/\| tac//g" %{buildroot}%{_sysconfdir}/rc.d/init.d/rtirq
+
+# start rtirq after the alsasound startup script (starts at 87)
+perl -p -i -e "s|35 81 19|35 88 19|g" %{buildroot}%{_sysconfdir}/rc.d/init.d/rtirq
+
+# high priority is 70 instead of 90 (in Fedora 17+)
+perl -p -i -e "s|RTIRQ_PRIO_HIGH=90|RTIRQ_PRIO_HIGH=70|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
+# low priority is 65, 5 above Jack highest priority thread
+perl -p -i -e "s|RTIRQ_PRIO_LOW=51|RTIRQ_PRIO_LOW=65|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
+# priority decrement now 1 instead of 5, no need to leave vacant priorities
+perl -p -i -e "s|RTIRQ_PRIO_DECR=5|RTIRQ_PRIO_DECR=1|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
+# remove usb from list of cards in configuration, this is now handled through udev rules
+perl -p -i -e "s|rtc snd usb i8042|rtc snd i8042|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
+# adjust priority for udev changes, same as highest priority
+perl -p -i -e "s|RTIRQ_PRIO_UDEV=85|RTIRQ_PRIO_UDEV=70|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
+
+# install udev and power files
+install -D %{SOURCE2} -m 0644 %{buildroot}%{_prefix}/lib/udev/rules.d/95-rtirq.rules
+install -D %{SOURCE1} -m 0755 %{buildroot}%{_bindir}/rtirq-udev
+install -D %{SOURCE3} -m 0755 %{buildroot}%{_sysconfdir}/pm/sleep.d/05-rtirq
+
+%post
+# only run on install, not upgrade
+if [ "$1" = "1" ]; then
+ /sbin/chkconfig --add rtirq
+# /sbin/chkconfig rtirq on
+fi
+if [ -L /etc/rc.d/rc5.d/S81rtirq ] ; then
+ # update startup to new priority
+ /sbin/chkconfig --del rtirq
+ /sbin/chkconfig --add rtirq
+fi
+
+%preun
+# only run if this is the last instance to be removed
+if [ "$1" = "0" ]; then
+ /sbin/chkconfig rtirq off
+ /sbin/chkconfig --del rtirq
+fi
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%doc LICENSE
+%config(noreplace) %{_sysconfdir}/sysconfig/rtirq
+%{_sysconfdir}/rc.d/init.d/rtirq
+# udev and power management
+%{_prefix}/lib/udev/rules.d/95-rtirq.rules
+%{_sysconfdir}/pm/sleep.d/05-rtirq
+%{_bindir}/rtirq-udev
+
+%changelog
+* Tue Jul 24 2012 Brendan Jones <brendan.jones.it at gmail.com> 20120505-5
+- Add LICENSE file
+
+* Tue Jul 24 2012 Brendan Jones <brendan.jones.it at gmail.com> 20120505-4
+- Update udev lib macro
+
+* Tue Jul 24 2012 Brendan Jones <brendan.jones.it at gmail.com> 20120505-3
+- Move udev rules to /usr/lib/udev
+
+* Wed Jul 12 2012 Brendan Jones <brendan.jones.it at gmail.com> 20120505-2
+- initial SPEC changes for use in Fedora
+
+* Tue May 29 2012 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20120505-1
+- udpate to 20120505
+- add rtirq patch for minimum priority (nando at ccrma)
+- tweak priorities for new Fedora allowed rt priorities (max priority for
+ jack users is 70 in fc17+, jackd priority is 60)
+- add udev rule, power management rule, udev script and patch to add udev
+ and default priorities to rtirq configuration file (nando at ccrma)
+- tweak udev priority to be the max priority
+
+* Fri May 4 2012 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20120504-2
+- update to 20120504, proper handling of pci soundcards on 3.2.x
+- add patch to fix handling of soundcards on 3.2
+
+* Fri Oct 7 2011 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20111007-1
+- update to 20111007, has better logic for shared interrupts
+
+* Tue May 31 2011 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20090920-1
+- changed schedutils requirement to /usr/bin/chrt, fc15 no longer has it
+
+* Mon Oct 26 2009 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20090920-1
+- updated to latest version that works with 2.6.31.* rt kernels
+
+* Thu Jan 11 2007 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20070101-1
+- updated to 20070101, works with latest versions of the realtime
+ preempt patch
+- fix order of interrupts (was reversing the priority of the soundcards)
+
+* Tue Aug 29 2006 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20060819-1
+- updated to 20060819 (fixes errors on PREEMPT_DESKTOP kernels)
+
+* Wed Apr 5 2006 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20060218-1
+- updated to 20060218
+
+* Mon Jun 20 2005 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20050620-1
+- updated to 20050620
+
+* Thu Apr 14 2005 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20050414-1
+- Rui added support for unthreading rtc and snd interrupts
+
+* Fri Apr 8 2005 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20050408-1
+- small fixes from Rui, new tarball
+
+* Wed Apr 6 2005 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20050407-1
+- new tarball from Rui with dup irqs fix incorporated
+
+* Wed Apr 6 2005 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20050406-1
+- updated to new tarball
+- added patch to avoid irq's used by several devices to end up lower
+ in priority, helps maintain the soundcard at the proper irq priority
+- changed default high priority
+- with both changes the soundcard priority should be 70...63
+
+* Mon Mar 21 2005 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20041118-2
+- start rtirq after alsasound, add post script to check priority
+ and readd rtirq if needed
+
+* Thu Dec 23 2004 Fernando Lopez-Lezcano <nando at ccrma.stanford.edu> 20041118-1
+- initial Planet CCRMA build
+- do not rearrange interrupts on package install, seems safer to me,
+ of course if there are problems this merely delays them till the
+ next reboot or when the user executes the script :-)
+
+* Thu Nov 12 2004 Rui Nuno Capela <rncbc at users.sourceforge.net>
+- Bumped to 20041112 version.
+
+* Thu Nov 8 2004 Rui Nuno Capela <rncbc at users.sourceforge.net>
+- Update for the new 20041108 version.
+
+* Thu Nov 4 2004 Rui Nuno Capela <rncbc at users.sourceforge.net>
+- Created initial rtirq.spec
+
diff --git a/sources b/sources
index e69de29..e934191 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+1228311c17fe91921689a2bf10b21ce5 rtirq-20120505.tar.gz
More information about the scm-commits
mailing list