Subject: Re: [patch 10/15] ppp_generic: fix lockdep warning

From: Jarek Poplawski <[email-masked]>
Date: Thu, 26 Apr 2007 12:49:50 +0200

On Thu, Apr 26, 2007 at 01:39:11AM -0700, David Miller wrote:
> From: [email-masked]
> Date: Thu, 26 Apr 2007 00:27:29 -0700
> 
> > lockdep has seen locks "-> #0" - "-> #3" taken in circular order, but IMHO,
> > lock "-> #3" (&pch->downl) taken after "-> #2" (&ppp->wlock) differs from
> > &pch->downl lock taken in "-> #0" (before &vlan_netdev_xmit_lock_key) and
> > lockdep should be notified about this.
> > 
> > Reported & tested by: "Yuriy N. Shkandybin" <[email-masked]>
> > Signed-off-by: Jarek Poplawski <[email-masked]>
> > Cc: Paul Mackerras <[email-masked]>
> > Signed-off-by: Andrew Morton <[email-masked]>
> 
> I believe there were some problems found in this one,
> so I'm going to hold on it for now.
> 

This patch should prevent lockdep from reporting one kind
of possible circular locking error, which in my opinion is
impossible (lockdep doesn't see the difference in serving
two types of ppp channels). So, if I'm not wrong, this
patch is helpful sometime.

But there is also a second, very similar lockdep report,
probably also false (lockdep cannot see the difference
between locks of two different, I hope, vlan devices),
which needs more work:
a) vlan should use different lockdep lock subclasses or
classes for each device, which would require quite a lot
of static memory reserved, probably only to silence
lockdep,
b) pppoe could change the way of sending packets, so
the locks of ppp_generic were not seen by lockdep
with so many variants; I'm not sure the maintainer of
pppoe likes this idea;

Doing a) should be enough, I guess; doing b) is easier
but, probably, the similar is possible elsewhere, too.

Of course, there is possibility to silence lockdep
easier, e.g. don't let it know about vlan's lock
at all, but there is always, a risk lockdep reports
could be right sometimes...

Probably this kind of "error" reports could be avoided,
if vlan's config were started after all their devices
were up. Here it is probably: netdev1, vlan1, netdev2,
vlan2... and lockdep isn't able to distinguish them
enough.

Currently I think about some change in lockdep, to track
something like different vlans with less memory, but I'm
not sure it'll work, yet.

Regards,
Jarek P.