summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHamza Mahfooz <hamzamahfooz@linux.microsoft.com>2025-02-24 09:23:23 -0500
committerTejun Heo <tj@kernel.org>2025-02-24 08:13:41 -1000
commit769a72d0bf80892581366082124e9d15b2dd6b08 (patch)
treea65d38accca2eddad6a5a8133313b34a5dc1d6d6
parentd082ecbc71e9e0bf49883ee4afd435a77a5101b6 (diff)
rust: workqueue: define built-in bh queues
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> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--rust/kernel/workqueue.rs18
1 files changed, 18 insertions, 0 deletions
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) }
+}