> Is this check in the right place, and is running the right condition > to gate it on?
Right, reproduced: removing a program that needs 3K buffers fails after a resume with the interface down. In v7 the buffer size is only checked when adding or replacing a program, and a detached device only gets the software state updated. Adding a program is still checked against rings that a resume has just allocated, i.e. against 2K buffers, like on a device that has never been opened; computing the size from the MTU as igb_set_rx_buffer_len() does can follow separately.
> Does this guard cover a device that PCI error recovery has detached?
The double open is fixed in v7 by the same change. The XSK state during PCI error recovery is pre-existing and will be fixed separately, with the other XSK queue issues.
> This is a pre-existing issue, but this guard also requires > !netif_device_present(). Because of that, it doesn't catch the state left > when the igb_open() call at the end of igb_xdp_setup() fails:
Pre-existing and not specific to resume; it needs the program change to be undone as well, so it will be fixed separately.
> The commit message gives the cause as "__igb_resume() rebuilds the queue > counts and the rings without RTNL". Does pm_runtime_get_sync() also > serialise against system resume?
No. The caller you name runs on system_freezable_wq since fece8420e76f ("xsk: freeze deferred pool teardown without blocking unregister"); the system resume path rebuilding the rings without RTNL is pre-existing and not addressed by this series.
> The return value of pm_runtime_get_sync() is ignored because, after a > failed resume, the callees "find the device down". Does that state stay > the same for the rest of igb_xdp()?
It needs a resume that fails with a transient error, followed by another resume that doesn't hold RTNL while igb_xdp() runs. I've left it, as closing it would mean taking a lock in the resume path, which is what ac8c58f5b535 removed.
> This isn't a bug introduced by this patch, but igb_xdp() is the only ndo > that this patch resumes. Do igb_change_mtu() and > igb_set_features()->igb_reinit_locked()/igb_reset() have the same problem > on a runtime suspended device?
igb detaches the netdev while runtime suspended, and dev_set_mtu() refuses a detached device with -ENODEV before calling ndo_change_mtu (checked: "ip link set mtu" fails while suspended). igb_set_features() only acts on changes of NTUPLE, RXALL and VLAN Rx stripping, which only come through ethtool, and ethtool resumes the device first. pw-bot: cr