rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: "Boqun Feng" <boqun.feng@gmail.com>
Cc: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Frederic Weisbecker" <frederic@kernel.org>,
	"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Lyude Paul" <lyude@redhat.com>,
	"Guangbo Cui" <2407018371@qq.com>,
	"Dirk Behme" <dirk.behme@gmail.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Miguel Ojeda" <ojeda@kernel.org>
Subject: Re: [PATCH v9 01/13] rust: hrtimer: introduce hrtimer support
Date: Tue, 25 Feb 2025 06:50:01 +0100	[thread overview]
Message-ID: <875xkyzi7q.fsf@kernel.org> (raw)
In-Reply-To: <Z7zVE_CvmIVukkXB@boqun-archlinux> (Boqun Feng's message of "Mon, 24 Feb 2025 12:22:43 -0800")

"Boqun Feng" <boqun.feng@gmail.com> writes:

> On Mon, Feb 24, 2025 at 08:52:35PM +0100, Andreas Hindborg wrote:
>> "Boqun Feng" <boqun.feng@gmail.com> writes:
>>
>> > On Mon, Feb 24, 2025 at 07:58:04PM +0100, Andreas Hindborg wrote:
>> >> > On Mon, Feb 24, 2025 at 05:45:03PM +0100, Miguel Ojeda wrote:
>> >> >> On Mon, Feb 24, 2025 at 5:31 PM Boqun Feng <boqun.feng@gmail.com> wrote:
>> >> >> >
>> >> >> > On Mon, Feb 24, 2025 at 05:23:59PM +0100, Miguel Ojeda wrote:
>> >> >> > >
>> >> >> > > side -- Andreas and I discussed it the other day. The description of
>> >> >> > > the issue has some lines, but perhaps the commit message could
>> >> >> >
>> >> >> > Do you have a link to the issue?
>> >> >>
>> >> >> Sorry, I meant "description of the symbol", i.e. the description field
>> >> >> in the patch.
>> >> >>
>> >> >
>> >> > Oh, I see. Yes, the patch description should provide more information
>> >> > about what the kconfig means for hrtimer maintainers' development.
>> >>
>> >> Right, I neglected to update the commit message. I will do that if we
>> >> have another version.
>> >>
>> >> >
>> >> >> > I asked because hrtimer API is always available regardless of the
>> >> >> > configuration, and it's such a core API, so it should always be there
>> >> >> > (Rust or C).
>> >> >>
>> >> >> It may not make sense for something that is always built on the C
>> >> >> side, yeah. I think the intention here may be that one can easily
>> >> >> disable it while "developing" a change on the C side. I am not sure
>> >> >> what "developing" means here, though, and we need to be careful --
>> >> >> after all, Kconfig options are visible to users and they do not care
>> >> >> about that.
>> >> >>
>> >> >
>> >> > Personally, I don't think CONFIG_RUST_HRTIMER is necessarily because as
>> >> > you mentioned below, people can disable Rust entirely during
>> >> > "developing".
>> >> >
>> >> > And if I understand the intention correctly, the CONFIG_RUST_HRTIMER
>> >> > config provides hrtimer maintainers a way that they could disable Rust
>> >> > hrtimer abstraction (while enabling other Rust component) when they're
>> >> > developing a change on the C side, right? If so, it's hrtimer
>> >> > maintainers' call, and this patch should provide more information on
>> >> > this.
>> >> >
>> >> > Back to my personal opinion, I don't think this is necessary ;-)
>> >> > Particularly because I can fix if something breaks Rust side, and I'm
>> >> > confident and happy to do so for hrtimer ;-)
>> >>
>> >> As Miguel said, the idea for this came up in the past week in one of the
>> >> mega threads discussing rust in general. We had a lot of "what happens
>> >> if I change something in my subsystem and that breaks rust" kind of
>> >> discussions.
>> >>
>> >
>> > So far we haven't heard such a question from hrtimer maintainers, I
>> > would only add such a kconfig if explicitly requested.
>>
>> It gives flexibility and has no negative side effects. Of course, if it
>
> The negative side effects that I can think of:
>
> * It doubles the work for testing, it's a Kconfig after all, so every
>   reasonable test run will have to run at least one build with it and
>   one build without it combined with other configs.
>
> * It may compelicate other component. For example, if I would like
>   use hrtimer in a doc test of a lock component (the component itself
>   doesn't depend on hrtimer, so it exists with CONFIG_RUST_HRTIMER=n),
>   because I would like to unlock something after a certain time. Now
>   since CONFIG_RUST_HRTIMER can be unset, how would I write the test?
>
>   #[cfg(CONFIG_RUST_HRTIMER)]
>   <use the Rust timer>
>   #[cfg(not(CONFIG_RUST_HRTIMER))]
>   <use the C timer? with unsafe??>
>
> A new kconfig is not something free. We will need to cope with it in
> multiple places.

Alright, those are valid arguments.

>
>> is unwanted, we can just remove it. But I would like to understand the
>> deeper rationale.
>>
>>
>> >
>> >> For subsystems where the people maintaining the C subsystem is not the
>> >> same people maintaining the Rust abstractions, this switch might be
>> >> valuable. It would allow making breaking changes to the C code of a
>> >> subsystem without refactoring the Rust code in the same sitting. Rather
>> >
>> > That's why I asked Frederic to be a reviewer of Rust hrtimer API. In
>> > longer-term, more and more people will get more or less Rust knowledge,
>> > and I'd argue that's the direction we should head to. So my vision is a
>> > significant amount of core kernel developers would be able to make C and
>> > Rust changes at the same time. It's of course not mandatory, but it's
>> > better collaboration.
>>
>> Having this switch does not prevent longer term plans or change
>> directions of anything. It's simply a convenience feature made
>> available. I also expect the future you envision. But it is an
>> envisioned _future_. It is not the present reality.
>>
>
> The reality is: we haven't heard hrtimer maintainers ask for this,
> right? I know you're trying to do something nice, I do appreciate your
> intention, but if hrtimer maintainers haven't asked for this, maybe it
> implies that they can handle or trust that wouldn't be a problem?

Thanks for explaining.

For reference, we do not have this feature in block, and it was not a
problem yet.

Let's await hrtimer maintainers and follow their lead.



Best regards,
Andreas Hindborg



  reply	other threads:[~2025-02-25  5:50 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 12:03 [PATCH v9 00/13] hrtimer Rust API Andreas Hindborg
2025-02-24 12:03 ` [PATCH v9 01/13] rust: hrtimer: introduce hrtimer support Andreas Hindborg
2025-02-24 13:19   ` Andreas Hindborg
2025-02-24 15:46     ` Boqun Feng
2025-02-24 16:23       ` Miguel Ojeda
2025-02-24 16:31         ` Boqun Feng
2025-02-24 16:45           ` Miguel Ojeda
2025-02-24 17:01             ` Boqun Feng
2025-02-24 18:58               ` Andreas Hindborg
2025-02-24 19:18                 ` Boqun Feng
2025-02-24 19:52                   ` Andreas Hindborg
2025-02-24 20:22                     ` Boqun Feng
2025-02-25  5:50                       ` Andreas Hindborg [this message]
2025-02-26 16:31                     ` Frederic Weisbecker
2025-02-26 19:41                       ` Andreas Hindborg
2025-02-24 20:04   ` Tamir Duberstein
2025-02-25  8:52     ` Andreas Hindborg
2025-02-25 15:37       ` Tamir Duberstein
2025-02-25 19:12         ` Andreas Hindborg
2025-02-25 20:13           ` Tamir Duberstein
2025-02-26 11:48             ` Andreas Hindborg
2025-02-26 15:29               ` Tamir Duberstein
2025-03-07  9:09                 ` Andreas Hindborg
2025-02-25 11:36   ` Markus Elfring
2025-02-25 12:13     ` Andreas Hindborg
2025-02-27  8:31   ` Thomas Gleixner
2025-02-27 10:44     ` Andreas Hindborg
2025-02-24 12:03 ` [PATCH v9 02/13] rust: sync: add `Arc::as_ptr` Andreas Hindborg
2025-02-24 12:03 ` [PATCH v9 03/13] rust: hrtimer: implement `HrTimerPointer` for `Arc` Andreas Hindborg
2025-02-24 23:13   ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 04/13] rust: hrtimer: allow timer restart from timer handler Andreas Hindborg
2025-02-24 23:23   ` Lyude Paul
2025-02-25  8:58     ` Andreas Hindborg
2025-02-25 21:46       ` Lyude Paul
2025-02-26 13:43         ` Andreas Hindborg
2025-02-26 19:26           ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 05/13] rust: hrtimer: add `UnsafeHrTimerPointer` Andreas Hindborg
2025-02-24 23:24   ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 06/13] rust: hrtimer: add `hrtimer::ScopedHrTimerPointer` Andreas Hindborg
2025-02-24 23:25   ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 07/13] rust: hrtimer: implement `UnsafeHrTimerPointer` for `Pin<&T>` Andreas Hindborg
2025-02-24 23:32   ` Lyude Paul
2025-02-25  9:01     ` Andreas Hindborg
2025-02-24 12:03 ` [PATCH v9 08/13] rust: hrtimer: implement `UnsafeHrTimerPointer` for `Pin<&mut T>` Andreas Hindborg
2025-02-24 23:33   ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 09/13] rust: alloc: add `Box::into_pin` Andreas Hindborg
2025-02-24 23:34   ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 10/13] rust: hrtimer: implement `HrTimerPointer` for `Pin<Box<T>>` Andreas Hindborg
2025-02-24 23:37   ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 11/13] rust: hrtimer: add `HrTimerMode` Andreas Hindborg
2025-02-24 23:40   ` Lyude Paul
2025-02-25  9:04     ` Andreas Hindborg
2025-02-25 21:49       ` Lyude Paul
2025-02-24 12:03 ` [PATCH v9 12/13] rust: hrtimer: add clocksource selection through `ClockSource` Andreas Hindborg
2025-02-24 23:42   ` Lyude Paul
2025-02-27  9:11   ` Thomas Gleixner
2025-02-27  9:24     ` Thomas Gleixner
2025-02-27 11:18     ` Andreas Hindborg
2025-02-27 14:22       ` Thomas Gleixner
2025-02-27 16:03         ` Andreas Hindborg
2025-02-24 12:03 ` [PATCH v9 13/13] rust: hrtimer: add maintainer entry Andreas Hindborg
2025-02-24 15:44   ` Boqun Feng
2025-02-26 16:17     ` Frederic Weisbecker
2025-02-26 19:42       ` Andreas Hindborg
2025-02-26 19:49       ` Lyude Paul
2025-02-26 21:08         ` Andreas Hindborg
2025-02-27  9:12       ` Thomas Gleixner
2025-02-27 10:45         ` Andreas Hindborg
2025-02-24 23:43   ` Lyude Paul

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=875xkyzi7q.fsf@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=2407018371@qq.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=anna-maria@linutronix.de \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dirk.behme@gmail.com \
    --cc=frederic@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@gmail.com \
    --cc=tglx@linutronix.de \
    --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).