lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <03FF521C-1F9D-48A7-9EDC-688157046DAE@collabora.com>
Date: Thu, 28 Nov 2024 11:35:13 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Lyude Paul <lyude@...hat.com>
Cc: dri-devel@...ts.freedesktop.org,
 rust-for-linux@...r.kernel.org,
 Asahi Lina <lina@...hilina.net>,
 Danilo Krummrich <dakr@...nel.org>,
 mcanal@...lia.com,
 airlied@...hat.com,
 zhiw@...dia.com,
 cjia@...dia.com,
 jhubbard@...dia.com,
 Miguel Ojeda <ojeda@...nel.org>,
 Alex Gaynor <alex.gaynor@...il.com>,
 Wedson Almeida Filho <wedsonaf@...il.com>,
 Boqun Feng <boqun.feng@...il.com>,
 Gary Guo <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>,
 Benno Lossin <benno.lossin@...ton.me>,
 Andreas Hindborg <a.hindborg@...sung.com>,
 Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>,
 Danilo Krummrich <dakr@...hat.com>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [WIP RFC v2 31/35] rust: drm: Add Device::event_lock()

Hi Lyude,

> On 30 Sep 2024, at 20:10, Lyude Paul <lyude@...hat.com> wrote:
> 
> This is just a crate-private helper to use Lock::from_raw() to provide an
> immutable reference to the DRM event_lock, so that it can be used like a
> normal rust spinlock. We'll need this for adding vblank related bindings.
> 
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> ---
> rust/kernel/drm/device.rs | 7 +++++++
> 1 file changed, 7 insertions(+)
> 
> diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs
> index d4d6b1185f6a6..207e7ea87cf8f 100644
> --- a/rust/kernel/drm/device.rs
> +++ b/rust/kernel/drm/device.rs
> @@ -15,6 +15,7 @@
>     error::from_err_ptr,
>     error::Result,
>     types::{ARef, AlwaysRefCounted, ForeignOwnable, Opaque},
> +    sync::*,
> };
> use core::{
>     ffi::c_void,
> @@ -159,6 +160,12 @@ pub fn data(&self) -> <T::Data as ForeignOwnable>::Borrowed<'_> {
>         unsafe { <T::Data as ForeignOwnable>::from_foreign(drm.raw_data()) };
>     }
> 
> +    /// Returns a reference to the `event` spinlock
> +    pub(crate) fn event_lock(&self) -> &SpinLockIrq<()> {
> +        // SAFETY: `event_lock` is initialized for as long as `self` is exposed to users
> +        unsafe { SpinLockIrq::from_raw(&mut (*self.as_raw()).event_lock) }
> +    }
> +

I see this depends on your SpinLockIrq series, which I will get to later. I will defer any comments
until then.

>     pub(crate) const fn has_kms() -> bool {
>         <T::Kms as KmsImplPrivate>::MODE_CONFIG_OPS.is_some()
>     }
> -- 
> 2.46.1
> 
> 

— Daniel


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ