PERFORCE change 116938 for review
Jung-uk Kim
jkim at FreeBSD.org
Fri Mar 30 17:41:50 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=116938
Change 116938 by jkim at jkim_hammer on 2007/03/30 17:40:59
IFC @116937
Affected files ...
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#48 integrate
.. //depot/projects/linuxolator/src/sys/dev/firewire/firewire.c#3 integrate
.. //depot/projects/linuxolator/src/sys/geom/geom_ctl.c#2 integrate
.. //depot/projects/linuxolator/src/sys/netgraph/ng_base.c#5 integrate
Differences ...
==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#48 (text+ko) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.37 2007/03/30 00:06:21 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.39 2007/03/30 17:27:13 jkim Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
==== //depot/projects/linuxolator/src/sys/dev/firewire/firewire.c#3 (text+ko) ====
@@ -31,7 +31,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.84 2007/03/16 05:39:33 simokawa Exp $
+ * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.86 2007/03/30 15:43:56 simokawa Exp $
*
*/
@@ -355,7 +355,6 @@
"split transaction timeout dst=0x%x tl=0x%x state=%d\n",
xfer->send.hdr.mode.hdr.dst, i, xfer->state);
xfer->resp = ETIMEDOUT;
- STAILQ_REMOVE_HEAD(&fc->tlabels[i], link);
fw_xfer_done(xfer);
}
}
@@ -420,7 +419,6 @@
bus_generic_attach(dev);
/* bus_reset */
- fw_busreset(fc);
fc->ibr(fc);
return 0;
@@ -1013,6 +1011,7 @@
if (xfer->fc == NULL)
panic("fw_xfer_done: why xfer->fc is NULL?");
+ fw_tl_free(xfer->fc, xfer);
xfer->hand(xfer);
}
@@ -1039,7 +1038,6 @@
*/
printf("fw_xfer_free FWXF_START\n");
#endif
- fw_tl_free(xfer->fc, xfer);
}
xfer->state = FWXF_INIT;
xfer->resp = 0;
==== //depot/projects/linuxolator/src/sys/geom/geom_ctl.c#2 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/geom_ctl.c,v 1.38 2006/04/07 16:19:48 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/geom_ctl.c,v 1.39 2007/03/30 16:32:08 delphij Exp $");
#include "opt_geom.h"
@@ -398,17 +398,17 @@
struct g_geom *gp;
p = gctl_get_asciiparam(req, arg);
- if (p != NULL) {
- LIST_FOREACH(mp, &g_classes, class) {
- if (mpr != NULL && mpr != mp)
- continue;
- LIST_FOREACH(gp, &mp->geom, geom) {
- if (!strcmp(p, gp->name))
- return (gp);
- }
+ if (p == NULL)
+ return (NULL);
+ LIST_FOREACH(mp, &g_classes, class) {
+ if (mpr != NULL && mpr != mp)
+ continue;
+ LIST_FOREACH(gp, &mp->geom, geom) {
+ if (!strcmp(p, gp->name))
+ return (gp);
}
}
- gctl_error(req, "Geom not found");
+ gctl_error(req, "Geom not found: \"%s\"", p);
return (NULL);
}
@@ -424,7 +424,7 @@
pp = g_provider_by_name(p);
if (pp != NULL)
return (pp);
- gctl_error(req, "Provider not found");
+ gctl_error(req, "Provider not found: \"%s\"", p);
return (NULL);
}
==== //depot/projects/linuxolator/src/sys/netgraph/ng_base.c#5 (text+ko) ====
@@ -38,7 +38,7 @@
* Authors: Julian Elischer <julian at freebsd.org>
* Archie Cobbs <archie at freebsd.org>
*
- * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.129 2007/03/18 16:49:50 rwatson Exp $
+ * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.130 2007/03/30 14:34:34 wkoszek Exp $
* $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $
*/
@@ -228,6 +228,19 @@
#define _NG_ALLOC_NODE(node) \
MALLOC(node, node_p, sizeof(*node), M_NETGRAPH_NODE, M_NOWAIT | M_ZERO)
+#define NG_QUEUE_LOCK_INIT(n) \
+ mtx_init(&(n)->q_mtx, "ng_node", NULL, MTX_SPIN)
+#define NG_QUEUE_LOCK(n) \
+ mtx_lock_spin(&(n)->q_mtx)
+#define NG_QUEUE_UNLOCK(n) \
+ mtx_unlock_spin(&(n)->q_mtx)
+#define NG_WORKLIST_LOCK_INIT() \
+ mtx_init(&ng_worklist_mtx, "ng_worklist", NULL, MTX_SPIN)
+#define NG_WORKLIST_LOCK() \
+ mtx_lock_spin(&ng_worklist_mtx)
+#define NG_WORKLIST_UNLOCK() \
+ mtx_unlock_spin(&ng_worklist_mtx)
+
#ifdef NETGRAPH_DEBUG /*----------------------------------------------*/
/*
* In debug mode:
@@ -605,7 +618,7 @@
NG_NODE_REF(node); /* note reference */
type->refs++;
- mtx_init(&node->nd_input_queue.q_mtx, "ng_node", NULL, MTX_SPIN);
+ NG_QUEUE_LOCK_INIT(&node->nd_input_queue);
node->nd_input_queue.queue = NULL;
node->nd_input_queue.last = &node->nd_input_queue.queue;
node->nd_input_queue.q_flags = 0;
@@ -2039,7 +2052,7 @@
atomic_subtract_long(&ngq->q_flags, READER_INCREMENT);
/* ######### End Hack alert ######### */
- mtx_lock_spin((&ngq->q_mtx));
+ NG_QUEUE_LOCK(ngq);
/*
* Try again. Another processor (or interrupt for that matter) may
* have removed the last queued item that was stopping us from
@@ -2050,7 +2063,7 @@
*/
if ((ngq->q_flags & NGQ_RMASK) == 0) {
atomic_add_long(&ngq->q_flags, READER_INCREMENT);
- mtx_unlock_spin((&ngq->q_mtx));
+ NG_QUEUE_UNLOCK(ngq);
CTR4(KTR_NET, "%20s: node [%x] (%p) slow acquired item %p",
__func__, ngq->q_node->nd_ID, ngq->q_node, item);
return (item);
@@ -2060,7 +2073,7 @@
* and queue the request for later.
*/
ng_queue_rw(ngq, item, NGQRW_R);
- mtx_unlock_spin(&(ngq->q_mtx));
+ NG_QUEUE_UNLOCK(ngq);
return (NULL);
}
@@ -2072,7 +2085,7 @@
("%s: working on deadnode", __func__));
restart:
- mtx_lock_spin(&(ngq->q_mtx));
+ NG_QUEUE_LOCK(ngq);
/*
* If there are no readers, no writer, and no pending packets, then
* we can just go ahead. In all other situations we need to queue the
@@ -2081,7 +2094,7 @@
if ((ngq->q_flags & NGQ_WMASK) == 0) {
/* collision could happen *HERE* */
atomic_add_long(&ngq->q_flags, WRITER_ACTIVE);
- mtx_unlock_spin((&ngq->q_mtx));
+ NG_QUEUE_UNLOCK(ngq);
if (ngq->q_flags & READER_MASK) {
/* Collision with fast-track reader */
atomic_subtract_long(&ngq->q_flags, WRITER_ACTIVE);
@@ -2096,7 +2109,7 @@
* and queue the request for later.
*/
ng_queue_rw(ngq, item, NGQRW_W);
- mtx_unlock_spin(&(ngq->q_mtx));
+ NG_QUEUE_UNLOCK(ngq);
return (NULL);
}
@@ -2192,7 +2205,7 @@
{
item_p item;
- mtx_lock_spin(&ngq->q_mtx);
+ NG_QUEUE_LOCK(ngq);
while (ngq->queue) {
item = ngq->queue;
ngq->queue = item->el_next;
@@ -2200,7 +2213,7 @@
ngq->last = &(ngq->queue);
atomic_add_long(&ngq->q_flags, -OP_PENDING);
}
- mtx_unlock_spin(&ngq->q_mtx);
+ NG_QUEUE_UNLOCK(ngq);
/* If the item is supplying a callback, call it with an error */
if (item->apply != NULL) {
@@ -2208,14 +2221,14 @@
item->apply = NULL;
}
NG_FREE_ITEM(item);
- mtx_lock_spin(&ngq->q_mtx);
+ NG_QUEUE_LOCK(ngq);
}
/*
* Take us off the work queue if we are there.
* We definately have no work to be done.
*/
ng_worklist_remove(ngq->q_node);
- mtx_unlock_spin(&ngq->q_mtx);
+ NG_QUEUE_UNLOCK(ngq);
}
/***********************************************************************
@@ -2339,9 +2352,9 @@
#ifdef NETGRAPH_DEBUG
_ngi_check(item, __FILE__, __LINE__);
#endif
- mtx_lock_spin(&(ngq->q_mtx));
+ NG_QUEUE_LOCK(ngq);
ng_queue_rw(ngq, item, rw);
- mtx_unlock_spin(&(ngq->q_mtx));
+ NG_QUEUE_UNLOCK(ngq);
if (flags & NG_PROGRESS)
return (EINPROGRESS);
@@ -2384,10 +2397,10 @@
return (error);
}
- mtx_lock_spin(&(ngq->q_mtx));
+ NG_QUEUE_LOCK(ngq);
if (NEXT_QUEUED_ITEM_CAN_PROCEED(ngq))
ng_setisr(ngq->q_node);
- mtx_unlock_spin(&(ngq->q_mtx));
+ NG_QUEUE_UNLOCK(ngq);
return (error);
}
@@ -3140,7 +3153,7 @@
switch (event) {
case MOD_LOAD:
/* Initialize everything. */
- mtx_init(&ng_worklist_mtx, "ng_worklist", NULL, MTX_SPIN);
+ NG_WORKLIST_LOCK_INIT();
mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL,
MTX_DEF);
mtx_init(&ng_nodelist_mtx, "netgraph nodelist mutex", NULL,
@@ -3318,15 +3331,15 @@
node_p node = NULL;
for (;;) {
- mtx_lock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_LOCK();
node = TAILQ_FIRST(&ng_worklist);
if (!node) {
- mtx_unlock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_UNLOCK();
break;
}
node->nd_flags &= ~NGF_WORKQ;
TAILQ_REMOVE(&ng_worklist, node, nd_work);
- mtx_unlock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_UNLOCK();
CTR3(KTR_NET, "%20s: node [%x] (%p) taken off worklist",
__func__, node->nd_ID, node);
/*
@@ -3345,13 +3358,13 @@
for (;;) {
int rw;
- mtx_lock_spin(&node->nd_input_queue.q_mtx);
+ NG_QUEUE_LOCK(&node->nd_input_queue);
item = ng_dequeue(&node->nd_input_queue, &rw);
if (item == NULL) {
- mtx_unlock_spin(&node->nd_input_queue.q_mtx);
+ NG_QUEUE_UNLOCK(&node->nd_input_queue);
break; /* go look for another node */
} else {
- mtx_unlock_spin(&node->nd_input_queue.q_mtx);
+ NG_QUEUE_UNLOCK(&node->nd_input_queue);
NGI_GET_NODE(item, node); /* zaps stored node */
ng_apply_item(node, item, rw);
NG_NODE_UNREF(node);
@@ -3366,16 +3379,16 @@
{
mtx_assert(&node->nd_input_queue.q_mtx, MA_OWNED);
- mtx_lock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_LOCK();
if (node->nd_flags & NGF_WORKQ) {
node->nd_flags &= ~NGF_WORKQ;
TAILQ_REMOVE(&ng_worklist, node, nd_work);
- mtx_unlock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_UNLOCK();
NG_NODE_UNREF(node);
CTR3(KTR_NET, "%20s: node [%x] (%p) removed from worklist",
__func__, node->nd_ID, node);
} else {
- mtx_unlock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_UNLOCK();
}
}
@@ -3396,9 +3409,9 @@
* then put us on.
*/
node->nd_flags |= NGF_WORKQ;
- mtx_lock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_LOCK();
TAILQ_INSERT_TAIL(&ng_worklist, node, nd_work);
- mtx_unlock_spin(&ng_worklist_mtx);
+ NG_WORKLIST_UNLOCK();
NG_NODE_REF(node); /* XXX fafe in mutex? */
CTR3(KTR_NET, "%20s: node [%x] (%p) put on worklist", __func__,
node->nd_ID, node);
More information about the p4-projects
mailing list