Re: rtirq, kernels >= 3.2 and udev & pm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 05/09/2012 07:50 AM, Robin Gareus wrote:
On 05/09/2012 04:38 PM, Rui Nuno Capela wrote:
On 05/09/2012 02:03 AM, Fernando Lopez-Lezcano wrote:
PS: Another rtirq script in /etc/pm/sleep.d/ could save the current
priorities before a suspend and restore them after a resume - that does
not happen currently.

what about just `rtirq restart` on the sleep.d script (on thaw|resume) ?

indeed. that works just fine here since over 2 years.

the scripts I use to retain jackd2&  qjackctl during suspend/resume
cycles are available from http://gareus.org/wiki/jack2contol
for dynamically switching audio-interfaces I settled on dbus (and not
udev, since jackd runs as user): http://gareus.org/blog/jack2dbus

Cool....

I'm attaching my first try at using a pm-utils script. This script saves the priority state of all irq* processes and restores them after a resume. It only restores the priority for processes that still exist after the resume, and will do nothing for new processes (ie: you plugin a usb card while the computer is sleeping). That would be taken care by my previously posted udev script which would change priority of newly inserted soundcards. I put 05rtirq it in /etc/pm/sleep.d/ directory... it seems to be working fine in my laptop.

-- Fernando
#!/bin/bash
#
# rtirq_power: save and restore irq process priorities
#
# This script is called when a change in power status happens, 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

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user

[ALSA Users]     [ALSA Devel]     [Linux Media]     [Kernel]     [Online Dating]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Video 4 Linux]

Add to Google Powered by Linux