From: netdev-bot+sashiko@kernel.org
To: parthiban.veerasooran@microchip.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, hkallweit1@gmail.com,
linux@armlinux.org.uk, netdev@vger.kernel.org,
UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next RESEND v4 2/4] net: ethernet: oa_tc6: deliver the PHY interrupt to phylib
Date: Wed, 25 Nov 2026 13:05:27 +0000 [thread overview]
Message-ID: <179561192720.3135.12144826803876923892@kernel.org> (raw)
In-Reply-To: <20261124124930.485323-3-parthiban.veerasooran@microchip.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 4 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] oa_tc6_phy_exit() (drivers/net/ethernet/oa_tc6.c:824) now
calls cancel_work_sync(&tc6->phy_irq_work) for every user that does…
- [Medium] Each PHYINT event makes oa_tc6_process_extended_status() set
OA_TC6_INT_MASK0_PHY_INT_MASK in hardware (oa_tc6_phy_irq_mask_hw(),…
- [Medium] After handle_nested_irq() lets the PHY driver read and ack
STS1, oa_tc6_phy_irq_work() clears PHYINTM via…
- [Medium] net: ethernet: oa_tc6: repeated PHY_INT handling when already
masked
--
net: ethernet: oa_tc6: deliver the PHY interrupt to phylib
This commit exposes the in-band OA TC6 PHY interrupt (STATUS0.PHYINT) to
phylib as a nested virtual IRQ, gated by a new OA_TC6_PHY_INT quirk flag.
A custom irq_chip writes the PHYINTM mask bit over SPI from
irq_bus_sync_unlock. PHY interrupt dispatch is deferred to a work item:
the hardware source is masked when PHYINT is seen, and unmasked after
handle_nested_irq() runs.
> diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
> index 8e86cfde6d1c8..da4df6feafa9e 100644
> --- a/drivers/net/ethernet/oa_tc6.c
> +++ b/drivers/net/ethernet/oa_tc6.c
[ ... ]
> @@ -531,6 +538,178 @@ int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int devnum,
[ ... ]
> +static void oa_tc6_phy_irq_work(struct work_struct *work)
> +{
> + struct oa_tc6 *tc6 = container_of(work, struct oa_tc6, phy_irq_work);
> + int ret;
> +
> + /* Dispatched off the SPI chunk-processing thread so that
> + * phy_interrupt() taking phydev->lock and issuing synchronous SPI
> + * control transfers from PHY handle_interrupt() cannot stall the single
> + * thread pumping TX/RX data chunks.
> + */
> + handle_nested_irq(tc6->phy_virq);
> +
> + ret = oa_tc6_phy_irq_unmask_hw(tc6);
> + if (ret)
> + dev_err(&tc6->spi->dev, "Failed to unmask PHY interrupt: %d\n",
> + ret);
[Severity: Medium]
Does this path act on PHYINT again for every remaining chunk of the
same transfer?
oa_tc6_process_spi_data_rx_buf() walks all no_of_rx_chunks footers of
a transfer that has already been clocked in. If PHYINT was pending,
every one of those footers has EXST set.
Chunk 0 gets here, sets PHYINTM through oa_tc6_phy_irq_mask_hw() and
schedules phy_irq_work. Writing value back to STATUS0 does not clear
PHYINT, though. It reflects the PHY's own status and stays set until
the PHY driver acks it from the worker.
So for chunks 1 .. no_of_rx_chunks - 1 the STATUS0 read returns
non-zero again and the !value early return is skipped. Each chunk then
does a STATUS0 write plus a read and a write of INT_MASK0. That is four
synchronous control transfers per chunk on the realtime thread that
pumps TX/RX data, which is the cost the masking was meant to avoid.
The repeated schedule_work() is also not always a no-op. The workqueue
clears the pending bit before calling oa_tc6_phy_irq_work(). If the
worker is already running on another CPU and has not yet acked the
PHY, this queues it a second time. The second run calls
handle_nested_irq() with nothing pending, the PHY driver returns
IRQ_NONE, and note_interrupt() counts it as unhandled.
The commit message says a reschedule on an already-pending work item
can't duplicate an event. That only holds while the work is still
pending, not while it is executing.
The same thing happens outside the multi-chunk case. Say genirq has
masked the IRQ, so phy_irq_masked is true (for example after
disable_irq() from phylib), while the PHY line is still asserted. Any
other STATUS0 event, such as an RX buffer overflow, will then see
PHYINT here, mask it again over SPI and schedule the worker anyway.
Would it make sense to skip this block when PHYINTM is already set?
One way would be to keep a shadow of the hardware mask bit under
phy_irq_lock, and also to ignore PHYINT while phy_irq_masked is true.
[Severity: Medium]
If oa_tc6_phy_irq_unmask_hw() fails here, does the PHY interrupt stay
masked in hardware for good?
On every PHYINT event, oa_tc6_process_extended_status() sets
OA_TC6_INT_MASK0_PHY_INT_MASK through oa_tc6_phy_irq_mask_hw() before it
schedules this work:
if (tc6->phy_virq && FIELD_GET(OA_TC6_STATUS0_PHY_INT, value)) {
ret = oa_tc6_phy_irq_mask_hw(tc6);
...
else
schedule_work(&tc6->phy_irq_work);
}
This worker is the only place that clears the bit again. Either SPI
control transfer inside oa_tc6_phy_irq_unmask_hw() can fail, with a
spi_sync() error or with -EPROTO from the control reply echo check. In
that case the worker logs and returns. It does not retry or reschedule.
phy_irq_masked stays false, so genirq and phylib treat the IRQ as
enabled. oa_tc6_phy_irq_bus_sync_unlock() only runs on enable_irq(),
disable_irq(), request_irq() or free_irq(), none of which happen in
steady state. phydev->irq is valid, so phylib does not poll either.
Would later link and PLCA status changes then be lost until the
interface is rebound or goes through suspend/resume?
[Severity: Medium]
Can a PHY event that latches while PHYINTM is set be missed here?
handle_nested_irq() lets the PHY driver read and ack its status. After
that, this worker clears PHYINTM. It does not re-read STATUS0, and it
does not wake the SPI thread (int_flag plus wakeup) to look for a
PHYINT that became pending while the mask was set.
Take an event that arrives between the PHY driver's ack and the
INT_MASK0 write. It is only seen if the MAC-PHY re-asserts IRQn when an
already-set status bit is unmasked. PHYINT is only noticed from a footer
with EXST set. Otherwise the SPI thread runs only on IRQn or pending TX,
so on an idle link the event could stay unprocessed.
The commit message says:
PHYINT is level triggered and stays asserted until acked, so a no-op
reschedule on an already-pending work item can't lose or duplicate an
event.
Does this cover the MAC-PHY IRQn side, or only the PHY-side source?
phylib's resume path has the same dependency. mdio_bus_phy_resume()
does:
enable_irq(phydev->irq);
irq_wake_thread(phydev->irq, phydev);
irq_wake_thread() only does something when action->thread is set. That
is not the case for the nested-thread IRQ created with
irq_set_nested_thread() in oa_tc6_phy_irq_map(). So a PHY interrupt
postponed during suspend would only be delivered again if the hardware
re-signals after the unmask in oa_tc6_phy_irq_bus_sync_unlock().
Would it make sense to re-check STATUS0, or kick the SPI thread, after
unmasking?
> +}
[ ... ]
> @@ -624,6 +821,7 @@ static void oa_tc6_phy_exit(struct oa_tc6 *tc6)
> if (tc6->quirk_flags & OA_TC6_BROKEN_PHY)
> return;
>
> + cancel_work_sync(&tc6->phy_irq_work);
[Severity: Medium]
Can this hit the WARN_ON(!work->func) in __flush_work() when
OA_TC6_PHY_INT is not set?
The only INIT_WORK() for phy_irq_work is in oa_tc6_phy_irq_setup(). That
function is only reached from oa_tc6_mdiobus_register() when the quirk
is set:
if (tc6->quirk_flags & OA_TC6_PHY_INT) {
ret = oa_tc6_phy_irq_setup(tc6);
In this commit lan865x_probe() still does:
priv->tc6 = oa_tc6_init(spi, netdev, NULL);
so quirk_flags is 0 and phy_irq_work is still zeroed from
devm_kzalloc. Teardown then goes:
lan865x_remove()
oa_tc6_exit()
oa_tc6_phy_exit()
cancel_work_sync(&tc6->phy_irq_work)
__cancel_work_sync()
__flush_work()
WARN_ON(!work->func)
The same applies to the lan865x_probe() error paths after
oa_tc6_init(). It also applies to the phy_exit label inside
oa_tc6_init() itself, which is taken when oa_tc6_enable_data_transfer(),
oa_tc6_update_buffer_status_from_register() or
devm_request_threaded_irq() fails.
The next patch, "microchip: lan865x: enable PHY interrupt via virtual
IRQ", makes lan865x pass OA_TC6_PHY_INT, which removes the in-tree
trigger at the end of the series. But oa_tc6_init() still accepts
quirks == NULL, and this patch on its own breaks bisection.
Could INIT_WORK() be done unconditionally in oa_tc6_init(), next to
mutex_init(&tc6->phy_irq_lock)? Alternatively, cancel_work_sync() here
could be gated on OA_TC6_PHY_INT or tc6->phy_virq.
> phy_disconnect(tc6->phydev);
> oa_tc6_mdiobus_unregister(tc6);
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124124930.485323-1-parthiban.veerasooran%40microchip.com
next prev parent reply other threads:[~2026-11-25 13:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 12:49 [PATCH net-next RESEND v4 0/4] net: microchip_t1s: fix collision detection on PLCA status change Parthiban Veerasooran
2026-11-24 12:49 ` [PATCH net-next RESEND v4 1/4] net: phy: " Parthiban Veerasooran
2026-11-25 13:05 ` netdev-bot+sashiko
2026-11-24 12:49 ` [PATCH net-next RESEND v4 2/4] net: ethernet: oa_tc6: deliver the PHY interrupt to phylib Parthiban Veerasooran
2026-11-25 13:05 ` netdev-bot+sashiko [this message]
2026-11-24 12:49 ` [PATCH net-next RESEND v4 3/4] microchip: lan865x: enable PHY interrupt via virtual IRQ Parthiban Veerasooran
2026-11-25 13:05 ` netdev-bot+sashiko
2026-11-24 12:49 ` [PATCH net-next RESEND v4 4/4] net: phy: microchip_t1s: fix collision detection for LAN867X Rev.D0 Parthiban Veerasooran
2026-11-25 13:05 ` netdev-bot+sashiko
2026-11-24 12:52 ` [PATCH net-next RESEND v4 0/4] net: microchip_t1s: fix collision detection on PLCA status change netdev-bot+sinfo
2026-11-25 3:28 ` Parthiban.Veerasooran
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=179561192720.3135.12144826803876923892@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parthiban.veerasooran@microchip.com \
/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