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 2C75EC52D7C for ; Tue, 13 Aug 2024 17:30:52 +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=5NoZCSaoOttYGFP4/rYe/XKjJjPS0m2JdIDQ6t2cpfA=; b=gxhQpVFxNG7hCeJp8MX0GysDra Fj2e98TN1yLbe9TVU6kUcjOkTshnkFGyge2dSIjCI92FTKcHpGnbiRPpM/8PtaE+Nw36iRtEywu86 l6oSOdcErG0Mkgksza+Av2jP3LfiQQwzf59YLezF59RCD1btRHAVeMmIfmStqntodK1yG32b7sH3v I9N36S6ELhEzFhJ12bkQ9u6Z7PCNwUh6BgiPFoyeS2RreFDVh3gVkf277ELCdiXJy3kPnnaDgBWTp ncSRgBBPpeZRuxoW05T29qoaV4OX50lF2vLhWTFSba+7xVkylaC1ghnoYDrunhJQv5bdtXdl4Hg0F DwfqXmGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdvLv-00000004VkY-2Akf; Tue, 13 Aug 2024 17:30:35 +0000 Received: from mail-ej1-f52.google.com ([209.85.218.52]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sduKz-00000004L8Q-0bTF for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 16:25:34 +0000 Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a7a8553db90so675884066b.2 for ; Tue, 13 Aug 2024 09:25:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723566331; x=1724171131; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5NoZCSaoOttYGFP4/rYe/XKjJjPS0m2JdIDQ6t2cpfA=; b=ZDZmZNoSB7oLGpP5JQ7ClHS9eOEIcDOteH6kZqfGQ/VcuNZ/hd8N1P45vfb4CFgq1W /L+DPLmySGQxb1A8R50/DDP2LrrpTviDe47a/XNLizzZEINp9niSx3gPQj4oMMKla0J5 WZ370puz052Zp5Y8aHhMXBTJlibi8W2NBb3zkNF44/baY8AM2x0URyVlzoz7Dr0BU2Y5 C9Qyu0jTvtxCA4Ghrfp//A4fZoq+g9cT7XNPyQXtN3KS+xQT86x4wCpqy8ZC8yHnDLoU 7cU/pGM5oitq1KrfLllwZn6E/yC/ZhrNa+PerCsJPWkK9a0PdYaIYwgnslbjZn9KT9l8 jtwA== X-Gm-Message-State: AOJu0YwL/ysMNXPYK6ejOl+4s+JRh0KqFWbqe02IOcxTXIeA/aUFzr9a eKHBIhC969B8MUupb5T7jBHJEbn4+ymX9YGdZO/FcO1GeZvedq8x X-Google-Smtp-Source: AGHT+IFkpR0IkCYUU+T11+NYu6VUySRtWZV3ow4RwBvn3WjywCNSuBqDVsW3Qc8BvnDESX+CuMTY+w== X-Received: by 2002:a17:907:1c26:b0:a6f:6126:18aa with SMTP id a640c23a62f3a-a80ed2d5a41mr280573866b.67.1723566330595; Tue, 13 Aug 2024 09:25:30 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-115.fbsv.net. [2a03:2880:30ff:73::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a80f414f04csm80637366b.166.2024.08.13.09.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 09:25:30 -0700 (PDT) Date: Tue, 13 Aug 2024 09:25:27 -0700 From: Breno Leitao To: Marc Zyngier 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 Message-ID: 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-20240813_092533_208682_AD9FBEC5 X-CRM114-Status: GOOD ( 18.17 ) 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 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 Reviewed-by: Breno Leitao Thanks for taming my fiery commit.