On Sun, Mar 10, 2024 at 8:36 PM linke li <lilinke99@xxxxxx> wrote: > > > In a complicated environment, for example, this function is called many > > times at the same time and orqe->flags is changed at the same time, I am > > not sure if this will introduce risks or not. > > I think one function of READ_ONCE is to read a valid value while the value > may change concurrently. And there is a smp() above the READ_ONCE, which > means that the READ_ONCE is well ordered. I think it is kind of safe here. This is not a smp problem. Compared with the original source, your commit introduces a time slot. > > > if you need to ensure the consistency of the flags throughout the function, not sure if the following is better or not. > > > if (((orqe_flags=READ_ONCE(orqe->flags))) & SIW_WQE_VALID) { > > This patch looks like exactly do the same things. The only difference I > think is the code style. No. > > Thanks, > Linke > >