[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180814234940.GB3224@localhost.localdomain>
Date: Tue, 14 Aug 2018 17:49:40 -0600
From: Keith Busch <keith.busch@...ux.intel.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: wnukowski@...gle.com, Jens Axboe <axboe@...com>,
Sagi Grimberg <sagi@...mberg.me>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-nvme <linux-nvme@...ts.infradead.org>,
Keith Busch <keith.busch@...el.com>, yigitfiliz@...gle.com,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH] Bugfix for handling of shadow doorbell buffer.
On Tue, Aug 14, 2018 at 04:16:41PM -0700, Linus Torvalds wrote:
> On Tue, Aug 14, 2018 at 3:56 PM Keith Busch <keith.busch@...ux.intel.com> wrote:
> >
> > You just want to ensure the '*dbbuf_db = value' isn't reordered, right?
> > The order dependency might be more obvious if done as:
> >
> > WRITE_ONCE(*dbbuf_db, value);
> >
> > if (!nvme_dbbuf_need_event(READ_ONCE(*dbbuf_ei), value, old_value))
> > return false;
> >
> > And 'volatile' is again redundant.
>
> Yes, using READ_ONCE/WRITE_ONCE obviates the need for volatile, but it
> does *not* impose a memory ordering.
>
> It imposes an ordering on the compiler, but not on the CPU, so you
> still want the "mb()" there
I mistakenly recalled memory-barriers.txt mentioned order was enforced
on the CPU, but that's true only for overlapping memory, which this is
not. Thanks for the correction.
Powered by blists - more mailing lists