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 32B851D5150; Tue, 8 Jul 2025 15:36:41 +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=1751989002; cv=none; b=VL0LKrQDT62t28H0oyZzhn0p8UMA5t0RJ+L0JviUKZShM4xVXn429hDeVr89+k9QZzM2+7hchIYkeVjQ61bwkuICH62CYipNcQRMvSoqp81Bl7QyfMPXE0R34wPemmdUdM3mHx1eHeLe/NkuR3kQ9YNCyTgLGT5uCcndKvaM3ZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751989002; c=relaxed/simple; bh=Iwf1w4LMrMCn4ONtXi63g2Muwr/nfqefgVJp8vV/llo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AETpVbCtnDUIKC10kG1bqso11+YYbWk95w3wD4xtgFMPPCa8lcGpYdBakvRwYVRz56Lk5ql75w2NqQdmtsUTJaOY0LbBQZ9O/R96TI4eyMv8cCzMIuVXvR3nvJOMgq6Cptptvds2qyxBMUf9Co1XiSGniyw0eTmNZhx4PApVpY4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z+aURvg+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z+aURvg+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06DCDC4CEED; Tue, 8 Jul 2025 15:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751989001; bh=Iwf1w4LMrMCn4ONtXi63g2Muwr/nfqefgVJp8vV/llo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Z+aURvg+kvTxybVdl8IG4R6b5AFm4L3j0CeEEX9TbdbIT+8NC8DlOzedvhCe6kCV2 rFJL1UAYhrwGg3Ofo0YSYGP+9xNRv2JAO+fkqyzjJ8us8klDRX7ujUXfgmSe2FA+J5 QAnKc4rjYbEtmPMHgab2EgWznTe2RBVphVN1kWvOycOnqq0R/T2QtV11kUwJTTU6bz uCH3QkjR3sxxErVCAjbedfWeod5zqmNO/0eN3T8qANUqlJAw1xsIFRretV/7RMFlin qfvKixT2uNctM8qsbU9MpqIdb0hCXP+4nFBXB9EN3RZfB8TZO1oN2yo07DbroxBGiz fqmW5O7ksOf/g== From: Andreas Hindborg To: "Benno Lossin" Cc: "Oliver Mangold" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?Q?Bj?= =?utf-8?Q?=C3=B6rn?= Roy Baron , "Alice Ryhl" , "Trevor Gross" , "Asahi Lina" , , Subject: Re: [PATCH v11 4/4] rust: Add `OwnableRefCounted` In-Reply-To: (Benno Lossin's message of "Tue, 08 Jul 2025 16:50:03 +0200") References: <20250618-unique-ref-v11-0-49eadcdc0aa6@pm.me> <20250618-unique-ref-v11-4-49eadcdc0aa6@pm.me> <87bjpwqmo5.fsf@kernel.org> <87zfdgp253.fsf@kernel.org> <87jz4iomc9.fsf@kernel.org> User-Agent: mu4e 1.12.9; emacs 30.1 Date: Tue, 08 Jul 2025 17:35:26 +0200 Message-ID: <87ldoyn1a9.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "Benno Lossin" writes: > On Tue Jul 8, 2025 at 3:15 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Mon Jul 7, 2025 at 3:21 PM CEST, Andreas Hindborg wrote: >>>> When a completion comes back from hardware, it carries the ID. We use >>>> the C block layer `tag_to_rq` machinery to turn this ID back into an >>>> `Owned>`. In that process, we check that `refcount =3D=3D 1= ` and >>>> if so, we set refcount to 0 and invent an `Owned>`. >>> >>> (because if not, this would be wrong) >> >> I hope it is not wrong =F0=9F=98=86 You can see the latest and greatest = here [1]. > > Thanks for the pointer, the "implementation details" in the docs on > `Request` were very helpful! This is another argument for not having the > blanket impl for `Ownable` when `T: Refcount` I mentioned in the other > thread. > >> [1] https://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux.git= /tree/rust/kernel/block/mq/request.rs?h=3Drnull-v6.15#n398 > > The comment in line 424 looks wrong? Yes, nice catch. The assert is correct though. Best regards, Andreas Hindborg