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]
Date: Thu, 25 Apr 2024 15:51:29 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...sung.com>, Alice Ryhl <aliceryhl@...gle.com>, linux-pm@...r.kernel.org, Vincent Guittot <vincent.guittot@...aro.org>, Stephen Boyd <sboyd@...nel.org>, Nishanth Menon <nm@...com>, rust-for-linux@...r.kernel.org, Manos Pitsidianakis <manos.pitsidianakis@...aro.org>, Erik Schilling <erik.schilling@...aro.org>, Alex Bennée <alex.bennee@...aro.org>, Joakim Bech <joakim.bech@...aro.org>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/3] rust: Add bindings for OPP framework

On 22.04.24 12:24, Viresh Kumar wrote:
> Thanks for the review Benno. I was waiting for more review comments to
> come in and hence didn't reply earlier with an update.
> 
> On 07-04-24, 09:54, Benno Lossin wrote:
>> On 05.04.24 13:09, Viresh Kumar wrote:
>>> +    clk_names: Option<Pin<Vec<CString>>>,
>>
>> Why are you using `Pin<Vec<_>>`? The vector may reallocate the backing
>> storage at any point in time.
> 
>>> +    /// Sets the configuration with the OPP core.
>>> +    pub fn set(&mut self, dev: &Device) -> Result<()> {
>>> +        // Already configured.
>>> +        if self.token.is_some() {
>>
>> Why does the config hold onto this token? Would it make sense to consume
>> the config and return a `Handle` or `Token` abstraction? Then you don't
>> need to check if the config has been "used" before.
> 
>>> +#[repr(transparent)]
>>> +pub struct OPP(*mut bindings::dev_pm_opp);
>>
>> I think you should use the `ARef` pattern instead:
>>
>>       #[repr(transparent)]
>>       pub struct OPP(Opaque<bindings::dev_pm_opp>);
>>
>>       unsafe impl AlwaysRefCounted for OPP {
>>           // ...
>>       }
>>
>> Then you can use `ARef<OPP>` everywhere you use `OPP` currently.
> 
> All these comments look good to me. Updated the code with them (not
> reposting them for now)

I currently do not have a lot of time, so I will re-review it when you
post a new version.

> -------------------------8<-------------------------
> 
>  rust/bindings/bindings_helper.h |   1 +
>  rust/kernel/lib.rs              |   2 +
>  rust/kernel/opp.rs              | 888 ++++++++++++++++++++++++++++++++

One other nice thing that you could do would be to split this patch into
multiple smaller ones. That makes understanding the pieces a lot easier.

-- 
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ