Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1933627ybp; Sat, 5 Oct 2019 02:21:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCJo/SII30zH3u9LFez0NVYoGc9qrdWrm/OZHaCr3+G6yts7ILiTmM73M0PN6K1wjXHhmu X-Received: by 2002:a50:c3c7:: with SMTP id i7mr19689145edf.138.1570267298933; Sat, 05 Oct 2019 02:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570267298; cv=none; d=google.com; s=arc-20160816; b=vKF9nki/5HP6WqaoPY7zXetLTcAvyIz7sW8qTz82UlITPk96VG3ErMzYUVVn+i0L1Y tt4VgBIRD8Bwkwm7/zYR/U+4qb6jo6JsUXx2PVsdUO9SgXjO8HXgNKJwBSyq3ZUFSyEt V31D4Jw5RhMH0zbpg67JeXi8SbuMXmAlEGA4eALJ942IkZh9Ss4FvqRqd/paB6xxBLkD UCD33cSarXlx3NCzkgrGoeX8yPJYJwcfM2k8tn5vd1BT7XvEykE/jV24sEkRxu7xBkZH ffc/HzwlPjvrJHRg2pF7OpDQ9U99n2n+pAiKC1jMdHOghV+5ljM6Ewn7X9DHUJ3lhY5M zXlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=f6BMm3bC3bkusqxJWYAC/zLRsOGev2sxGw4nQG+kQcc=; b=ymyb4XweN7kvhOAmGqZiJWOJP/OCw8SeTqzjttluSj1qKQFjKB1t2mpMT3aPpBWtfT etU90Oe2vtmSMKVFWkaw/clvcP8+om//VSLEJCtcCM8Ioniln/AetdRKSYJFP8OqcVmt IeqEBjW7Ct2ZDMFEbvlMYraYtEMhT+nAooHgFR3OAgQumkgqJmOKibuQ33i8YDaryOVa rzvSdDVAPFM7o7x1NSrun9bO9rNhWqwV0ZUOZmjFSI0BufBjqO2ZUpKJaNPID2OP5jXG pC43zQuhuwZB3aHbZI3Skf0ST0mIUJIp9qL8+hpGit8Oq7AVuF5gGG8ILLpN8kqRYPsk Seaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gvmHNy8D; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si4269913ejg.127.2019.10.05.02.20.58; Sat, 05 Oct 2019 02:21:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gvmHNy8D; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbfJEJNo (ORCPT + 99 others); Sat, 5 Oct 2019 05:13:44 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44755 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbfJEJNo (ORCPT ); Sat, 5 Oct 2019 05:13:44 -0400 Received: by mail-lj1-f193.google.com with SMTP id m13so8792376ljj.11; Sat, 05 Oct 2019 02:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f6BMm3bC3bkusqxJWYAC/zLRsOGev2sxGw4nQG+kQcc=; b=gvmHNy8D4Y14VKLA2WNPxfPGjW3qIykENQ7BWGE6EHDMK6OmmzdygA2CjHtOTvJZeF dhxGhRqJu9eVM1MOolMtYDle+7h3uMRpjKyeA6RQT4v1tIj00wVeI2ovWvYOUU4s2JK0 bG5adlXhTC3ME3tUn3BmQyxcsSdsgOwUh5pRvlQVaWamBwI+3Mbndk4VUBzAOBB+Ec5E tHl2QLygGimnMkkgsJOIJy8azP9wL1injFT6QVvLcWZz0g1/VKoBCND4umumlI5S4M/U 0Mdld6SUVr8+0NAxbz8T2xfzsRP34AdMyMJnmcKPgS+0wwEpDvV6/F8V9LTSZwxhQNib hK8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f6BMm3bC3bkusqxJWYAC/zLRsOGev2sxGw4nQG+kQcc=; b=KkKUnKLdoJegZZIAfz9MjkFeeglcVtk1WkhNppw+8LvAwO3E1qoMMVPQEuGhyx4xpW xGTo3EEv/e440jSjdK5WATgRHqptEuvLLcGVxd3brluf9m4WSepfcZ3sT1XG2BCILeI7 b3Ng4sENULj4eGKThYjymESaORifoYj81IjIHLkLx25S6URwSvN4PSuet52sOVoaJ7WG jYsjpcShRG3uhpMukOoE91CWPbVsjx/fUZhxhDc0N22fEM4yDJQ/TP6If4k8F/lnPJd6 8fVRT0XWiStS1WUae9aPqrakig9UyWCx8L1MKhxyGyfeSpiDPvnnSJGmqkNxc6JR29FF hGsA== X-Gm-Message-State: APjAAAWfn5y8grZkb7Fa5UMDundtcQUPCrJw9H1PTYe+TF5eymDLUOOw ZIQzdNuPYCPIgQw0odwIP3ugpubJYmd1s4IIE7c= X-Received: by 2002:a2e:744:: with SMTP id i4mr12193905ljd.64.1570266821465; Sat, 05 Oct 2019 02:13:41 -0700 (PDT) MIME-Version: 1.0 References: <20190928164843.31800-1-ap420073@gmail.com> <20190928164843.31800-8-ap420073@gmail.com> <33adc57c243dccc1dcb478113166fa01add3d49a.camel@sipsolutions.net> <72bc9727d0943c56403eac03b6de69c00b0f53f6.camel@sipsolutions.net> In-Reply-To: <72bc9727d0943c56403eac03b6de69c00b0f53f6.camel@sipsolutions.net> From: Taehee Yoo Date: Sat, 5 Oct 2019 18:13:30 +0900 Message-ID: Subject: Re: [PATCH net v4 07/12] macvlan: use dynamic lockdep key instead of subclass To: Johannes Berg Cc: David Miller , Netdev , linux-wireless@vger.kernel.org, Jakub Kicinski , j.vosburgh@gmail.com, vfalico@gmail.com, Andy Gospodarek , =?UTF-8?B?SmnFmcOtIFDDrXJrbw==?= , sd@queasysnail.net, Roopa Prabhu , saeedm@mellanox.com, manishc@marvell.com, rahulv@marvell.com, kys@microsoft.com, haiyangz@microsoft.com, Stephen Hemminger , sashal@kernel.org, hare@suse.de, varun@chelsio.com, ubraun@linux.ibm.com, kgraul@linux.ibm.com, Jay Vosburgh , Cody Schuffelen , bjorn@mork.no Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 1 Oct 2019 at 16:25, Johannes Berg wrote: > > Hi, > Hi, > > > I didn't see any discussion on this, but perhaps I missed it? The cost > > > would be a bigger netdev struct (when lockdep is enabled), but we > > > already have that for all the VLANs etc. it's just in the private data, > > > so it's not a _huge_ difference really I'd think, and this is quite a > > > bit of code for each device type now. > > > > Actually I agree with your opinion. > > The benefits of this way are to be able to make common helper functions. > > That would reduce duplicate codes and we can maintain this more easily. > > But I'm not sure about the overhead of this way. So I would like to ask > > maintainers and more reviewers about this. > > :-) > > > Using "struct nested_netdev_lockdep" looks really good. > > I will make common codes such as "struct nested_netdev_lockdep" > > and "netdev_devinit_nested_lockdep" and others in a v5 patch. > > That makes *sense*, but it seems to me that for example in virt_wifi we > just missed this part completely, so addressing it in the generic code > would still reduce overall code and complexity? > Yes, you're right, Virt_wifi has the same problem. I will fix this in a v5 patch! > Actually, looking at net-next, we already have > netdev_lockdep_set_classes() as a macro there that handles all this. I > guess having it as a macro makes some sense so it "evaporates" when > lockdep isn't enabled. > > > I'd probably try that but maybe somebody else can chime in and say what > they think about applying that to *every* netdev instead though. > If we place lockdep keys into "struct net_device", this macro would be a little bit modified and reused. And driver code shape will not be huge changed. I think this way is better than this v4 way. So I will try it. > > > > What's not really clear to me is why the qdisc locks can actually stay > > > the same at all levels? Can they just never nest? But then why are they > > > different per device type? > > > > I didn't test about qdisc so I didn't modify code related to qdisc code. > > If someone reviews this, I would really appreciate. > > I didn't really think hard about it when I wrote this ... > > But it seems to me the whole nesting also has to be applied here? > > __dev_xmit_skb: > * qdisc_run_begin() > * sch_direct_xmit() > * HARD_TX_LOCK(dev, txq, smp_processor_id()); > * dev_hard_start_xmit() // say this is VLAN > * dev_queue_xmit() // on real_dev > * __dev_xmit_skb // recursion on another netdev > > Now if you have VLAN-in-VLAN the whole thing will recurse right? > I have checked on this routine. Only xmit_lock(HARD_TX_LOCK) could be nested. other qdisc locks(runinng, busylock) will not be nested. This patch already handles the _xmit_lock key. so I think there is no problem. But I would like to place four lockdep keys(busylock, address, running, _xmit_lock) into "struct net_device" because of code complexity. Let me know if I misunderstood anything. > johannes > Thank you, Taehee