[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add upper bound to receiver ring poll to reduce DPC latency
It doesnt look like threaded DPCs are used
I'm not sure of the best way to share results, as most testing was done on XenServer patched variants (I dont think our patches should have affected the general performance). Headline results seem to suggest that file copy speeds (over network, between 2 VMs on the same host) increased from approx 350-400MB/s to approx 420-460MB/s. This would be the case where netback is supplying sufficient data to keep the rings active, looping inside the DPC routines, processing the incoming fragments. Rachel may be able to collate the results into an easier to view format (results are currently presented on an internal wiki page)
Owen
[CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments unless you have verified the sender and know the content is safe.
On 07/02/2023 14:05, Rachel.Yan@xxxxxxxxxx wrote:
> From: Rachel Yan <Rachel.Yan@xxxxxxxxxx>
>
> Adds an upper bound to the ring poll iteration with optimal value found through experimentation to avoid going round the ring an infinite (or very large) number of times. This has been tested to show improvements in DPC latencies and file transfer speeds.
>
Do you have numbers you can share? The reason for moving to threaded
DPCs was to avoid having to play games like this.
Paul
> Signed-off-by: Rachel Yan <rachel.yan@xxxxxxxxxx>
>
> ---
> src/xenvif/receiver.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
> index 2145133..d469de4 100644
> --- a/src/xenvif/receiver.c
> +++ b/src/xenvif/receiver.c
> @@ -2013,11 +2013,15 @@ ReceiverRingPoll(
> PXENVIF_RECEIVER Receiver;
> PXENVIF_FRONTEND Frontend;
> ULONG Count;
> + ULONG MaxCount;
> + BOOLEAN NeedQueueDpc;
>
> Receiver = Ring->Receiver;
> Frontend = Receiver->Frontend;
>
> Count = 0;
> + MaxCount = 10 * XENVIF_RECEIVER_RING_SIZE;
> + NeedQueueDpc = FALSE;
>
> if (!Ring->Enabled || Ring->Paused)
> goto done;
> @@ -2068,6 +2072,15 @@ ReceiverRingPoll(
> PXENVIF_RECEIVER_FRAGMENT Fragment;
> PMDL Mdl;
>
> + // avoid going through the ring an infinite (or very large) amount of times
> + // if the netback producer happens to fill in just enough packets to cause us
> + // to go around the ring multiple times. This should reduce Dpc latencies.
> +
> + if (Count >= MaxCount) {
> + NeedQueueDpc = TRUE;
> + break;
> + }
> +
> rsp = RING_GET_RESPONSE(&Ring->Front, rsp_cons);
>
> // netback is required to complete requests in order and place
> @@ -2247,7 +2260,7 @@ ReceiverRingPoll(
> if (!__ReceiverRingIsStopped(Ring))
> ReceiverRingFill(Ring);
>
> - if (Ring->PacketQueue != NULL &&
> + if ((NeedQueueDpc || Ring->PacketQueue != NULL) &&
> KeInsertQueueDpc(&Ring->QueueDpc, NULL, NULL))
> Ring->QueueDpcs++;
>
|