[PATCH v5 0/3] rust: Add irq abstraction, SpinLockIrq

Lyude Paul posted 3 patches 2 months, 2 weeks ago
There is a newer version of this series
rust/helpers/helpers.c            |   1 +
rust/helpers/irq.c                |  22 +++++++
rust/kernel/irq.rs                |  90 +++++++++++++++++++++++++
rust/kernel/lib.rs                |   1 +
rust/kernel/sync.rs               |   2 +-
rust/kernel/sync/lock.rs          |  17 ++++-
rust/kernel/sync/lock/mutex.rs    |   1 +
rust/kernel/sync/lock/spinlock.rs | 105 ++++++++++++++++++++++++++++++
8 files changed, 236 insertions(+), 3 deletions(-)
create mode 100644 rust/helpers/irq.c
create mode 100644 rust/kernel/irq.rs
[PATCH v5 0/3] rust: Add irq abstraction, SpinLockIrq
Posted by Lyude Paul 2 months, 2 weeks ago
This adds a simple interface for disabling and enabling CPUs, along with
the ability to mark a function as expecting interrupts be disabled -
along with adding bindings for spin_lock_irqsave/spin_lock_irqrestore().

Current example usecase (very much WIP driver) in rvkms:

https://gitlab.freedesktop.org/lyudess/linux/-/commits/rvkms-example-08012024

specifically drivers/gpu/drm/rvkms/crtc.rs

Lyude Paul (3):
  rust: Introduce irq module
  rust: sync: Introduce lock::Backend::Context
  rust: sync: Add SpinLockIrq

 rust/helpers/helpers.c            |   1 +
 rust/helpers/irq.c                |  22 +++++++
 rust/kernel/irq.rs                |  90 +++++++++++++++++++++++++
 rust/kernel/lib.rs                |   1 +
 rust/kernel/sync.rs               |   2 +-
 rust/kernel/sync/lock.rs          |  17 ++++-
 rust/kernel/sync/lock/mutex.rs    |   1 +
 rust/kernel/sync/lock/spinlock.rs | 105 ++++++++++++++++++++++++++++++
 8 files changed, 236 insertions(+), 3 deletions(-)
 create mode 100644 rust/helpers/irq.c
 create mode 100644 rust/kernel/irq.rs


base-commit: 93dc3be19450447a3a7090bd1dfb9f3daac3e8d2
-- 
2.46.0
Re: [PATCH v5 0/3] rust: Add irq abstraction, SpinLockIrq
Posted by Gary Guo 2 months, 2 weeks ago
On Thu, 12 Sep 2024 15:04:15 -0400
Lyude Paul <lyude@redhat.com> wrote:

> This adds a simple interface for disabling and enabling CPUs, along with
> the ability to mark a function as expecting interrupts be disabled -
> along with adding bindings for spin_lock_irqsave/spin_lock_irqrestore().
> 
> Current example usecase (very much WIP driver) in rvkms:
> 
> https://gitlab.freedesktop.org/lyudess/linux/-/commits/rvkms-example-08012024
> 
> specifically drivers/gpu/drm/rvkms/crtc.rs
> 
> Lyude Paul (3):
>   rust: Introduce irq module
>   rust: sync: Introduce lock::Backend::Context
>   rust: sync: Add SpinLockIrq
> 
>  rust/helpers/helpers.c            |   1 +
>  rust/helpers/irq.c                |  22 +++++++
>  rust/kernel/irq.rs                |  90 +++++++++++++++++++++++++
>  rust/kernel/lib.rs                |   1 +
>  rust/kernel/sync.rs               |   2 +-
>  rust/kernel/sync/lock.rs          |  17 ++++-
>  rust/kernel/sync/lock/mutex.rs    |   1 +
>  rust/kernel/sync/lock/spinlock.rs | 105 ++++++++++++++++++++++++++++++
>  8 files changed, 236 insertions(+), 3 deletions(-)
>  create mode 100644 rust/helpers/irq.c
>  create mode 100644 rust/kernel/irq.rs
> 
> 
> base-commit: 93dc3be19450447a3a7090bd1dfb9f3daac3e8d2

With the invariant documentation of `IrqDisabled` fixed:

Reviewed-by: Gary Guo <gary@garyguo.net>
Re: [PATCH v5 0/3] rust: Add irq abstraction, SpinLockIrq
Posted by Daniel Almeida 2 months, 2 weeks ago
This series looks good to me. Thanks for working on it.

— Daniel