Subject: Re: [PATCH v15 06/20] nvme-tcp: Add DDP data-path

From: Aurelien Aptel <[email-masked]>
Date: Wed, 20 Sep 2023 19:04:59 +0300

Sagi Grimberg <[email-masked]> writes:
>> Sorry, the original answer was misleading.
>> The problem is not about the timing but only about which CPU the code is
>> running on.  If we move setup_ddp() earlier as you suggested, it can
>> result it running on the wrong CPU.
>
> Please define wrong CPU.

Let's say we connect with 1 IO queue on CPU 0.

We run our application which run IOs on multiple CPU cores (0 and 7 as
an example).
Whenever the IO was issued on CPU 7, setup_cmd_pdu() and queue_request()
will be run in the context of CPU 7.
We consider CPU 7 "wrong", because it isn't q->io_cpu (CPU 0).

It's only after queue_request() dispatches it that it will it run on CPU 0.

> But the sk_incmoing_cpu is updated with the cpu that is reading the
> socket, so in fact it should converge to the io_cpu - shouldn't it?

Yes, that is true.

> Can you please provide a concrete explanation to the performance
> degradation?

We believe the setup_ddp should be called from the CPU core on which the
nvme queue was created so all the IO path SW-HW interaction will run on
the same CPU core.
The performance degradation is relevant only to specific cases in which
the application will run on the "wrong" CPU core on which the NVMe queue
was not created.

If you don’t see it as a problem, we can move the setup_ddp to
setup_cmd_pdu().

Thanks