From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 982D3C3DA7F for ; Mon, 12 Aug 2024 16:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0f1mCkidoy1yZgYWEVvRnyVolbdcRflW6gleLgGfN1s=; b=rzRkZhpcat8ZY9RnYDSwo+J+pQ 8LpU80MLC5Qd0FH02d9Aufz1TFI4FLUgoU/qfzQ1ZOz4IH0tUcpSITiPXgbaH0X+W2bu+yTcH0O4J WS90p9hNfYITXbCnD/i3VxM+KJAySLdKT1TCf7l1hcdjX7uyCmmmkD4jD4WnwnTc0xdA6UDPy8GVA DM2wtAaoJfY9IkAUj8fBKipNuT5oJL8LyFrz0ciaKlVHXYtdTzn9cN3M1rfkYnxHB8cW5zvZHSvWr k6NmdXDa3EJuzzU7exnz6g4h8OsETIv5U2YUrVnS36/Oz6wAkNrMJkm3m5CMqsrflukiDsvGc6aeQ yGZ66PJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdXrh-00000000ss5-0yW4; Mon, 12 Aug 2024 16:25:49 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdXr5-00000000snp-3d9r for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 16:25:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D0C1060FA5; Mon, 12 Aug 2024 16:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A128C32782; Mon, 12 Aug 2024 16:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723479910; bh=0N3l/THIj+g6e1lTf7tTyw4XJWS6sD5AsYtZ4TQRfM8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g8fGgjQe19NkhVu0IpwASmCKW4QUDop7BzG9NNidxNBLPMvxqNwjQh6z9SmPfVtpX 3Hp0bykbfI9BrxZBUj3tfeImiAp6c/REhbE/EXX5Cfz+y+z2H/eCN2VNQITJ5RUthe kcuqGYZTGjIiSxwzsrg8MZjaaV4khWRNY0xft6DvtejsoarfCFp/b0TOzZgxM5cOc8 OEWG3Xhl57aseoCPALfuwBKeCBJIxwCc7lvatc/JPYpeTPthE6ZyV5VO+73/lb44/X fH1R4lnnU0GINGjp/+hpix3QN9HeVFxRqmpT2zBtFbCQDtMOpvzWXaOVZkwjOLUbQF OezQiUYm2o//g== Date: Mon, 12 Aug 2024 17:25:05 +0100 From: Simon Horman To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Breno Leitao , Sunil Goutham , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: Re: [PATCH net] net: thunder_bgx: Fix netdev structure allocation Message-ID: <20240812162505.GC44433@kernel.org> References: <20240812141322.1742918-1-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240812141322.1742918-1-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_092511_976614_03F77069 X-CRM114-Status: GOOD ( 16.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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). (I saw that :) > 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: Simon Horman