DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kangjie Xu <kangjie.xu@linux.alibaba.com>
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: dev@dpdk.org, xuanzhuo@linux.alibaba.com,
	hengqi@linux.alibaba.com, jasonwang@redhat.com, mst@redhat.com
Subject: [PATCH v2 0/2] vhost: support VIRTIO_F_RING_RESET for vhost-user
Date: Mon,  5 Sep 2022 11:48:03 +0800	[thread overview]
Message-ID: <cover.1662347861.git.kangjie.xu@linux.alibaba.com> (raw)

Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
virtqueue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    https://github.com/oasis-tcs/virtio-spec/issues/124
    https://github.com/oasis-tcs/virtio-spec/issues/139

The implementation only adds the feature bit in supported features.
It also adds a new vhost-user message VHOST_USER_RESET_VRING. The
related definition is defined in the related QEMU patch set:
  https://lore.kernel.org/qemu-devel/cover.1661510725.git.kangjie.xu@linux.alibaba.com/T/#t

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. It will send VHOST_USER_RESET_VRING
to DPDK. After received the message, DPDK will reset the virtqueue. The
new message VHOST_USER_RESET_VRING has been acked by the QEMU virtio
maintainer:
    https://lore.kernel.org/qemu-devel/57362274-b2fb-a47d-fea7-d3ebcfad967b@redhat.com/

2. After the virtqueue is disabled, the driver may optionally re-enable
it. To avoid confusion with VHOST_USER_SET_VRING_ENABLE, we call this
part as "restart". The virtqueue's information may be changed when
restarting it. Thus, the information of the reset virtqueue should be
updated. This part is basically similar to when the virtqueue is started
for the first time, except that the restart process does not need to set
features and set mem table since they do not change. QEMU will send
messages containing size, base, addr, kickfd and callfd of the virtqueue
in order. Specifically, the DPDK will receive these messages in order:
    a. VHOST_USER_SET_VRING_NUM
    b. VHOST_USER_SET_VRING_BASE
    c. VHOST_USER_SET_VRING_ADDR
    d. VHOST_USER_SET_VRING_KICK
    e. VHOST_USER_SET_VRING_CALL
    f. VHOST_USER_SET_VRING_ENABLE
The last VHOST_USER_SET_VRING_ENABLE message with "payload.state.num" set
to 1, will be sent to enable the virtqueue and the restart process is
finished.

Test environment:
    Host: 5.4.189
    Qemu: QEMU emulator version 7.0.50 (With vq reset support)
    Guest: 5.19.0-rc3 (With vq reset support)
    DPDK: 22.07-rc1
    Test Cmd: ethtool -g eth1; ethtool -G eth1 rx $1 tx $2;
            ethtool -g eth1;

    The driver can resize the virtio queue, then virtio queue reset
    function should be triggered.

Guest Kernel Patch:
    https://lore.kernel.org/bpf/20220801063902.129329-1-xuanzhuo@linux.alibaba.com/

QEMU Patch:
    https://lore.kernel.org/qemu-devel/cover.1661510725.git.kangjie.xu@linux.alibaba.com/T/
    https://lore.kernel.org/qemu-devel/cover.1661414345.git.kangjie.xu@linux.alibaba.com/T/

Looking forward to your review and comments.

Kangjie Xu (2):
  vhost: support VIRTIO_F_RING_RESET for vhost-user
  vhost: introduce VHOST_USER_RESET_VRING

 lib/vhost/vhost.c      |  2 +-
 lib/vhost/vhost.h      |  9 ++++++++-
 lib/vhost/vhost_user.c | 27 ++++++++++++++++++++++++++-
 lib/vhost/vhost_user.h |  1 +
 4 files changed, 36 insertions(+), 3 deletions(-)

-- 
2.32.0


             reply	other threads:[~2022-09-05  3:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  3:48 Kangjie Xu [this message]
2022-09-05  3:48 ` [PATCH v2 1/2] " Kangjie Xu
2022-09-05  3:48 ` [PATCH v2 2/2] vhost: introduce VHOST_USER_RESET_VRING Kangjie Xu
2022-09-22  9:35   ` Xia, Chenbo
2022-09-23  1:41     ` Xuan Zhuo
2022-09-26  7:28       ` Xia, Chenbo

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=cover.1662347861.git.kangjie.xu@linux.alibaba.com \
    --to=kangjie.xu@linux.alibaba.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=hengqi@linux.alibaba.com \
    --cc=jasonwang@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=xuanzhuo@linux.alibaba.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).