[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEz=LctG46xSHVxRg0VwnfCpv+uyOHdb0jqQ+WJNc7zSnMA2Ng@mail.gmail.com>
Date: Mon, 11 Mar 2024 01:00:20 +0800
From: Greg Sword <gregsword0@...il.com>
To: linke li <lilinke99@...com>
Cc: yanjun.zhu@...ux.dev, bmt@...ich.ibm.com, jgg@...pe.ca, leon@...nel.org,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org
Subject: Re: [PATCH] RDMA/siw: Reuse value read using READ_ONCE instead of
re-reading it
On Sun, Mar 10, 2024 at 8:36 PM linke li <lilinke99@...com> 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
>
>
Powered by blists - more mailing lists