mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: FUJITA Tomonori <tomo@flapping.org>
To: a.hindborg@kernel.org
Cc: tomo@flapping.org, boqun@kernel.org, fujita.tomonori@gmail.com,
	frederic@kernel.org, lyude@redhat.com, tglx@kernel.org,
	anna-maria@linutronix.de, jstultz@google.com, sboyd@kernel.org,
	ojeda@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com,
	lossin@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
	dakr@kernel.org, daniel.almeida@collabora.com, tamird@kernel.org,
	acourbot@nvidia.com, work@onurozkan.dev,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] rust: hrtimer: add active() method to query timer state
Date: Sat, 14 Nov 2026 22:38:16 +0900 (JST)	[thread overview]
Message-ID: <20261114.223816.1091200428221776094.tomo@flapping.org> (raw)
In-Reply-To: <87wlqiv386.fsf@t14s.mail-host-address-is-not-set>

On Thu, 12 Nov 2026 09:55:05 +0100
Andreas Hindborg <a.hindborg@kernel.org> wrote:

> FUJITA Tomonori <tomo@flapping.org> writes:
>
>>> +    /// Query the state of the timer.
>>> +    ///
>>> +    /// Returns [`true`] if the timer is in the started or running states.
>>> +    ///
>>> +    /// This method synchronizes internally and does not require exclusive access to the timer.
>>> +    ///
>>> +    /// The returned value is a snapshot. A concurrent start or expiry can change the state of the
>>> +    /// timer right after this method returns, so callers that need the state to be stable must
>>> +    /// serialize against those operations by other means.
>>
>> Does "expiry" here mean that the callback returns HrTimerRestart::NoRestart
>> on another CPU? An expiry alone moves the timer from started to running, so
>> active() still returns true. If so, I think it is clearer to write this case
>> directly, and to add the case where the timer is canceled on another CPU.
>>
>> The same sentence is in the commit message, so please update it too.
> 
> Right. How about this:
> 
>   The returned value is a snapshot. A concurrent evnet can change the state of the
>   timer right after this method returns, so callers that need the state to be stable must
>   serialize against those operations by other means.
> 
> The intention is not to reiterate the state machine, but to indicate
> that things might changes.

Looks good to me, except for one small point. Since "start or expiry"
was removed, it's not clear what "those operations" refers to. How
about something like:

  must serialize against such events by other means.

Also typo: evnet -> event


      reply	other threads:[~2026-11-14 13:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 10:17 Andreas Hindborg
2026-11-05 11:11 ` FUJITA Tomonori
2026-11-12  8:55   ` Andreas Hindborg
2026-11-14 13:38     ` FUJITA Tomonori [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=20261114.223816.1091200428221776094.tomo@flapping.org \
    --to=tomo@flapping.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=anna-maria@linutronix.de \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=frederic@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tamird@kernel.org \
    --cc=tglx@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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

all inboxes | Powered by JetHome®