From: Cong Wang <xiyou.wangcong@gmail.com>
To: Taehee Yoo <ap420073@gmail.com>
Cc: syzbot <syzbot+4ec99438ed7450da6272@syzkaller.appspotmail.com>,
Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: WARNING: bad unlock balance in sch_direct_xmit
Date: Tue, 14 Jan 2020 11:39:22 -0800 [thread overview]
Message-ID: <CAM_iQpWPnOO7KoaADX4rnmZWdspseft4DDE=C21ORboWdUO9Qw@mail.gmail.com> (raw)
In-Reply-To: <CAMArcTVHj2_yGjsYMoMow0LsAe0cs+Xyz68+TAa6Nb4tQbc6EA@mail.gmail.com>
On Mon, Jan 13, 2020 at 2:53 AM Taehee Yoo <ap420073@gmail.com> wrote:
>
> On Sun, 12 Jan 2020 at 08:28, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> >
> > On Sat, Jan 11, 2020 at 1:53 PM Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > > The details you provide here are really helpful for me to understand
> > > the reasons behind your changes. Let me think about this and see how
> > > I could address both problems. This appears to be harder than I originally
> > > thought.
> >
> > Do you think the following patch will make everyone happy?
> >
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 0ad39c87b7fd..7e885d069707 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -9177,22 +9177,10 @@ static void
> > netdev_unregister_lockdep_key(struct net_device *dev)
> >
> > void netdev_update_lockdep_key(struct net_device *dev)
> > {
> > - struct netdev_queue *queue;
> > - int i;
> > -
> > - lockdep_unregister_key(&dev->qdisc_xmit_lock_key);
> > lockdep_unregister_key(&dev->addr_list_lock_key);
> > -
> > - lockdep_register_key(&dev->qdisc_xmit_lock_key);
> > lockdep_register_key(&dev->addr_list_lock_key);
> >
> > lockdep_set_class(&dev->addr_list_lock, &dev->addr_list_lock_key);
> > - for (i = 0; i < dev->num_tx_queues; i++) {
> > - queue = netdev_get_tx_queue(dev, i);
> > -
> > - lockdep_set_class(&queue->_xmit_lock,
> > - &dev->qdisc_xmit_lock_key);
> > - }
> > }
> > EXPORT_SYMBOL(netdev_update_lockdep_key);
> >
> > I think as long as we don't take _xmit_lock nestedly, it is fine. And
> > most (or all?) of the software netdev's are already lockless, so I can't
> > think of any case we take more than one _xmit_lock on TX path.
> >
> > I tested it with the syzbot reproducer and your set master/nomaster
> > commands, I don't get any lockdep splat.
> >
> > What do you think?
> >
> > Thanks!
>
> I have tested this approach and I have no found any problem.
> As you said, most of virtual interfaces are already lockless.
> So, generally lockdep warning will not occur.
> I found two virtual interfaces that they don't have LLTX and they also
> could be upper interface. Interfaces are "rmnet" and virt_wifi" type.
>
> My test case is here.
>
> [Before]
> master0(bond or team or bridge)
> |
> slave0(rmnet or virt_wifi)
> |
> master1
> |
> slave1
> |
> master2
> |
> veth
>
> [After]
> master0(bond or team or bridge)
> |
> slave1(rmnet or virt_wifi)
> |
> master2
> |
> slave0
> |
> master1
> |
> veth
>
> In this test, the ordering of slave1 and slave0 will be changed.
> But, rmnet and virt_wifi type interface couldn't be slave of bond, team,
> and bridge type interface. So, This graph will not be made.
> So, I agree with this approach.
Thanks for reviewing it and auditing more network devices.
I will send out the patch formally.
next prev parent reply other threads:[~2020-01-14 19:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-03 15:59 WARNING: bad unlock balance in sch_direct_xmit syzbot
2020-01-05 18:30 ` syzbot
2020-01-05 22:58 ` syzbot
2020-01-07 5:36 ` Cong Wang
2020-01-07 11:30 ` Taehee Yoo
2020-01-08 0:34 ` Cong Wang
2020-01-08 11:42 ` Taehee Yoo
2020-01-09 23:38 ` Cong Wang
2020-01-10 3:06 ` Taehee Yoo
2020-01-10 4:43 ` Cong Wang
2020-01-10 6:02 ` Taehee Yoo
2020-01-11 21:53 ` Cong Wang
2020-01-11 23:28 ` Cong Wang
2020-01-13 10:53 ` Taehee Yoo
2020-01-14 19:39 ` Cong Wang [this message]
2020-01-13 10:13 ` Taehee Yoo
2020-01-13 11:08 ` Dmitry Vyukov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM_iQpWPnOO7KoaADX4rnmZWdspseft4DDE=C21ORboWdUO9Qw@mail.gmail.com' \
--to=xiyou.wangcong@gmail.com \
--cc=ap420073@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=syzbot+4ec99438ed7450da6272@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).