From: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
To: rust-for-linux@vger.kernel.org
Cc: "Hamza Mahfooz" <hamzamahfooz@linux.microsoft.com>,
"Miguel Ojeda" <ojeda@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>,
"Wedson Almeida Filho" <walmeida@microsoft.com>,
"Nell Shamrell-Harrington" <nells@linux.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: [PATCH] rust: workqueue: define built-in bh queues
Date: Fri, 21 Feb 2025 17:35:31 -0500 [thread overview]
Message-ID: <20250221223533.158959-1-hamzamahfooz@linux.microsoft.com> (raw)
We provide these methods because it lets us access these queues from
Rust without using unsafe code.
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
---
rust/kernel/workqueue.rs | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
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 reply other threads:[~2025-02-21 22:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 22:35 Hamza Mahfooz [this message]
2025-02-21 22:45 ` [PATCH] rust: workqueue: define built-in bh queues Miguel Ojeda
2025-02-22 4:17 ` Jarkko Sakkinen
2025-02-22 4:37 ` Jarkko Sakkinen
2025-02-22 4:41 ` Boqun Feng
2025-02-22 6:04 ` Jarkko Sakkinen
2025-02-22 11:57 ` Miguel Ojeda
2025-02-24 17:26 ` Tejun Heo
2025-02-22 4:15 ` Jarkko Sakkinen
2025-02-22 11:53 ` Miguel Ojeda
2025-02-24 17:19 ` 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=20250221223533.158959-1-hamzamahfooz@linux.microsoft.com \
--to=hamzamahfooz@linux.microsoft.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=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=dirk.behme@gmail.com \
--cc=gary@garyguo.net \
--cc=kernel@mandragore.io \
--cc=linux-kernel@vger.kernel.org \
--cc=mu001999@outlook.com \
--cc=nells@linux.microsoft.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.