Re: [PATCH 1/2] rust: scatterlist: tie owned tables to the device's bound lifetime
From: Danilo Krummrich
Date: Mon Nov 16 2026 - 07:43:40 EST
On Mon Nov 16, 2026 at 5:02 AM CET, Alexandre Courbot wrote:
>> @@ -81,7 +78,7 @@ pub(crate) fn new(
>> let mut level0 = CoherentBox::<'_, [u64]>::zeroed_slice(
>> dev,
>> GSP_PAGE_SIZE / size_of::<u64>(),
>> - GFP_KERNEL
>> + GFP_KERNEL,
>
> Stray hunk? Maybe we can move it to patch 2 since it reformats that part
> anyway.
I noticed this before sending too, but for some odd reason rustfmt insists on
this with this change.
When I noticed I was 'whatever', but now I got curious. It happens when
level2 <- {
build_lvl(&data)
.map(|l2| SGTable::new(dev, l2, DataDirection::ToDevice, GFP_KERNEL))?
},
is changed to
level2: {
let l2 = build_lvl(data)?;
SGTable::new(dev, l2, DataDirection::ToDevice, GFP_KERNEL)?
},
>> @@ -308,38 +283,27 @@ fn drop(&mut self) {
>> ///
>> /// - The backing memory pages.
>> /// - The `struct sg_table` allocation (`sgt`).
>
> `sgt` is removed by this patch.
Good catch, I will remove this and the other one.
> <...>
>> diff --git a/samples/rust/rust_dma.rs b/samples/rust/rust_dma.rs
>> index ffb693544673..844e137cddc8 100644
>> --- a/samples/rust/rust_dma.rs
>> +++ b/samples/rust/rust_dma.rs
>> @@ -35,8 +35,7 @@
>> struct DmaSampleData<'bound> {
>> pdev: &'bound pci::Device<Bound>,
>> ca: Coherent<'bound, [MyStruct]>,
>> - #[pin]
>> - sgt: SGTable<Owned<VVec<u8>>>,
>> + sgt: SGTable<Owned<'bound, VVec<u8>>>,
>
> Since there is no more `pin` in `DmaSampleData`, can we also remove its
> `pinned_drop` attribute?
Yes, I left it as is intentionally though as this patch is purely a mechanical
conversion. I can send another one, analogous to the nova-core one.