Subject: igc driver causes suspend to fail if powersave is enabled

From: Srikar Dronamraju <[email-masked]>
Date: Wed, 15 Mar 2023 12:50:19 +0530

Hi,

On Lenovo ThinkPad P15 Gen 2i with I225-LM Ethernet card running Fedora 37
kernel 6.1.13-200.fc37.x86_64, running powertop --auto-tune causes suspend
and reboot to fail. Once suspend fails, networking stops working even for
wireless. Infact as a normal user, I cant even start a sudo session after
trying to suspend.

Reboot/shutdown fails since Network-Manager cant be killed. (More below)
The only option left is for the system to be hard-reboot.

I finally found that the problem was because enabling auto or powersave on
ethernet card was causing this issue. i.e

echo 'auto' > '/sys/bus/pci/devices/0000:0b:00.0/power/control'

Pls do note, I was not using ethernet, I was just using wireless even before
suspend.

lspci -v reports
0b:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-LM (rev 03)
	Subsystem: Lenovo Device 22d8
	Flags: fast devsel, IRQ 16, IOMMU group 17
	Memory at be300000 (32-bit, non-prefetchable) [size=1M]
	Memory at be400000 (32-bit, non-prefetchable) [size=16K]
	Capabilities: [40] Power Management version 3
	Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
	Capabilities: [70] MSI-X: Enable- Count=5 Masked-
	Capabilities: [a0] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [140] Device Serial Number 88-a4-c2-ff-ff-5f-09-88
	Capabilities: [1c0] Latency Tolerance Reporting
	Capabilities: [1f0] Precision Time Measurement
	Capabilities: [1e0] L1 PM Substates
	Kernel modules: igc

When suspend fails, we see messages like this

kernel: Freezing of tasks failed after 20.001 seconds (3 tasks refusing to freeze, wq_busy=0):
kernel: task:NetworkManager  state:D stack:0     pid:2014  ppid:1      flags:0x00004006
kernel: Call Trace:
kernel:  <TASK>
kernel:  __schedule+0x35f/0x1360
kernel:  ? asm_sysvec_reschedule_ipi+0x16/0x20
kernel:  schedule+0x5d/0xe0
kernel:  schedule_preempt_disabled+0x14/0x30
kernel:  __mutex_lock.constprop.0+0x390/0x6e0
kernel:  ? __cond_resched+0x1c/0x30
kernel:  igc_resume+0xfc/0x1d0 [igc]
kernel:  ? pci_pm_restore_noirq+0xc0/0xc0
kernel:  __rpm_callback+0x41/0x170
kernel:  rpm_callback+0x35/0x70
kernel:  ? pci_pm_restore_noirq+0xc0/0xc0
kernel:  rpm_resume+0x5bb/0x800
kernel:  __pm_runtime_resume+0x47/0x80
kernel:  dev_ethtool+0x124/0x2eb0
kernel:  ? avc_has_extended_perms+0x22a/0x520
kernel:  ? inet_ioctl+0xd8/0x1e0
kernel:  dev_ioctl+0x156/0x520
kernel:  sock_do_ioctl+0xda/0x120
kernel:  sock_ioctl+0xed/0x330
kernel:  ? security_file_ioctl+0x39/0x60
kernel:  __x64_sys_ioctl+0x8d/0xd0
kernel:  do_syscall_64+0x58/0x80
kernel:  ? __x64_sys_ioctl+0xa8/0xd0
kernel:  ? syscall_exit_to_user_mode+0x17/0x40
kernel:  ? do_syscall_64+0x67/0x80
kernel:  ? do_syscall_64+0x67/0x80
kernel:  ? do_syscall_64+0x67/0x80
kernel:  ? do_syscall_64+0x67/0x80
kernel:  entry_SYSCALL_64_after_hwframe+0x63/0xcd
kernel: RIP: 0033:0x7ff964b93d6f
kernel: RSP: 002b:00007ffc96c6f540 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
kernel: RAX: ffffffffffffffda RBX: 00005608c0ba8040 RCX: 00007ff964b93d6f
kernel: RDX: 00007ffc96c6f640 RSI: 0000000000008946 RDI: 000000000000001e
kernel: RBP: 00007ffc96c6f7c0 R08: 0000000000000000 R09: 0000000000000000
kernel: R10: 0000000000000021 R11: 0000000000000246 R12: 0000000000000000
kernel: R13: 00007ffc96c6f640 R14: 00007ffc96c6f620 R15: 00007ffc96c6f620
kernel:  </TASK>

We have seen similar problems even with people running other distros like
Arch Linux and RHEL 8 (which is 4.18 based)distros. So this is not distro
specific or kernel specific too.

Even installing tlp package from https://linrunner.de/tlp/index.html causes
similar issues.

-- 
Thanks and Regards
Srikar Dronamraju