[PATCH v6 1/9] eal: generic 64 bit counter
Stephen Hemminger
stephen at networkplumber.org
Fri May 17 17:07:15 CEST 2024
On Fri, 17 May 2024 04:26:58 +0000
Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com> wrote:
> >
> > The C standard has always guaranteed that read and write to unsigned log will not be split.
> As I understand, this is true only if the variable is an atomic variable. If not, there is no difference between atomic variables and non-atomic variables.
Let me look.
It certainly falls under the "if a compiler did this it is crazy and would never be able to run Linux" per Linus.
>
> > Therefore if arch is 64 bit native there is no need for atomics
> At least on ARM architecture, if the variable is not aligned on 8B boundary, the load or store are not atomic. I am sure it is the same on other architectures.
> Bruce, any comments for x86?
This code needs to assume alignment to 8B. I'll document that.
But no runtime checks please.
More information about the dev
mailing list