From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796258545; b=mZ7loStPLS5iQtszg9GEy9I8JkruMptYq5CJf7ePhZR3pF3HbYdG9F9tAif3HFDMdmPo LW5Cmgy1YEZvTxVB6Mh8cUdod7GO3+WoxlZBoEgArG9Vt/R96MKO97uletIhmIPSWG852 eehtXahmcrEnCdt1wvOACOD4XOO2q/riFTVCq05v3E8st10V9SMDKC6mj9Q0pgTnI2H0j 1+XT7lWXIptuN3eOtl4HzgmWeylZiG7z2ma1n+YEWWCw0xbeF6xcAKvtV8apP40AYFe8r NhaI6adPvlc3WnUuJNnrGOEPcdO+KUVadNyWay2XqDWQ+iI5ThdF4UYLZQCBlGXB2IA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796258545; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=CazVnwECzwVpGvkgz80aWWO1Mqcq8sclZ0qgGo2b7q4=; b=jNxlZr4dMt+wZdTPirRxwhqQhphMPM6qbwgcDX2kGZ/ZTdTJRRblqOtr6oYlK+wD6jWe 4b1xzcWUFUA5iF3iUVSL5DgGU633Pr0K+e+ON/ex/oYn8pvHD8RcYFjhUObxP/GrTKYLJ ed/iA8aD721UWyMciJ8qnZgkXt6yQN9taqC6lacuaCQqw93VnWwVFJfwaa7cHKW3V26Sf WERK1xy83PNwslHn8CdOgM0Bg+0E/Owp4BkVb3AJ/zMXvfwx5WQBs1U24XXiH7D1h3s02 6JldPyOJ0RZOj7kJ4uv0ypLonFkq7jxCd1vML28Vjq2t4NthY85TSstqKBcrMjv33PA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=j3YGmCoS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 688B7606A322; Thu, 3 Dec 2026 00:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=j3YGmCoS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 652641F00893; Thu, 3 Dec 2026 00:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796258545; bh=CazVnwECzwVpGvkgz80aWWO1Mqcq8sclZ0qgGo2b7q4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=j3YGmCoSZv806Ca/c4+xkJN3SDCuhb98pdwdzoUNJSWMOXYvJD4FArLMm4Yy1AWur qphbfibM2yLR9up6h1Rjn3Z+DQJa8JeoRspUe4CqkIXN8JbUfZKGuH31w7MlNg9teF AiMHYwHmiROZQYzLTcf9CjDBeHh3XtLKzXmjAfV9duYfEeSlkSJRo8oseifTHvxaXH xy03R5OGbXrVDkDNrTTiytbny9dsNPDmSEpoeUbYbfw6KcfHcG4wvI6jS4Ida86Xz1 GjE1Skw+PZZNhEf/IfmLQje48RRSmG9wzoIos3NJS43EKvH+HigSeahEOMIY5sH6NW XHXqVZHeCdEXQ== Subject: Re: [PATCH net 1/4] ionic: fix devcmds racing the BAR unmap on PCI reset From: netdev-bot+sashiko@kernel.org To: nikhil.rao@amd.com Cc: brett.creeley@amd.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, eric.joyner@amd.com, abhijit.gangurde@amd.com, allen.hubbe@amd.com Date: Thu, 03 Dec 2026 00:42:23 +0000 Message-ID: <179625854395.3146.17197499909139989325@kernel.org> In-Reply-To: <20261202-b4-pr60-v1-1-b1f6706e065b@amd.com> References: <20261202-b4-pr60-v1-1-b1f6706e065b@amd.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The patch makes `ionic->dev_cmd_lock` protect the lifetime of the `idev.dev_cmd_regs` pointer, but the lock's comment in `struct ionic`… -- ionic: fix devcmds racing the BAR unmap on PCI reset This patch makes dev_cmd_lock protect idev.dev_cmd_regs. ionic_clear_pci() now clears the pointer under the lock before BAR0 is unmapped. ionic_get_regs() and ionic_firmware_update() now check the pointer for NULL while holding the lock, and ionic_vf_start() now takes the lock around its devcmd. Closes: https://lore.kernel.org/netdev/179539559673.3135.12079878343644861835@kernel.org/ > diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c > index ddc2f9770df45..49941fc6bbc41 100644 > --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c > +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c > @@ -219,7 +219,9 @@ static void ionic_clear_pci(struct ionic *ionic) > { > if (ionic->num_bars) { > ionic->idev.dev_info_regs = NULL; > + mutex_lock(&ionic->dev_cmd_lock); > ionic->idev.dev_cmd_regs = NULL; > + mutex_unlock(&ionic->dev_cmd_lock); [Severity: Low] This isn't a bug, but should the comment on dev_cmd_lock in struct ionic (drivers/net/ethernet/pensando/ionic/ionic.h) be updated too? It still says only: struct mutex dev_cmd_lock; /* lock for dev_cmd operations */ After this patch, three places rely on the lock to keep idev.dev_cmd_regs alive. This teardown in ionic_clear_pci() needs it, and so do the new NULL checks in ionic_get_regs() and in the per-chunk loop of ionic_firmware_update(). The code doesn't say anywhere that a reader must hold dev_cmd_lock from the NULL check through the MMIO access. The comment is still unchanged at the end of the series. The sibling patch "ionic: fix PHC reads racing the BAR unmap on PCI reset" does document its matching rule: spinlock_t lock; /* lock for state_page, cc, tc and idev.hwstamp_regs */ Could dev_cmd_lock get a similar note, for example "lock for dev_cmd operations and idev.dev_cmd_regs"? One site still uses the pointer without the lock. ionic_lif_queue_identify() computes &idev->dev_cmd_regs->data outside the lock. Its only caller chain is ionic_probe()->ionic_lif_alloc(), and the commit message excludes probe-time identify on purpose. That exception is only in the commit message, though, and not in the code. > ionic->idev.intr_status = NULL; > ionic->idev.intr_ctrl = NULL; [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-b4-pr60-v1-0-b1f6706e065b%40amd.com