svn commit: r221055 - in head/sys: kern ofed/include/linux

Jeff Roberson jeff at FreeBSD.org
Tue Apr 26 07:30:53 UTC 2011


Author: jeff
Date: Tue Apr 26 07:30:52 2011
New Revision: 221055
URL: http://svn.freebsd.org/changeset/base/221055

Log:
   - Catch up to falloc() changes.
   - PHOLD() before using a task structure on the stack.
   - Fix a LOR between the sleepq lock and thread lock in _intr_drain().

Modified:
  head/sys/kern/kern_intr.c
  head/sys/ofed/include/linux/file.h
  head/sys/ofed/include/linux/workqueue.h

Modified: head/sys/kern/kern_intr.c
==============================================================================
--- head/sys/kern/kern_intr.c	Tue Apr 26 04:52:35 2011	(r221054)
+++ head/sys/kern/kern_intr.c	Tue Apr 26 07:30:52 2011	(r221055)
@@ -746,7 +746,6 @@ intr_handler_source(void *cookie)
 void
 _intr_drain(int irq)
 {
-	struct mtx *mtx;
 	struct intr_event *ie;
 	struct intr_thread *ithd;
 	struct thread *td;
@@ -758,13 +757,21 @@ _intr_drain(int irq)
 		return;
 	ithd = ie->ie_thread;
 	td = ithd->it_thread;
+	/*
+	 * We set the flag and wait for it to be cleared to avoid
+	 * long delays with potentially busy interrupt handlers
+	 * were we to only sample TD_AWAITING_INTR() every tick.
+	 */
 	thread_lock(td);
-	mtx = td->td_lock;
 	if (!TD_AWAITING_INTR(td)) {
 		ithd->it_flags |= IT_WAIT;
-		msleep_spin(ithd, mtx, "isync", 0);
+		while (ithd->it_flags & IT_WAIT) {
+			thread_unlock(td);
+			pause("idrain", 1);
+			thread_lock(td);
+		}
 	}
-	mtx_unlock_spin(mtx);
+	thread_unlock(td);
 	return;
 }
 

Modified: head/sys/ofed/include/linux/file.h
==============================================================================
--- head/sys/ofed/include/linux/file.h	Tue Apr 26 04:52:35 2011	(r221054)
+++ head/sys/ofed/include/linux/file.h	Tue Apr 26 07:30:52 2011	(r221055)
@@ -92,7 +92,7 @@ get_unused_fd(void)
 	int error;
 	int fd;
 
-	error = falloc(curthread, &file, &fd);
+	error = falloc(curthread, &file, &fd, 0);
 	if (error)
 		return -error;
 	return fd;

Modified: head/sys/ofed/include/linux/workqueue.h
==============================================================================
--- head/sys/ofed/include/linux/workqueue.h	Tue Apr 26 04:52:35 2011	(r221054)
+++ head/sys/ofed/include/linux/workqueue.h	Tue Apr 26 07:30:52 2011	(r221055)
@@ -160,9 +160,11 @@ flush_taskqueue(struct taskqueue *tq)
 {
 	struct task flushtask;
 
+	PHOLD(curproc);
 	TASK_INIT(&flushtask, 0, _flush_fn, NULL);
 	taskqueue_enqueue(tq, &flushtask);
 	taskqueue_drain(tq, &flushtask);
+	PRELE(curproc);
 }
 
 static inline int


More information about the svn-src-all mailing list