Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1209368lqp; Fri, 22 Mar 2024 08:24:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpTjKojGhaXIapvwSLhJP+VAMqeTMlieGflWe29GnGGlSVvGEK9qP+WYxCZ0Tu8a3ZkF5fSIvMWYEa5MkrBT5fet0mzLVnNfnSrdIvjw== X-Google-Smtp-Source: AGHT+IEYIB1LckVuzURP2iLgmEV8SbOd3nBg48KKO7WNo1QbJJ4Un1gLZwW56/2U9D9aSkPSTiJv X-Received: by 2002:a9d:3e12:0:b0:6e6:966e:cc0 with SMTP id a18-20020a9d3e12000000b006e6966e0cc0mr3147285otd.12.1711121046135; Fri, 22 Mar 2024 08:24:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711121046; cv=pass; d=google.com; s=arc-20160816; b=id5CWALjJRxQLkIqroKYfT27gRxLdQ85cDDz7s1UQAiY1m727G7q30RCPhOECnrFs9 Kvmd/A8C/E6+jfqv2SZ89zPF7LsJBEYxDj0I7CggRj+mvdNQkdi9QgOKvean2TxW5Zsh rggXMz5aXyjmVjyeB237i9Tg+2oRCkOt9BFELp7nFLUrgJNgN5aHdRo6IRt5cMHdl3f7 RyfaRWbpR1ovIZ3iHflfpoF4jkTqYx+kOHAsA587xF/6YsXzhdym6ZIwZvMeS9S/fkAD 1y2wREOH8Bn3feRwt0zcm6KaQQmmGLK35nfJ+KoHq+vb5HzMQbfBgUHei1xZE54UzZs0 qEYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=4RKRFNoMapxI3JJylCmWQ23Hlyixg87XxgLdaz5wdsQ=; fh=byMXkkqNwyTcUcBCGlV2A/dWjGAU2s+iMwFnmI4GTbc=; b=jLC6CNznkOjB0B/Pg802UsSNJeL4AJ8EqP5q4dKenLiILlOlirG8KQLDIxm8rTAlDl I5UL6OhXfO32WoINnlZqv9pUtIAsEj7qUsXPVtwdtRT20SBx5ztCC1BQe0gkQ7b6EKGp TOWA0an8+Ka1dEL5MjbJraR+z6M6BgunskKIRcY44KZfbovW2LAYCyr6e5HFbOYmenuX VN92yWNRqEp2E9G9Z1Q/udHsKx2P6bEhkAFdbnhb8Bv4qxWtw0jU+FeFhY8b4Wj002dS OGejFTuWtl4v7QSBF6vmMHPyOT18lX4MuJ5wJo9+ZDeuGss3bNgXShydtqvyFMD9sIXJ nEKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=phXk55he; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111696-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x8-20020ae9e648000000b00789eead43c8si2210120qkl.206.2024.03.22.08.24.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 08:24:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=phXk55he; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111696-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D59C11C2258E for ; Fri, 22 Mar 2024 15:24:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6CEE537F0; Fri, 22 Mar 2024 15:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="phXk55he" 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 BDAF451C4F; Fri, 22 Mar 2024 15:23:38 +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=1711121018; cv=none; b=MtPgn5gPNhexZVCfKr4SKiQX1mtmUspzG5ko7vNfuQmRu5vAKWZ/4ruKyzD2U3m3N/WykUixupO0mPmPq9MSUkKS0ThG2ZjmGe7Sy6NRkL7rVRDutz7Q+lyVuAwNTQUPLs/wFO+i1r+FPTP902O4RXy3d+z9joA080pBixbT6e4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711121018; c=relaxed/simple; bh=2jKs8iXhSIhZoCfrPfcc8CMFgCUmi/F0p3tI20DDC8s=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jhrmYzgu8ingXa7HVpwys+Bed79hj1j2hc54AvCx6N7gkrCq+cT6gpkFX4pwJ3G30BC8Ah+VW4c5+iwvZLGTW9iDxgu5HOdXLZRfzqjGZi4f9y156ob6sEH52CthOqZpVJiVMXbZpgmpslvsKn4kcRDbZd7cGUQzwd7NlaYymi4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=phXk55he; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCE20C433F1; Fri, 22 Mar 2024 15:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711121018; bh=2jKs8iXhSIhZoCfrPfcc8CMFgCUmi/F0p3tI20DDC8s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=phXk55hei4tv1d33xGsvZp2FCn8mCM1trm3kDZfQZdICDrEPJDLhK13MkrfHTJ3F+ bgnkYMAXoZsVDL0KFaNrewQEizN9ZhjUIakwhcOqCu9h7AtLMmYPmstvKhReuXKU6A PNYisq/fQ0BFHUMNi4Vt8/1EWLXcjYeasaFYl2FKLaDuaBJhEIiSuNGBMxfu13fovx B/ul9ZNN5Buz40ja9e+w+KnF57OBIjoKx4QmjCgZLBwHhmQOkAp4hd8HYzf80xaoi3 ZhAFHXouRrw3NeaETACnYVW3/DkQqpnuW1+UuopVNDj4REwqeESiG0E0KfnEuvLu1a A1jG1pzvo5rFg== Date: Fri, 22 Mar 2024 08:23:36 -0700 From: Jakub Kicinski To: Breno Leitao Cc: Jeff Johnson , Kalle Valo , Jeff Johnson , keescook@chromium.org, "open list:NETWORKING DRIVERS (WIRELESS)" , "open list:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER" , open list Subject: Re: [PATCH] ath10k: allocate dummy net_device dynamically Message-ID: <20240322082336.49f110cc@kernel.org> In-Reply-To: References: <20240319104754.2535294-1-leitao@debian.org> <9fcdb857-da62-4832-ae11-043fe993e4ad@quicinc.com> <20240321072821.59f56757@kernel.org> <5039256c-03eb-4cda-8d11-49e4561cf1ef@quicinc.com> <20240321151744.246ce2d0@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 22 Mar 2024 07:58:02 -0700 Breno Leitao wrote: > > Looks like init_dummy_netdev wipes the netdev structure clean, so I > > don't think we can use it directly as the setup function, Breno :( > > Before my patch, init_dummy_netdev was being also used. The patch was > basically replacing the init_dummy_netdev by alloc_netdev() with will > call "setup(dev);" later. > > - init_dummy_netdev(&irq_grp->napi_ndev); > + irq_grp->napi_ndev = alloc_netdev(0, "dummy", NET_NAME_UNKNOWN, > + init_dummy_netdev); > > I am wondering if alloc_netdev() is messing with something instead of > init_dummy_netdev(). alloc_netdev() allocates some memory and initializes lists which free_netdev() wants to free, basically. But init_dummy_netdev() does: /* Clear everything. Note we don't initialize spinlocks * are they aren't supposed to be taken by any of the * NAPI code and this dummy netdev is supposed to be * only ever used for NAPI polls */ memset(dev, 0, sizeof(struct net_device)); so all those pointers and init alloc_netdev() did before calling setup will get wiped. > Also, Kalle's crash is during rmmod, and not during initialization. > getting NULL after free_netdev() is called. > > > Maybe we should add a new helper to "alloc dummy netdev" which can > > call alloc_netdev() with right arguments and do necessary init? > > What are the right arguments in this case? I'm not sure we have a noop setup() callback today. If you define a wrapper to allocate a dummy netdev you can define a new empty function next to it and pass that as init? Hope I got the question right.