Re: [Qemu-devel] [PATCH v6 kernel 3/5] virtio-balloon: speed up inflate/deflate process

2017-02-03 Thread Li, Liang Z
> > > > +static void free_extended_page_bitmap(struct virtio_balloon *vb) { > > + int i, bmap_count = vb->nr_page_bmap; > > + > > + for (i = 1; i < bmap_count; i++) { > > + kfree(vb->page_bitmap[i]); > > + vb->page_bitmap[i] = NULL; > > + vb->nr_page_bmap--; > >

Re: [Qemu-devel] [PATCH v6 kernel 3/5] virtio-balloon: speed up inflate/deflate process

2017-01-18 Thread Li, Liang Z
> On Wed, Jan 18, 2017 at 04:56:58AM +0000, Li, Liang Z wrote: > > > > - virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL); > > > > - virtqueue_kick(vq); > > > > +static void do_set_resp_bitmap(struct virtio_balloon *vb, > > >

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v6 kernel 2/5] virtio-balloon: define new feature bit and head struct

2017-01-18 Thread Li, Liang Z
> > > > > > Signed-off-by: Liang Li > > > > > > Cc: Michael S. Tsirkin > > > > > > Cc: Paolo Bonzini > > > > > > Cc: Cornelia Huck > > > > > > Cc: Amit Shah > > > > > > Cc: Dave Hansen > > > > > > Cc: Andrea Arcangeli > > > > > > Cc: David Hildenbrand > > > > > > --- > > > > > > include/ua

Re: [Qemu-devel] [PATCH v6 kernel 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2017-01-18 Thread Li, Liang Z
> Am 21.12.2016 um 07:52 schrieb Liang Li: > > This patch set contains two parts of changes to the virtio-balloon. > > > > One is the change for speeding up the inflating & deflating process, > > the main idea of this optimization is to use {pfn|length} to present > > the page information instead o

Re: [Qemu-devel] [PATCH v6 kernel 3/5] virtio-balloon: speed up inflate/deflate process

2017-01-17 Thread Li, Liang Z
> > - virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL); > > - virtqueue_kick(vq); > > +static void do_set_resp_bitmap(struct virtio_balloon *vb, > > + unsigned long base_pfn, int pages) > > > > - /* When host has read buffer, this completes via balloon_ack */ > > - wait_event(vb->

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v6 kernel 2/5] virtio-balloon: define new feature bit and head struct

2017-01-17 Thread Li, Liang Z
> Sent: Wednesday, January 18, 2017 3:11 AM > To: Li, Liang Z > Cc: k...@vger.kernel.org; virtio-...@lists.oasis-open.org; qemu- > de...@nongnu.org; linux...@kvack.org; linux-ker...@vger.kernel.org; > virtualizat...@lists.linux-foundation.org; amit.s...@redhat.com; Hansen, >

Re: [Qemu-devel] about post copy recovery

2017-01-15 Thread Li, Liang Z
> * Li, Liang Z (liang.z...@intel.com) wrote: > > > > Hi David, > > > > I remembered some guys wanted to solve the issue of post copy recovery > when network broken down, do you know latest status? > > Hi Liang, > Yes, Haris looked at it as part of GSoC, t

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v6 kernel 2/5] virtio-balloon: define new feature bit and head struct

2017-01-13 Thread Li, Liang Z
> On Wed, Dec 21, 2016 at 02:52:25PM +0800, Liang Li wrote: > > Add a new feature which supports sending the page information with > > range array. The current implementation uses PFNs array, which is not > > very efficient. Using ranges can improve the performance of > > inflating/deflating signif

[Qemu-devel] about post copy recovery

2017-01-10 Thread Li, Liang Z
Hi David, I remembered some guys wanted to solve the issue of post copy recovery when network broken down, do you know latest status? Thanks! Liang

Re: [Qemu-devel] [PATCH v6 kernel 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2017-01-09 Thread Li, Liang Z
Hi guys, Could you help to review this patch set? Thanks! Liang > -Original Message- > From: Li, Liang Z > Sent: Wednesday, December 21, 2016 2:52 PM > To: k...@vger.kernel.org > Cc: virtio-...@lists.oasis-open.org; qemu-devel@nongnu.org; linux- > m...@kv

Re: [Qemu-devel] [PATCH v3 0/4] migration: skip scanning and migrating ram pages released by virtio-balloon driver.

2017-01-05 Thread Li, Liang Z
> >> If we want to actually host enforce (disallow) access to inflated > >> pages, having > > > > Is that a new feature? > > Still in the design phase. Andrea Arcangeli briefly mentioned in in his reply > to > v5 of your patch series > > "We also plan to use userfaultfd to make the balloon drive

Re: [Qemu-devel] [PATCH v3 0/4] migration: skip scanning and migrating ram pages released by virtio-balloon driver.

2017-01-04 Thread Li, Liang Z
> Am 23.12.2016 um 03:50 schrieb Li, Liang Z: > >> While measuring live migration performance for qemu/kvm guest, it was > >> observed that the qemu doesn’t maintain any intelligence for the > >> guest ram pages released by the guest balloon driver and treat such

Re: [Qemu-devel] [PATCH v3 0/4] migration: skip scanning and migrating ram pages released by virtio-balloon driver.

2016-12-22 Thread Li, Liang Z
> While measuring live migration performance for qemu/kvm guest, it was > observed that the qemu doesn’t maintain any intelligence for the guest ram > pages released by the guest balloon driver and treat such pages as any other > normal guest ram pages. This has direct impact on overall migration t

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-17 Thread Li, Liang Z
> Subject: Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for > fast (de)inflating & fast live migration > > On Thu, Dec 15, 2016 at 05:40:45PM -0800, Dave Hansen wrote: > > On 12/15/2016 05:38 PM, Li, Liang Z wrote: > > > > > > Use 52 bits f

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-17 Thread Li, Liang Z
> On Fri, Dec 16, 2016 at 01:12:21AM +0000, Li, Liang Z wrote: > > There still exist the case if the MAX_ORDER is configured to a large > > value, e.g. 36 for a system with huge amount of memory, then there is only > 28 bits left for the pfn, which is not enough. > > No

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-15 Thread Li, Liang Z
> On 12/15/2016 05:38 PM, Li, Liang Z wrote: > > > > Use 52 bits for 'pfn', 12 bits for 'length', when the 12 bits is not long > > enough > for the 'length' > > Set the 'length' to a special value to indicate the "act

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-15 Thread Li, Liang Z
> On 12/15/2016 04:48 PM, Li, Liang Z wrote: > >>> It seems we leave too many bit for the pfn, and the bits leave for > >>> length is not enough, How about keep 45 bits for the pfn and 19 bits > >>> for length, 45 bits for pfn can cover 57 bits physical ad

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-15 Thread Li, Liang Z
> On Thu, Dec 15, 2016 at 07:34:33AM -0800, Dave Hansen wrote: > > On 12/14/2016 12:59 AM, Li, Liang Z wrote: > > >> Subject: Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend > > >> virtio-balloon for fast (de)inflating & fast live migration > > >>

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-15 Thread Li, Liang Z
> Subject: Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for > fast (de)inflating & fast live migration > > On 12/14/2016 12:59 AM, Li, Liang Z wrote: > >> Subject: Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon > >> for fast (

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-14 Thread Li, Liang Z
> Subject: Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for > fast (de)inflating & fast live migration > > On 12/08/2016 08:45 PM, Li, Liang Z wrote: > > What's the conclusion of your discussion? It seems you want some > > statistic before decidi

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-14 Thread Li, Liang Z
> fast (de)inflating & fast live migration > > Hello, > > On Fri, Dec 09, 2016 at 05:35:45AM +, Li, Liang Z wrote: > > > On 12/08/2016 08:45 PM, Li, Liang Z wrote: > > > > What's the conclusion of your discussion? It seems you want some > >

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-08 Thread Li, Liang Z
> On 12/08/2016 08:45 PM, Li, Liang Z wrote: > > What's the conclusion of your discussion? It seems you want some > > statistic before deciding whether to ripping the bitmap from the ABI, > > am I right? > > I think Andrea and David feel pretty strongly that we sh

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-08 Thread Li, Liang Z
> > 1. Current patches do a hypercall for each order in the allocator. > >This is inefficient, but independent from the underlying data > >structure in the ABI, unless bitmaps are in play, which they aren't. > > 2. Should we have bitmaps in the ABI, even if they are not in use by the > >

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-08 Thread Li, Liang Z
> Subject: Re: [PATCH kernel v5 0/5] Extend virtio-balloon for fast > (de)inflating > & fast live migration > > On 12/07/2016 05:35 AM, Li, Liang Z wrote: > >> Am 30.11.2016 um 09:43 schrieb Liang Li: > >> IOW in real examples, do we have really large consecu

Re: [Qemu-devel] [PATCH kernel v5 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-12-07 Thread Li, Liang Z
> Am 30.11.2016 um 09:43 schrieb Liang Li: > > This patch set contains two parts of changes to the virtio-balloon. > > > > One is the change for speeding up the inflating & deflating process, > > the main idea of this optimization is to use bitmap to send the page > > information to host instead of

Re: [Qemu-devel] [PATCH kernel v5 5/5] virtio-balloon: tell host vm's unused page info

2016-12-05 Thread Li, Liang Z
> >>> + mutex_lock(&vb->balloon_lock); > >>> + > >>> + for (order = MAX_ORDER - 1; order >= 0; order--) { > >> > >> I scratched my head for a bit on this one. Why are you walking over > >> orders, > >> *then* zones. I *think* you're doing it because you can efficiently > >> fill the bitmaps at a

Re: [Qemu-devel] [PATCH kernel v5 5/5] virtio-balloon: tell host vm's unused page info

2016-12-04 Thread Li, Liang Z
> On 11/30/2016 12:43 AM, Liang Li wrote: > > +static void send_unused_pages_info(struct virtio_balloon *vb, > > + unsigned long req_id) > > +{ > > + struct scatterlist sg_in; > > + unsigned long pos = 0; > > + struct virtqueue *vq = vb->req_vq; > > + struct virtio

Re: [Qemu-devel] [PATCH kernel v4 7/7] virtio-balloon: tell host vm's unused page info

2016-11-07 Thread Li, Liang Z
> On 11/06/2016 07:37 PM, Li, Liang Z wrote: > >> Let's say we do a 32k bitmap that can hold ~1M pages. That's 4GB of RAM. > >> On a 1TB system, that's 256 passes through the top-level loop. > >> The bottom-level lists have tens of thousands of pages

Re: [Qemu-devel] Migration dirty bitmap: should only mark pages as dirty after they have been sent

2016-11-07 Thread Li, Liang Z
> > I compare SHA1 with XBZRLE. I use XBZRLE in two ways: > > 1. Begins to buffer pages from iteration 1; 2. As current > > implementation, begins to buffer pages from iteration 2. > > > > I post the results of three workloads: cpu2006.zeusmp, cpu2006.mcf, > > memcached. > > I set the cache size as

Re: [Qemu-devel] Migration dirty bitmap: should only mark pages as dirty after they have been sent

2016-11-07 Thread Li, Liang Z
> > > > > > > > > I think this is "very" wasteful. Assume the workload > > > > > > > > > writes the pages > > > > > dirty randomly within the guest address space, and the transfer > > > > > speed is constant. Intuitively, I think nearly half of the dirty > > > > > pages produced in Iteration 1 is n

Re: [Qemu-devel] [PATCH kernel v4 7/7] virtio-balloon: tell host vm's unused page info

2016-11-06 Thread Li, Liang Z
> Please squish this and patch 5 together. It makes no sense to separate them. > OK. > > +static void send_unused_pages_info(struct virtio_balloon *vb, > > + unsigned long req_id) > > +{ > > + struct scatterlist sg_in; > > + unsigned long pfn = 0, bmap_len, pfn_lim

Re: [Qemu-devel] Migration dirty bitmap: should only mark pages as dirty after they have been sent

2016-11-03 Thread Li, Liang Z
> > > > > > > I think this is "very" wasteful. Assume the workload writes > > > > > > > the pages > > > dirty randomly within the guest address space, and the transfer > > > speed is constant. Intuitively, I think nearly half of the dirty > > > pages produced in Iteration 1 is not really dirty. Thi

Re: [Qemu-devel] Migration dirty bitmap: should only mark pages as dirty after they have been sent

2016-11-03 Thread Li, Liang Z
> > > > > I think this is "very" wasteful. Assume the workload writes the pages > dirty randomly within the guest address space, and the transfer speed is > constant. Intuitively, I think nearly half of the dirty pages produced in > Iteration 1 is not really dirty. This means the time of Iteration

Re: [Qemu-devel] Migration dirty bitmap: should only mark pages as dirty after they have been sent

2016-11-03 Thread Li, Liang Z
> pages will be sent. Before that during the migration setup, the > ioctl(KVM_GET_DIRTY_LOG) is called once, so the kernel begins to produce > the dirty bitmap from this moment. When the pages "that haven't been > sent" are written, the kernel space marks them as dirty. However I don't > think this

Re: [Qemu-devel] [RESEND PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-10-26 Thread Li, Liang Z
> On 10/26/2016 03:06 AM, Li, Liang Z wrote: > > I am working on Dave's new bitmap schema, I have finished the part of > > getting the 'hybrid scheme bitmap' and found the complexity was more > > than I expected. The main issue is more memory is required t

Re: [Qemu-devel] [RESEND PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-10-26 Thread Li, Liang Z
.@redhat.com > Subject: Re: [RESEND PATCH v3 kernel 0/7] Extend virtio-balloon for fast > (de)inflating & fast live migration > > On 10/26/2016 03:13 AM, Li, Liang Z wrote: > > 3 times memory required is not accurate, please ignore this. sorry ... > > The complexity is the

Re: [Qemu-devel] [RESEND PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-10-26 Thread Li, Liang Z
> > On 10/20/2016 11:24 PM, Liang Li wrote: > > > Dave Hansen suggested a new scheme to encode the data structure, > > > because of additional complexity, it's not implemented in v3. > > > > So, what do you want done with this patch set? Do you want it applied > > as-is so that we can introduce a

Re: [Qemu-devel] [RESEND PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-10-26 Thread Li, Liang Z
> On 10/20/2016 11:24 PM, Liang Li wrote: > > Dave Hansen suggested a new scheme to encode the data structure, > > because of additional complexity, it's not implemented in v3. > > So, what do you want done with this patch set? Do you want it applied as-is > so that we can introduce a new host/gu

Re: [Qemu-devel] [RESEND PATCH v3 kernel 4/7] virtio-balloon: speed up inflate/deflate process

2016-10-25 Thread Li, Liang Z
> > +static inline void init_pfn_range(struct virtio_balloon *vb) { > > + vb->min_pfn = ULONG_MAX; > > + vb->max_pfn = 0; > > +} > > + > > +static inline void update_pfn_range(struct virtio_balloon *vb, > > +struct page *page) > > +{ > > + unsigned long balloon_pfn

Re: [Qemu-devel] [RESEND PATCH v3 kernel 3/7] mm: add a function to get the max pfn

2016-10-24 Thread Li, Liang Z
> On 10/20/2016 11:24 PM, Liang Li wrote: > > Expose the function to get the max pfn, so it can be used in the > > virtio-balloon device driver. Simply include the 'linux/bootmem.h' > > is not enough, if the device driver is built to a module, directly > > refer the max_pfn lead to build failed. >

Re: [Qemu-devel] [RESEND PATCH v3 kernel 2/7] virtio-balloon: define new feature bit and page bitmap head

2016-10-24 Thread Li, Liang Z
> On 10/20/2016 11:24 PM, Liang Li wrote: > > Add a new feature which supports sending the page information with a > > bitmap. The current implementation uses PFNs array, which is not very > > efficient. Using bitmap can improve the performance of > > inflating/deflating significantly > > Why is i

Re: [Qemu-devel] [RESEND PATCH v3 kernel 1/7] virtio-balloon: rework deflate to add page to a list

2016-10-24 Thread Li, Liang Z
> On 10/20/2016 11:24 PM, Liang Li wrote: > > Will allow faster notifications using a bitmap down the road. > > balloon_pfn_to_page() can be removed because it's useless. > > This is a pretty terse description of what's going on here. Could you try to > elaborate a bit? What *is* the current app

Re: [Qemu-devel] [RESEND PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-10-23 Thread Li, Liang Z
> On Fri, Oct 21, 2016 at 10:25:21AM -0700, Dave Hansen wrote: > > On 10/20/2016 11:24 PM, Liang Li wrote: > > > Dave Hansen suggested a new scheme to encode the data structure, > > > because of additional complexity, it's not implemented in v3. > > > > So, what do you want done with this patch set

Re: [Qemu-devel] [PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-08-31 Thread Li, Liang Z
> Subject: Re: [PATCH v3 kernel 0/7] Extend virtio-balloon for fast > (de)inflating > & fast live migration > > 2016-08-08 14:35 GMT+08:00 Liang Li : > > This patch set contains two parts of changes to the virtio-balloon. > > > > One is the change for speeding up the inflating & deflating process

Re: [Qemu-devel] [PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-08-30 Thread Li, Liang Z
Hi Michael, I know you are very busy. If you have time, could you help to take a look at this patch set? Thanks! Liang > -Original Message- > From: Li, Liang Z > Sent: Thursday, August 18, 2016 9:06 AM > To: Michael S. Tsirkin > Cc: virtualizat...@lists.linux-founda

Re: [Qemu-devel] [PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-08-17 Thread Li, Liang Z
Hi Michael, Could you help to review this version when you have time? Thanks! Liang > -Original Message- > From: Li, Liang Z > Sent: Monday, August 08, 2016 2:35 PM > To: linux-ker...@vger.kernel.org > Cc: virtualizat...@lists.linux-foundation.org; linux...@kvack.o

Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-11 Thread Li, Liang Z
> >> > BTW. Is it possible to bypass the shared block in the > >> 'ram_find_and_save_block'? > >> > I mean no to check if a page is dirty for a shared block, it may > >> > make things > >> faster. > >> > >> Nice spotted. That would make things faster. But once there we > >> could split the bitmap

Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-11 Thread Li, Liang Z
> >> > >> I might have missed something, could you tell me more? > >> > >> void bitmap_set(unsigned long *map, long start, long nr); I think the > >> @start and @nr are both the number of the bits. > >> > >> thanks, > >> Lai > > > > You are right, I have make a mistake by checking the code. Sorry

Re: [Qemu-devel] [PATCH repost] virtio-balloon: Remove needless precompiled directive

2016-08-10 Thread Li, Liang Z
> On Tue, Aug 09, 2016 at 08:30:42AM +0800, Liang Li wrote: > > Since there in wrapper around madvise(), the virtio-balloon code is > > able to work without the precompiled directive, the directive can be > > removed. > > > > Signed-off-by: Liang Li > > Suggested-by: Thomas Huth > > Reviewd-by: D

Re: [Qemu-devel] [PATCH] migration: fix live migration failure with compression

2016-08-09 Thread Li, Liang Z
> Subject: Re: [PATCH] migration: fix live migration failure with compression > > * Liang Li (liang.z...@intel.com) wrote: > > Because of commit 11808bb0c422, which remove some condition checks of > > 'f->ops->writev_buffer', 'qemu_put_qemu_file' should be enhanced to > > clear the 'f_src->iovcnt'

Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-09 Thread Li, Liang Z
> On Wed, Aug 10, 2016 at 10:22 AM, Li, Liang Z wrote: > > Hi Jiangshan, > > > > Glad to see your patch. It's a simple implementation which could provide > very useful functions. > > > >> +static void migration_bitmap_init(unsign

Re: [Qemu-devel] [PATCH V2] add migration capability to bypass the shared memory

2016-08-09 Thread Li, Liang Z
Hi Jiangshan, Glad to see your patch. It's a simple implementation which could provide very useful functions. > +static void migration_bitmap_init(unsigned long *bitmap) { > +RAMBlock *block; > + > +bitmap_clear(bitmap, 0, last_ram_offset() >> TARGET_PAGE_BITS); > +rcu_read_lock(); >

Re: [Qemu-devel] [PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-08-08 Thread Li, Liang Z
> Subject: Re: [PATCH v3 kernel 0/7] Extend virtio-balloon for fast > (de)inflating > & fast live migration > > On 08/07/2016 11:35 PM, Liang Li wrote: > > Dave Hansen suggested a new scheme to encode the data structure, > > because of additional complexity, it's not implemented in v3. > > FWIW,

Re: [Qemu-devel] [PATCH v2] balloon: Fix failure of updating guest memory status

2016-08-08 Thread Li, Liang Z
> > > > Hi Liang, > > > > I should be able to look into it this week if you help me with testing. > > > > Thanks, > > Ladi > > Please try the attached patch. I have tested it with a simple 'migrate' to > save > the state and then '-incoming' to load it back. > Thanks for your work. I have alrea

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-08-01 Thread Li, Liang Z
> > It's only small because it makes you rescan the free list. > > So maybe you should do something else. > > I looked at it a bit. Instead of scanning the free list, how about > > scanning actual page structures? If page is unused, pass it to host. > > Solves the problem of rescanning multiple tim

Re: [Qemu-devel] [PATCH v2] balloon: Fix failure of updating guest memory status

2016-08-01 Thread Li, Liang Z
> On Wed, Jul 06, 2016 at 12:49:06PM +0000, Li, Liang Z wrote: > > > > > > After live migration, 'guest-stats' can't get the expected > > > > > > memory status in the guest. This issue is caused by commit > 4eae2a657d. > >

Re: [Qemu-devel] [QEMU v2 1/9] virtio-balloon: Remove needless precompiled directive

2016-08-01 Thread Li, Liang Z
> * Liang Li (liang.z...@intel.com) wrote: > > Since there in wrapper around madvise(), the virtio-balloon code is > > able to work without the precompiled directive, the directive can be > > removed. > > > > Signed-off-by: Liang Li > > Suggested-by: Thomas Huth > > This one could be posted sepa

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-28 Thread Li, Liang Z
> > > On Wed, Jul 27, 2016 at 09:03:21AM -0700, Dave Hansen wrote: > > > > On 07/26/2016 06:23 PM, Liang Li wrote: > > > > > + vb->pfn_limit = VIRTIO_BALLOON_PFNS_LIMIT; > > > > > + vb->pfn_limit = min(vb->pfn_limit, get_max_pfn()); > > > > > + vb->bmap_len = ALIGN(vb->pfn_limit, BITS_P

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-28 Thread Li, Liang Z
> On Thu, Jul 28, 2016 at 06:36:18AM +0000, Li, Liang Z wrote: > > > > > This ends up doing a 1MB kmalloc() right? That seems a _bit_ big. > > > > > How big was the pfn buffer before? > > > > > > > > Yes, it is if the max pfn is more than 3

Re: [Qemu-devel] [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-28 Thread Li, Liang Z
> On Thu, Jul 28, 2016 at 03:06:37AM +0000, Li, Liang Z wrote: > > > > + * VIRTIO_BALLOON_PFNS_LIMIT is used to limit the size of page > > > > +bitmap > > > > + * to prevent a very large page bitmap, there are two reasons for this: > > > > + *

Re: [Qemu-devel] [PATCH v2 repost 7/7] virtio-balloon: tell host vm's free page info

2016-07-28 Thread Li, Liang Z
> > } > > > > +static void update_free_pages_stats(struct virtio_balloon *vb, > > why _stats? Will change. > > + max_pfn = get_max_pfn(); > > + mutex_lock(&vb->balloon_lock); > > + while (pfn < max_pfn) { > > + memset(vb->page_bitmap, 0, vb->bmap_len); > > + ret = get_

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-27 Thread Li, Liang Z
> > > This ends up doing a 1MB kmalloc() right? That seems a _bit_ big. > > > How big was the pfn buffer before? > > > > Yes, it is if the max pfn is more than 32GB. > > The size of the pfn buffer use before is 256*4 = 1024 Bytes, it's too > > small, and it's the main reason for bad performance. >

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 repost 6/7] mm: add the related functions to get free page info

2016-07-27 Thread Li, Liang Z
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7da61ad..3ad8b10 > > 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -4523,6 +4523,52 @@ unsigned long get_max_pfn(void) } > > EXPORT_SYMBOL(get_max_pfn); > > > > +static void mark_free_pages_bitmap(struct zone *zone, unsig

Re: [Qemu-devel] [PATCH v2 repost 6/7] mm: add the related functions to get free page info

2016-07-27 Thread Li, Liang Z
> On 07/27/2016 03:05 PM, Michael S. Tsirkin wrote: > > On Wed, Jul 27, 2016 at 09:40:56AM -0700, Dave Hansen wrote: > >> On 07/26/2016 06:23 PM, Liang Li wrote: > >>> + for_each_migratetype_order(order, t) { > >>> + list_for_each(curr, &zone->free_area[order].free_list[t]) { > >>> +

Re: [Qemu-devel] [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-27 Thread Li, Liang Z
> > +/* > > + * VIRTIO_BALLOON_PFNS_LIMIT is used to limit the size of page bitmap > > + * to prevent a very large page bitmap, there are two reasons for this: > > + * 1) to save memory. > > + * 2) allocate a large bitmap may fail. > > + * > > + * The actual limit of pfn is determined by: > > + * p

Re: [Qemu-devel] [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-27 Thread Li, Liang Z
> Subject: Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate > process > > On Wed, Jul 27, 2016 at 09:03:21AM -0700, Dave Hansen wrote: > > On 07/26/2016 06:23 PM, Liang Li wrote: > > > + vb->pfn_limit = VIRTIO_BALLOON_PFNS_LIMIT; > > > + vb->pfn_limit = min(vb->pfn_limit, get_max

Re: [Qemu-devel] [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-27 Thread Li, Liang Z
> > + * VIRTIO_BALLOON_PFNS_LIMIT is used to limit the size of page bitmap > > + * to prevent a very large page bitmap, there are two reasons for this: > > + * 1) to save memory. > > + * 2) allocate a large bitmap may fail. > > + * > > + * The actual limit of pfn is determined by: > > + * pfn_limit

Re: [Qemu-devel] [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate process

2016-07-27 Thread Li, Liang Z
> Subject: Re: [PATCH v2 repost 4/7] virtio-balloon: speed up inflate/deflate > process > > On 07/26/2016 06:23 PM, Liang Li wrote: > > + vb->pfn_limit = VIRTIO_BALLOON_PFNS_LIMIT; > > + vb->pfn_limit = min(vb->pfn_limit, get_max_pfn()); > > + vb->bmap_len = ALIGN(vb->pfn_limit, BITS_PER_LON

Re: [Qemu-devel] [PATCH v2 repost 6/7] mm: add the related functions to get free page info

2016-07-27 Thread Li, Liang Z
> Subject: Re: [PATCH v2 repost 6/7] mm: add the related functions to get free > page info > > On 07/26/2016 06:23 PM, Liang Li wrote: > > + for_each_migratetype_order(order, t) { > > + list_for_each(curr, &zone->free_area[order].free_list[t]) { > > + pfn = page_to_pf

Re: [Qemu-devel] [virtio-dev] Re: [PATCH v2 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-07-26 Thread Li, Liang Z
> So I'm fine with this patchset, but I noticed it was not yet reviewed by MM > people. And that is not surprising since you did not copy memory > management mailing list on it. > > I added linux...@kvack.org Cc on this mail but this might not be enough. > > Please repost (e.g. [PATCH v2 repost])

Re: [Qemu-devel] [PATCH v2 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-07-21 Thread Li, Liang Z
Hi Michael, If you have time, could you help to review this patch set? Thanks! Liang > -Original Message- > From: Li, Liang Z > Sent: Wednesday, June 29, 2016 6:32 PM > To: m...@redhat.com > Cc: linux-ker...@vger.kernel.org; virtualizat...@lists.linux-foun

Re: [Qemu-devel] [QEMU v2 0/9] Fast (de)inflating & fast live migration

2016-07-21 Thread Li, Liang Z
it.s...@redhat.com; k...@vger.kernel.org; dgilb...@redhat.com; > th...@redhat.com; Li, Liang Z > Subject: [QEMU v2 0/9] Fast (de)inflating & fast live migration > > This patch set intends to do two optimizations, one is to speed up the > (de)inflating process of virtio balloon, an

Re: [Qemu-devel] [PATCH v2] balloon: Fix failure of updating guest memory status

2016-07-06 Thread Li, Liang Z
> > > > After live migration, 'guest-stats' can't get the expected memory > > > > status in the guest. This issue is caused by commit 4eae2a657d. > > > > The value of 's->stats_vq_elem' will be NULL after live migration, > > > > and the check in the function 'balloon_stats_poll_cb()' will > > > > p

Re: [Qemu-devel] [PATCH v2] balloon: Fix failure of updating guest memory status

2016-07-06 Thread Li, Liang Z
> On Wed, Jul 06, 2016 at 10:36:33AM +0800, Liang Li wrote: > > After live migration, 'guest-stats' can't get the expected memory > > status in the guest. This issue is caused by commit 4eae2a657d. > > The value of 's->stats_vq_elem' will be NULL after live migration, and > > the check in the funct

Re: [Qemu-devel] [PATCH v2 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-07-05 Thread Li, Liang Z
Ping ... Liang > -Original Message- > From: Li, Liang Z > Sent: Wednesday, June 29, 2016 6:32 PM > To: m...@redhat.com > Cc: linux-ker...@vger.kernel.org; virtualizat...@lists.linux-foundation.org; > k...@vger.kernel.org; qemu-devel@nongnu.org; virtio-dev@lists.oasis-

Re: [Qemu-devel] [PATCH] balloon: Fix failure of updating guest memory status

2016-07-01 Thread Li, Liang Z
> > +if (s->stats_vq_elem == NULL) { > > +virtqueue_push(s->svq, &elem, 0); > > +virtio_notify(vdev, s->svq); > > +return; > > +} > > virtqueue_push(s->svq, s->stats_vq_elem, s->stats_vq_offset); > > virtio_notify(vdev, s->svq); > > g_free(s->stats_vq_

Re: [Qemu-devel] [PATCH] balloon: Fix failure of updating guest memory status

2016-06-30 Thread Li, Liang Z
> > +if (s->stats_vq_elem == NULL) { > > +virtqueue_push(s->svq, &elem, 0); > > +virtio_notify(vdev, s->svq); > > +return; > > +} > > virtqueue_push(s->svq, s->stats_vq_elem, s->stats_vq_offset); > > virtio_notify(vdev, s->svq); > > g_free(s->stats_vq_

Re: [Qemu-devel] [PATCH] balloon: Fix failure of updating guest memory status

2016-06-30 Thread Li, Liang Z
> >> What if we are not in the just-after-live-migration situation though? > >> If the guest simply didn't add a buffer to the queue for some reason, > >> wouldn't this newly added push/notify break the balloon protocol? > >> > > Could you elaborate how it happens? > > The added code only works for

Re: [Qemu-devel] [PATCH] balloon: Fix failure of updating guest memory status

2016-06-30 Thread Li, Liang Z
> On Thu, Jun 30, 2016 at 9:31 AM, Liang Li wrote: > > After live migration, 'guest-stats' can't get the expected memory > > status in the guest. This issue is caused by commit 4eae2a657d. > > The value of 's->stats_vq_elem' will be NULL after live migration, and > > the check in the function 'bal

Re: [Qemu-devel] [QEMU 6/7] kvm: Add two new arch specific functions

2016-06-19 Thread Li, Liang Z
> > --- a/target-arm/kvm.c > > +++ b/target-arm/kvm.c > > @@ -627,3 +627,17 @@ int kvm_arch_msi_data_to_gsi(uint32_t data) { > > return (data - 32) & 0x; > > } > > + > > +unsigned long get_guest_max_pfn(void) { > > +/* To be done */ > > + > > +return 0; > > +} > > + > > +unsigned

Re: [Qemu-devel] [QEMU 7/7] migration: skip free pages during live migration

2016-06-19 Thread Li, Liang Z
> On Mon, Jun 13, 2016 at 06:16:49PM +0800, Liang Li wrote: > > After sending out the request for free pages, live migration process > > will start without waiting for the free page bitmap is ready. If the > > free page bitmap is not ready when doing the 1st > > migration_bitmap_sync() after ram_sa

Re: [Qemu-devel] [QEMU 4/7] balloon: get free page info from guest

2016-06-19 Thread Li, Liang Z
> On Mon, Jun 13, 2016 at 06:16:46PM +0800, Liang Li wrote: > > Add a new feature to get the free page information from guest, the > > free page information is saved in a bitmap. Please note that 'free > > page' only means these pages are free before the request, some of the > > pages will become n

Re: [Qemu-devel] [QEMU 2/7] virtio-balloon: add drop cache support

2016-06-19 Thread Li, Liang Z
> On Mon, Jun 13, 2016 at 06:16:44PM +0800, Liang Li wrote: > > virtio-balloon can make use of the amount of free memory to determine > > the amount of memory to be filled in the balloon, but the amount of > > free memory will be effected by the page cache, which can be reclaimed. > > Drop the cach

Re: [Qemu-devel] [QEMU 1/7] balloon: speed up inflating & deflating process

2016-06-19 Thread Li, Liang Z
> > > > virtqueue_push(vq, elem, offset); @@ -374,6 +489,7 @@ static > > uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f, > > VirtIOBalloon *dev = VIRTIO_BALLOON(vdev); > > f |= dev->host_features; > > virtio_add_feature(&f, VIRTIO_BALLOON_F_STATS_VQ); >

Re: [Qemu-devel] [QEMU 3/7] Add the hmp and qmp interface for dropping cache

2016-06-16 Thread Li, Liang Z
> > > > +{ 'command': 'balloon_drop_cache', 'data': {'value': > > > > +'DropCacheType'} } > > > > > > Also, as noted in the man page quote above, it is recommended to > > > call > > > sync() to minimise dirty pages. Should we have a way to request a > > > sync as part of this monitor command. > > >

Re: [Qemu-devel] [QEMU 1/7] balloon: speed up inflating & deflating process

2016-06-16 Thread Li, Liang Z
> +chunk = TARGET_PAGE_SIZE; > +} > +} > +} > + > +static void balloon_bulk_pages(ram_addr_t base_pfn, unsigned long > >>> *bitmap, > + unsigned long len, int page_shift, > +bool deflate) { #if defined(__l

Re: [Qemu-devel] [QEMU 1/7] balloon: speed up inflating & deflating process

2016-06-14 Thread Li, Liang Z
> > On 13.06.2016 12:16, 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 host (6

Re: [Qemu-devel] [QEMU 1/7] balloon: speed up inflating & deflating process

2016-06-14 Thread Li, Liang Z
> Subject: Re: [QEMU 1/7] balloon: speed up inflating & deflating process > > On 13.06.2016 12:16, 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

Re: [Qemu-devel] [QEMU 3/7] Add the hmp and qmp interface for dropping cache

2016-06-13 Thread Li, Liang Z
> * Li, Liang Z (liang.z...@intel.com) wrote: > > > Because writing to this file is a nondestructive operation and dirty > > > objects are not freeable, the user should run sync(1) first. > > > [/quote] > > > > > > IOW, by &#x

Re: [Qemu-devel] [QEMU 3/7] Add the hmp and qmp interface for dropping cache

2016-06-13 Thread Li, Liang Z
> > On 13/06/2016 12:50, Daniel P. Berrange wrote: > > More generally, it feels like this is taking as down a path towards > > actively managing the guest kernel VM from the host. Is this really a > > path we want to be going down, given that its going to take us into > > increasing non-portable c

Re: [Qemu-devel] [QEMU 3/7] Add the hmp and qmp interface for dropping cache

2016-06-13 Thread Li, Liang Z
> On Mon, Jun 13, 2016 at 11:50:08AM +0100, Daniel P. Berrange wrote: > > On Mon, Jun 13, 2016 at 06:16:45PM +0800, Liang Li wrote: > > > Add the hmp and qmp interface to drop vm's page cache, users can > > > control the type of cache they want vm to drop. > > > > > > Signed-off-by: Liang Li > > >

Re: [Qemu-devel] [QEMU 3/7] Add the hmp and qmp interface for dropping cache

2016-06-13 Thread Li, Liang Z
> Because writing to this file is a nondestructive operation and dirty objects > are > not freeable, the user should run sync(1) first. > [/quote] > > IOW, by 'slab' you mean dentries and inodes ? > Yes. > > +## > > +{ 'command': 'balloon_drop_cache', 'data': {'value': 'DropCacheType'} > > +} >

Re: [Qemu-devel] [PATCH v2 2/9] migration: Fix a potential issue

2016-06-12 Thread Li, Liang Z
> > > > +static void wait_for_decompress_done(void) { > > > > +int idx, thread_count; > > > > + > > > > +if (!migrate_use_compression()) { > > > > +return; > > > > +} > > > > + > > > > +thread_count = migrate_decompress_threads(); > > > > +qemu_mutex_lock(&decomp_done_lo

Re: [Qemu-devel] [PATCH v2 2/9] migration: Fix a potential issue

2016-06-10 Thread Li, Liang Z
> Subject: Re: [PATCH v2 2/9] migration: Fix a potential issue > > On (Thu) 05 May 2016 [15:32:52], Liang Li wrote: > > At the end of live migration and before vm_start() on the destination > > side, we should make sure all the decompression tasks are finished, if > > this can not be guaranteed, t

Re: [Qemu-devel] [PATCH RFC v2 kernel] balloon: speed up inflating/deflating process

2016-06-07 Thread Li, Liang Z
Ping... Liang > -Original Message- > From: Li, Liang Z > Sent: Wednesday, June 01, 2016 10:41 AM > To: linux-ker...@vger.kernel.org > Cc: k...@vger.kernel.org; qemu-devel@nongnu.org; Michael S. Tsirkin; > Paolo Bonzini; Cornelia Huck; Amit Shah > Subject: RE:

Re: [Qemu-devel] [PATCH v2 0/2] AVX2 configure fixes

2016-06-02 Thread Li, Liang Z
test > > configure | 15 +++ > util/cutils.c | 8 +--- > 2 files changed, 12 insertions(+), 11 deletions(-) > > -- > 2.7.4 Looks good. Thank! Reviewed-by: Liang Li Liang

Re: [Qemu-devel] [PATCH RFC v2 kernel] balloon: speed up inflating/deflating process

2016-05-31 Thread Li, Liang Z
conservative? Liang > -Original Message----- > From: Li, Liang Z > Sent: Friday, May 27, 2016 6:34 PM > To: linux-ker...@vger.kernel.org > Cc: k...@vger.kernel.org; qemu-devel@nongnu.org; Li, Liang Z; Michael S. > Tsirkin; Paolo Bonzini; Cornelia Huck; Amit Shah > Subj

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

2016-05-25 Thread Li, Liang Z
> > > Interesting. How about instead of tell host, we do multiple scans, > > > each time ignoring pages out of range? > > > > > > for (pfn = min pfn; pfn < max pfn; pfn += 1G) { > > > foreach page > > > if page pfn < pfn || page pfn >= pfn + 1G > > >

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

2016-05-25 Thread Li, Liang Z
> > > > > > > > Hi MST, > > > > > > > > I have measured the performance when using a 32K page bitmap, > > > > > > Just to make sure. Do you mean a 32Kbyte bitmap? > > > Covering 1Gbyte of memory? > > Yes. > > > > > > > > > and inflate the balloon to 3GB > > > > of an idle guest with 4GB RAM. > > >

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

2016-05-25 Thread Li, Liang Z
> On Wed, May 25, 2016 at 08:48:17AM +0000, Li, Liang Z wrote: > > > > > Suggestion to address all above comments: > > > > > 1. allocate a bunch of pages and link them up, > > > > > calculating the min and the max pfn. > > >

  1   2   3   4   >