From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=46.14.198.178 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796069304; b=dA0BMKgp5jt98JtcDrPPL3nW+cAAxj7U83EJpoLZHGV9Nek56JXcE32uRp7hgPwHkoEj jw7q9R4cVgGNoj5IkVPni4HrjHLDaXL04+CBMjm6L/jkF/9m5NKlrTGArnidHBA8AfVrk lQH/Sx9drHt7BSt0sTlUuMkxERabFuuyPtpto101hNfgE+Mq/KxSfFt6t5+Aixo7Y3S3F Gtd12utv5bOyc9dpZvyCL8U8+jdvkq8rvR4pQKXCJZjrpDWPlJ6rXpV1sScLNQHwlk/ot FIXM+vmy1Qhp3GEzqyhEGvQSypQQgdoRNnvztZjiBPvviVtKdyKiQcSsnRFDbwd+M1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796069304; h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:DKIM-Signature; bh=Rdj7jriatpCTdTfsTA2ftVZsNefjT+KV+BgvY3TUfA0=; b=s+Opotbf3E0XAVEDku4ZCHBoxrSc6dL3fTqYrmoqwWt7JO4yLXG4cRFSZMfzrj342MXt uXgM9OKM7V68/IDwjScJmdgHjVDqjz3+fz4JN/AgSKmN5uwUqivBdm3uLBNwxQBYToUOn Ymd6RYZjOz+8zqEYj9uQMtQCtO3e6tCcO9wE99sLWUxhQ1tmkiNHgWE57u9tVMYv3NB1I FPVESV0fc3H/22Y/j00Nl1wO+RmqarAqhtutK2xRAVNnoKyEPbMKtH5f7+bRMOCWr1Dob dFuPjdJURrWb1mUjseXN/5BNi7bdRguh6jS4AEQ4b//5NUsyZ271eFGJ8eIUgsYOoAQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=rimpianto.com; spf=pass smtp.mailfrom=rimpianto.com; dkim=pass header.d=rimpianto.com header.i=@rimpianto.com header.a=rsa-sha256 header.s=s20260314391 header.b=QGOPynme; arc=none smtp.remote-ip=46.14.198.178 Received: from mail.rimpianto.com (mail.rimpianto.com [46.14.198.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DF46606A32A; Mon, 30 Nov 2026 20:08:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5DF46606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rimpianto.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rimpianto.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rimpianto.com header.i=@rimpianto.com header.a=rsa-sha256 header.s=s20260314391 header.b=QGOPynme Received: from localhost (Unknown [127.0.0.1]) by mail.rimpianto.com (Haraka) with ESMTPSA id 522EB1AF-3D1E-4C73-9DCD-AB64605DD370.1 envelope-from tls TLS_AES_256_GCM_SHA384 (authenticated bits=0); Mon, 30 Nov 2026 21:07:10 +0100 Authentication-Results: mail.rimpianto.com; auth=pass (plain) From: Federico Musto To: netdev-bot+sashiko@kernel.org Cc: Federico Musto , Chris Snook , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH net v5 1/2] net: atl1c: wait for in-flight RX polls before the link-down ring reset Date: Mon, 30 Nov 2026 21:07:09 +0100 Message-ID: <20261130200709.34802-1-federico@rimpianto.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <179595291724.3146.10471005923458447939@kernel.org> References: <20261125113120.99743-2-federico@rimpianto.com> <179595291724.3146.10471005923458447939@kernel.org> X-Mailing-List: linux-kernel@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: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimpianto.com; h=Content-Transfer-Encoding: Content-Type: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=s20260314391; t=1796069230; bh=Rdj7jriatpCTdTfsTA2ftVZsNefjT+KV+BgvY3TUfA0=; b=QGOPynmerjk7XEGqh7STRAlRJmUXwCXJRF84XpLPA5Lsbaiap+SCksrhcyO22nJKSyP8psAtN q49eEdv9fr9v/EO00d3AOyeW67pZ0rNCZlMZyGjyUMJTysI1GYaLr128n5PSz7FIDUjrmp2yvEc pd30wS91z50zyMTXVGcAhL11YaGwxn39HlvRGAFbhiOs6IheMPGRNQ3SO+dM3Mvwixo8qm1Kx3R sYahmc83e70ixojqDmaHCwiMhSOHaMwSZUnGxH8p/x1dgD8FANQcsbbPG+pc6RlFe9TINBQb1xy QOSNH2CsFqptINPZo6ppI7WmB7apKa6hcj9ag15joOYQ== Thank you for the review. The four findings are correct. Before I write a v6 I would like to ask the maintainers about the direction, because I do not think another round of fixes to the wait is the right answer. The question is at the end. [Medium] The link-down sequence is skipped when the wait gives up. Correct. When atl1c_rx_poll_sync() returns false the handler returns before hw->hibernate, atl1c_reset_mac(), atl1c_set_aspm(SPEED_0), atl1c_post_phy_linkchg(SPEED_0) and atl1c_configure(), and nothing records that this work is owed. With a threaded busy-poll that is every link-down, not a rare case. [Low] The comment and the commit message overstate the guarantee. Correct. atl1c_clean_rx() writes REG_IMR after napi_complete_done(), so the poll is still running once NAPI_STATE_SCHED is clear, and polls can still start. Only the narrower claim holds: no RX poll walks the rings. [High, pre-existing] The TX side of the same reset. [High, pre-existing] No exclusion against the atl1c_down() callers. Both correct. atl1c_clean_tx() has no carrier gate, and __AT_DOWN is only looked at while NAPI_STATE_SCHED is set. These findings, and most of those on v4, have one cause: atl1c_common_task() is not serialised with any path that resets or tears down the rings (change_mtu, atl1c_reinit_locked(), suspend, PCI error recovery), and it takes neither RTNL nor __AT_RESETTING. A lock-free wait on NAPI_STATE_SCHED can only cover the RX poll, and each revision has exposed the next uncovered context. What I propose for v6 is to replace this patch with the locking model of alx, the sibling driver: - a mutex in struct atl1c_adapter, as alx has alx->mtx, taken by the work item (which rechecks __AT_DOWN under it), by open and close around atl1c_up() and atl1c_down(), by atl1c_change_mtu(), atl1c_reinit_locked(), suspend, resume and the PCI error handlers; - under that mutex the link-down branch does what alx_check_link() does: netif_tx_disable() and napi_disable() on every TX and RX NAPI, then the existing reset sequence unchanged, then napi_enable() and the queues are woken; - atl1c_rx_poll_sync(), its timeout and the smp_mb() go away, and no part of the link-down sequence is ever skipped. That removes the Medium and the Low above and closes both pre-existing issues. It is a larger patch than anything in this series so far, and it touches every entry point of the driver. Questions for the maintainers: 1. Is this the direction you want for atl1c, or would you prefer something smaller? 2. Should the locking change go to net with Fixes: and stable, or to net-next? If net-next, should the leak fix in patch 2 wait for it, since it adds a free in the window of the same race? On testing, following up on Chris's note of Nov 4: I can test on a MikroTik CCR2004-1G-2XS-PCIe. It is not Atheros silicon; the card exposes emulated AR8151 functions to the host, so it does not stand in for a physical AR8151. Within that limit I am willing to test atl1c patches on it, mine or anyone else's. pw-bot: cr