Re: Re: Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

From: zhenwei pi
Date: Thu May 18 2023 - 07:04:16 EST




On 5/18/23 18:09, Michael S. Tsirkin wrote:
On Thu, May 18, 2023 at 08:47:22AM +0800, zhenwei pi wrote:
On 5/17/23 18:39, Michael S. Tsirkin wrote:
On Wed, May 17, 2023 at 04:35:55PM +0800, zhenwei pi wrote:


On 5/17/23 15:46, Christoph Hellwig wrote:
On Wed, May 17, 2023 at 03:43:03PM +0800, zhenwei pi wrote:
I have a plan to introduce 'Virtio Over Fabrics'(TCP&RDMA) as Virtio
transport, as mentioned in cover letter of this series:
3 weeks ago, I posted a proposal 'Virtio Over Fabrics':
https://lists.oasis-open.org/archives/virtio-comment/202304/msg00442.html

Just don't do it. Please define your own protocols over RDMA or TCP
for exactly the operations you need (for many they will already exist)
instead of piggyg backing on virtio and making everyone else pay the
price.


Hi

1, `virtqueue_add_inbuf` in current version:
static inline int virtqueue_add_inbuf(struct virtqueue *vq,
struct scatterlist *sg,
unsigned int num,
void *data,
gfp_t gfp)
{
if (likely(!vq->abstract))
return vring_virtqueue_add_sgs(vq, &sg, num, 0, 1, data,
NULL, gfp);

return vq->add_sgs(vq, &sg, num, 0, 1, data, NULL, gfp);
}

And disassemble 'virtinput_queue_evtbuf':
static void virtinput_queue_evtbuf(struct virtio_input *vi,
struct virtio_input_event *evtbuf)
{
struct scatterlist sg[1];

sg_init_one(sg, evtbuf, sizeof(*evtbuf));
virtqueue_add_inbuf(vi->evt, sg, 1, evtbuf, GFP_ATOMIC);
}

I notice that two instructions are newly added for vring like:
24d: 80 78 35 00 cmpb $0x0,0x35(%rax)
251: 75 3f jne 292

Is it an expensive price...

Can we somehow only override the kick method?
Then take the ring and send it over ...


Could you please take a look at this code?
https://github.com/pizhenwei/linux/blob/virtio-of-github/drivers/virtio/virtio_fabrics.c#LL861C13-L861C23

what am I looking at here?

Looks like at least vof_handle_vq duplicates some code from vringh.
But besides that yes, that's the idea.


OK, I'd drop this series.

Cc Jason & Stefan.


--
zhenwei pi