rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"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>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Georgi Djakov" <djakov@kernel.org>,
	"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
	"Bjorn Andersson" <bjorn.andersson@oss.qualcomm.com>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/2] rust: Add initial interconnect framework abstractions
Date: Wed, 23 Jul 2025 13:32:19 +0200	[thread overview]
Message-ID: <d80ebfbb-5fb5-4dde-a79b-adb22231a63e@oss.qualcomm.com> (raw)
In-Reply-To: <CANiq72nPLn+3V_DhN9_dmKnRrb5mfjzQ67Utz7HdtOY3McpweA@mail.gmail.com>

On 7/23/25 12:42 PM, Miguel Ojeda wrote:
> Hi Konrad,
> 
> Some quick mostly doc-related comments...

[...]

>> +    /// Create a new instance from gigabytes (GB) per second
>> +    pub const fn from_gigabytes_per_sec(gbps: u32) -> Self {
>> +        Self(gbps * 1000 * 1000)
>> +    }
> 
> I guess this means callers must call this with reasonable numbers and
> otherwise it is considered a bug, right? i.e. this could overflow, and
> thus panic under `CONFIG_RUST_OVERFLOW_CHECKS=y`.

The C framework makes no effort to check for that, so panicking is at
least something.. That said, what would you suggest to do here?

[...]

>> +#[cfg(CONFIG_INTERCONNECT)]
>> +mod icc_path {
> 
> Maybe a different file?

I was debating that. icc_path represents the interconnect consumer part
(i.e. used in device drivers that just need to toggle a bus endpoint),
whereas the corresponding provider part (which manages said bus) is not
yet abstracted.

It would make logical sense to split these two.. with the latter going
to icc_provider.rs, perhaps?

[...]

>> +// SAFETY: An `IccPath` is always reference-counted and can be released from any thread.
>> +unsafe impl Send for IccPath {}
> 
> This gives an error, right? Was it meant to be inside the other Rust module?

No, it compiles fine here.. Strangely, I didn't get any warnings or 
errors with this patch. Maybe because the struct is pub and within the
same file?

Should I move it into the module scope for sanity?

> 
> Also, please also run `make .... rustfmt`.
> 
> Finally, the examples in the docs are converted automatically into
> KUnit tests (under `CONFIG_RUST_KERNEL_DOCTESTS=y`) -- the examples
> currently have build errors.

I was missing this config, yeah..

> 
> We have some extra notes at:
> 
>     https://rust-for-linux.com/contributing#submit-checklist-addendum
> 
> on things that are useful to test/check.

I almost wanna say `make rustfmt` produced slightly different results
(one or two lines of difference) than make rust-analyzer + vscode
extension.. hmm.. Perhaps PEBKAC..

Konrad

  reply	other threads:[~2025-07-23 11:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 21:14 [PATCH 0/2] Add initial interconnect (icc_path) Rust abstractions Konrad Dybcio
2025-07-22 21:14 ` [PATCH 1/2] rust: Add initial interconnect framework abstractions Konrad Dybcio
2025-07-23 10:42   ` Miguel Ojeda
2025-07-23 11:32     ` Konrad Dybcio [this message]
2025-07-23 11:41       ` Miguel Ojeda
2025-07-23 11:42         ` Miguel Ojeda
2025-07-23 11:53         ` Konrad Dybcio
2025-07-23 10:44   ` Daniel Sedlak
2025-07-23 11:36     ` Konrad Dybcio
2025-07-23 11:34   ` kernel test robot
2025-07-23 12:36   ` Daniel Almeida
2025-07-22 21:14 ` [PATCH DNM 2/2] interconnect: Add a test Rust consumer driver Konrad Dybcio
2025-07-23 13:10   ` Daniel Almeida
2025-07-23 13:22     ` Benno Lossin
2025-07-23 10:22 ` [PATCH 0/2] Add initial interconnect (icc_path) Rust abstractions Miguel Ojeda
2025-07-24 12:36   ` Konrad Dybcio
2025-07-24 15:55     ` Miguel Ojeda

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=d80ebfbb-5fb5-4dde-a79b-adb22231a63e@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn.andersson@oss.qualcomm.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=djakov@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gary@garyguo.net \
    --cc=konradybcio@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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).