linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Bjorn Andersson" <andersson@kernel.org>
Cc: "Matthew Maurer" <mmaurer@google.com>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Satya Durga Srinivasu Prabhala" <satyap@quicinc.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Trilok Soni" <tsoni@quicinc.com>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH RFC] soc: qcom: socinfo: Re-implement in Rust
Date: Wed, 17 Dec 2025 19:35:18 +0100	[thread overview]
Message-ID: <DF0PIORGZZ4L.30S2XEKT9V1D4@kernel.org> (raw)
In-Reply-To: <nqao3h3a45aw74bpvleqpx4iqmsjcxdjgvegyafnhvk2vtwwz4@n37vq7lsgzrr>

On Wed Dec 17, 2025 at 12:13 AM CET, Bjorn Andersson wrote:
> On Tue, Dec 16, 2025 at 02:13:08PM -0800, Matthew Maurer wrote:
>> Rust likely does not provide any significant benefits for the socinfo
>> driver itself, aside from having caught the slight disconnect
>> (mentioned on the other thread) where it should probably be an
>> auxiliary device because it assumes that the `qcom-smem` device will
>> remain active as long as it does.

I want to highlight that this is an existing issue in the C driver that has been
caught in Rust by the language itself.

However, a Rust implementation of this driver ensures correctness for much more
potential pitfalls. For instance, the C debugfs infrastructure requires the user
to ensure that the exported data remains alive for the duration it is exposed
via debugfs. In Rust, it is not possible to violate this lifetime relationship
without producing a compile time error.

This is just one example, and I assume there are many more (I haven't read the
full patch). Maybe Matthew can chime in again and give some more examples.

Again I haven't read the full patch in detail, but it is obvious that is a
fairly trivial driver. Yet I think there is room bugs / mistakes that can be
caught by a Rust implementation.

>> 
>
> Yes, this isn't unique to Rust.

The auxiliary bus and the corresponding lifetime guarantees are not unique to
Rust. However, with Rust's type system and the corresponding implementation of
the driver model in Rust we can ensure (at compile time) that driver
implementations remain within the given boundaries of those lifetime guarantees.

This is a siginificant advantage -- violations of drivers using device resources
after device / driver unbind is a very common source of mistakes. Most of them
we can catch at compile time in Rust drivers.

- Danilo

      parent reply	other threads:[~2025-12-17 18:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <x2HszWYqUaRfzLW8I1wOegJRSBRXVUzqafU9O_QLG1E-OjqkyUPQKn-jM9dzhvsgMW_M0NGXvrgEkN0p9mV7ww==@protonmail.internalid>
2025-12-13  0:36 ` [PATCH RFC] soc: qcom: socinfo: Re-implement in Rust Matthew Maurer
2025-12-13  2:50   ` Bryan O'Donoghue
2025-12-13  3:01     ` Miguel Ojeda
2025-12-13  3:54   ` Dmitry Baryshkov
2025-12-13 16:58     ` Matthew Maurer
2025-12-15 12:11       ` Gary Guo
2025-12-15 19:44       ` Dmitry Baryshkov
2025-12-16  0:55         ` Matthew Maurer
2025-12-16  9:45           ` Danilo Krummrich
2025-12-13 13:27   ` Greg KH
2025-12-13 16:26     ` Matthew Maurer
2025-12-13 17:11       ` Matthew Maurer
2025-12-13 13:57   ` Greg KH
2025-12-13 16:24     ` Matthew Maurer
2025-12-13 17:08       ` Matthew Maurer
2025-12-16 21:00       ` Bjorn Andersson
2025-12-16 20:55         ` Matthew Maurer
2025-12-16 22:14           ` Bjorn Andersson
2025-12-16 22:32             ` Matthew Maurer
2025-12-16 20:57   ` Bjorn Andersson
2025-12-16 20:53     ` Matthew Maurer
2025-12-16 22:01       ` Bjorn Andersson
2025-12-16 22:13         ` Matthew Maurer
2025-12-16 23:13           ` Bjorn Andersson
2025-12-16 23:32             ` Matthew Maurer
2025-12-17  0:23               ` Bjorn Andersson
2025-12-17  0:27                 ` Matthew Maurer
2025-12-17 18:35             ` Danilo Krummrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DF0PIORGZZ4L.30S2XEKT9V1D4@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=andersson@kernel.org \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mmaurer@google.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=satyap@quicinc.com \
    --cc=tmgross@umich.edu \
    --cc=tsoni@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).