rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin
       [not found] <aPhGo5WjbPM1Yu95@tardis-2.local>
@ 2025-10-22  3:42 ` Boqun Feng
  2025-10-22  9:07   ` Danilo Krummrich
  0 siblings, 1 reply; 3+ messages in thread
From: Boqun Feng @ 2025-10-22  3:42 UTC (permalink / raw)
  To: Peter Zijlstra, Daniel Almeida, Matthew Maurer, Danilo Krummrich
  Cc: Stephen Rothwell, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	linux-kernel, linux-next, Miguel Ojeda, Alex Gaynor, Boqun Feng,
	Gary Guo, lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	rust-for-linux

Since we are going to make `Mutex<T>` structurally pin the data (i.e.
`T`), therefore `.lock()` function only returns a `Guard` that can
dereference a mutable reference to `T` if only `T` is `Unpin`, therefore
restrict the impl `Reader` block of `Mutex<T>` to that.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 rust/kernel/debugfs/traits.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/debugfs/traits.rs b/rust/kernel/debugfs/traits.rs
index ab009eb254b3..ba7ec5a900b8 100644
--- a/rust/kernel/debugfs/traits.rs
+++ b/rust/kernel/debugfs/traits.rs
@@ -50,7 +50,7 @@ pub trait Reader {
     fn read_from_slice(&self, reader: &mut UserSliceReader) -> Result;
 }
 
-impl<T: FromStr> Reader for Mutex<T> {
+impl<T: FromStr + Unpin> Reader for Mutex<T> {
     fn read_from_slice(&self, reader: &mut UserSliceReader) -> Result {
         let mut buf = [0u8; 128];
         if reader.len() > buf.len() {
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin
  2025-10-22  3:42 ` [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin Boqun Feng
@ 2025-10-22  9:07   ` Danilo Krummrich
  2025-10-22  9:10     ` Danilo Krummrich
  0 siblings, 1 reply; 3+ messages in thread
From: Danilo Krummrich @ 2025-10-22  9:07 UTC (permalink / raw)
  To: Boqun Feng
  Cc: Peter Zijlstra, Daniel Almeida, Matthew Maurer, Stephen Rothwell,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, linux-kernel,
	linux-next, Miguel Ojeda, Alex Gaynor, Gary Guo, lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux

On 10/22/25 5:42 AM, Boqun Feng wrote:
> Since we are going to make `Mutex<T>` structurally pin the data (i.e.
> `T`), therefore `.lock()` function only returns a `Guard` that can
> dereference a mutable reference to `T` if only `T` is `Unpin`, therefore
> restrict the impl `Reader` block of `Mutex<T>` to that.
> 
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>

I assume this can go through the driver-core tree, since it's only about a
conflict in linux-next?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin
  2025-10-22  9:07   ` Danilo Krummrich
@ 2025-10-22  9:10     ` Danilo Krummrich
  0 siblings, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2025-10-22  9:10 UTC (permalink / raw)
  To: Boqun Feng
  Cc: Peter Zijlstra, Daniel Almeida, Matthew Maurer, Stephen Rothwell,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, linux-kernel,
	linux-next, Miguel Ojeda, Alex Gaynor, Gary Guo, lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux

On 10/22/25 11:07 AM, Danilo Krummrich wrote:
> On 10/22/25 5:42 AM, Boqun Feng wrote:
>> Since we are going to make `Mutex<T>` structurally pin the data (i.e.
>> `T`), therefore `.lock()` function only returns a `Guard` that can
>> dereference a mutable reference to `T` if only `T` is `Unpin`, therefore
>> restrict the impl `Reader` block of `Mutex<T>` to that.
>>
>> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> 
> I assume this can go through the driver-core tree, since it's only about a
> conflict in linux-next?

Sorry, I confused this, obviously your tree is broken without this change,
please feel free to take it.

Acked-by: Danilo Krummrich <dakr@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-22  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <aPhGo5WjbPM1Yu95@tardis-2.local>
2025-10-22  3:42 ` [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin Boqun Feng
2025-10-22  9:07   ` Danilo Krummrich
2025-10-22  9:10     ` Danilo Krummrich

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).