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

From: zhenwei pi
Date: Wed May 17 2023 - 04:39:21 EST




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...

2, Storage/FS specific remote protocol is quite popular, otherwise I'm not familiar with other device protocols. For example, I need a remote crypto device to accelerate HTTPS ... With Virtio Over Fabrics, I have a chance to attach a virtio-crypto device to do this work.

--
zhenwei pi