public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the tip tree
@ 2025-10-22  0:46 Stephen Rothwell
  2025-10-22  2:18 ` Boqun Feng
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2025-10-22  0:46 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra
  Cc: Boqun Feng, Daniel Almeida, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

error[E0594]: cannot assign to data in dereference of `lock::Guard<'_, T, MutexBackend>`
  --> rust/kernel/debugfs/traits.rs:64:9
   |
64 |         *self.lock() = val;
   |         ^^^^^^^^^^^^ cannot assign
   |
   = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `lock::Guard<'_, T, MutexBackend>`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0594`.

Caused by commit

  da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut")

I have used the tip tree from next-20251021 for today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: build failure after merge of the tip tree
  2025-10-22  0:46 linux-next: build failure after merge of the tip tree Stephen Rothwell
@ 2025-10-22  2:18 ` Boqun Feng
  2025-10-22  2:51   ` Boqun Feng
  0 siblings, 1 reply; 6+ messages in thread
From: Boqun Feng @ 2025-10-22  2:18 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Daniel Almeida, Linux Kernel Mailing List,
	Linux Next Mailing List

On Wed, Oct 22, 2025 at 11:46:44AM +1100, Stephen Rothwell wrote:
> Hi all,
> 

Hi Stephen,

Thanks for reporting this.

Cc Mathhew and Danilo,

> After merging the tip tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
> 
> error[E0594]: cannot assign to data in dereference of `lock::Guard<'_, T, MutexBackend>`
>   --> rust/kernel/debugfs/traits.rs:64:9
>    |
> 64 |         *self.lock() = val;
>    |         ^^^^^^^^^^^^ cannot assign
>    |
>    = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `lock::Guard<'_, T, MutexBackend>`
> 

Could we make the `impl Reader` for `Mutex<T>` to bound where `T:
Unpin`? Since `Mutex<T>` is structurally pinning `T`, you cannot use
`*self.lock()` to overwrite `T` directly. And that'll fix this.

Thanks!

Regards,
Boqun

> error: aborting due to 1 previous error
> 
> For more information about this error, try `rustc --explain E0594`.
> 
> Caused by commit
> 
>   da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut")
> 
> I have used the tip tree from next-20251021 for today.
> 
> -- 
> Cheers,
> Stephen Rothwell



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

* Re: linux-next: build failure after merge of the tip tree
  2025-10-22  2:18 ` Boqun Feng
@ 2025-10-22  2:51   ` Boqun Feng
  2025-10-22  3:42     ` [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin Boqun Feng
  0 siblings, 1 reply; 6+ messages in thread
From: Boqun Feng @ 2025-10-22  2:51 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Daniel Almeida, Linux Kernel Mailing List,
	Linux Next Mailing List, Matthew Maurer, Danilo Krummrich

On Tue, Oct 21, 2025 at 10:18:58PM -0400, Boqun Feng wrote:
> On Wed, Oct 22, 2025 at 11:46:44AM +1100, Stephen Rothwell wrote:
> > Hi all,
> > 
> 
> Hi Stephen,
> 
> Thanks for reporting this.
> 
> Cc Mathhew and Danilo,
> 

(now really Cc them...)

Regards,
Boqun

> > After merging the tip tree, today's linux-next build (x86_64 allmodconfig)
> > failed like this:
> > 
> > error[E0594]: cannot assign to data in dereference of `lock::Guard<'_, T, MutexBackend>`
> >   --> rust/kernel/debugfs/traits.rs:64:9
> >    |
> > 64 |         *self.lock() = val;
> >    |         ^^^^^^^^^^^^ cannot assign
> >    |
> >    = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `lock::Guard<'_, T, MutexBackend>`
> > 
> 
> Could we make the `impl Reader` for `Mutex<T>` to bound where `T:
> Unpin`? Since `Mutex<T>` is structurally pinning `T`, you cannot use
> `*self.lock()` to overwrite `T` directly. And that'll fix this.
> 
> Thanks!
> 
> Regards,
> Boqun
> 
> > error: aborting due to 1 previous error
> > 
> > For more information about this error, try `rustc --explain E0594`.
> > 
> > Caused by commit
> > 
> >   da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut")
> > 
> > I have used the tip tree from next-20251021 for today.
> > 
> > -- 
> > Cheers,
> > Stephen Rothwell
> 
> 

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

* [PATCH] rust: debugfs: Implement Reader for Mutex<T> only when T is Unpin
  2025-10-22  2:51   ` Boqun Feng
@ 2025-10-22  3:42     ` Boqun Feng
  2025-10-22  9:07       ` Danilo Krummrich
  0 siblings, 1 reply; 6+ 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] 6+ 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; 6+ 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] 6+ 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; 6+ 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] 6+ messages in thread

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22  0:46 linux-next: build failure after merge of the tip tree Stephen Rothwell
2025-10-22  2:18 ` Boqun Feng
2025-10-22  2:51   ` Boqun Feng
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