[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XENVBD PATCH 3/3] ring: Weaken and delete unnecessary barriers


  • To: Owen Smith <owen.smith@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Wed, 20 May 2026 10:39:33 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Delivery-date: Wed, 20 May 2026 08:39:40 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

On 20/05/2026 10:35, Owen Smith wrote:
> While there is potentially a difference between xen_rmb() and xen_wmb() in 
> Linux, both
> are defined as KeMemoryBarrierWithoutFence() in the Windows drivers.
> Is it necessary to have both entries here?
> I take it that using xen_mb() (i.e. KeMemoryBarrier()) is not required, and a 
> single
> KeMemoryBarrierWithoutFence() should be sufficient
> 
> Owen
> 
> @@ -1260,7 +1260,8 @@ BlkifRingPoll(
>                   Retry = TRUE;
>           }
> 
> -        KeMemoryBarrier();
> +        xen_rmb();
> +        xen_wmb();
> 
>           BlkifRing->Front.rsp_cons = rsp_cons;
>           BlkifRing->Shared->rsp_event = rsp_cons + 1;

I think the main difference would be in architectures with a weak memory 
model (ARM64) if we ever decide to port the Windows PV drivers there. At 
the same time, WDK doesn't seem to provide an equivalent barrier (we'd 
have to resort to C11 barriers perhaps?) So I decided to keep both for 
correctness with the release semantics that I was looking for.

Should we make our own acquire/release barrier macros for this purpose?


--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.