amdgpu_gfx_kfd_sch_ctrl(9)
π amdgpu_gfx_kfd_sch_ctrl β a whole kernel API manual, but make it cute
okay so bestie, welcome to amdgpu_gfx_kfd_sch_ctrl(9), a real page from the Kernel API Manual. yes it's a kernel function. yes it's about schedulers. no you don't have to be scared. let's go π«Ά
β¨ NAME β¨
amdgpu_gfx_kfd_sch_ctrl β no cap, this is the function that controls the KFD scheduler from the KGD (that's the Graphics Driver, iykyk) π
π¦ SYNOPSIS π¦
void amdgpu_gfx_kfd_sch_ctrl (struct amdgpu_device *adev , u32 idx ,
bool enable );
literally the whole signature. three args, one void return, zero drama (until the NOTE section, we'll get there) β¨
π ARGUMENTS π
adevβ anamdgpu_devicepointer. your main character struct πΈidxβ the index of the scheduler you wanna control. which one? this one. π₯enableβ whether to enable or disable the KFD scheduler. yes it's a bool. yes it's exactly what it sounds like. π
π DESCRIPTION π
so what does this thing actually do? it controls the KFD (Kernel Fusion Driver) scheduler from the KGD, bestie. it's part of the cleaner shader feature, and it plays a key role in enforcing process isolation on the GPU β which is kind of a big deal π
the mechanism? a reference count called kfd_sch_req_count, tracking how many requests there are to enable the KFD scheduler. here's the tea:
- when a request to enable the KFD scheduler is made, the reference count is decremented. (yes, decremented. that's what the page says. keep your eyes on it π)
- when the reference count reaches zero, a delayed work is scheduled to enforce isolation after a delay of
GFX_SLICE_PERIOD. iconic behaviour, honestly β³
and when a request to disable the KFD scheduler comes in, the function goes in this exact order:
- first it checks if the reference count is zero π΅οΈ
- if it is, it cancels the delayed work for enforcing isolation, and checks if the KFD scheduler is active
- if the KFD scheduler is active, it sends a request to stop the KFD scheduler and sets the KFD scheduler state to inactive π
- then it increments the reference count β¬οΈ
the whole thing is synchronized using kfd_sch_mutex, so the KFD scheduler state and the reference count get updated atomically β no racing, no messy vibes, periodt π
π NOTE π
listen. if the reference count is already zero when a request to enable the KFD scheduler is made, that means there's an imbalance bug somewhere. the function triggers a warning in this case. so if you see that warning, it's not a vibe, it's a bug hunt π¨
π§ SEE ALSO π§
the kernel file that started it all:
./drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
and the whole friend group, in this exact order:
amdgpu_gfx_parse_disable_cu(9)amdgpu_gfx_handle_priv_fault(9)amdgpu_gfx_set_run_cleaner_shader(9)amdgpu_gfx_get_enforce_isolation(9)amdgpu_gfx_set_enforce_isolation(9)amdgpu_gfx_enforce_isolation_handler(9)amdgpu_gfx_enforce_isolation_wait_for_kfd(9)amdgpu_gfx_enforce_isolation_ring_begin_use(9)amdgpu_gfx_enforce_isolation_ring_end_use(9)amdgpu_gfx_csb_preamble_start(9)amdgpu_gfx_csb_data_parser(9)amdgpu_gfx_csb_preamble_end(9)
go read them. they're all slaying in their own way π¦
π and that's the page!! this cutie lives in ./drivers/gpu/drm/amd/amdgpu, dated October 2026, and it's filed under amdgpu_gfx_kfd_sch_ctrl(9) in the Kernel API Manual. mwah, go enforce some isolation bestie πΈβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms