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 1ECB1242914; Tue, 22 Jul 2025 11:02:53 +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=1753182174; cv=none; b=NNeElrQSEGjDJKb/tviRh9ocOIbt6dGGc78O8os8b1YKch4QpXeJ3SD1r9c0E20krRsK74x1+dizTg6nDv4+wi+WnBLfEX4dggseOxKsib0/6FEsjvYKIOLAJMfhYCgOpU7SaoY3+uchOv6OjMHAomU/Dh/0bwYnciBPmlZP3Fs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753182174; c=relaxed/simple; bh=g77nOjhF39d0hWS6dcCWWmDVOPoN5zX71R8a89P/bzo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VplzdMYCEhbjddYA7WsJlHdWx2JYnBg6XzEgr9yTCT56T89+RA4wp2rBetRq7ZFMNRpt55BFt9PaEaU+2U8qLsOhN7m31SKIxumTvrCivfHgQuo3F1UAxtTH73EuQtZAMPUFQPDeFPBqk1GQHxR+Vf+D2MKQ09Hlv3eWsAy6IB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H9Ks5c2R; 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="H9Ks5c2R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01152C4CEEB; Tue, 22 Jul 2025 11:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753182173; bh=g77nOjhF39d0hWS6dcCWWmDVOPoN5zX71R8a89P/bzo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=H9Ks5c2RKRdF1/bhzF/09U8r8HMi+aurj4hC8rOkHhRpj/3fPiM1uCMKBA/ESV8ro oeNoXb1HBDINTxrERWhzE+w+hDqD+N/f5A3HFKkr/S7uzejCRUJ/oHtNh73uwkFS98 L2H01fli/nW8oJLu0RrTQSO/0kWOl2iw5AjLV6rjnLY51jMEJgKJY43cJEaI73v3m5 LDWV6laV371RLCpRagFZ0MiQ3R3JbUrbJWN0J1W8hNbxfNhhdgws3asgEZn40/mEOs 8e2R+eE5ClYVpA1KAhhxG4gYeGd4lX87ba18GrohFLHDeR+lEzug9dd8LNrSJC/pWX H9sFnuvjgcPHA== Message-ID: Date: Tue, 22 Jul 2025 13:02:48 +0200 Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] rust: Update PCI binding safety comments and add inline compiler hint To: Benno Lossin Cc: Alistair Popple , rust-for-linux@vger.kernel.org, Bjorn Helgaas , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Greg Kroah-Hartman , "Rafael J. Wysocki" , John Hubbard , Alexandre Courbot , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250710022415.923972-1-apopple@nvidia.com> From: Danilo Krummrich Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/22/25 12:57 PM, Benno Lossin wrote: > On Tue Jul 22, 2025 at 11:51 AM CEST, Danilo Krummrich wrote: >> I think they're good, but we're pretty late in the cycle now. That should be >> fine though, we can probably take them through the nova tree, or in the worst >> case share a tag, if needed. >> >> Given that, it would probably be good to add the Guarantee section on as_raw(), >> as proposed by Benno, right away. >> >> @Benno: Any proposal on what this section should say? > > At a minimum I'd say "The returned pointer is valid.", but that doesn't > really say for what it's valid... AFAIK you're mostly using this pointer > to pass it to the C side, in that case, how about: It is used for for FFI calls and to access fields of the underlying struct pci_dev. > /// # Guarantees > /// > /// The returned pointer is valid for reads and writes from the C side for as long as `self` exists. > > Maybe we need to change it a bit more, but let's just start with this.