Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Dec 2000 12:25:22 -0800
From:      Julian Elischer <julian@elischer.org>
To:        Chuck Paterson <cp@bsdi.com>
Cc:        smp@FreeBSD.ORG
Subject:   Re: Netgraph locking primatives. take 1.
Message-ID:  <3A3E72B2.25D43708@elischer.org>
References:  <200012182014.eBIKEoP22868@berserker.bsdi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Chuck Paterson wrote:
> 
> Julian,
> 
>         I read your mail and looked at your example and still am
> not sure if there is a problem. In the last email I used the
> word process several times when it really isn't the right notion
> with respect to messages. It should really be processes and/or
> message. The thread of control in this case is a message, not a
> process. It may not be a process that hangs, but rather a pair of
> messages that can never make progress.

No because messages never have a dependance on another message..
no message cares if any other message makes progress or not.

> 
>         You said that if you are running in node X then you
> hold a reader lock on node X.

until you've finished processing that packet, which is not allowed to delay,
sleep or wait.
A packet is either processed immediatly and thrown out onto the input queue of
some other module,
or it is queued internealy waiting for some other packet to turn up, (e.g.
packet re-assembly in multilink PPP). However in the latter case, teh lock is
released while it is queued.
(actually, in both cases it is released..)

> This means that code running in node
> X can never get a writer lock, if it is to avoid deadlock. I think
> what needs to happen is that if you are running in node X you must
> hold a reader or writer lock.  Both the decision of which type of
> lock is needed and the acquistion of the lock must be made before
> entering the node.

I think you are thinking of some behaviour that is not what
netgraph does. Netgraph moves individual packets around a graph 
of processing nodes.

The over-riding rule for netgraph is that it may not hold a lock on a node
while it is not actually processing a packet in that node. If processing stops
(e.g. the packet needs extra data not yet present) and the packet is queued,
then the lock is released. 

> 
>         As I said I looked through your mail and the example and
> could not tell for sure where you were at. Sorry if I am just
> saying the samething you were talking about.
> 
> Chuck

-- 
      __--_|\  Julian Elischer
     /       \ julian@elischer.org
    (   OZ    ) World tour 2000
---> X_.---._/  presently in:  Budapest
            v


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A3E72B2.25D43708>