[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220328231233.GA102571@anparri>
Date: Tue, 29 Mar 2022 01:12:33 +0200
From: Andrea Parri <parri.andrea@...il.com>
To: Michael Kelley <mikelley@...rosoft.com>
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, sthemmin@...rosoft.com,
wei.liu@...nel.org, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org, vkuznets@...hat.com,
decui@...rosoft.com
Subject: Re: [PATCH 1/1] hv: drivers: vmbus: Prevent load re-ordering when
reading ring buffer
On Sun, Mar 27, 2022 at 08:25:10AM -0700, Michael Kelley wrote:
> When reading a packet from a host-to-guest ring buffer, there is no
> memory barrier between reading the write index (to see if there is
> a packet to read) and reading the contents of the packet. The Hyper-V
> host uses store-release when updating the write index to ensure that
> writes of the packet data are completed first. On the guest side,
> the processor can reorder and read the packet data before the write
> index, and sometimes get stale packet data. Getting such stale packet
> data has been observed in a reproducible case in a VM on ARM64.
>
> Fix this by using virt_load_acquire() to read the write index,
> ensuring that reads of the packet data cannot be reordered
> before it. Preventing such reordering is logically correct, and
> with this change, getting stale data can no longer be reproduced.
>
> Signed-off-by: Michael Kelley <mikelley@...rosoft.com>
Reviewed-by: Andrea Parri (Microsoft) <parri.andrea@...il.com>
Nit: subject prefix -> "Drivers: hv: vmbus:".
Thanks,
Andrea
Powered by blists - more mailing lists