From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B558D1D9A43; Tue, 8 Oct 2024 13:29:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728394162; cv=none; b=uTwcj57UNKxfjdTiZ+Wl12Rs6BnRgzkVvtDYCVDxxc1ITzfcsOyGg+1ZCRiNsZFIGABgzR4MjlDix1FepXo4oEr6gBSYTLb74F85o5xE+eLZvmyY9xxss+qMFXKGAgIPU5ID7ZTPQtMaVSeggK55HKJQBW9mLMEStjfj3aLySzU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728394162; c=relaxed/simple; bh=GepXjxZ0tGSaPm+xJ8oq0FdnrwmIE3qMsymYs/PNJww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BeGRXFe4enQSPu0NR+S/SNkKiajHEgEF8fQHA3EnomkqZTI3cjjcjtTEmdQ/Mg9X7Cnu+qUpqIVLvZ2dxlHldzxT6J8m8acT9LALd6k7rSNwXVynEionq6lsnheiYlrX9BNJ26DF2JGS4g+Y0PKdnGaKz7WqvThoerk1QJKW1SE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MN+B3ioo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MN+B3ioo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E27BFC4CEC7; Tue, 8 Oct 2024 13:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728394162; bh=GepXjxZ0tGSaPm+xJ8oq0FdnrwmIE3qMsymYs/PNJww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MN+B3iooc84S2pjmX7I3wBNDStpXUx2MiGCtD7NIPmXhp8N9AH2YRj9drMFyrrgqr k8P2xuvswfKySkG4ID2pRGKIonGWKsghRLOwZFuxkQTuk1onJEr8GH5XMxaL/IKbVa AXBfGvTtaafdx0yL+3yB46aU4ReTNmdA/HfsRGDU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tvrtko Ursulin , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Luben Tuikov , Matthew Brost , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Philipp Stanner Subject: [PATCH 6.6 324/386] drm/sched: Add locking to drm_sched_entity_modify_sched Date: Tue, 8 Oct 2024 14:09:29 +0200 Message-ID: <20241008115642.136365085@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115629.309157387@linuxfoundation.org> References: <20241008115629.309157387@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tvrtko Ursulin commit 4286cc2c953983d44d248c9de1c81d3a9643345c upstream. Without the locking amdgpu currently can race between amdgpu_ctx_set_entity_priority() (via drm_sched_entity_modify_sched()) and drm_sched_job_arm(), leading to the latter accesing potentially inconsitent entity->sched_list and entity->num_sched_list pair. v2: * Improve commit message. (Philipp) Signed-off-by: Tvrtko Ursulin Fixes: b37aced31eb0 ("drm/scheduler: implement a function to modify sched list") Cc: Christian König Cc: Alex Deucher Cc: Luben Tuikov Cc: Matthew Brost Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: Philipp Stanner Cc: # v5.7+ Reviewed-by: Christian König Link: https://patchwork.freedesktop.org/patch/msgid/20240913160559.49054-2-tursulin@igalia.com Signed-off-by: Christian König Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/scheduler/sched_entity.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -111,8 +111,10 @@ void drm_sched_entity_modify_sched(struc { WARN_ON(!num_sched_list || !sched_list); + spin_lock(&entity->rq_lock); entity->sched_list = sched_list; entity->num_sched_list = num_sched_list; + spin_unlock(&entity->rq_lock); } EXPORT_SYMBOL(drm_sched_entity_modify_sched);