[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DB2F98GJQMTL.3UMZTA6FR7BA@kernel.org>
Date: Thu, 03 Jul 2025 14:34:13 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Alice Ryhl"
<aliceryhl@...gle.com>
Cc: "Danilo Krummrich" <dakr@...nel.org>, "Matthew Maurer"
<mmaurer@...gle.com>, "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor"
<alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Andreas Hindborg" <a.hindborg@...nel.org>,
"Trevor Gross" <tmgross@...ch.edu>, "Rafael J. Wysocki"
<rafael@...nel.org>, "Sami Tolvanen" <samitolvanen@...gle.com>, "Timur
Tabi" <ttabi@...dia.com>, <linux-kernel@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, "Dirk Behme" <dirk.behme@...bosch.com>
Subject: Re: [PATCH v8 4/6] rust: debugfs: Support arbitrary owned backing
for File
On Thu Jul 3, 2025 at 1:41 PM CEST, Greg Kroah-Hartman wrote:
> On Thu, Jul 03, 2025 at 12:54:18PM +0200, Alice Ryhl wrote:
>> On Thu, Jul 3, 2025 at 12:33 PM Benno Lossin <lossin@...nel.org> wrote:
>> > How would your example look like with the current approach? IIUC, it
>> > also wouldn't work, because the debugfs data can't be mutated?
>>
>> I would store a bunch of `File<Arc<Process>>` instances somewhere.
>> Each one has a closure that takes the spinlock and prints the
>> appropriate value.
But you could also do that with the pin-init design?
> Ok, I think we need to see some "real" examples here of the api in use
> before figuring it out further as I'm totally confused :)
Agreed :)
> Yes, we need to be able to have a debugfs file callback handle a mutable
> structure in order to lock things correctly.
To me this seems orthogonal to storing the value in-place or in a
`ForeignOwnable`.
> We also need to have it be mutable so that it can MODIFY the value
> (everyone seems to forget that debugfs allows that...)
Well that changes things a lot IMO... How does the C side usually handle
synchronization here? Does the driver decide that the structure exposed
to debugfs is locked with eg a spinlock and then in the debugfs callback
they just lock the same one?
---
Cheers,
Benno
> So how about a platform driver that exposes values read from a platform
> device (i.e. a soc info driver), that also includes a
> local-to-the-device data structure that can be locked and modified?
> That should cover all the use cases that I can think of at the moment.
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists