netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org
Subject: Re: [PATCH net-next 2/2] net: initialize netdev->lock on dummy devices
Date: Sat, 11 Jan 2025 12:35:22 -0800	[thread overview]
Message-ID: <20250111123522.7e4d1519@kernel.org> (raw)
In-Reply-To: <30c4dfe3-8991-4659-8379-47f0ac0d6f31@lunn.ch>

On Sat, 11 Jan 2025 19:58:40 +0100 Andrew Lunn wrote:
> On Fri, Jan 10, 2025 at 10:59:55PM -0800, Jakub Kicinski wrote:
> > Make sure netdev->lock is always valid, even on dummy netdevs.
> > 
> > Apparently it's legal to call mutex_destroy() on an uninitialized
> > mutex (and we do that in free_netdev()), but it doesn't seem right.
> > Plus we'll soon want to take netdev->lock on more paths which dummy
> > netdevs may reach.  
> 
> I assume here that dummy does not call alloc_netdev_mqs() or one of it
> wrappers? 

Yes, we have both dummies which go thru alloc and static ones.

> That is how the lock seems to get initialised for real MAC
> drivers. Are there other bits of initialisation in that function which
> dummy is missing? Should we really be refactoring alloc_netdev_mqs()
> to expose an initialisation helper for everything which is not related
> queues?

You make a good point. Let me do the opposite, we only have two callers
of init_dummy_netdev(). Instead of unexporting it let me delete it
completely and make the two callers allocate the netdevs with
alloc_netdev_mqs().
-- 
pw-bot: cr

  reply	other threads:[~2025-01-11 20:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11  6:59 [PATCH net-next 1/2] net: un-export init_dummy_netdev() Jakub Kicinski
2025-01-11  6:59 ` [PATCH net-next 2/2] net: initialize netdev->lock on dummy devices Jakub Kicinski
2025-01-11 18:58   ` Andrew Lunn
2025-01-11 20:35     ` Jakub Kicinski [this message]
2025-01-13  5:14 ` [PATCH net-next 1/2] net: un-export init_dummy_netdev() Kalesh Anakkur Purayil
2025-01-13  5:48   ` Kalesh Anakkur Purayil
2025-01-13 16:51   ` Andrew Lunn
2025-01-14  9:27     ` Kalesh Anakkur Purayil

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=20250111123522.7e4d1519@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).