From: Thomas Gleixner <tglx@linutronix.de>
To: Jeff Layton <jlayton@kernel.org>,
John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>,
linux-kernel@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: Re: [PATCH v2] timekeeping: don't use seqcount loop in ktime_mono_to_any on 64-bit systems
Date: Tue, 10 Sep 2024 19:46:02 +0200 [thread overview]
Message-ID: <87jzfj9zc5.ffs@tglx> (raw)
In-Reply-To: <20240910-mgtime-v2-1-e96826ac56f0@kernel.org>
On Tue, Sep 10 2024 at 08:55, Jeff Layton wrote:
> ktime_mono_to_any only fetches the offset inside the loop. This is a
> single word on 64-bit hosts, and seqcount_read_begin implies a full SMP
> barrier.
>
> When BITS_PER_LONG == 64, just do a simple ktime_add instead as there
> is no possibility of getting a torn offset value.
>
> Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> Thanks for the review so far, Thomas! Hopefully this looks better.
> Disregard my earlier question about making this a static inline too.
> That would require making offsets[] a global symbol, which I don't think
> we want to do.
This still fails to address these:
> Please describe functions with foo() and not foo.
> Which will make KCSAN complain ...
>
> So yes, READ_ONCE() is the correct thing todo, but then we want to have
> the counterpart at the write sides.
KCSAN requires this to be annotated and it's also a good documentation
that this is a intentional unprotected access.
Thanks,
tglx
prev parent reply other threads:[~2024-09-10 17:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 12:55 [PATCH v2] timekeeping: don't use seqcount loop in ktime_mono_to_any on 64-bit systems Jeff Layton
2024-09-10 17:46 ` Thomas Gleixner [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=87jzfj9zc5.ffs@tglx \
--to=tglx@linutronix.de \
--cc=jlayton@kernel.org \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=vadim.fedorenko@linux.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