Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Apr 2022 07:44:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        x11@FreeBSD.org
Subject:   [Bug 254472] graphics/drm-fbsd13-kmod Xorg crash on resume
Message-ID:  <bug-254472-7141-hUHEVCyjpD@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-254472-7141@https.bugs.freebsd.org/bugzilla/>
References:  <bug-254472-7141@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D254472

--- Comment #6 from Maurizio <maurizio1018@gmail.com> ---
I have found a workaround for this bug, an i915kms kernel driver patch.
I have tested  the patch on a Lenovo Thinkpad T450.

NOTICE: I don=E2=80=99t know if this  patch can damage your laptop, if it h=
appens it is
not my responsibility.

The patch changes only one line of code in the source file
drm-kmod-drm_v5.4.144_6/drivers/gpu/drm/i915/i915_gem.c in the function
wait_for_timelines:
I have replaced the line:
timeout =3D i915_request_wait(rq, wait, timeout);
with:=20=20=20=20=20=20
    timeout =3D i915_request_wait(rq, wait, MAX_SCHEDULE_TIMEOUT);

the rest of the patch lines are only printf messages to display the time sp=
ent
in the function. The i915_request_wait function never timeouts. I have warn=
ed
you with the above notice because my laptop can take more than 4 seconds to
resume.

Before applying the patch you must be able to build the
graphics/drm-fbsd13-kmod port from source.

Building the patched i915kms driver:
# cd /usr/ports/graphics/drm-fbsd13-kmod/
# make clean
# make config
select =E2=80=9CBuild with debugging support=E2=80=9D
# mkdir files
Copy the patch file patch-drivers_gpu_drm_i915_i915__gem.c in the files
directory and verify it
# ls /usr/ports/graphics/drm-fbsd13-kmod/files
patch-drivers_gpu_drm_i915_i915__gem.c
# make build deinstall reinstall
should compile and install the patched code without errors. Reboot for runn=
ing
the new driver.

How this patch works on my laptop in the suspend/resume cycle.
When suspend/resume works fast, I have this output at the console:

vgapci0: child drmn0 requested pci_enable_io

Start of i915_gem_wait_for_idle()
flags=3D12 (locked), timeout=3D200

Calling wait_for_timelines()
flags=3D12 (locked), timeout=3D2147483647 (forever)

End of i915_gem_wait_for_idle() in 0 tick(s)
rtsx0: Resume

The i915_gem_wait_for_idle function takes less than one ms (tick =3D ms).=
=20=20

When the suspend/resume cycle is slow, I have an output similar to:
vgapci0: child drmn0 requested pci_enable_io

Start of i915_gem_wait_for_idle()
flags=3D12 (locked), timeout=3D200

Calling wait_for_timelines()
drmn0: Resetting rcs0 for hang on rcs0
flags=3D12 (locked), timeout=3D2147483647 (forever)

End of i915_gem_wait_for_idle() in 4138 tick(s)

Start of i915_gem_wait_for_idle()
flags=3D12 (locked), timeout=3D200

Calling wait_for_timelines()
flags=3D12 (locked), timeout=3D2147483647 (forever)

End of i915_gem_wait_for_idle() in 0 tick(s)
rtsx0: Resume

The message =E2=80=9Cdrmn0: Resetting rcs0 for hang on rcs0=E2=80=9D is wri=
tten to the console
and the i915_gem_wait_for_idle function takes more than 4 seconds to finish.
The i915_gem_wait_for_idle is called again without errors and the laptop
resumes.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-254472-7141-hUHEVCyjpD>