Skip to content

Commit 769a72d

Browse files
effective-lighthtejun
authored andcommitted
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 <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent d082ecb commit 769a72d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

rust/kernel/workqueue.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,3 +703,21 @@ pub fn system_freezable_power_efficient() -> &'static Queue {
703703
// SAFETY: `system_freezable_power_efficient_wq` is a C global, always available.
704704
unsafe { Queue::from_raw(bindings::system_freezable_power_efficient_wq) }
705705
}
706+
707+
/// Returns the system bottom halves work queue (`system_bh_wq`).
708+
///
709+
/// It is similar to the one returned by [`system`] but for work items which
710+
/// need to run from a softirq context.
711+
pub fn system_bh() -> &'static Queue {
712+
// SAFETY: `system_bh_wq` is a C global, always available.
713+
unsafe { Queue::from_raw(bindings::system_bh_wq) }
714+
}
715+
716+
/// Returns the system bottom halves high-priority work queue (`system_bh_highpri_wq`).
717+
///
718+
/// It is similar to the one returned by [`system_bh`] but for work items which
719+
/// require higher scheduling priority.
720+
pub fn system_bh_highpri() -> &'static Queue {
721+
// SAFETY: `system_bh_highpri_wq` is a C global, always available.
722+
unsafe { Queue::from_raw(bindings::system_bh_highpri_wq) }
723+
}

0 commit comments

Comments
 (0)