From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.85.22 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796421896; b=Hdz0dsR8nVKzHxoTaJRDjY3wIyhRzj7cHzXlAXClWBb0W1y8uDNtfMY1tK5wGYIkNFi+ h8ck842JBOqXSs7gnicHgYnVDwrWOEeV8A0DKtzr16ek4z+wPf2ODTe0HncYGFuYRmAxf 9JoS8iQEyR9eHrQh4ms1aWeo1ErpXCz2j/I3ojuj6mXXUd94xruh//xKFoxS1BDirxVXv W7K7oYnYxy4wOerqTA+h1EpEhZX+A+cxWs+hMop2koS32pzUliprb0WDSFPSkicccaxCr 0ojLt60K3mgQVLYg/4edYZXxehyn7aSGwwogv28/s/KB1mQWhAe7nH6kIJgx8yAHCAA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796421896; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To:CC:X-Mailer: X-Originating-IP:X-ClientProxiedBy:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=0G9EoIEuGkfyeWxml4kGEWpgzrRtL05xgi4wGpo5v4g=; b=f6sYo73++HBM9uAxVWVLzn5f8hhrfuM1gM8SbnfmSo4HPJt81Q7vgrEysPurnKk3Nka7 Pantqq5V5YpREKK9fs3vPOuXNL3IhQoJgKyRZwBGLwyb6CmZ6/LGrO5dwMdJJyDsxD+cb sRnrwb7eFOvBRZRE0C5QrZ5EO1s9ATXrIbMjJUqq45rxXAsePinp6hvcS8xFrn4ZKra2f EMh3HjnqfxCr4p7vamT1/4PktXdLWX3ZuKLwjwtGx+WE0Rh/uk7A2++X86biVcvtNbIqP hg/0B76rfzMLJJ3CtLmVdoNTazFVg7Ck2ZQMWtRg5+uVMSNwCxKLZe3+Sim9H815LGw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=5bCY1pqw; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.85.22 Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazon11010022.outbound.protection.outlook.com [52.101.85.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE0AC606A32C; Fri, 4 Dec 2026 22:04:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BE0AC606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=5bCY1pqw ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OWj9iNXdp+AV7iPo96saggGNS/cjSQ6Q7bREJLgdbECcNwxzZ1EgJF7i+H5CXr786OboM18a50M7GE83Qfzmht/gXEQoYwalfmyWbd0hvoW/jQTP7wIrxTsT1vN0iqdhp8xkhR/cKDTzkwsdDJ6hhjg/BQm/YfiMRvVoA4GDOcmoilCVFqrIBCxW1bYqZtXskACZty4oZmeABlXFKfQ7MaVX7dXHHIfYCvI4IDqy+E/ph4zbFPNtDUuGoZyKAY7n08TO7vsQbnt2M9rGu5v1wZUxiniJVWyUhbo4J92CikwiVE4wKoO9wB1ale6vHLe0Nj57HmZxLyZal51PG4gVVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0G9EoIEuGkfyeWxml4kGEWpgzrRtL05xgi4wGpo5v4g=; b=ZfkCOZTgBtiHOYoZ59jOnyIrwPZP+Z84J0uNqwrE3kMMn8Lq4WDQLj6nQ35TM0+RJfP6wq2mUDX6kJAEVouYNv9Fe4D+ScGkxAB5/7gNDOkwnALktZJhZP9XQBious0FKBnoaLnYm8vve+C6MwrnZKUqgyxbkBbLYNKinLu/1dUro17xDr2jXdZ48H2aze4eZo3sNbdByqOpvH4Tn/ufQibRvTY2hFyHdYiu/DM1o3M7csVBXr4/WE2KgO3ROoE7pDVgD+hjlGOdhuUNR5Bs0iXVY+jiLB28loxZjssbxqSSq3CuIDo46mRcF1u8LltKkKdNiim0mf4U6It3itjRYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0G9EoIEuGkfyeWxml4kGEWpgzrRtL05xgi4wGpo5v4g=; b=5bCY1pqw92o4JW4KckEYX1NCpggpQxS9uz+HUwZkoxl/Czgvh9OIJqtamJkkFnthfCPDS9K9+huyLUBhqYi3pVg2G8Fz7m7dXhK0UJkw1/gyYdDetEPQ0G9TnPxweMXGfeEDJCo0Q8DY4sa/IL/StS9YIzLC5ZEb00bnR1+coUk= Received: from BL1PR13CA0220.namprd13.prod.outlook.com (2603:10b6:208:2bf::15) by DS7PR12MB8321.namprd12.prod.outlook.com (2603:10b6:8:ec::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Fri, 4 Dec 2026 22:04:49 +0000 Received: from BL4PEPF000003F3.namprd04.prod.outlook.com (2603:10b6:208:2bf:cafe::9a) by BL1PR13CA0220.outlook.office365.com (2603:10b6:208:2bf::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.709.7 via Frontend Transport; Fri, 4 Dec 2026 22:04:49 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BL4PEPF000003F3.mail.protection.outlook.com (10.167.249.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Fri, 4 Dec 2026 22:04:49 +0000 Received: from [10.11.96.223] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Fri, 4 Dec 2026 16:04:47 -0600 From: "Nikhil P. Rao" Subject: [PATCH net v2 0/5] ionic: fix register reads racing the BAR unmap on PCI reset Date: Fri, 4 Dec 2026 22:04:19 +0000 Message-ID: <20261204-b4-pr60-v2-0-9e0b5408a68e@amd.com> 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAOM4E2sC/z2NQQrCMBREr1L+2kgS7W915T2kiyb5sRHalCQWp fTuphHcDMzweLNCpOAowrVaIdDiovNTLvJQgR766UHMmdxBcolCiJapM5sDclZb0570BZGaHjI 9B7LuXUx3mChB9xvjSz1Jp92xY4OLyYdP+VtEgYs6x1+9CMaZEhYbjsSxVrd+NEftR+i2bfsCf BLtyrMAAAA= X-Change-ID: 20261118-b4-pr60-5fd83c966e7a To: Brett Creeley , Andrew Lunn , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , Paolo Abeni , Richard Cochran CC: , , Eric Joyner , Abhijit Gangurde , "Allen Hubbe" , "Nikhil P. Rao" , X-Mailer: b4 0.15.2 X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL4PEPF000003F3:EE_|DS7PR12MB8321:EE_ X-MS-Office365-Filtering-Correlation-Id: 5080a1ca-8259-4b05-44ab-08df52529d57 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|376014|1800799024|23010399003|6133799003|18002099003|3023799007|11063799006|56012099006|261028144727099003|261021123027099003|261009223027099003|261021135927099003|10067099003|261022075727099003|261022105027099003|261021121427099003|261026140227099003|261026121527099003|261102123227099003; X-Microsoft-Antispam-Message-Info: v6ymmb1+Ssw0qtX82yziV8Z7ffsuigKNkY9Pnz0cTFQ55bTzvu2b2cK/Zp8FBwdkSkn6FopGXs/ohABnsxlx/N/JHYkDegM4dZdRgPaSizPSSq7O/b9qf/KFTaWy5dGAW+aZT5u0g/xbgpirfvu54bp8mcQGXlFLHzHDysSW6uFYzgjaAjHQjl5ZJjKGAopy6bBzyQ8K0L6YUiLqXVZySCeet8guICYSymuTApf4NZJpPhx4PUw0/f9Qg3pJAhminVvpf/88KnF7dlWNYgD4Rim5scbk/M5aSstUNcu9QxrCAkzj/wLXiG9xrV9xCnRDD8nWfpQNaFUUFikE4JE11olk60EPoEX6cIBFNBlL2RUC8ovIRV8q5CIgR8YGbUsq/38yVrGf1qUupZ2a1QAlS6i3CskrTLHEXHHR2eSKitP2c+4NCg6BkQ4twxnKFz+kQGQHWZ63SHCixoDFPWVF0ByNkP9C7QKDYqbHIcSejmW8A54DLh3mkh/6xCqkSTIWPkeDcBSEq4JVuwdryeZYuYkUiFTcDWOPGTBdKLy11fpW/Q48HtLdRAR7MOgokKy7+q74zfjDww4Ex8yNMfY+dSwZ1kp+h699/heTAcR/mrrSZ0rK90NBfbS5c1zJMR03GxyDHISxbaL4u3viIqoVvQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700016)(376014)(1800799024)(23010399003)(6133799003)(18002099003)(3023799007)(11063799006)(56012099006)(261028144727099003)(261021123027099003)(261009223027099003)(261021135927099003)(10067099003)(261022075727099003)(261022105027099003)(261021121427099003)(261026140227099003)(261026121527099003)(261102123227099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aH8N++m5lP/MXLt7B0vJI1oEUUhVLv9ARuJ319445H/u1DGcWXvW5na0m+mhQuSlQ1dvIPB5YD2i/6JT271/Ck+8HXWu8n+oINhIPfc2HkxL23KCd9zU6Q8tZ1R1ewzo2SpmNPhhs7Xm3EITEsyQSlFMzFUk5rnoosl+3GHtnoVjlO7tdNqHcLuIcDE5XmU9LZY7YH1GMnJLbQevNkKRRebX3v/dbRjXBfnzsY5JliecGp9wkQ8LtVjgDCcpJKp4lXQO7u5hFssJc5z2skIm1X3pFzMpuRGaLHDPpztRf1DjG79jS7s2JrMWIt93Cq46kZMqyXpcREZqKHFr1Gd79hl5AqLVb952lidUrRHK2X6Cx1I/hkCSnV5+5fPuxOrjfv9u9it7+jNYE1ASf1r1+QrN8ebVSIbzEMkeH6N5iOOvV6qGDhyUswgYHUfpG7OP X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 22:04:49.0004 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5080a1ca-8259-4b05-44ab-08df52529d57 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL4PEPF000003F3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8321 A PCI reset of an ionic device runs ionic_reset_prepare(), which ends in ionic_clear_pci(): it clears the driver's pointers into BAR0 and unmaps it. Several readers test one of those pointers and then read through it without synchronizing with that teardown, so a reset that lands between the test and the read makes them access the unmapped BAR. This series closes those windows. Patch 1 clears and sets the device command registers under dev_cmd_lock and takes the lock in the two readers that did not. Patch 2 turns the lockless device info readers (firmware status, heartbeat and the ethtool register dump) into RCU readers and has the teardown wait for them. Patch 3 clears the PHC counter registers under phc->lock when the reset starts and has the PHC operations check them under that lock. Patch 4 holds queue_lock while ethtool -C writes the interrupt control registers, so the update cannot race the queue teardown of either reset. Patch 5 cancels a queue's DIM work after NAPI is disabled, so a poll cannot queue it again before the queue is freed and BAR0 unmapped. The firmware up handler, run from deferred work, also reads the device info registers. A reset's own admin commands can queue that work after the reset has cancelled it; a separate series keeps the deferred work stopped across a reset. The races in patches 1-3 were reproduced on an AMD Pensando NIC, on a kernel with KASAN and lockdep, by holding the reader between its check and its access with a test-only kprobe module while a PCI reset ran: without the series the access faults on the unmapped BAR, with it the reset waits for the reader or the reader backs off. The races in patches 4 and 5 were not reproduced. The series was also run through 30 PCI resets per test under concurrent ethtool, devlink and PHC load with lockdep enabled, without regressions. The races in patches 1-3 and 5 were found by Sashiko and the one in patch 4 by a Claude Code review; Claude Code was also used in developing and testing the fixes. Signed-off-by: Nikhil P. Rao --- Changes in v2: - Patch 1: note in dev_cmd_lock's comment that it protects idev.dev_cmd_regs (Sashiko). - Patch 2: note that dev_info_regs is RCU protected (Sashiko). - Patch 4: cover the firmware reset path too, retitle, add Fixes: c672412f6172 (Sashiko). - New patch 5: cancel the DIM work after napi_disable() and reset its state (Sashiko). - Link to v1: https://patch.msgid.link/20261202-b4-pr60-v1-0-b1f6706e065b@amd.com --- Nikhil P. Rao (5): ionic: fix devcmds racing the BAR unmap on PCI reset ionic: fix device info register reads racing the BAR unmap on PCI reset ionic: fix PHC reads racing the BAR unmap on PCI reset ionic: fix ethtool coalesce updates racing a reset ionic: fix DIM work racing the queue teardown drivers/net/ethernet/pensando/ionic/ionic.h | 3 +- .../net/ethernet/pensando/ionic/ionic_bus_pci.c | 21 ++++++++++++- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 34 +++++++++++++--------- drivers/net/ethernet/pensando/ionic/ionic_dev.h | 1 + .../net/ethernet/pensando/ionic/ionic_ethtool.c | 18 ++++++++++-- drivers/net/ethernet/pensando/ionic/ionic_fw.c | 6 ++++ drivers/net/ethernet/pensando/ionic/ionic_lif.c | 3 +- drivers/net/ethernet/pensando/ionic/ionic_lif.h | 2 +- drivers/net/ethernet/pensando/ionic/ionic_phc.c | 20 +++++++++++-- 9 files changed, 85 insertions(+), 23 deletions(-) --- base-commit: e9d78fc6741ac06d438cf64e314c28e57014432a change-id: 20261118-b4-pr60-5fd83c966e7a Best regards, -- Nikhil P. Rao