Skip to content

Commit 36855e1

Browse files
jannaujohn-cabaj
authored andcommitted
fixup! rust: drm: sched: Add GPU scheduler abstraction
kernel behavior change: zero drm_gpu_scheduler.sched_rq Signed-off-by: Janne Grunau <j@jannau.net> (cherry picked from commit d6f7d91 https://github.com/AsahiLinux/linux) Signed-off-by: John Cabaj <john.cabaj@canonical.com>
1 parent f6a111c commit 36855e1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rust/kernel/drm/sched.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ impl<T: JobImpl> Scheduler<T> {
325325
) -> Result<Scheduler<T>> {
326326
let mut sched: UniqueArc<MaybeUninit<SchedulerInner<T>>> = UniqueArc::try_new_uninit()?;
327327

328+
// SAFETY: zero sched->sched_rq as drm_sched_init() uses it to exit early withoput initialisation
329+
// TODO: allocate sched zzeroed instead
330+
unsafe {
331+
(*sched.as_mut_ptr()).sched.sched_rq = core::ptr::null_mut();
332+
};
333+
328334
// SAFETY: The drm_sched pointer is valid and pinned as it was just allocated above.
329335
to_result(unsafe {
330336
bindings::drm_sched_init(

0 commit comments

Comments
 (0)