lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b71832f-f3a9-4109-baa1-f29a8327d872@gmail.com>
Date: Fri, 13 Jun 2025 12:45:14 +0300
From: Abdiel Janulgue <abdiel.janulgue@...il.com>
To: Alexandre Courbot <acourbot@...dia.com>, dakr@...nel.org
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
 Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>,
 Benno Lossin <benno.lossin@...ton.me>,
 Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>, Valentin Obst <kernel@...entinobst.de>,
 open list <linux-kernel@...r.kernel.org>,
 Marek Szyprowski <m.szyprowski@...sung.com>,
 Robin Murphy <robin.murphy@....com>, airlied@...hat.com,
 rust-for-linux@...r.kernel.org,
 "open list:DMA MAPPING HELPERS" <iommu@...ts.linux.dev>,
 Petr Tesarik <petr@...arici.cz>, Andrew Morton <akpm@...ux-foundation.org>,
 Herbert Xu <herbert@...dor.apana.org.au>,
 Sui Jingfeng <sui.jingfeng@...ux.dev>, Randy Dunlap <rdunlap@...radead.org>,
 Michael Kelley <mhklinux@...look.com>
Subject: Re: [PATCH v4 3/3] rust: dma: add as_slice/write functions for
 CoherentAllocation

On 02/06/2025 16:05, Alexandre Courbot wrote:
> On Mon Jun 2, 2025 at 5:53 PM JST, Abdiel Janulgue wrote:
>> Add unsafe accessors for the region for reading or writing large
>> blocks of data.
>>
>> Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
>> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@...il.com>
> 
> A couple remaining nits/questions below, but FWIW:
> 
> Reviewed-by: Alexandre Courbot <acourbot@...dia.com>
>> +
>> +    /// Writes data to the region starting from `offset`. `offset` is in units of `T`, not the
>> +    /// number of bytes.
> 
> Reading this sentence it occured to me that `offset` may be ambiguous
> here, as in my mind it rings as being in bytes unit. How about using
> `index` throughout the file?

Thanks! I don't have any strong opinion about this, I think it's enough 
that the subsequent paragraph makes it clear that the unit is in bytes 
unit? In any case, this could this be updated later after the merge?

>> +    /// ```
>> +    pub unsafe fn write(&self, src: &[T], offset: usize) -> Result {
> 
> Can this function be written by leveraging `as_slice_mut` and
> `clone_from_slice`?

using `slice::clone_from_slice` would enforce the length of the coherent 
allocation to be always the same as src data. Not sure if that is what 
we want. Also, instead of just a straight memcpy, this would go through 
a 2-step layer (a call to `slice::from_raw_parts_mut` and then the 
`slice::clone_from_slice` itself)?.


Regards,
Abdiel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ