From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC3B41CA9F; Tue, 13 Aug 2024 16:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723567747; cv=none; b=AbEkZufBwDXtRzXuaK/OvmvBWqp5XBtIxAk32E42sA89bqQRwQtwqGAAo0VIPBMkx2zW1Tag2TMZ4KV3oHpE/3ewK2NbkXMqLdakMZpuFZU2dnq/CTbGeTHA8DOaA3d7BCOfUImrvuobjFJrVWlouQBoBrrFESdLLfGKCGbRaSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723567747; c=relaxed/simple; bh=m6VisToohIEMIQJQIbU8qwBhwVBuJUfVH2KDYx1eBWQ=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=D/817RNhd6CfT7Q+aX514/QGJ8ike1h8ookgDYu7C1xXrB82ofeue1moRofgQsNg2a6E2iiBWXxxhAIyylwRAGn6GR05QxJMwDp5JOu04OgtEWQ+GQ0nVPN9C8EO86Ezn5iaV5+kRzcF27bCIq34pt2Qq7Y+fZIs3atq8Ovhis8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IDbE0rW9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IDbE0rW9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7BDC4AF09; Tue, 13 Aug 2024 16:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723567746; bh=m6VisToohIEMIQJQIbU8qwBhwVBuJUfVH2KDYx1eBWQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IDbE0rW91NfgeiyaVSeUG+leSIJD28drSzhjH79F/ohoMaJOx/o3fpMzrt+BoEFOB G0v8LK+bDG2+Hr+7zYY6x5ih92Ie+CpERw0cuiGIeu3PiMHA1d46z+LUJMBqIVRtu3 3PoEHKElKNBWozlUp0IkA9LRyHvVClVf3EsX3Engg+aTJ6Iv4qz6eq7RPUbboIjTDl 1BwIqjkQ/mEPC50dvdAIRC934MPbCEXIzUlibJUdYWtYj9W6USLekd2qTerSuTpOj2 0/drEIfE2neATCFj24azxArhbSvQ7Tmxf59qwmgs20ItEsqJtkLw7/EGHPdaSCYgUn k/dE1cv0npviA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sduhk-003QLJ-AG; Tue, 13 Aug 2024 17:49:04 +0100 Date: Tue, 13 Aug 2024 17:49:04 +0100 Message-ID: <86wmkkz7un.wl-maz@kernel.org> From: Marc Zyngier To: Breno Leitao Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Sunil Goutham , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: Re: [PATCH net] net: thunder_bgx: Fix netdev structure allocation In-Reply-To: References: <20240812141322.1742918-1-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: leitao@debian.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, sgoutham@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Tue, 13 Aug 2024 17:25:27 +0100, Breno Leitao wrote: > > 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? :-) It's always good practice to check that someone still cares about terrible HW. Break it, wait for a few releases, and purge it if nobody was looking. Unfortunately, this is one of the few machines I have that has 16kB page support, so I can't really turn a blind eye on the breakage... ;-) > > > 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 > > Reviewed-by: Breno Leitao > > Thanks for taming my fiery commit. No worries. Thanks, M. -- Without deviation from the norm, progress is not possible.