rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Danilo Krummrich" <dakr@redhat.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Stephen Boyd" <sboyd@kernel.org>, "Nishanth Menon" <nm@ti.com>,
	"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	"Erik Schilling" <erik.schilling@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Joakim Bech" <joakim.bech@linaro.org>,
	"Rob Herring" <robh@kernel.org>, "Christoph Hellwig" <hch@lst.de>,
	"Jason Gunthorpe" <jgg@nvidia.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	linux-pm@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] rust: Add cpumask helpers
Date: Mon, 24 Feb 2025 14:40:24 -0500	[thread overview]
Message-ID: <Z7zLKNcvvga08jcw@thinkpad> (raw)
In-Reply-To: <20250224085613.ksburgsarl35tvnh@vireshk-i7>

On Mon, Feb 24, 2025 at 02:26:13PM +0530, Viresh Kumar wrote:
> Hi Yury,
> 
> On 21-02-25, 15:56, Yury Norov wrote:
> > Question: zalloc_cpumask_war() is a convenient wrapper around
> > alloc_cpumask_var_node(). Maybe rust can use the latter directly as it's
> > a true outlined function? There's more flexibility, if you need it, but
> > also a higher risk that the API will change: ~40 users vs 180 for zalloc
> > thing. Up to you guys. I can send v2 if needed.
> 
> I looked at the APIs again and here is what I feel:
> 
> - I am not sure if the Rust code will have any users of the *_node()
>   APIs in the near future. i.e. There is no need for the Rust code to
>   implement Cpumask::new_node() version for now.
> 
> - I have missed implementing the uninitialized version earlier,
>   alloc_cpumask_var(), which I think should be implemented right away.
>   Bindings for alloc_cpumask_var() are required to be added for this
>   though.
> 
> - One advantage of using zalloc_cpumask_var() instead of
>   alloc_cpumask_var() is that we don't need to open code it in the
>   Rust code, specifically for the !CONFIG_CPUMASK_OFFSTACK case where
>   we need to call cpumask_clear() separately.
>
> - The Rust side can have following abstractions for now:
> 
>   pub fn new() -> Result<Self>;
>   pub fn new_zeroed() -> Result<Self>;
> 
> -- 
> viresh

OK, if you need both I'll export both. I'll send it in v2 together
with clarifications from discussion with Miguel.
 

  reply	other threads:[~2025-02-24 19:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21 20:56 [PATCH 0/2] Bitmap bindings for rust Yury Norov
2025-02-21 20:56 ` [PATCH 1/2] rust: Add cpumask helpers Yury Norov
2025-02-24  8:56   ` Viresh Kumar
2025-02-24 19:40     ` Yury Norov [this message]
2025-02-21 20:56 ` [PATCH 2/2] MAINTAINERS: add rust bindings entry for bitmap API Yury Norov
2025-02-22 13:50   ` Miguel Ojeda
2025-02-22 23:34     ` Yury Norov
2025-02-24  5:14       ` Viresh Kumar
  -- strict thread matches above, loose matches on Subject: below --
2025-02-24 23:39 [PATCH v2 0/2] Bitmap bindings for rust Yury Norov
2025-02-24 23:39 ` [PATCH 1/2] rust: Add cpumask helpers Yury Norov
2025-02-25  9:24   ` Alice Ryhl
2025-02-25  9:43   ` Daniel Almeida
2025-02-25  9:50     ` Viresh Kumar
2025-02-26 16:17       ` Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7zLKNcvvga08jcw@thinkpad \
    --to=yury.norov@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.bennee@linaro.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@redhat.com \
    --cc=erik.schilling@linaro.org \
    --cc=gary@garyguo.net \
    --cc=hch@lst.de \
    --cc=jgg@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=joakim.bech@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=nm@ti.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).