RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> On Fri, 20 May 2016 17:59:46 +0800 > Liang Li wrote: > > > The implementation of the current virtio-balloon is not very > > efficient, Bellow is test result of time spends on inflating the > > balloon to 3GB of a 4GB idle guest: > > > > a. allocating pages (6.5%, 103ms) > > b. sending PFNs to h

RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> On 20/05/2016 11:59, Liang Li wrote: > > + > > + sg_init_table(sg, 5); > > + sg_set_buf(&sg[0], &flags, sizeof(flags)); > > + sg_set_buf(&sg[1], &start_pfn, sizeof(start_pfn)); > > + sg_set_buf(&sg[2], &page_shift, sizeof(page_shift)); > > + sg_se

[RFC PATCH V3 2/3] vhost: convert pre sorted vhost memory array to interval tree

2016-05-24 Thread Jason Wang
Current pre-sorted memory region array has some limitations for future device IOTLB conversion: 1) need extra work for adding and removing a single region, and it's expected to be slow because of sorting or memory re-allocation. 2) need extra work of removing a large range which may intersect

[RFC PATCH V3 1/3] vhost: introduce vhost memory accessors

2016-05-24 Thread Jason Wang
This patch introduces vhost memory accessors which were just wrappers for userspace address access helpers. This is a requirement for vhost device iotlb implementation which will add iotlb translations in those accessors. Signed-off-by: Jason Wang --- drivers/vhost/net.c | 1 + drivers/vhost/

[RFC PATCH V3 0/3] basic device IOTLB support

2016-05-24 Thread Jason Wang
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 trans

[RFC PATCH V3 3/3] vhost: device IOTLB API

2016-05-24 Thread Jason Wang
This patch tries to implement an device IOTLB for vhost. This could be used with for co-operation with userspace(qemu) implementation of DMA remapping. The idea is simple, cache the translation in a software device IOTLB (interval tree) implementation in vhost and make vhost_net file descriptor co

RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> On Fri, May 20, 2016 at 05:59:46PM +0800, Liang Li wrote: > > The implementation of the current virtio-balloon is not very > > efficient, Bellow is test result of time spends on inflating the > > balloon to 3GB of a 4GB idle guest: > > > > a. allocating pages (6.5%, 103ms) > > b. sending PFNs to

RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> > On Fri, May 20, 2016 at 05:59:46PM +0800, Liang Li wrote: > > > The implementation of the current virtio-balloon is not very > > > efficient, Bellow is test result of time spends on inflating the > > > balloon to 3GB of a 4GB idle guest: > > > > > > a. allocating pages (6.5%, 103ms) > > > b. se

Re: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Michael S. Tsirkin
On Tue, May 24, 2016 at 09:51:46AM +, Li, Liang Z wrote: > > On Fri, May 20, 2016 at 05:59:46PM +0800, Liang Li wrote: > > > The implementation of the current virtio-balloon is not very > > > efficient, Bellow is test result of time spends on inflating the > > > balloon to 3GB of a 4GB idle gue

RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> > > > { > > > > - struct scatterlist sg; > > > > unsigned int len; > > > > > > > > - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); > > > > + if (virtio_has_feature(vb->vdev, > > > VIRTIO_BALLOON_F_PAGE_BITMAP)) { > > > > + u32 page_shift

Re: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Michael S. Tsirkin
On Tue, May 24, 2016 at 10:38:43AM +, Li, Liang Z wrote: > > > > > { > > > > > - struct scatterlist sg; > > > > > unsigned int len; > > > > > > > > > > - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); > > > > > + if (virtio_has_feature(vb->vdev, > > > > VIRTI

[PULL] vhost: cleanups and fixes

2016-05-24 Thread Michael S. Tsirkin
The following changes since commit 2dcd0af568b0cf583645c8a317dd12e344b1c72a: Linux 4.6 (2016-05-15 15:43:13 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus for you to fetch changes up to bb991288728e6a47a6f0fac6a4e9df

[PATCH] tools/virtio: add noring tool

2016-05-24 Thread Michael S. Tsirkin
Useful to measure testing framework overhead. Cc: Jesper Dangaard Brouer Signed-off-by: Michael S. Tsirkin --- tools/virtio/ringtest/noring.c | 69 ++ tools/virtio/ringtest/Makefile | 4 ++- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 1

Re: [PATCH] tools/virtio/ringtest: add usage example to README

2016-05-24 Thread Mike Rapoport
Michael, Any updates on this? On Wed, May 04, 2016 at 09:12:55AM +0300, Mike Rapoport wrote: > Having typical usage example in the README file is more convinient than in > the git history... > > Signed-off-by: Mike Rapoport > --- > tools/virtio/ringtest/README | 4 > 1 file changed, 4 ins

Re: [PATCH v3] tools/virtio/ringtest: fix run-on-all.sh to work without /dev/cpu

2016-05-24 Thread Mike Rapoport
Michael, Any updates on this? On Wed, May 04, 2016 at 01:15:50PM +0300, Mike Rapoport wrote: > /dev/cpu is only available on x86 with certain modules (e.g. msr) enabled. > Using lscpu to get processors count is more portable. > > Signed-off-by: Mike Rapoport > --- > v3: simplify by using lscpu

RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> > > > > This can be pre-initialized, correct? > > > > > > > > pre-initialized? I am not quite understand your mean. > > > > > > I think you can maintain sg as part of device state and init sg with the > bitmap. > > > > > > > I got it. > > > > > > > This is grossly inefficient if you only requeste

Re: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Michael S. Tsirkin
On Tue, May 24, 2016 at 02:36:08PM +, Li, Liang Z wrote: > > > > > > This can be pre-initialized, correct? > > > > > > > > > > pre-initialized? I am not quite understand your mean. > > > > > > > > I think you can maintain sg as part of device state and init sg with the > > bitmap. > > > > > > >

RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> On Tue, May 24, 2016 at 02:36:08PM +, Li, Liang Z wrote: > > > > > > > This can be pre-initialized, correct? > > > > > > > > > > > > pre-initialized? I am not quite understand your mean. > > > > > > > > > > I think you can maintain sg as part of device state and init sg > > > > > with the > >

RE: [PATCH RFC kernel] balloon: speed up inflating/deflating process

2016-05-24 Thread Li, Liang Z
> > > > > > > This is grossly inefficient if you only requested a single page. > > > > > > > And it's also allocating memory very aggressively without > > > > > > > ever telling the host what is going on. > > > > > > > > > > > > If only requested a single page, there is no need to send the > > > >