Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Dec 2007 23:13:01 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 131337 for review
Message-ID:  <200712202313.lBKND126098677@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=131337

Change 131337 by hselasky@hselasky_laptop001 on 2007/12/20 23:12:18

	
	We need to set higher priority on the interrupt threads.
	
	TIP for testing: Buy an USB Sound card and lower the
	priority of the interrupt thread. When the system is
	busy you will hear glitches in the sound stream.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#75 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#82 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/usb_subr.c#75 (text+ko) ====

@@ -58,6 +58,8 @@
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
+#include <sys/proc.h>
+#include <sys/sched.h>
 #include <sys/kthread.h>
 #include <sys/unistd.h>
 #include <sys/uio.h>
@@ -2687,8 +2689,15 @@
 	struct usbd_config_td *ctd = arg;
 	struct usbd_config_td_item *item;
 	struct usbd_mbuf *m;
+	struct thread *td;
 	register int error;
 
+	/* adjust priority */
+	td = curthread;
+	thread_lock(td);
+	sched_prio(td, PI_DISK);
+	thread_unlock(td);
+
 	mtx_lock(ctd->p_mtx);
 
 	while (1) {
@@ -2813,7 +2822,7 @@
 	}
 	if (usb_thread_create
 	    (&usbd_config_td_thread, ctd, &(ctd->config_thread),
-	    "usbd config thread")) {
+	    "USB config thread")) {
 		PRINTFN(0, ("unable to create config thread!\n"));
 		ctd->config_thread = NULL;
 		goto error;

==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#82 (text+ko) ====

@@ -43,6 +43,8 @@
 #include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/sched.h>
 #include <sys/kthread.h>
 #include <sys/unistd.h>
 
@@ -2121,8 +2123,15 @@
 {
 	struct usbd_memory_info *info = arg;
 	struct usbd_xfer *xfer[4];
+	struct thread *td;
 	uint8_t dropcount;
 
+	/* adjust priority */
+	td = curthread;
+	thread_lock(td);
+	sched_prio(td, PI_NET);
+	thread_unlock(td);
+
 	mtx_lock(info->usb_mtx);
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712202313.lBKND126098677>