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] [day] [month] [year] [list]
Message-Id: <DDOW30B98WRF.2VQA9N45N2PYA@nvidia.com>
Date: Wed, 22 Oct 2025 22:35:59 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Daniel del Castillo" <delcastillodelarosadaniel@...il.com>, "Alexandre
 Courbot" <acourbot@...dia.com>, "Danilo Krummrich" <dakr@...nel.org>,
 "David Airlie" <airlied@...il.com>, "Simona Vetter" <simona@...ll.ch>,
 "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>
Cc: <nouveau@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
 <linux-kernel@...r.kernel.org>, "Boqun Feng" <boqun.feng@...il.com>, "Gary
 Guo" <gary@...yguo.net>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
 "Trevor Gross" <tmgross@...ch.edu>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH 1/2] nova-core: Solve mentions of `CoherentAllocation`
 improvements [COHA]

On Sun Oct 19, 2025 at 8:57 PM JST, Daniel del Castillo wrote:
>>> @@ -296,24 +287,19 @@ fn new_fwsec(dev: &Device<device::Bound>, bios: &Vbios, cmd: FwsecCommand) -> Re
>>>                  size: 0,
>>>                  flags: 2,
>>>              };
>>> -
>>> -            dmem_mapper.init_cmd = match cmd {
>>> -                FwsecCommand::Frts {
>>> -                    frts_addr,
>>> -                    frts_size,
>>> -                } => {
>>> -                    frts_cmd.frts_region = FrtsRegion {
>>> -                        ver: 1,
>>> -                        hdr: size_of::<FrtsRegion>() as u32,
>>> -                        addr: (frts_addr >> 12) as u32,
>>> -                        size: (frts_size >> 12) as u32,
>>> -                        ftype: NVFW_FRTS_CMD_REGION_TYPE_FB,
>>> -                    };
>>> -
>>> -                    NVFW_FALCON_APPIF_DMEMMAPPER_CMD_FRTS
>>> -                }
>>> -                FwsecCommand::Sb => NVFW_FALCON_APPIF_DMEMMAPPER_CMD_SB,
>>> -            };
>>> +            if let FwsecCommand::Frts {
>>> +                frts_addr,
>>> +                frts_size,
>>> +            } = cmd
>>> +            {
>>> +                frts_cmd.frts_region = FrtsRegion {
>>> +                    ver: 1,
>>> +                    hdr: size_of::<FrtsRegion>() as u32,
>>> +                    addr: (frts_addr >> 12) as u32,
>>> +                    size: (frts_size >> 12) as u32,
>>> +                    ftype: NVFW_FRTS_CMD_REGION_TYPE_FB,
>>> +                };
>>> +            }
>> 
>> I liked that the original code updated both `init_cmd` and `frts_region`
>> in the same match block. I understand it might be difficult to preserve
>> due to the borrowing rules, but can you try to preserve it if that's
>> possible at all?
>
> I agree it was nicer. I tried to preserve it, but I don't see a way to
> do it cleanly, as I can't keep both mutable references at the same time.
> What I could do is only check `cmd` once, set `init_cmd` and store an
> `Option<FrtsRegion>` that I will later use to set `frts_region` if it's
> not `None`. Let me know if you prefer that.

Yeah, I agree the borrow checker will get in the way now that we have
fixed the lifetimes.

What I wanted to avoid is performing the same match operation on `cmd`
twice, but if that's difficult then I guess we can live with it. Using a
temporary `Option` comes down to the same in the end, except that the
second test is indirect.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ