rust: workqueue: define built-in bh queues
PATCH v2 1/1 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.
---
v2: make the commit message suck less.
--- rust/kernel/workqueue.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
rust/kernel/workqueue.rs +18 -0
@@ -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 () -> &'staticQueue { +// 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 () -> &'staticQueue { +// SAFETY: `system_bh_highpri_wq` is a C global, always available. +unsafe {Queue ::from_raw (bindings::system_bh_highpri_wq) } +}
Signature · 1 line
2.47.1
Quoted 4 lines · Hamza Mahfooz
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]>
Ah, you already sent v2.
Again, let me know how you want route it.
Thanks.
Signature · 1 line
tejun
Quoted 11 lines · Tejun Heo
Quoted 4 lines · Hamza Mahfooz
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]>Ah, you already sent v2.
Acked-by Tejun Heo <[email protected]>Again, let me know how you want route it.
I would prefer it it went through the workqueue tree, thanks!
Quoted 5 lines
Thanks.
Signature · 1 line
tejun
Hi Hamza,
Quoted 10 lines · Hamza Mahfooz
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]>---
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
Quoted 29 lines
rust/kernel/workqueue.rs +18
-0@@ -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 () -> &'staticQueue { +// 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 () -> &'staticQueue { +// SAFETY: `system_bh_highpri_wq` is a C global, always available. +unsafe {Queue ::from_raw (bindings::system_bh_highpri_wq) } +}Signature · 1 line
2.47.1
Quoted 5 lines · Hamza Mahfooz
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]>
Tejun Heo
AppliedQuoted 4 lines · Hamza Mahfooz
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]>
Applied to wq/for-6.15.
Thanks.
Signature · 1 line
tejun