DragonFly BSD
DragonFly bugs List (threaded) for 2013-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[DragonFlyBSD - Bug #908] mention msleep() in porting_drivers.txt


From: "Samuel J. Greear via Redmine" <bugtracker-admin@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 10 Mar 2013 07:50:13 -0700

Issue #908 has been updated by sjg.

Description updated

Some more stuff for the porting file...


All mbuf calls use MB_* flags, not M_* flags.  e.g. MB_DONTWAIT instead of
M_NOWAIT.

m_collapse(*xxx, M_DONTWAIT, XXX_XXX) -> m_defrag(*xxx, MB_DONTWAIT)

IFQ_DRV_* -> ifq_*

(struct ifnet)->if_flags was split into if_flags and if_drv_flags in FreeBSD,
replace all occurences of if_drv_flags with if_flags and the variable being
assigned from IF_DRV_* to IF_*

----------------------------------------
Bug #908: mention msleep() in porting_drivers.txt
http://bugs.dragonflybsd.org/issues/908

Author: aoiko
Status: In Progress
Priority: Low
Assignee: sjg
Category: 
Target version: 


Any suggestions on how to make this clearer are welcome.

Index: notes/porting_drivers.txt
===================================================================
RCS file: /home/aggelos/imports/vcs/dcvs/doc/notes/porting_drivers.txt,v
retrieving revision 1.3
diff -u -p -u -r1.3 porting_drivers.txt
--- notes/porting_drivers.txt	29 Dec 2007 18:35:59 -0000	1.3
+++ notes/porting_drivers.txt	6 Jan 2008 17:40:24 -0000
@@ -84,6 +84,24 @@ $DragonFly: doc/notes/porting_drivers.tx
   call is replaced with
 	lockmgr(&my_lock, LK_EXCLUSIVE|LK_NOWAIT);

+  On occasion, the FreeBSD code will use mtx_sleep() or msleep()
+  (currently [01/2008], those macros have identical definitions)
+  in order to release a mutex and sleep without missing any
+  wakeups that might occur in between. The DragonFly idiom for
+  this case is to enter a critical section and use tsleep_interlock()
+  to let threads in other cpus know that we're about to go to
+  sleep. In our example, you would substitute
+
+	crit_enter();
+	tsleep_interlock(ident);
+	lockmgr(&my_lock, LK_RELEASE);
+	tsleep(ident, flags, "whatever", timeout);
+	crit_exit();
+	lockmgr(&my_lock, LK_EXCLUSIVE);
+
+  for
+	msleep(ident, &my_mtx, flags, "whatever", timeout);
+
   As for mtx_assert() calls, translate them like this:

 	mtx_assert(&my_mtx, MA_OWNED) -> KKASSERT(lockstatus(&my_lock, curthread) != 0)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



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