Messages in this thread | | | Date | Wed, 20 Nov 2019 19:18:40 +0000 | From | Will Deacon <> | Subject | Re: [PATCH v2] buffer: Fix I/O error due to ARM read-after-read hazard |
| |
On Thu, Nov 14, 2019 at 09:28:48PM +0800, Herbert Xu wrote: > Will Deacon <will@kernel.org> wrote: > > > > which is what can happen due to this erratum. It's generally good practice > > to use READ_ONCE() when reading something which can be updated concurrently > > because: > > > > * It ensures that the value is (re-)loaded from memory > > > > * It prevents the compiler from performing harmful optimisations, > > such as merging or tearing (although in this case I suspect > > these are ok because we're dealing with a single bit) > > > > * On Alpha, it gives you a barrier so that dependency ordering > > can be relied upon from the load > > The Alpha barrier matters for pointers, how could it make a > difference for individual bits?
I guess you could use the result of test_bit to index into an array or something?
Will
| |