From: Boqun Feng <boqun.feng@gmail.com>
To: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Cc: rust-for-linux@vger.kernel.org, "Tejun Heo" <tj@kernel.org>,
"Lai Jiangshan" <jiangshanlai@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@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>,
"Wedson Almeida Filho" <walmeida@microsoft.com>,
"Dirk Behme" <dirk.behme@gmail.com>,
"Konstantin Andrikopoulos" <kernel@mandragore.io>,
"Danilo Krummrich" <dakr@kernel.org>,
"Roland Xu" <mu001999@outlook.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rust: workqueue: define built-in bh queues
Date: Mon, 24 Feb 2025 10:09:17 -0800 [thread overview]
Message-ID: <Z7y1zZTi3UQzsvQh@boqun-archlinux> (raw)
In-Reply-To: <20250224142326.38396-1-hamzamahfooz@linux.microsoft.com>
Hi Hamza,
On Mon, Feb 24, 2025 at 09:23:23AM -0500, Hamza Mahfooz wrote:
> Provide safe getters to the system bh work queues. They will be used
> to reimplement the Hyper-V VMBus in rust.
>
> Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
> ---
> v2: make the commit message suck less.
> ---
> rust/kernel/workqueue.rs | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
while you're at it, could you also add some usage of system_bh() in the
example at around line 77 in workqueue.rs? It could demonstrate the
usage and generate unit tests. Thanks!
Regards,
Boqun
> diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
> index 0cd100d2aefb..68ce70d94f2d 100644
> --- a/rust/kernel/workqueue.rs
> +++ b/rust/kernel/workqueue.rs
> @@ -703,3 +703,21 @@ pub fn system_freezable_power_efficient() -> &'static Queue {
> // SAFETY: `system_freezable_power_efficient_wq` is a C global, always available.
> unsafe { Queue::from_raw(bindings::system_freezable_power_efficient_wq) }
> }
> +
> +/// Returns the system bottom halves work queue (`system_bh_wq`).
> +///
> +/// It is similar to the one returned by [`system`] but for work items which
> +/// need to run from a softirq context.
> +pub fn system_bh() -> &'static Queue {
> + // SAFETY: `system_bh_wq` is a C global, always available.
> + unsafe { Queue::from_raw(bindings::system_bh_wq) }
> +}
> +
> +/// Returns the system bottom halves high-priority work queue (`system_bh_highpri_wq`).
> +///
> +/// It is similar to the one returned by [`system_bh`] but for work items which
> +/// require higher scheduling priority.
> +pub fn system_bh_highpri() -> &'static Queue {
> + // SAFETY: `system_bh_highpri_wq` is a C global, always available.
> + unsafe { Queue::from_raw(bindings::system_bh_highpri_wq) }
> +}
> --
> 2.47.1
>
next prev parent reply other threads:[~2025-02-24 18:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 14:23 [PATCH v2] rust: workqueue: define built-in bh queues Hamza Mahfooz
2025-02-24 17:31 ` Tejun Heo
2025-02-24 18:03 ` Hamza Mahfooz
2025-02-24 18:09 ` Boqun Feng [this message]
2025-02-24 18:12 ` Alice Ryhl
2025-02-24 18:14 ` Tejun Heo
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=Z7y1zZTi3UQzsvQh@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=dakr@kernel.org \
--cc=dirk.behme@gmail.com \
--cc=gary@garyguo.net \
--cc=hamzamahfooz@linux.microsoft.com \
--cc=jiangshanlai@gmail.com \
--cc=kernel@mandragore.io \
--cc=linux-kernel@vger.kernel.org \
--cc=mu001999@outlook.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tj@kernel.org \
--cc=tmgross@umich.edu \
--cc=walmeida@microsoft.com \
/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).