Robin Gareus wrote:
> Rui Nuno Capela wrote:
>> Rui Nuno Capela wrote:
>>> Robin Gareus wrote:
>>>> Rui Nuno Capela wrote:
>>>>
>>>>> this issue on 2.6.31-rt has been already reported privately and i'll get
>>>>> to it as soon i get back home from vacation. meanwhile, it really looks
>>>>> like a regex trickery is all that's needed,
>>>> I'm not so sure, Since 2.6.31 it is also possible to raise the priority
>>>> not by IRQ number but by /device-driver/.
>>>>
>>>> ie:
>>>>   PID CLS RTPRIO  NI PRI %CPU STAT COMMAND
>>>>  9092 FF      89   - 129  0.4 S<   irq/17-HDA Inte
>>>>  1447 FF      50   -  90  0.1 S<   irq/17-uhci_hcd
>>>>  9093 FF      50   -  90  0.0 S<   irq/17-ohci1394
>>>>
>>>> ..but of course that's also just regexp trickery ;)
>>>>
>>>> Note that the kernel limits the IRQ process name to 15 chars.
>>>> "HDA Inte" won't read "HDA Intel" even when using `ps -w..`
>>>>
>>>> But '/proc/interrupts' says:
>>>>  17:   17215454     873204   IO-APIC-fasteoi   uhci_hcd:usb3, HDA Intel,
>>>> ohci1394
>>>>
>>>>> keeping in mind that
>>>>> backward compability with pre-2.6.31-rt kernels is in order (eg. i do
>>>>> still run on 2.56.29.5-rt22 for which the current rtirq script is
>>>>> perfect, of course)
>>>>> as a quick suggestion, try this for instance (re. line 120):
>>>>>   PIDS=`ps -eo pid,comm | egrep "(IRQ.${IRQ}|irq\/${IRQ}\-.+)\$" | awk
>>>>> '{print $1}'`
>>>> That works, but raises all devices on a given IRQ-line and results in:
>>>>   PID CLS RTPRIO  NI PRI %CPU STAT COMMAND
>>>>  1447 FF      88   - 128  0.1 S<   irq/17-uhci_hcd
>>>>  9092 FF      87   - 127  0.4 S<   irq/17-HDA Inte
>>>>  9093 FF      86   - 126  0.0 S<   irq/17-ohci1394
>>>>
>>> which is the exact and old behavior of rtirq for kernel-rt < 2.6.31-rt.
>>>
>>> this time however it looks that you can actually improve things when
>>> several device drivers are hanging on a irq line. that is, one can tune
>>> up the one and only the one actually intended (eg. "snd" => "irq/17-HDA
>>> Inte" and nothing else)
>>>
>>> not just a simple regex oneliner anymore and i'm afraid it might need a
>>> deeper retouch...
>>>
>> not so deeper, more than a simple regex fix but some bash trickery now
>> added: please, try the attached patch (rtirq-20090807-1.diff) and tell ;)
> 
> 
> Almost - it fails because "HDA Inte" has a space in it. So
> ${NAME2} is only "HDA" instead of "HDA Intel".
> 
> I've added quotation marks around ${NAME2} to the rtirq_exec_num and
> rtirq_exec_name function calls (line 167 and line 231) and then it works.
> 
> However, there's still an issue with RTIRQ_TRAIL. If one wants to raise
> two drivers on the same IRQ line. For example
> "HDA Intel" and "ohci1394" but not uhci_hcd:usb3 (all on IRQ 17 here)
> rtirq will only do the first device and skip the remaining.
> 
> Thanks for your help, it must be fun to code on the beach ;)
> 

beach support is fine ;)

here goes another one (rtirq-20090807-2.diff), with your quotation marks
in place and RTIRQ_TRAIL issue probably tamed ... please try as i don't
have the right kernel to make proper testing.

byee--off to snorkeling now 8)
-- 
rncbc aka Rui Nuno Capela
rn...@rncbc.org
--- rtirq-20090626/rtirq.sh	2009-06-25 23:52:29.000000000 +0100
+++ rtirq-20090807/rtirq.sh	2009-08-07 17:42:51.000000000 +0100
@@ -116,8 +116,16 @@ function rtirq_exec_num ()
 	fi
 	# And now do the proper threading prioritization...
 	if [ -z "`echo ${RTIRQ_TRAIL} | grep :${IRQ}:`" ]
-	then 
-		PIDS=`ps -eo pid,comm | egrep "IRQ.${IRQ}\$" | awk '{print $1}'`
+	then
+		# Special for kernel-rt >= 2.6.31, where one can
+		# prioritize shared IRQs by device driver (NAME2)...
+		PIDS=`ps -eo pid,comm | egrep "irq/${IRQ}-${NAME2:0:8}\$" | awk '{print $1}'`
+		if [ -z "${PIDS}" ]
+		then
+			# Backward compability for older kernel-rt < 2.6.31...
+			PIDS=`ps -eo pid,comm | egrep "IRQ.${IRQ}\$" | awk '{print $1}'`
+			RTIRQ_TRAIL=":${IRQ}${RTIRQ_TRAIL}"
+		fi
 		for PID in ${PIDS}
 		do
 			PREPEND="Setting IRQ priorities: ${ACTION} [${NAME2}] irq=${IRQ} pid=${PID}"
@@ -148,7 +156,6 @@ function rtirq_exec_num ()
 			esac
 			PRI2=$((${PRI2} - 1))
 		done
-		RTIRQ_TRAIL=":${IRQ}${RTIRQ_TRAIL}"
 	fi
 }
 
@@ -164,7 +171,7 @@ function rtirq_exec_name ()
 	IRQS=`grep "${NAME2}" /proc/interrupts | awk -F: '{print $1}'`
 	for IRQ in ${IRQS}
 	do
-		rtirq_exec_num ${ACTION} ${NAME1} ${NAME2} ${PRI1} ${IRQ}
+		rtirq_exec_num ${ACTION} "${NAME1}" "${NAME2}" ${PRI1} ${IRQ}
 		PRI1=$((${PRI1} - 1))
 	done
 }
@@ -224,21 +231,22 @@ function rtirq_exec ()
 		case ${NAME} in
 		snd)
 			PRI1=${PRI0}
-			IRQS=`grep irq /proc/asound/cards | tac | sed 's/.* irq \(.*\)/\1/'`
-			for IRQ in ${IRQS}
+			grep irq /proc/asound/cards | tac | \
+			sed 's/\(.*\) at .* irq \(.*\)/\2 \1/' | \
+			while read IRQ NAME2
 			do
-				rtirq_exec_num ${ACTION} ${NAME} ${NAME} ${PRI1} ${IRQ}
+				rtirq_exec_num ${ACTION} "${NAME}" "${NAME2}" ${PRI1} ${IRQ}
 				PRI1=$((${PRI1} - 1))
 			done
 			;;
 		usb)
-			rtirq_exec_name ${ACTION} ${NAME} "ohci_hcd" ${PRI0}
-			rtirq_exec_name ${ACTION} ${NAME} "uhci_hcd" ${PRI0}
-			rtirq_exec_name ${ACTION} ${NAME} "ehci_hcd" ${PRI0}
+			rtirq_exec_name ${ACTION} "${NAME}" "ohci_hcd" ${PRI0}
+			rtirq_exec_name ${ACTION} "${NAME}" "uhci_hcd" ${PRI0}
+			rtirq_exec_name ${ACTION} "${NAME}" "ehci_hcd" ${PRI0}
 			;;
 		*)
-			rtirq_exec_name ${ACTION} ${NAME} ${NAME} ${PRI0}
-			;;  
+			rtirq_exec_name ${ACTION} "${NAME}" "${NAME}" ${PRI0}
+			;;
 		esac
 		[ ${PRI0} -gt ${DECR} ] && PRI0=$((${PRI0} - ${DECR}))
 	done
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev

Reply via email to