Bug 262734 - LinuxKPI: [patch] call dev_pm_ops::prepare() upon suspend to prevent Xorg from crashing after resume
Summary: LinuxKPI: [patch] call dev_pm_ops::prepare() upon suspend to prevent Xorg fro...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2022-03-23 09:48 UTC by Taku YAMAMOTO
Modified: 2022-10-17 12:34 UTC (History)
0 users

See Also:


Attachments
Call dev_pm_ops::prepare() from linux_pci_suspend() (3.12 KB, patch)
2022-03-23 09:48 UTC, Taku YAMAMOTO
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Taku YAMAMOTO 2022-03-23 09:48:17 UTC
Created attachment 232653 [details]
Call dev_pm_ops::prepare() from linux_pci_suspend()

The dev_pm_ops' prepare() method should be called prior to its suspend() method,
according to the Linux documentation:
https://www.kernel.org/doc/html/v5.4/driver-api/pm/types.html#c.dev_pm_ops

Without doing so, at least on my X1 Carbon 6th gen., Xorg usually (but not
always) crashes after resume.

I also suspect that the lacking of calling prepare() contributes to the hang
on resume, infrequent but not rare, albeit no evidence.

I have a couple of variants to call prepare() method at the time:

* call prepare() via power_suspend_early eventhandler:
  stucks inside switch_to_kernel_context_sync() once per several trials.
* (patch attached) call prepare() directly from linux_pci_suspend():
  survives at least 10 trials, no failures yet.
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:34:43 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>