From: sashiko-bot@kernel.org
To: "François-Xavier Gsell" <fxgsell@gmail.com>,
intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net 1/2] igc: restore hw_addr on resume after a failed register read
Date: Sun, 06 Dec 2026 11:37:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-252381@kernel.org> (raw)
In-Reply-To: <20261205113710.1833153-2-fxgsell@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] igc: __igc_resume() re-attaches dead device after igc_rd32()
clears hw_addr
- [Medium] igc: __igc_resume() restores hw_addr before
pci_enable_device_mem()
- [Low] igc: unmarked store to hw_addr in __igc_resume() races with
READ_ONCE()
--
commit 853967ef3eff4cdb85aad595eb8ba4400f22bff5
Author: François-Xavier Gsell <fxgsell@gmail.com>
igc: restore hw_addr on resume after a failed register read
This commit restores hw->hw_addr from adapter->io_addr in __igc_resume()
after checking pci_device_is_present() so register accesses can resume
after an earlier failed read cleared hw->hw_addr.
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index 9d93b306cb815..cd24cb65fe007 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -7585,6 +7585,10 @@ static int __igc_resume(struct device *dev, bool rpm)
>
> if (!pci_device_is_present(pdev))
> return -ENODEV;
> +
> + /* A failed register read may have cleared hw_addr. */
> + hw->hw_addr = adapter->io_addr;
> +
> err = pci_enable_device_mem(pdev);
> if (err) {
> netdev_err(netdev, "Cannot enable PCI device from suspend\n");
[Severity: Medium]
Can __igc_resume() still re-attach a dead device if MMIO reads continue to
return all-ones during resume?
If MMIO fails during igc_reset(), igc_rd32() clears hw->hw_addr to NULL and
calls netif_device_detach(), which is a no-op because __igc_shutdown()
already detached the netdev. __igc_resume() then still runs __igc_open()
and calls netif_device_attach().
Once hw->hw_addr is NULL, later igc_rd32() calls return early on
IGC_REMOVED(hw_addr) and never call netif_device_detach() again, leaving
the interface attached with bogus link state and repeated Tx hangs.
Checking IGC_REMOVED(READ_ONCE(hw->hw_addr)) after igc_reset() and aborting
before __igc_open() and netif_device_attach() would avoid this.
[Severity: Medium]
Should hw->hw_addr be restored only after pci_enable_device_mem() and
igc_init_interrupt_scheme() succeed?
Unlike ixgbe, igc implements igc_runtime_resume() while userspace is active.
If PCI_COMMAND_MEMORY was cleared before suspend, pci_restore_state() leaves
MMIO disabled until pci_enable_device_mem() runs, allowing a concurrent PTP
read to see all-ones and clear hw->hw_addr back to NULL before igc_reset():
CPU0 (igc_runtime_resume) CPU1 (PTP clock_gettime)
pci_restore_state()
/* PCI_COMMAND_MEMORY clear */
hw->hw_addr = adapter->io_addr
igc_ptp_gettimex64_i225()
rd32(IGC_SYSTIML)
readl() -> ~0 <-- MMIO still off
hw->hw_addr = NULL
pci_enable_device_mem()
igc_reset() /* hw_addr is NULL */
In addition, if pci_enable_device_mem() or igc_init_interrupt_scheme()
fails, __igc_resume() returns an error with hw->hw_addr left non-NULL on an
unenabled device. Restoring hw->hw_addr right before igc_reset(), matching
igc_io_slot_reset(), avoids both issues.
[Severity: Low]
Does this plain store to hw->hw_addr introduce a data race with
READ_ONCE(hw->hw_addr) in igc_rd32() and wr32()?
During igc_runtime_resume(), PTP callbacks such as igc_ptp_gettimex64_i225()
call rd32() concurrently without shared locking, which can trigger KCSAN
reports under CONFIG_KCSAN_STRICT=y. Using WRITE_ONCE(hw->hw_addr,
adapter->io_addr) pairs with the existing READ_ONCE() readers.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205113710.1833153-1-fxgsell@gmail.com?part=1
next prev parent reply other threads:[~2026-12-06 11:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 11:37 [PATCH iwl-net 0/2] igc/igb: recover register access on resume François-Xavier Gsell
2026-12-05 11:37 ` [PATCH iwl-net 1/2] igc: restore hw_addr on resume after a failed register read François-Xavier Gsell
2026-12-06 11:37 ` sashiko-bot [this message]
2026-12-05 11:37 ` [PATCH iwl-net 2/2] igb: " François-Xavier Gsell
2026-12-06 11:37 ` sashiko-bot
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=sashiko-outbox-252381@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fxgsell@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=sashiko-reviews@lists.linux.dev \
/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