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 052591C57B1; Tue, 15 Oct 2024 12:05:02 +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=1728993902; cv=none; b=t5dPnvBDLa1n2whMU/J2HiSh12sEmw1fUL8zv4960h5depz08uS7UvoXYB1XxushbEUKSizN+mEbWcibP3SHFrSpS5XrbylaFMvbPsFOAwAl1TEorpj30+xDwiV2sK4mpyaiLzYWTa4+VoX2EnX0WHJgtfrfpbyjw5apEA8XenA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728993902; c=relaxed/simple; bh=UD7pQf75KZZTZGdDCzba2EqNBabJBFu3/Fi3OTAb/5w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rys7xcs3WRBBy5Hfo2L0mL9zZ3K0+5vA/b4k0f76Wmqm1KI1Nw1MlDy09Bu6UNHU/hAXAsGbaRyMWoMAghqYcG6xP5toSEOaCWjFTTgzTcELEpj64Icvmjn0wosqMgGzHs2hu4E6MGVfGMd6dGjrJngjDCGxWox3VZWRM3OQghk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=b7j+qBFJ; 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="b7j+qBFJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B4C1C4CEC6; Tue, 15 Oct 2024 12:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728993901; bh=UD7pQf75KZZTZGdDCzba2EqNBabJBFu3/Fi3OTAb/5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7j+qBFJctNUEBosokCG8N6QP2U4JoSviQT+f2w7e36Q83P12LDAyqDODQ8W8fO/F C9tyJyvhZQ3/zTkX6gop6wrxu5hy5LjIgpzkyjf122z9Q1L1YNzC2xYV6O4MpS3MAv CZ0ZjzUBcBiTqa3VRbvq7qtF6EYuyMI6xVftq604= 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 5.15 547/691] drm/sched: Add locking to drm_sched_entity_modify_sched Date: Tue, 15 Oct 2024 13:28:15 +0200 Message-ID: <20241015112502.050012618@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015112440.309539031@linuxfoundation.org> References: <20241015112440.309539031@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-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 @@ -99,8 +99,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);