* [PATCH] rust: add helper for mutex_trylock
@ 2025-05-28 8:34 Paolo Bonzini
2025-05-28 9:39 ` Miguel Ojeda
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Paolo Bonzini @ 2025-05-28 8:34 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: rust-for-linux, ojeda, Stephen Rothwell
After commit c5b6ababd21a ("locking/mutex: implement mutex_trylock_nested",
currently in the KVM tree) mutex_trylock() will be a macro when lockdep is
enabled. Rust therefore needs the corresponding helper. Just add it and
the rust/bindings/bindings_helpers_generated.rs Makefile rules will do
their thing.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Ok to apply to the KVM tree?
rust/helpers/mutex.c | 5 +++++
1 files changed, 5 insertions(+)
diff a/rust/helpers/mutex.c b/rust/helpers/mutex.c
index 06575553eda5,06575553eda5..9ab29104bee1
--- a/rust/helpers/mutex.c
+++ b/rust/helpers/mutex.c
@@ -7,6 +7,11 @@ void rust_helper_mutex_lock(struct mute
mutex_lock(lock);
}
+int rust_helper_mutex_trylock(struct mutex *lock)
+{
+ return mutex_trylock(lock);
+}
+
void rust_helper___mutex_init(struct mutex *mutex, const char *name,
struct lock_class_key *key)
{
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: add helper for mutex_trylock
2025-05-28 8:34 [PATCH] rust: add helper for mutex_trylock Paolo Bonzini
@ 2025-05-28 9:39 ` Miguel Ojeda
2025-05-28 14:51 ` Boqun Feng
2025-05-28 10:23 ` Alice Ryhl
2025-05-28 16:08 ` mlevitsk
2 siblings, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2025-05-28 9:39 UTC (permalink / raw)
To: Paolo Bonzini, Boqun Feng
Cc: linux-kernel, kvm, rust-for-linux, ojeda, Stephen Rothwell
On Wed, May 28, 2025 at 10:34 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Ok to apply to the KVM tree?
Yeah, looks good to me, thanks!
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Cc'ing Boqun just in case and so that he is aware. Boqun: this fixes a
Rust build error on the kvm branch which failed on merging into -next:
https://lore.kernel.org/linux-next/20250528152832.3ce43330@canb.auug.org.au/
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: add helper for mutex_trylock
2025-05-28 8:34 [PATCH] rust: add helper for mutex_trylock Paolo Bonzini
2025-05-28 9:39 ` Miguel Ojeda
@ 2025-05-28 10:23 ` Alice Ryhl
2025-05-28 16:08 ` mlevitsk
2 siblings, 0 replies; 5+ messages in thread
From: Alice Ryhl @ 2025-05-28 10:23 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, rust-for-linux, ojeda, Stephen Rothwell
On Wed, May 28, 2025 at 10:34:30AM +0200, Paolo Bonzini wrote:
> After commit c5b6ababd21a ("locking/mutex: implement mutex_trylock_nested",
> currently in the KVM tree) mutex_trylock() will be a macro when lockdep is
> enabled. Rust therefore needs the corresponding helper. Just add it and
> the rust/bindings/bindings_helpers_generated.rs Makefile rules will do
> their thing.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: add helper for mutex_trylock
2025-05-28 9:39 ` Miguel Ojeda
@ 2025-05-28 14:51 ` Boqun Feng
0 siblings, 0 replies; 5+ messages in thread
From: Boqun Feng @ 2025-05-28 14:51 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Paolo Bonzini, linux-kernel, kvm, rust-for-linux, ojeda,
Stephen Rothwell
On Wed, May 28, 2025 at 11:39:12AM +0200, Miguel Ojeda wrote:
> On Wed, May 28, 2025 at 10:34 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > Ok to apply to the KVM tree?
>
> Yeah, looks good to me, thanks!
>
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
>
> Cc'ing Boqun just in case and so that he is aware. Boqun: this fixes a
> Rust build error on the kvm branch which failed on merging into -next:
>
> https://lore.kernel.org/linux-next/20250528152832.3ce43330@canb.auug.org.au/
>
Thank you both!
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Regards,
Boqun
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: add helper for mutex_trylock
2025-05-28 8:34 [PATCH] rust: add helper for mutex_trylock Paolo Bonzini
2025-05-28 9:39 ` Miguel Ojeda
2025-05-28 10:23 ` Alice Ryhl
@ 2025-05-28 16:08 ` mlevitsk
2 siblings, 0 replies; 5+ messages in thread
From: mlevitsk @ 2025-05-28 16:08 UTC (permalink / raw)
To: Paolo Bonzini, linux-kernel, kvm; +Cc: rust-for-linux, ojeda, Stephen Rothwell
On Wed, 2025-05-28 at 10:34 +0200, Paolo Bonzini wrote:
> After commit c5b6ababd21a ("locking/mutex: implement mutex_trylock_nested",
> currently in the KVM tree) mutex_trylock() will be a macro when lockdep is
> enabled. Rust therefore needs the corresponding helper. Just add it and
> the rust/bindings/bindings_helpers_generated.rs Makefile rules will do
> their thing.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Hi,
Sorry for that.
Next time I'll check rust bindings as well, I never had to deal with them before.
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Best regards,
Maxim Levitsky
> ---
> Ok to apply to the KVM tree?
>
> rust/helpers/mutex.c | 5 +++++
> 1 files changed, 5 insertions(+)
>
> diff a/rust/helpers/mutex.c b/rust/helpers/mutex.c
> index 06575553eda5,06575553eda5..9ab29104bee1
> --- a/rust/helpers/mutex.c
> +++ b/rust/helpers/mutex.c
> @@ -7,6 +7,11 @@ void rust_helper_mutex_lock(struct mute
> mutex_lock(lock);
> }
>
> +int rust_helper_mutex_trylock(struct mutex *lock)
> +{
> + return mutex_trylock(lock);
> +}
> +
> void rust_helper___mutex_init(struct mutex *mutex, const char *name,
> struct lock_class_key *key)
> {
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-05-28 16:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 8:34 [PATCH] rust: add helper for mutex_trylock Paolo Bonzini
2025-05-28 9:39 ` Miguel Ojeda
2025-05-28 14:51 ` Boqun Feng
2025-05-28 10:23 ` Alice Ryhl
2025-05-28 16:08 ` mlevitsk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).