qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: wexu@redhat.com, qemu-devel@nongnu.org
Cc: tiwei.bie@intel.com, mst@redhat.com, jfreimann@redhat.com
Subject: Re: [Qemu-devel] [RFC v2 0/8] packed ring virtio-net userspace backend support
Date: Wed, 6 Jun 2018 10:34:32 +0800	[thread overview]
Message-ID: <22f43a8e-7e98-e034-e9f7-1046f4b4b554@redhat.com> (raw)
In-Reply-To: <1528225683-11413-1-git-send-email-wexu@redhat.com>



On 2018年06月06日 03:07, wexu@redhat.com wrote:
> From: Wei Xu <wexu@redhat.com>
>
> Todo:
> - address Rx slow performance
> - event index interrupt suppression test

Tiwei's code support event index, you can try with that.

Actually, unless you disable event_idx explicitly, it work by default.

>
> v1->v2
> - sync to tiwei's v5
> - reuse memory cache function with 1.0
> - dropped detach patch and notification helper(04 & 05 in v1)
> - guest virtio-net driver unload/reload support
> - event suppression support(not tested)
> - addressed feedback from v1
>
> About guest virtio-net load/unload:
> Since last_avail, avail_wrap_count, used_idx and used_wrap_count are
> all 16 or bool type variables, so I turned to merge them to
> 'vhost_vring_state.num' in stead of introducing a new case
> in handling ioctl, test has been done with a tweak in kernel side like:

s.num is unsigned int which is 32bit, but you want to hold 2 16bit vars 
and a boolean.

So I'm afraid it won't work...

>
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1439,10 +1439,16 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
>              r = -EFAULT;
>              break;
>          }
> -               if (s.num > 0xffff) {
> -                       r = -EINVAL;
> -                       break;
> -               }
> +               if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) {
> +                       vq->avail_wrap_counter = (bool)(uint16_t)(s.num >> 16);
> +                       vq->last_used_idx = (uint16_t)(s.num >> 32);
> +                       vq->used_wrap_counter = (bool)(uint16_t)(s.num >> 48);
> +                } else {
> +                    if (s.num > 0xffff) {
> +                            r = -EINVAL;
> +                            break;
> +                    }
> +                }
>          vq->last_avail_idx = s.num;
>          /* Forget the cached index value. */
>          vq->avail_idx = vq->last_avail_idx;
> @@ -1450,8 +1456,15 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
>      case VHOST_GET_VRING_BASE:
>          s.index = idx;
>          s.num = vq->last_avail_idx;
> +               if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) {
> +                       s.num |= vq->avail_wrap_counter << 16;
> +                       s.num |= vq->last_used_idx << 32;
> +                       s.num |= vq->used_wrap_counter << 48;
> +                }
>          if (copy_to_user(argp, &s, sizeof s))
>              r = -EFAULT;
> +               if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED))
> +                       s.num |= vq->avail_wrap_counter << 31;
>          break;
>      case VHOST_SET_VRING_ADDR:
>          if (copy_from_user(&a, argp, sizeof a)) {
>
> Wei Xu (8):
>    virtio: feature bit, data structure, init for packed ring
>    virtio: memory cache for packed ring
>    virtio: empty check and desc read for packed ring
>    virtio: get avail bytes check for packed ring
>    virtio: queue pop support for packed ring
>    virtio: flush/push support for packed ring
>    virtio: event suppression support for packed ring
>    virtio: support guest driver reload for vhost-net
>
>   hw/net/vhost_net.c                             |   2 +
>   hw/virtio/virtio.c                             | 677 +++++++++++++++++++++++--
>   include/hw/virtio/virtio.h                     |   4 +-
>   include/standard-headers/linux/virtio_config.h |  15 +
>   4 files changed, 649 insertions(+), 49 deletions(-)
>

  parent reply	other threads:[~2018-06-06  2:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 19:07 [Qemu-devel] [RFC v2 0/8] packed ring virtio-net userspace backend support wexu
2018-06-05 19:07 ` [Qemu-devel] [RFC v2 1/8] virtio: feature bit, data structure, init for 1.1 wexu
2018-06-06  2:49   ` Jason Wang
2018-06-05 19:07 ` [Qemu-devel] [RFC v2 2/8] virtio: memory cache for packed ring wexu
2018-06-06  2:53   ` Jason Wang
2018-06-19  7:39     ` Wei Xu
2018-06-13 12:27   ` Paolo Bonzini
2018-06-05 19:07 ` [Qemu-devel] [RFC v2 3/8] virtio: empty check and desc read " wexu
2018-06-06  3:09   ` Jason Wang
2018-06-05 19:07 ` [Qemu-devel] [RFC v2 4/8] virtio: get avail bytes check " wexu
2018-06-06  3:19   ` Jason Wang
2018-06-05 19:08 ` [Qemu-devel] [RFC v2 5/8] virtio: queue pop " wexu
2018-06-06  3:29   ` Jason Wang
2018-06-06  3:38     ` Wei Xu
2018-06-06  3:41       ` Jason Wang
2018-06-19  7:58         ` Wei Xu
2018-06-05 19:08 ` [Qemu-devel] [RFC v2 6/8] virtio: flush/push " wexu
2018-06-06  3:39   ` Jason Wang
     [not found]   ` <7dc2af60-47ad-1250-fc6c-3fdf288654c3@redhat.com>
2018-11-28 17:33     ` Maxime Coquelin
2018-06-05 19:08 ` [Qemu-devel] [RFC v2 7/8] virtio: event suppression " wexu
2018-06-06  3:46   ` Jason Wang
2018-06-05 19:08 ` [Qemu-devel] [RFC v2 8/8] virtio: guest driver reload for vhost-net wexu
2018-06-06  3:48   ` Jason Wang
2018-06-19  7:53     ` Wei Xu
2018-06-06  2:34 ` Jason Wang [this message]
2018-06-06  3:49 ` [Qemu-devel] [RFC v2 0/8] packed ring virtio-net userspace backend support Jason Wang
2018-06-19  7:41   ` Wei Xu

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=22f43a8e-7e98-e034-e9f7-1046f4b4b554@redhat.com \
    --to=jasowang@redhat.com \
    --cc=jfreimann@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tiwei.bie@intel.com \
    --cc=wexu@redhat.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).