Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] e1000e: data race on adapter->flags in e1000_watchdog_task()
  [1]
--

commit a2887ea1ca15cc20dbf05390436bdded73c4d7b5
Author: Craig I. Hagan <[email protected]>

e1000e: fix link stuck at 10 Mb/s after DMoff exit

This commit records the PCIM_STATE (DMoff) bit in the link status change
interrupt handler so e1000_watchdog_task() still enters the DMoff wait and
full-reset path if DMoff ends before the watchdog runs.

> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c 
> b/drivers/net/ethernet/intel/e1000e/netdev.c
> index c3e944ee4cf9a..47a6964fa7df0 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -1785,6 +1785,7 @@ static irqreturn_t e1000_intr_msi(int __always_unused 
> irq, void *data)
>       /* read ICR disables interrupts using IAM */
>       if (icr & E1000_ICR_LSC) {
>               hw->mac.get_link_status = true;
> +             hw->mac.dmoff_at_lsc = er32(STATUS) & E1000_STATUS_PCIM_STATE;
>               /* ICH8 workaround-- Call gig speed drop workaround on cable
>                * disconnect (LSC) before accessing any PHY registers
>                */

[Severity: High]
This problem wasn't introduced by this patch, but can unlocked updates to
adapter->flags in e1000_intr_msi() and e1000_watchdog_task() cause a data
race [1]?

e1000_watchdog_task() runs in process context with interrupts enabled and
calls e1000e_enable_receives(), which clears FLAG_RESTART_NOW with a
non-atomic read-modify-write while the LSC interrupt handler sets
FLAG_RESTART_NOW in adapter->flags:

drivers/net/ethernet/intel/e1000e/netdev.c:e1000e_enable_receives() {
        if ((adapter->flags & FLAG_RX_NEEDS_RESTART) &&
            (adapter->flags & FLAG_RESTART_NOW)) {
                ...
                ew32(RCTL, rctl | E1000_RCTL_EN);
                adapter->flags &= ~FLAG_RESTART_NOW;
        }
}

CPU0 (kworker)                    CPU1 (<hardirq>)
e1000_watchdog_task()
  e1000e_enable_receives()
    tmp = adapter->flags
                                  e1000_intr_msi()
                                    adapter->flags |= FLAG_RESTART_NOW
    adapter->flags = tmp & ~FLAG_RESTART_NOW  <-- overwrites interrupt update

Losing the flag update skips the needed device reset or Rx restart and can
stall traffic.

[1] https://sashiko.dev/#/bug/linux-63b75aa0-7ff8-4f26-8fdb-d0ecb891cbfa

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to