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

Re: [PATCH 1/2] xennet: improve NBL batching receive path


  • To: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>, David ambu <david.preetham@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Wed, 23 Sep 2026 09:53: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=b9WXk9+LNWb6LlcGrcOOSPCtQWdiSOHpysmsN1+e1VA=; b=DaG1KGtq91rTVWdVefkvr0oDbO2hHazqTB20qiSjz9rbDJI4Zmpf7JY5GanL04YGnK//ChYCZWfLMkV//dsiKiLfLziN+wkyTLLF1M2leRJ6KSdU/UvvfDLuRrvNx9/QS9NsoxzwH6ts1Tunq8YdtZmO9EjpIoKwowBIaf4WYRr+FkN9dpr1NoM0NttjPuK4DaTV9HQhj5ZQaQG/sNuP3G45p2SPAKfEIGvrbEyPOubICCsSpkh8PezeOkbYqkqoS7V3T3aYJh33brPswecuQzVGM/U1SDwyFb6SmyOc5nqGk2twjD6xmaMPyHHTSOKoFQp1l4jILhbh7ZCCy1DFzQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MtZkP2M7VfNl18ilxVZqneUz8GY2Mgay0PYRKZq90mlhuL6GyyrT40fBRe4AeZXJYMr6RoIWZAAYFvHgbzxeiwM2P55Oj9+/Lwe8gz52S7LVcxQexiXfsTp+6Ivp5IPlfCDXfTKDufeRwTLXJWqi1p7YR+JABy+oL9wVQEGga/HZPh4LSh0mCpnUh+GXVzcLGQd1Wj1ArZkLFMhPLGp1YS3Y2TAAvW3CdYbhvLfZn6+YVRCRfKLgyXhWLF9qm0FwvI6BeQMqYl+RD/h4ViqnVt4PDJwSPCBcFGIJEkhKMXCuyyA7dPQmvlHTURq0BpKiQ8UhvCgIiwv3fQ1jZUBSTg==
  • 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, 23 Sep 2026 09:53:17 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHdRrtcRBjz//WLtUSjudtOhbIIVLbb3RgAgAAXBww=
  • Thread-topic: [PATCH 1/2] xennet: improve NBL batching receive path

>>
>> -    Returned = Receiver->Returned;
>> +    (VOID) InterlockedAdd(&Receiver->Indicated, Count);
>>
>>       KeMemoryBarrier();
>>
>> +    Returned = Receiver->Returned;
>>       Indicated = Receiver->Indicated;
>
>I wasn't sure about the purpose of the previous barriers so I went
>digging. I've found that Receiver->Returned and Receiver->Indicated are
>only ever added to, without a dependency between the two. So wouldn't
>this be sufficient without any further barriers?
>
>     if (Count == 0)
>         return;
>
>     Indicated = InterlockedAdd(&Receiver->Indicated, Count);
>     Returned = Receiver->Returned;

I was also looking into this, as the InterlockedAdd operation does a full 
memory barrier,
KeMemoryBarrier is not required. I'd put the Returned read before the 
InterlockedAdd,
so its sampled before the implicit barrier.

I think there is also an improvement here, and the caller, where the 
Queue->Lock can be acquired
once - to insert the NBL, and if Push, swap out the NBL - but this should be 
looked at as a
future change

Owen

>
>>
>>       Flags = NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL |
>
>--
>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®.