[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XENVBD PATCH 3/3] ring: Weaken and delete unnecessary barriers
- To: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Owen Smith <owen.smith@xxxxxxxxxx>
- Date: Wed, 20 May 2026 08:47:10 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3eoox2H+gWG6QxLY7rT0Tc6EnDVPe9osmdFCfvMm4tQ=; b=dDx1/86DNdDI3h9aDpV39W4kpFCYflijMu0RtlMcKCBnU3RH0pWmzgBzqXMCfv5efizkSq34AReBSurkxrHnu6D0J0NKExWq42T9qNVuzgPDs5n9hkzRxJtADxjjN1I8IBYPN8QAt95RBjzEXjw6qwQmW0v1TLV8EXkkTKP+l7RwVSagVLR2hf/QHI6WJ3RJa2ryyS0NC2g2GaUNDt+5TVFsqQu09bux+1aTlM5/S1CBZH8Aqy6vzfrORK5kUZYrhLadkXEBto4/EPRhqZtlNybUmzGoi5nV8cqedUZaanJLFi1j9HYQI6qtgIlk52CalvdlAphAG+kI4JCefV+mJg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mabd0ZXsPSbMZWDoz3pw1DHnt+d7mmRvjB0kjHpEVlB652m+HgBkwMIZVmWPJ4k4caBq4Wn39bbMrrqmO6HwyG8PpapNAdzSzaNnREaiYFcCi15UYhNb8lOGBK+9ajOMFdwTBQlH8vGOS/Ajy9r1tHz18pezwZI0EaCwHsWYmxBoxjprn7TqsLxTiy1wvR8ICLG8JeMuvlA3GwMKgSCYAVanRlX5OJPuOePSl5mfg4AdLLPyYrRnYpl+pRlmgK3IldY/U2peCp+ImKPP0QGd1Qxvjj/PDavZwRgykxd57RxKqY1Vk2GDIxyNKtDHRMGQ1yVi6xNo4yWl2ZRHE3d6HQ==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Delivery-date: Wed, 20 May 2026 08:47:17 +0000
- List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
- Msip_labels:
- Thread-index: AQHc5rCzi+cjmgFw5kWi32C+9vSCMrYWmNMQgAACKICAAAHQfA==
- Thread-topic: [XENVBD PATCH 3/3] ring: Weaken and delete unnecessary barriers
I think this should be fine, 2 compiler barriers back-to-back shouldnt have
significant additional overhead, and should still be lower than a full barrier
I'm just running some basic tests, but this series looks good so far
Owen
________________________________________
From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
Sent: 20 May 2026 9:39 AM
To: Owen Smith; win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Subject: Re: [XENVBD PATCH 3/3] ring: Weaken and delete unnecessary barriers
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
|