From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "Richard Cochran" <richardcochran@gmail.com>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Arnd Bergmann" <arnd@arndb.de>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Tianfei Zhang" <tianfei.zhang@intel.com>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>,
"Vadim Fedorenko" <vadim.fedorenko@linux.dev>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Calvin Owens" <calvin@wbinvd.org>,
"Philipp Stanner" <pstanner@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fpga@vger.kernel.org
Subject: Re: [PATCH] RFC: ptp: add comment about register access race
Date: Thu, 27 Feb 2025 17:23:48 +0200 [thread overview]
Message-ID: <Z8CDhIN5vhcSm1ge@smile.fi.intel.com> (raw)
In-Reply-To: <20250227141749.3767032-1-arnd@kernel.org>
On Thu, Feb 27, 2025 at 03:17:27PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> While reviewing a patch to the ioread64_hi_lo() helpers, I noticed
> that there are several PTP drivers that use multiple register reads
> to access a 64-bit hardware register in a racy way.
>
> There are usually safe ways of doing this, but at least these four
> drivers do that. A third register read obviously makes the hardware
> access 50% slower. If the low word counds nanoseconds and a single
> register read takes on the order of 1µs, the resulting value is
> wrong in one of 4 million cases, which is pretty rare but common
> enough that it would be observed in practice.
...
> Sorry I hadn't sent this out as a proper patch so far. Any ideas
> what we should do here?
Actually this reminds me one of the discussion where it was some interesting
HW design that latches the value on the first read of _low_ part (IIRC), but
I might be mistaken with the details.
That said, it's from HW to HW, it might be race-less in some cases.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-02-27 15:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 14:17 [PATCH] RFC: ptp: add comment about register access race Arnd Bergmann
2025-02-27 15:23 ` Andy Shevchenko [this message]
2025-03-02 20:55 ` Richard Cochran
2025-03-03 7:50 ` Andy Shevchenko
2025-03-04 4:09 ` Richard Cochran
2025-03-04 8:24 ` Arnd Bergmann
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=Z8CDhIN5vhcSm1ge@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=calvin@wbinvd.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathan.lemon@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pstanner@redhat.com \
--cc=richardcochran@gmail.com \
--cc=thomas.weissschuh@linutronix.de \
--cc=tianfei.zhang@intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.