From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 161B73FF1CB for ; Mon, 6 Jul 2026 11:38:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783337917; cv=none; b=gKa/eFNXjJcqv+s0dPOGkg18y9oVXhuPJnEFK+uZcwyfvxn+wj/ar5UfZ6s5H5QIHqwOMpltK/eNF6OrcanapHiNDB0mecxigl3jPx7rxPr6IfIdz+ck0olDn37quhAHiAq3Vhgs86edm1IfncXYGBPwBnblOjj39sD9hdkMrjc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783337917; c=relaxed/simple; bh=Q+BP0u/y0Hyd0p6lBycKMnPnhD8TLh8z8EwXrezLYF8=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=jvC1d0JaiRMRyGD3kqzVwoZcn8HkiYm63HdIsZntTuklZ3/hGCThhHhSDpXdKnr7+GS149wOLwRlyhgYiPPHUJQ6F4subCVfv3aZfAfUtY8hOnVcouEWPORTz3DEJd2taygzWQnnSdT2UCJ8Z2cgov1PjrMIOx+aTZk+UidicLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hbZMC1UR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hbZMC1UR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88C801F000E9; Mon, 6 Jul 2026 11:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783337915; bh=l+aT3QZ2N+Ch8j6u7o5Q++W7zx0tOiHFvaY9CK5XacA=; h=Date:Subject:Cc:To:From:References:In-Reply-To; b=hbZMC1UR0GoPIJQIFj9F7L53KpVakJp+ost79Sz0pGLFXqIZGq4hpI0i78mKOkQYr sm6YA3otDKGYbtEqXU153x3EtNrvLRCXBpTBNR7CwAYV3wGpVP2qO5R7/O8/S+vQCa wlMk0AIN5xrYNaOd8kH3j+TAq3c/YNKRZFKF9EDAwDxH5w4UlaKFflkOviIult5Ndr adWezq0FKAckU2RC+E/OxYZIH8RVWCQd5kdFQQJKgpi9bdQQ5iZLt24yZrmiabfi8z ZQp9dFfISOu4oHfF1/z0b0BTu6Ua/ay98W6FAUx3n+bAed51x3MU66y4uQzw3rTqls cf1TEMpPsCLCA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 06 Jul 2026 13:38:32 +0200 Message-Id: Subject: Re: [PATCH 1/2] drm/sched: Guard sched->ready with ACCESS_ONCE() Cc: , "Matthew Brost" , =?utf-8?q?Christian_K=C3=B6nig?= , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , , To: "Philipp Stanner" From: "Danilo Krummrich" References: <20260629104040.2695163-2-phasta@kernel.org> <5ed4ecfe-05bb-4bdd-9aa3-155e1d926861@kernel.org> <2abbd54a7908f5ee82bcffb22bf0dccc05734bbe.camel@mailbox.org> In-Reply-To: <2abbd54a7908f5ee82bcffb22bf0dccc05734bbe.camel@mailbox.org> On Mon Jul 6, 2026 at 10:44 AM CEST, Philipp Stanner wrote: > On Mon, 2026-06-29 at 14:09 +0200, Danilo Krummrich wrote: >> > + WRITE_ONCE(sched->ready, false); >>=20 >> Don't we need smp_store_release() here and >>=20 >> > + return READ_ONCE(sched->ready); >> smp_load_acquire() here? > > Maybe. Not sure what the precise access rules would be. To really get > correctness, all counter-parties you found in amdgpu would have to > remove their layering violations anyways, which is beyond my scope. Fair enough, let's get it right in the core infrastructure then. >> Also, what about drm_sched_init()? It also seems that this is accessed f= rom >> amdgpu without the drm_sched_wqueue_ready() helper about a million times= . :) >>=20 >> $ grep -Rin "sched\.ready" drivers/gpu/drm/amd | wc >> $=C2=A0=C2=A0=C2=A0=C2=A0 119=C2=A0=C2=A0=C2=A0=C2=A0 544=C2=A0=C2=A0 1= 0320 >>=20 >> There may be false positives, but from a quick glance at least most of t= hem seem >> to actually come from the scheduler. > > Correct. > > Your ordering comment hints at me that you would rather see the ready- > flag be left as is, if it can't be made right 100% (which it can't). No, the change makes sense. Getting it right in the core infrastructure is = the right thing to do, even if you don't want to fix up amdgpu.