From: Jason Wang <jasowang@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
qemu-level <qemu-devel@nongnu.org>,
virtualization <virtualization@lists.linux-foundation.org>,
Eli Cohen <eli@mellanox.com>, Eric Blake <eblake@redhat.com>,
Parav Pandit <parav@mellanox.com>, Cindy Lu <lulu@redhat.com>,
"Fangyi \(Eric\)" <eric.fangyi@huawei.com>,
Markus Armbruster <armbru@redhat.com>,
yebiaoxiang@huawei.com, Liuxiangdong <liuxiangdong5@huawei.com>,
Laurent Vivier <lvivier@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Gautam Dawar <gdawar@xilinx.com>,
Xiao W Wang <xiao.w.wang@intel.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Harpreet Singh Anand <hanand@xilinx.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Lingshan <lingshan.zhu@intel.com>
Subject: Re: [PATCH v2 07/14] vhost: Shadow virtqueue buffers forwarding
Date: Thu, 3 Mar 2022 15:35:53 +0800 [thread overview]
Message-ID: <cd0f4492-71fc-33d9-ca09-e61df5d2eadf@redhat.com> (raw)
In-Reply-To: <CAJaqyWe=hGmAvU_Fr34fecbF_7kUYqcm-EOdHJOo47TtddPwLw@mail.gmail.com>
在 2022/3/3 上午2:23, Eugenio Perez Martin 写道:
>>> +
>>> +static bool vhost_svq_add_split(VhostShadowVirtqueue *svq,
>>> + VirtQueueElement *elem,
>>> + unsigned *head)
>>> +{
>>> + unsigned avail_idx;
>>> + vring_avail_t *avail = svq->vring.avail;
>>> +
>>> + *head = svq->free_head;
>>> +
>>> + /* We need some descriptors here */
>>> + if (unlikely(!elem->out_num && !elem->in_num)) {
>>> + qemu_log_mask(LOG_GUEST_ERROR,
>>> + "Guest provided element with no descriptors");
>>> + return false;
>>> + }
>>> +
>>> + vhost_vring_write_descs(svq, elem->out_sg, elem->out_num,
>>> + elem->in_num > 0, false);
>>> + vhost_vring_write_descs(svq, elem->in_sg, elem->in_num, false, true);
>> I wonder instead of passing in/out separately and using the hint like
>> more_descs, is it better to simply pass the elem to
>> vhost_vrign_write_descs() then we know which one is the last that
>> doesn't depend on more_descs.
>>
> I'm not sure I follow this.
>
> The purpose of vhost_vring_write_descs is to abstract the writing of a
> batch of descriptors, its chaining, etc. It accepts the write
> parameter just for the write flag. If we make elem as a parameter, we
> would need to duplicate that for loop for read and for write
> descriptors, isn't it?
>
> To duplicate the for loop is the way it is done in the kernel, but I
> actually think the kernel could benefit from abstracting both in the
> same function too. Please let me know if you think otherwise or I've
> missed your point.
Ok, so it's just a suggestion and we can do optimization on top for sure.
Thanks
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-03-03 7:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220227134111.3254066-1-eperezma@redhat.com>
2022-02-28 2:32 ` [PATCH v2 00/14] vDPA shadow virtqueue Jason Wang
[not found] ` <20220227134111.3254066-3-eperezma@redhat.com>
2022-02-28 2:57 ` [PATCH v2 02/14] vhost: Add Shadow VirtQueue kick forwarding capabilities Jason Wang
[not found] ` <CAJaqyWezcrc=iPLe=Y7+g9oBYfUY9pK8OM4=ZUeRgXqr9ZUWkg@mail.gmail.com>
2022-03-03 7:12 ` Jason Wang
[not found] ` <CAJaqyWfbkzi19yMAXY7gwCAoj7sakwU_R2hDc1u8+jHPfHLadA@mail.gmail.com>
2022-03-04 1:39 ` Jason Wang
[not found] ` <20220227134111.3254066-4-eperezma@redhat.com>
2022-02-28 3:18 ` [PATCH v2 03/14] vhost: Add Shadow VirtQueue call " Jason Wang
[not found] ` <20220227134111.3254066-5-eperezma@redhat.com>
2022-02-28 3:25 ` [PATCH v2 04/14] vhost: Add vhost_svq_valid_features to shadow vq Jason Wang
[not found] ` <20220227134111.3254066-7-eperezma@redhat.com>
2022-02-28 3:59 ` [PATCH v2 06/14] vdpa: adapt vhost_ops callbacks to svq Jason Wang
[not found] ` <20220227134111.3254066-8-eperezma@redhat.com>
2022-02-28 5:39 ` [PATCH v2 07/14] vhost: Shadow virtqueue buffers forwarding Jason Wang
[not found] ` <CAJaqyWe=hGmAvU_Fr34fecbF_7kUYqcm-EOdHJOo47TtddPwLw@mail.gmail.com>
2022-03-03 7:35 ` Jason Wang [this message]
[not found] ` <20220227134111.3254066-9-eperezma@redhat.com>
2022-02-28 6:39 ` [PATCH v2 08/14] util: Add iova_tree_alloc Jason Wang
[not found] ` <CAJaqyWdNWqpdBQ-iTWLu7fH0prHPo8Uc1LXkEKvQ4X6cp7_TOA@mail.gmail.com>
2022-03-03 7:16 ` Jason Wang
[not found] ` <20220227134111.3254066-10-eperezma@redhat.com>
2022-02-28 7:06 ` [PATCH v2 09/14] vhost: Add VhostIOVATree Jason Wang
[not found] ` <CAJaqyWchLxXTRBE9zT9ZrF7UT_CnNbD=E5yaK6NrF-gDauhSAg@mail.gmail.com>
2022-03-04 2:04 ` Jason Wang
[not found] ` <CAJaqyWcsUv=Kc8up=T103wz8uy8YWd+6gK3Pm5PXwHVVMuLM2Q@mail.gmail.com>
2022-03-07 3:41 ` Jason Wang
[not found] ` <20220227134111.3254066-11-eperezma@redhat.com>
2022-02-28 7:36 ` [PATCH v2 10/14] vdpa: Add custom IOTLB translations to SVQ Jason Wang
[not found] ` <CAJaqyWf9c=OOKt7sB=kMY7FzNGG+YfPF=qNbu6A0UVkhzxmHZA@mail.gmail.com>
2022-03-03 7:33 ` Jason Wang
[not found] ` <CAJaqyWfwDjuVsX_ELpad0-8EQJJhK79tz5Yi18Ye1xksM_1snQ@mail.gmail.com>
2022-03-07 4:24 ` Jason Wang
[not found] ` <20220227134111.3254066-12-eperezma@redhat.com>
2022-02-28 7:38 ` [PATCH v2 11/14] vdpa: Adapt vhost_vdpa_get_vring_base " Jason Wang
2022-02-28 7:41 ` [PATCH v2 00/14] vDPA shadow virtqueue Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd0f4492-71fc-33d9-ca09-e61df5d2eadf@redhat.com \
--to=jasowang@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=ehabkost@redhat.com \
--cc=eli@mellanox.com \
--cc=eperezma@redhat.com \
--cc=eric.fangyi@huawei.com \
--cc=gdawar@xilinx.com \
--cc=hanand@xilinx.com \
--cc=lingshan.zhu@intel.com \
--cc=liuxiangdong5@huawei.com \
--cc=lulu@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=parav@mellanox.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xiao.w.wang@intel.com \
--cc=yebiaoxiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).