On Mon, Aug 29, 2022 at 09:45:53AM +0300, Golani, Mitulkumar Ajitkumar wrote: > Hi Imre, > > > [...] > > Still not sure what's going. Both i915_pci_probe() and > > i915_pci_remove()->i915_driver_remove() is called with a runtime PM > > reference - taken at local_pci_probe() and pci_device_remove() - and so the > > device should be runtime resumed at those points. > > > > Yes reference is being taken at local_pci_probe() and pci_device_remove() but > During i915_selftest@perf, it is loading and unloading i915_pci_probe() and > i915_pci_remove(), here pci_device_remove() is not being called, that's why > runtime PM reference is not present during i915_driver_remove(). Ok, that explains it. Taking an actual RPM reference unconditionally in i915_driver_remove() should fix this (instead of the disable/enable_rpm_wakeref_asserts() calls there): wakeref = intel_runtime_pm_get(); ... intel_runtime_pm_put(wakeref); While at it the same change should be applied in i915_driver_release() as well for consistency. > > > > > > disable_rpm_wakeref_asserts(rpm); > > > > > > > > > > > > intel_opregion_notify_adapter(dev_priv, PCI_D0); > > > > > > -- > > > > > > 2.25.1 > > > > > >