Issue #3480 has been reported by tuxillo.

----------------------------------------
Bug #3480: radeon: resume and GPU reset panic on a NULL pointer in 
radeon_wb_init()
http://bugs.dragonflybsd.org/issues/3480

* Author: tuxillo
* Status: New
* Priority: Normal
* Target version: 6.6
* Start date: 2026-11-23
----------------------------------------
As of master 64a78aecd3, radeon panics every time it resumes the GPU, after a 
suspend or a GPU reset. On a Radeon HD 5450 (Cedar), with the attached devsr.ko 
calling DEVICE_SUSPEND() and then DEVICE_RESUME() on drm0:

<pre>
devsr: resuming drm0
Fatal trap 12: page fault while in kernel mode
fault virtual address   = 0x0
radeon_wb_init.cold() at radeon_wb_init.cold 0xffffffff832855b2
evergreen_resume() at evergreen_resume+0xd8 0xffffffff831c8a88
</pre>

radeon_wb_init() (sys/dev/drm/radeon/radeon_device.c) starts with @void *wb_ptr 
= NULL;@ and sets @wb_ptr = &rdev->wb.wb@ only when it creates the writeback 
buffer, on the first call. It then always clears the page with @memset(*(void 
**)wb_ptr, 0, RADEON_GPU_PAGE_SIZE)@. Every asic's startup function calls 
radeon_wb_init() and every resume function calls the startup function, so each 
later call, from radeon_resume_kms() or radeon_gpu_reset(), reads through NULL. 
Linux clears @rdev->wb.wb@ directly. The memset came with c59a5c484f.

The attached patch sets wb_ptr before the test, so later calls clear the page 
the first call mapped.

TESTING: drm.ko and radeon.ko built from master 64a78aecd3, before and after 
the patch, on a Coffee Lake desktop with the Cedar. radeon was loaded from the 
text console with @sysctl kern.consmute=1@, so that #3479 doesn't get in the 
way, then @kldload devsr.ko; sysctl debug.devsr=drm0@. Before, it panicked as 
above on the first round. After, 5 of 5 rounds resumed: each time the GART was 
enabled again, the ring and IB tests on rings 0, 3 and 5 passed and UVD came 
back, with no errors in dmesg. I didn't test the GPU reset path directly. It 
reaches radeon_wb_init() through the same evergreen_resume(), and I hit this 
panic there once after a ring 0 lockup.

---Files--------------------------------
0001-radeon-don-t-dereference-NULL-in-radeon_wb_init-on-r.patch (1.42 KB)
Makefile (73 Bytes)
devsr.c (2.28 KB)


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://bugs.dragonflybsd.org/my/account

Reply via email to