]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdkfd: Fix race in GWS queue scheduling
authorJay Cornwall <jay.cornwall@amd.com>
Wed, 11 Jun 2025 14:52:14 +0000 (09:52 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Jul 2025 08:58:02 +0000 (10:58 +0200)
commit cfb05257ae168a0496c7637e1d9e3ab8a25cbffe upstream.

q->gws is not updated atomically with qpd->mapped_gws_queue. If a
runlist is created between pqm_set_gws and update_queue it will
contain a queue which uses GWS in a process with no GWS allocated.
This will result in a scheduler hang.

Use q->properties.is_gws which is changed while holding the DQM lock.

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit b98370220eb3110e82248e3354e16a489a492cfb)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c

index 18250845a9890a155be4c15917b713af919b8f6e..f335624c2d77d0b2e839311536857d17d1e6ed48 100644 (file)
@@ -201,7 +201,7 @@ static int pm_map_queues_v9(struct packet_manager *pm, uint32_t *buffer,
 
        packet->bitfields2.engine_sel =
                engine_sel__mes_map_queues__compute_vi;
-       packet->bitfields2.gws_control_queue = q->gws ? 1 : 0;
+       packet->bitfields2.gws_control_queue = q->properties.is_gws ? 1 : 0;
        packet->bitfields2.extended_engine_sel =
                extended_engine_sel__mes_map_queues__legacy_engine_sel;
        packet->bitfields2.queue_type =