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 0BCA33C061D for ; Sat, 11 Jul 2026 13:26:22 +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=1783776384; cv=none; b=GBFw7EtZOuHw/bz1FjAk6HVLV83PA7MA3JYOwVRAb6uY4zBVP4sWpqMEGPBwe7j94rVPVJTTBtByNReZ5krNnkIazp1kzKCdN6Iqg4imdAWdoDNTNqT1EiBAyKNBh7odVicIPpQM+X8i22I1Ak9KKV2NJY6iUzBHDP3AIqu3Pn8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783776384; c=relaxed/simple; bh=lHEpY7vHakjO64aBX8fM7BlQo3Mdqpj272fgkMvykNE=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:To:From:Subject: References:In-Reply-To; b=ApnF4vvzgRXhIIbF1MCxJEtDJpRNBe/OyTGglibNMCo8pZCyXzQTHy7h1oQH9Z9IMWzcGLVaqvEZJazmThWRnR/1osJq4KvcDjfkZanAsmASGUPcAxCzuBVCjEinxIoBfrOyER21oIhH6i5mWw7wXxP7pUwggzLo+yLc2h9+h54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aPCkOdEP; 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="aPCkOdEP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E3331F000E9; Sat, 11 Jul 2026 13:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783776382; bh=fVjphaM/B3cY7EEbFuMGuyKiZiBk4vV629GclTQJJMg=; h=Date:Cc:To:From:Subject:References:In-Reply-To; b=aPCkOdEP19Svl46slzbLUVN6gRb91P4h3BWpj9bBDHNWrQYZye/fT7IbhOfPSYDFf r+5XCR61+a/C0T7mHFvbedM62i/xP2GT34cmrHvBXjEE2P8TPwf6/U8meC2leyisXs DwRrUoDqEfQTI4tNuOz4fDqCRkazjdeEpcuTF92/pYuVIJARQ9jMC8kCknoQoroUJi snEZQYtFHCOOUsb7Eld1n23rSxEJc1ioKEEQuyhs7Sl4w8vqUnjezFn79OnJ/Nax7z Wa7xVqEMMkwVy9kORE0Ovf3tHkRnuo7es6LQyuKLfZGiEl9XTnWk24eVb+jMhzZWXr P+GYpFStidKYQ== 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: Sat, 11 Jul 2026 15:26:18 +0200 Message-Id: Cc: , , , , , , , , , , , To: =?utf-8?q?Christian_K=C3=B6nig?= From: "Danilo Krummrich" Subject: Re: [PATCH 09/12] drm/ttm: nuke buffer refcounting References: <20260710190752.2355-1-christian.koenig@amd.com> <20260710190752.2355-10-christian.koenig@amd.com> In-Reply-To: <20260710190752.2355-10-christian.koenig@amd.com> On Fri Jul 10, 2026 at 8:52 PM CEST, =3D?UTF-8?q?Christian=3D20K=3DC3=3DB6n= ig?=3D wrote: > +/** > + * ttm_bo_is_deleted - test if buffer is already deleted > + * @bo: the struct ttm_buffer_object to test > + * > + * Returns true if the buffer is already deleted and only waiting for > + * destruction. > + */ > +static inline bool ttm_bo_is_deleted(struct ttm_buffer_object *bo) > +{ > + return !kref_read(&bo->base.refcount); > +} This is an anti-pattern, branch decisions cannot rely on an atomic referenc= e count unless additional invariants are upheld that otherwise guarantee that= the read values does not instantly become meaningless. Something like this should at least document in which context and under whi= ch conditions it is valid to rely on the returned value.