mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Federico Musto <federico@rimpianto.com>
To: netdev-bot+sashiko@kernel.org
Cc: Federico Musto <federico@rimpianto.com>,
	Chris Snook <chris.snook@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	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	[thread overview]
Message-ID: <20261130200709.34802-1-federico@rimpianto.com> (raw)
In-Reply-To: <179595291724.3146.10471005923458447939@kernel.org>

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

  reply	other threads:[~2026-11-30 20:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 11:31 [PATCH net v5 0/2] net: atl1c: fix the RX buffer leak on errored frames Federico Musto
2026-11-25 11:31 ` [PATCH net v5 1/2] net: atl1c: wait for in-flight RX polls before the link-down ring reset Federico Musto
2026-11-29 11:48   ` netdev-bot+sashiko
2026-11-30 20:07     ` Federico Musto [this message]
2026-11-25 11:31 ` [PATCH net v5 2/2] net: atl1c: free the RX buffer when the descriptor reports an error Federico Musto
2026-11-29 11:48   ` netdev-bot+sashiko
2026-11-30 20:07     ` Federico Musto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130200709.34802-1-federico@rimpianto.com \
    --to=federico@rimpianto.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=chris.snook@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®