linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: wexu@redhat.com, peterx@redhat.com, vkaplans@redhat.com
Subject: Re: [RFC PATCH V3 0/3] basic device IOTLB support
Date: Tue, 14 Jun 2016 18:40:53 +0800	[thread overview]
Message-ID: <575FDF35.40201@redhat.com> (raw)
In-Reply-To: <1464082585-13049-1-git-send-email-jasowang@redhat.com>



On 2016年05月24日 17:36, Jason Wang wrote:
> This patch tries to implement an device IOTLB for vhost. This could be
> used with for co-operation with userspace IOMMU implementation (qemu)
> for a secure DMA environment (DMAR) in guest.
>
> The idea is simple. When vhost meets an IOTLB miss, it will request
> the assistance of userspace to do the translation, this is done
> through:
>
> - when there's a IOTLB miss, it will notify userspace through
>    vhost_net fd and then userspace read the fault address, size and
>    access from vhost fd.
> - userspace write the translation result back to vhost fd, vhost can
>    then update its IOTLB.
>
> The codes were optimized for fixed mapping users e.g dpdk in guest. It
> will be slow if dynamic mappings were used in guest. We could do
> optimizations on top.
>
> The codes were designed to be architecture independent. It should be
> easily ported to any architecture.
>
> Stress tested with l2fwd/vfio in guest with 4K/2M/1G page size. On 1G
> hugepage case, 100% TLB hit rate were noticed.
>
> Changes from V2:
> - introduce memory accessors for vhost
> - switch from ioctls to oridinary file read/write for iotlb miss and
>    updating
> - do not assume virtqueue were virtually mapped contiguously, all
>    virtqueue access were done throug IOTLB
> - verify memory access during IOTLB update and fail early
> - introduce a module parameter for the size of IOTLB
>
> Changes from V1:
> - support any size/range of updating and invalidation through
>    introducing the interval tree.
> - convert from per device iotlb request to per virtqueue iotlb
>    request, this solves the possible deadlock in V1.
> - read/write permission check support.
>
> Please review.

Have a benchmark on this. Test was done with l2fwd in guest.

For 2MB page, no difference in 64B performance and I notice a 4%-5% drop 
for 1500B performance compare to UIO in guest. We can add some shortcut 
to bypass the IOTLB for virtqueue accessing, but I think it's better to 
be done on top.

>
> Jason Wang (3):
>    vhost: introduce vhost memory accessors
>    vhost: convert pre sorted vhost memory array to interval tree
>    vhost: device IOTLB API
>
>   drivers/vhost/net.c        |  63 +++-
>   drivers/vhost/vhost.c      | 760 ++++++++++++++++++++++++++++++++++++++-------
>   drivers/vhost/vhost.h      |  60 +++-
>   include/uapi/linux/vhost.h |  28 ++
>   4 files changed, 790 insertions(+), 121 deletions(-)
>

  parent reply	other threads:[~2016-06-14 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24  9:36 [RFC PATCH V3 0/3] basic device IOTLB support Jason Wang
2016-05-24  9:36 ` [RFC PATCH V3 1/3] vhost: introduce vhost memory accessors Jason Wang
2016-05-24  9:36 ` [RFC PATCH V3 2/3] vhost: convert pre sorted vhost memory array to interval tree Jason Wang
2016-05-24  9:36 ` [RFC PATCH V3 3/3] vhost: device IOTLB API Jason Wang
2016-06-14 10:40 ` Jason Wang [this message]
2016-06-21 16:44 ` [RFC PATCH V3 0/3] basic device IOTLB support Michael S. Tsirkin
2016-06-22  9:53   ` 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=575FDF35.40201@redhat.com \
    --to=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=peterx@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vkaplans@redhat.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).