Re: [PATCH] netfilter: use per-CPU recursive lock {XV}
From: Mathieu Desnoyers
Date: Sun Apr 26 2009 - 18:37:49 EST
* Stephen Hemminger (shemminger@xxxxxxxxxx) wrote:
> On Sun, 26 Apr 2009 14:56:46 -0400
> Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx> wrote:
>
> > * Eric Dumazet (dada1@xxxxxxxxxxxxx) wrote:
> > > From: Stephen Hemminger <shemminger@xxxxxxxxxx>
> > >
> > > > Epilogue due to master Jarek. Lockdep carest not about the locking
> > > > doth bestowed. Therefore no keys are needed.
> > > >
> > > > Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxxxx>
> > >
> > > So far, so good, should be ready for inclusion now, nobody complained :)
> > >
> > > I include the final patch, merge of your last two patches.
> > >
> > > David, could you please review it once again and apply it if it's OK ?
> >
> > > Thanks to all for your help and patience
> > >
> > > [PATCH] netfilter: use per-CPU recursive lock {XV}
> >
> > Hi Eric,
> >
> > Suitable name would probably be :
> >
Hi Stephen,
[I see that you have cutted my name proposal from the original email,
which might make it difficult for others to follow. I will assume you
did it by mistake.]
(re-added)
[PATCH] netfilter: use bh disabling with per-cpu read-write lock
>
> But Linus is trying to delude himself.
>
> This usage is recursive even if he doesn't like the terminology.
> The same CPU has to be able to reacquire the read lock without deadlocking.
> If reader/writer locks were implemented in a pure writer gets priority
> method, then this code would break! So yes read locks can be used recursively
> now in Linux, but if the were implemented differently then this code
> would break. For example, the -rt kernel turns all read/write locks into
> mutexs, so the -rt kernel developers will have to address this.
Reading Documentation/spinlocks.txt, which states the lock usage
guidelines :
"Note that you can be clever with read-write locks and interrupts. For
example, if you know that the interrupt only ever gets a read-lock, then
you can use a non-irq version of read locks everywhere - because they
don't block on each other (and thus there is no dead-lock wrt interrupts.
But when you do the write-lock, you have to use the irq-safe version."
So it's assumed in the kernel-wide read lock usage that nested read
locks are OK. I'm adding Thomas and Steven in CC, but I'm quite sure
they must have dealt with nested read-lock transformation into mutexes
by detecting nesting in some way in -rt. But I'll let them confirm this.
So I don't see why you are dreaming about a different semantic than the
one of the primitives you are using. I guess I'll leave the semantics to
you. I just find it astonishing that you persist saying that everbody is
wrong on a topic like semantic, which is in the end a mean to
communicate ideas clearly within the overall community you disagree
with.
Good luck !
Mathieu
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/