Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

2024-11-11 Thread Nan Xiao
Hi Elad, Thanks very much for your time and clarification! Best Regards Nan Xiao On Mon, Nov 11, 2024 at 8:05 PM Elad Lahav wrote: > > > Machine-sized means smaller than or equal to sizeof(long). > > > > Take a look at the implementation of WRITE_ONCE or READ_ONCE of linux. > > That is not nece

Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

2024-11-11 Thread Elad Lahav
> Machine-sized means smaller than or equal to sizeof(long). > > Take a look at the implementation of WRITE_ONCE or READ_ONCE of linux. That is not necessarily true. What sizes and alignments are guaranteed to be atomic for access (i.e., writing a value to a memory location results in everyone see

Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

2024-11-11 Thread Nan Xiao
Hi Alan, > Machine-sized means smaller than or equal to sizeof(long). Got it, thanks very much for your help! Best Regards Nan Xiao On Mon, Nov 11, 2024 at 5:38 PM Alan Huang wrote: > > On Nov 11, 2024, at 17:30, Nan Xiao wrote: > > > > Hi Alan and Akira, > > > > Thanks very much for your answ

Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

2024-11-11 Thread Alan Huang
On Nov 11, 2024, at 17:30, Nan Xiao wrote: > > Hi Alan and Akira, > > Thanks very much for your answers! I have another question from > "4.3.4.2 A Volatile Solution". In this section, it mentions: > > 1. Implementations are forbidden from tearing an aligned volatile > access when machine inst

Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

2024-11-11 Thread Nan Xiao
Hi Alan and Akira, Thanks very much for your answers! I have another question from "4.3.4.2 A Volatile Solution". In this section, it mentions: 1. Implementations are forbidden from tearing an aligned volatile access when machine instructions of that access’s size and type are available. .

Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

2024-11-11 Thread Akira Yokosawa
On Mon, 11 Nov 2024 15:45:22 +0800, Nan Xiao wrote: > Hello, > > Greetings from me! Hi! > > I am reading "4.3.4.2 A Volatile Solution" of perfbook, and come > across following summary: > > To summarize, the volatile keyword can prevent load tearing and > store tearing in cases where the lo

Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

2024-11-10 Thread Alan Huang
On Nov 11, 2024, at 15:45, Nan Xiao wrote: > > Hello, > > Greetings from me! > > I am reading "4.3.4.2 A Volatile Solution" of perfbook, and come > across following summary: > >To summarize, the volatile keyword can prevent load tearing and > store tearing in cases where the loads and stor