netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Marc Zyngier <maz@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Sunil Goutham <sgoutham@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net] net: thunder_bgx: Fix netdev structure allocation
Date: Tue, 13 Aug 2024 09:25:27 -0700	[thread overview]
Message-ID: <ZruI940YZCETGNGq@gmail.com> (raw)
In-Reply-To: <20240812141322.1742918-1-maz@kernel.org>

Hello Marc,

On Mon, Aug 12, 2024 at 03:13:22PM +0100, Marc Zyngier wrote:
> Commit 94833addfaba ("net: thunderx: Unembed netdev structure") had
> a go at dynamically allocating the netdev structures for the thunderx_bgx
> driver.  This change results in my ThunderX box catching fire (to be fair,
> it is what it does best).

Should I be proud of it? :-)

> The issues with this change are that:
> 
> - bgx_lmac_enable() is called *after* bgx_acpi_register_phy() and
>   bgx_init_of_phy(), both expecting netdev to be a valid pointer.
> 
> - bgx_init_of_phy() populates the MAC addresses for *all* LMACs
>   attached to a given BGX instance, and thus needs netdev for each of
>   them to have been allocated.
> 
> There is a few things to be said about how the driver mixes LMAC and
> BGX states which leads to this sorry state, but that's beside the point.
> 
> To address this, go back to a situation where all netdev structures
> are allocated before the driver starts relying on them, and move the
> freeing of these structures to driver removal. Someone brave enough
> can always go and restructure the driver if they want.
> 
> Fixes: 94833addfaba ("net: thunderx: Unembed netdev structure")
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Reviewed-by: Breno Leitao <leitao@debian.org>

Thanks for taming my fiery commit.

  parent reply	other threads:[~2024-08-13 16:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 14:13 [PATCH net] net: thunder_bgx: Fix netdev structure allocation Marc Zyngier
2024-08-12 16:25 ` Simon Horman
2024-08-13 16:25 ` Breno Leitao [this message]
2024-08-13 16:49   ` Marc Zyngier
2024-08-15 11:00 ` patchwork-bot+netdevbpf

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=ZruI940YZCETGNGq@gmail.com \
    --to=leitao@debian.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sgoutham@marvell.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).