Guilherme G. Piccoli
2e557c8ca2
drm/amdgpu/fence: Fix oops due to non-matching drm_sched init/fini
...
commit 5ad7bbf3dba5c4a684338df1f285080f2588b535 upstream.
Currently amdgpu calls drm_sched_fini() from the fence driver sw fini
routine - such function is expected to be called only after the
respective init function - drm_sched_init() - was executed successfully.
Happens that we faced a driver probe failure in the Steam Deck
recently, and the function drm_sched_fini() was called even without
its counter-part had been previously called, causing the following oops:
amdgpu: probe of 0000:04:00.0 failed with error -110
BUG: kernel NULL pointer dereference, address: 0000000000000090
PGD 0 P4D 0
Oops: 0002 [#1 ] PREEMPT SMP NOPTI
CPU: 0 PID: 609 Comm: systemd-udevd Not tainted 6.2.0-rc3-gpiccoli #338
Hardware name: Valve Jupiter/Jupiter, BIOS F7A0113 11/04/2022
RIP: 0010:drm_sched_fini+0x84/0xa0 [gpu_sched]
[...]
Call Trace:
<TASK>
amdgpu_fence_driver_sw_fini+0xc8/0xd0 [amdgpu]
amdgpu_device_fini_sw+0x2b/0x3b0 [amdgpu]
amdgpu_driver_release_kms+0x16/0x30 [amdgpu]
devm_drm_dev_init_release+0x49/0x70
[...]
To prevent that, check if the drm_sched was properly initialized for a
given ring before calling its fini counter-part.
Notice ideally we'd use sched.ready for that; such field is set as the latest
thing on drm_sched_init(). But amdgpu seems to "override" the meaning of such
field - in the above oops for example, it was a GFX ring causing the crash, and
the sched.ready field was set to true in the ring init routine, regardless of
the state of the DRM scheduler. Hence, we ended-up using sched.ops as per
Christian's suggestion [0], and also removed the no_scheduler check [1].
[0] https://lore.kernel.org/amd-gfx/984ee981-2906-0eaf-ccec-9f80975cb136@amd.com/
[1] https://lore.kernel.org/amd-gfx/cd0e2994-f85f-d837-609f-7056d5fb7231@amd.com/
Fixes: 067f44c8b4 ("drm/amdgpu: avoid over-handle of fence driver fini in s3 test (v2)")
Suggested-by: Christian König <christian.koenig@amd.com >
Cc: Guchun Chen <guchun.chen@amd.com >
Cc: Luben Tuikov <luben.tuikov@amd.com >
Cc: Mario Limonciello <mario.limonciello@amd.com >
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com >
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-02-14 19:18:04 +01:00
..
2021-03-10 00:01:34 -05:00
2021-06-01 22:55:39 -04:00
2021-04-09 16:46:26 -04:00
2021-07-23 10:08:00 -04:00
2022-10-05 10:39:38 +02:00
2022-12-02 17:41:12 +01:00
2021-08-24 15:35:33 -04:00
2021-03-23 22:59:28 -04:00
2021-05-10 18:06:42 -04:00
2021-08-24 15:35:33 -04:00
2021-08-24 15:35:33 -04:00
2021-08-11 17:19:54 -04:00
2021-08-11 17:19:54 -04:00
2022-12-31 13:14:14 +01:00
2022-07-07 17:53:23 +02:00
2021-09-16 09:56:24 -04:00
2021-05-22 07:17:05 +02:00
2021-04-09 16:50:34 -04:00
2021-08-30 14:59:33 -04:00
2021-08-06 11:33:50 -04:00
2021-04-09 16:45:12 -04:00
2022-12-31 13:14:14 +01:00
2021-11-18 19:16:27 +01:00
2021-11-18 19:16:27 +01:00
2022-12-08 11:28:38 +01:00
2022-06-09 10:23:24 +02:00
2021-06-02 17:52:38 -04:00
2021-05-13 14:09:12 -04:00
2022-05-12 12:30:21 +02:00
2021-11-06 14:13:31 +01:00
2023-01-24 07:22:43 +01:00
2022-01-05 12:42:38 +01:00
2021-06-18 17:14:01 -04:00
2022-10-26 12:34:23 +02:00
2021-04-09 16:36:40 -04:00
2022-01-11 15:35:17 +01:00
2021-05-26 20:56:23 +02:00
2023-01-24 07:22:48 +01:00
2021-07-08 15:18:14 -04:00
2021-07-01 00:24:41 -04:00
2022-08-17 14:22:54 +02:00
2021-08-31 14:20:40 -04:00
2021-05-05 09:26:53 +02:00
2023-02-14 19:18:04 +01:00
2021-07-01 00:24:40 -04:00
2021-06-07 14:57:32 -04:00
2021-08-24 15:35:41 -04:00
2021-06-18 17:12:47 -04:00
2022-12-02 17:41:12 +01:00
2023-02-01 08:27:22 +01:00
2021-04-09 16:51:22 -04:00
2021-06-04 16:03:24 -04:00
2021-09-16 09:56:24 -04:00
2021-06-04 16:03:12 -04:00
2021-08-30 14:59:33 -04:00
2021-08-16 15:35:55 -04:00
2021-05-10 18:06:43 -04:00
2021-08-11 17:19:54 -04:00
2021-08-16 15:16:58 -04:00
2021-06-10 11:28:09 +10:00
2021-12-01 09:04:42 +01:00
2021-03-23 23:30:23 -04:00
2022-07-07 17:53:23 +02:00
2021-08-10 20:00:44 +02:00
2021-08-16 15:16:58 -04:00
2021-08-16 15:16:58 -04:00
2021-08-25 18:15:10 -04:00
2023-01-24 07:22:43 +01:00
2021-08-24 15:36:18 -04:00
2021-08-24 15:36:18 -04:00
2021-08-16 15:35:55 -04:00
2021-05-10 18:11:44 -04:00
2021-07-01 00:05:41 -04:00
2021-07-01 00:05:41 -04:00
2021-05-19 22:30:03 -04:00
2021-08-16 15:35:55 -04:00
2021-07-23 10:09:40 -04:00
2023-01-24 07:22:48 +01:00
2022-05-12 12:30:21 +02:00
2021-08-24 15:35:25 -04:00
2021-08-24 15:35:25 -04:00
2021-04-15 16:32:45 -04:00
2021-06-21 15:24:29 +02:00
2022-09-20 12:39:45 +02:00
2021-08-18 18:22:53 -04:00
2021-08-18 18:22:53 -04:00
2021-09-16 09:56:24 -04:00
2021-09-16 09:56:24 -04:00
2021-08-16 15:35:55 -04:00
2021-08-24 15:36:18 -04:00
2021-08-02 16:53:17 -04:00
2021-04-09 16:46:26 -04:00
2021-04-09 16:46:32 -04:00
2021-09-14 16:21:15 -04:00
2021-08-16 15:16:58 -04:00
2021-07-23 10:07:59 -04:00
2021-08-16 15:35:55 -04:00
2021-03-05 15:12:23 -05:00
2021-08-18 18:22:53 -04:00
2021-01-13 23:58:14 -05:00
2021-04-28 23:35:49 -04:00
2021-06-22 11:05:04 +02:00
2021-04-09 16:45:12 -04:00
2021-07-03 11:13:22 -07:00
2022-05-12 12:30:21 +02:00
2022-05-12 12:30:21 +02:00
2022-06-09 10:22:35 +02:00
2021-08-16 15:18:04 -04:00
2021-08-16 15:35:55 -04:00
2021-06-18 17:11:40 -04:00
2021-08-25 18:15:10 -04:00
2021-08-25 18:15:10 -04:00
2022-12-08 11:28:43 +01:00
2021-06-18 17:14:01 -04:00
2022-11-10 18:15:34 +01:00
2022-12-31 13:14:41 +01:00
2022-03-08 19:12:37 +01:00
2021-08-05 21:17:58 -04:00
2021-06-04 16:02:38 -04:00
2021-06-15 17:25:42 -04:00
2022-11-10 18:15:34 +01:00
2021-08-24 15:36:50 -04:00
2021-08-30 14:59:33 -04:00
2022-09-15 11:30:01 +02:00
2021-07-23 10:07:59 -04:00
2022-09-05 10:30:11 +02:00
2021-05-19 22:29:58 -04:00
2021-06-30 00:18:22 -04:00
2021-05-19 22:41:19 -04:00
2021-06-01 22:55:39 -04:00
2021-06-01 22:55:39 -04:00
2021-08-24 15:35:25 -04:00
2021-04-27 18:43:42 -04:00
2021-05-19 22:40:09 -04:00
2021-05-19 23:50:27 -04:00
2021-05-21 10:32:14 -04:00
2022-07-12 16:35:06 +02:00
2021-07-23 10:08:00 -04:00
2021-05-19 23:50:27 -04:00
2021-05-21 10:32:15 -04:00
2021-04-09 16:36:40 -04:00
2021-04-09 16:36:40 -04:00
2021-04-09 16:36:40 -04:00
2021-05-19 22:44:19 -04:00
2021-02-24 09:28:55 -05:00
2021-08-05 21:17:59 -04:00
2021-08-05 21:17:59 -04:00
2021-08-05 21:17:59 -04:00
2022-09-15 11:30:01 +02:00
2021-08-09 15:44:47 -04:00
2021-04-23 17:15:21 -04:00
2021-04-20 21:35:45 -04:00
2021-04-09 16:51:22 -04:00
2021-12-01 09:04:56 +01:00
2021-12-22 09:32:49 +01:00
2021-08-18 18:22:46 -04:00
2021-12-22 09:32:49 +01:00
2021-12-22 09:32:49 +01:00
2021-11-18 19:16:43 +01:00
2022-04-20 09:34:14 +02:00
2022-04-20 09:34:14 +02:00
2022-09-05 10:30:11 +02:00
2022-09-05 10:30:11 +02:00
2021-05-10 18:06:43 -04:00
2021-05-10 18:06:43 -04:00
2021-06-30 00:18:23 -04:00
2021-05-19 23:50:27 -04:00
2021-04-09 16:44:56 -04:00
2021-05-21 10:32:11 -04:00
2021-05-21 10:32:11 -04:00
2021-03-23 22:53:34 -04:00
2021-06-04 16:03:17 -04:00
2021-02-18 16:43:09 -05:00
2021-08-24 15:36:18 -04:00
2021-08-24 15:36:18 -04:00
2021-08-24 15:36:18 -04:00
2021-04-09 16:44:56 -04:00
2022-09-15 11:30:02 +02:00
2021-04-09 16:51:19 -04:00
2021-12-22 09:32:49 +01:00
2021-04-09 16:51:19 -04:00
2021-12-22 09:32:49 +01:00
2021-12-22 09:32:49 +01:00
2021-12-22 09:32:49 +01:00
2021-04-09 16:51:19 -04:00
2021-08-18 18:22:25 -04:00
2021-08-30 14:59:33 -04:00
2021-08-30 14:59:33 -04:00
2021-08-16 15:17:57 -04:00
2021-08-16 15:17:57 -04:00
2021-06-08 12:24:26 -04:00
2022-09-23 14:15:49 +02:00
2022-09-23 14:15:49 +02:00
2021-06-04 16:03:09 -04:00
2022-09-23 14:15:49 +02:00
2021-04-09 16:51:04 -04:00
2022-07-12 16:35:06 +02:00
2021-07-23 10:08:00 -04:00
2022-04-20 09:34:14 +02:00
2021-06-11 16:05:33 -04:00
2021-07-23 10:08:00 -04:00
2021-08-16 15:18:04 -04:00
2021-07-23 10:08:01 -04:00
2021-07-23 10:08:01 -04:00
2021-08-16 15:18:04 -04:00
2021-08-16 15:18:04 -04:00
2021-07-28 22:15:44 -04:00
2021-03-23 22:51:54 -04:00
2021-05-21 10:32:18 -04:00
2021-04-09 16:44:56 -04:00
2022-12-14 11:37:20 +01:00
2021-04-20 21:45:17 -04:00
2021-03-23 22:55:31 -04:00
2022-06-09 10:22:34 +02:00
2022-06-09 10:22:34 +02:00
2021-05-21 10:32:14 -04:00
2021-05-19 23:50:27 -04:00
2022-07-12 16:35:06 +02:00
2021-07-08 15:12:51 -04:00
2021-02-09 15:28:36 -05:00
2021-02-09 15:28:21 -05:00
2021-06-30 00:18:22 -04:00
2021-05-21 10:32:20 -04:00
2021-03-23 22:52:38 -04:00
2021-07-23 10:07:59 -04:00
2022-10-29 10:12:54 +02:00
2021-03-23 22:59:50 -04:00
2021-04-23 17:15:33 -04:00
2021-03-23 23:27:41 -04:00
2021-08-18 18:22:24 -04:00
2021-05-19 23:50:27 -04:00
2021-04-09 16:51:11 -04:00
2021-04-09 16:51:11 -04:00
2021-08-05 21:17:58 -04:00
2021-08-05 21:17:58 -04:00
2021-06-18 17:11:40 -04:00
2021-04-09 16:51:11 -04:00
2021-11-18 19:16:24 +01:00
2021-11-18 19:16:24 +01:00
2021-11-18 19:16:24 +01:00
2021-11-18 19:17:12 +01:00
2021-11-18 19:16:24 +01:00
2021-11-18 19:16:24 +01:00
2021-11-18 19:16:24 +01:00
2021-11-18 19:16:24 +01:00
2022-01-05 12:42:38 +01:00
2021-11-18 19:16:11 +01:00
2021-11-18 19:16:11 +01:00
2021-03-23 22:53:17 -04:00
2022-07-12 16:35:04 +02:00
2022-09-23 14:15:49 +02:00
2022-09-23 14:15:49 +02:00
2022-07-12 16:35:06 +02:00
2021-06-04 16:03:06 -04:00