Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-21 Thread Michael S. Tsirkin
On Tue, Aug 21, 2012 at 03:01:37PM +0930, Rusty Russell wrote: > On Wed, 15 Aug 2012 14:28:51 +0300, "Michael S. Tsirkin" > wrote: > > On Wed, Aug 15, 2012 at 12:16:51PM +0100, Mel Gorman wrote: > > > I was thinking of exactly that page->mapping == balloon_mapping check. As > > > I > > > do not

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-21 Thread Rusty Russell
On Wed, 15 Aug 2012 14:28:51 +0300, "Michael S. Tsirkin" wrote: > On Wed, Aug 15, 2012 at 12:16:51PM +0100, Mel Gorman wrote: > > I was thinking of exactly that page->mapping == balloon_mapping check. As I > > do not know how many active balloon drivers there might be I cannot guess > > in

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-21 Thread Rusty Russell
On Wed, 15 Aug 2012 14:28:51 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Aug 15, 2012 at 12:16:51PM +0100, Mel Gorman wrote: I was thinking of exactly that page-mapping == balloon_mapping check. As I do not know how many active balloon drivers there might be I cannot guess in

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-21 Thread Michael S. Tsirkin
On Tue, Aug 21, 2012 at 03:01:37PM +0930, Rusty Russell wrote: On Wed, 15 Aug 2012 14:28:51 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Aug 15, 2012 at 12:16:51PM +0100, Mel Gorman wrote: I was thinking of exactly that page-mapping == balloon_mapping check. As I do not

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-19 Thread Michael S. Tsirkin
On Mon, Aug 20, 2012 at 11:59:11AM +0930, Rusty Russell wrote: > On Wed, 15 Aug 2012 17:40:19 +0300, "Michael S. Tsirkin" > wrote: > > On Wed, Aug 15, 2012 at 09:34:58AM -0300, Rafael Aquini wrote: > > > On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: > > > > > > now CPU1

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-19 Thread Rusty Russell
On Wed, 15 Aug 2012 17:40:19 +0300, "Michael S. Tsirkin" wrote: > On Wed, Aug 15, 2012 at 09:34:58AM -0300, Rafael Aquini wrote: > > On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: > > > > > now CPU1 executes the next instruction: > > > > > > > > > > } > > > > > > > > > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-19 Thread Rusty Russell
On Wed, 15 Aug 2012 17:40:19 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Aug 15, 2012 at 09:34:58AM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: now CPU1 executes the next instruction: } which would

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-19 Thread Michael S. Tsirkin
On Mon, Aug 20, 2012 at 11:59:11AM +0930, Rusty Russell wrote: On Wed, 15 Aug 2012 17:40:19 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Aug 15, 2012 at 09:34:58AM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: now CPU1

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Rik van Riel
On 08/14/2012 05:38 PM, Michael S. Tsirkin wrote: And even ignoring that, global pointer to a device is an ugly hack and ugly hacks tend to explode. And even ignoring estetics, and if we decide we are fine with a single balloon, it needs to fail gracefully not crash like it does now. Fair

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 09:34:58AM -0300, Rafael Aquini wrote: > On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: > > > > now CPU1 executes the next instruction: > > > > > > > > } > > > > > > > > which would normally return to function's caller, > > > > but it has been

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: > > > now CPU1 executes the next instruction: > > > > > > } > > > > > > which would normally return to function's caller, > > > but it has been overwritten by CPU2 so we get corruption. > > > > > > No? > > > > At the point

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 12:16:51PM +0100, Mel Gorman wrote: > On Wed, Aug 15, 2012 at 01:01:08PM +0300, Michael S. Tsirkin wrote: > > On Wed, Aug 15, 2012 at 10:48:39AM +0100, Mel Gorman wrote: > > > On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: > > > > On Wed, Aug 15, 2012

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Mel Gorman
On Wed, Aug 15, 2012 at 01:01:08PM +0300, Michael S. Tsirkin wrote: > On Wed, Aug 15, 2012 at 10:48:39AM +0100, Mel Gorman wrote: > > On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: > > > On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: > > > > On Tue, Aug 14, 2012

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 10:48:39AM +0100, Mel Gorman wrote: > On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: > > On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: > > > On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: > > > > On Tue, Aug 14, 2012 at

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Mel Gorman
On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: > On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: > > On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: > > > On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: > > > > What I think you

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: > On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: > > On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: > > > What I think you should do is use rcu for access. > > > And here sync rcu before freeing. > > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Mel Gorman
On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: > On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: > > What I think you should do is use rcu for access. > > And here sync rcu before freeing. > > Maybe an overkill but at least a documented synchronization > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Mel Gorman
On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: What I think you should do is use rcu for access. And here sync rcu before freeing. Maybe an overkill but at least a documented synchronization primitive, and

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: What I think you should do is use rcu for access. And here sync rcu before freeing. Maybe an

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Mel Gorman
On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: What I think you should do is

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 10:48:39AM +0100, Mel Gorman wrote: On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:51:39PM

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Mel Gorman
On Wed, Aug 15, 2012 at 01:01:08PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 15, 2012 at 10:48:39AM +0100, Mel Gorman wrote: On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 15, 2012 at 10:05:28AM +0100, Mel Gorman wrote: On Tue, Aug 14, 2012 at

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 12:16:51PM +0100, Mel Gorman wrote: On Wed, Aug 15, 2012 at 01:01:08PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 15, 2012 at 10:48:39AM +0100, Mel Gorman wrote: On Wed, Aug 15, 2012 at 12:25:28PM +0300, Michael S. Tsirkin wrote: On Wed, Aug 15, 2012 at

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: now CPU1 executes the next instruction: } which would normally return to function's caller, but it has been overwritten by CPU2 so we get corruption. No? At the point CPU2 is unloading the module,

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Michael S. Tsirkin
On Wed, Aug 15, 2012 at 09:34:58AM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:31:09PM +0300, Michael S. Tsirkin wrote: now CPU1 executes the next instruction: } which would normally return to function's caller, but it has been overwritten by CPU2 so we get

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-15 Thread Rik van Riel
On 08/14/2012 05:38 PM, Michael S. Tsirkin wrote: And even ignoring that, global pointer to a device is an ugly hack and ugly hacks tend to explode. And even ignoring estetics, and if we decide we are fine with a single balloon, it needs to fail gracefully not crash like it does now. Fair

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rusty Russell
On Tue, 14 Aug 2012 11:33:20 +0300, "Michael S. Tsirkin" wrote: > On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: > > On Mon, 13 Aug 2012 11:41:23 +0300, "Michael S. Tsirkin" > > wrote: > > > On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: > > > > +/* > > > > + *

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 06:34:13PM -0300, Rafael Aquini wrote: > On Tue, Aug 14, 2012 at 11:49:06PM +0300, Michael S. Tsirkin wrote: > > On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: > > > On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: > > > > On Tue, Aug 14,

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 04:56:59PM -0400, Rik van Riel wrote: > On 08/14/2012 04:54 PM, Michael S. Tsirkin wrote: > > >To clarify, the global state that this patch adds, is ugly > >even if we didn't support multiple balloons yet. > >So I don't think I can accept such a patch. > >Rusty has a final

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 11:49:06PM +0300, Michael S. Tsirkin wrote: > On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: > > On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: > > > On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: > > > > On Tue, Aug 14,

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rik van Riel
On 08/14/2012 04:54 PM, Michael S. Tsirkin wrote: To clarify, the global state that this patch adds, is ugly even if we didn't support multiple balloons yet. So I don't think I can accept such a patch. Rusty has a final word here, maybe he thinks differently. Before deciding that "does not

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 11:49:06PM +0300, Michael S. Tsirkin wrote: > On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: > > On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: > > > On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: > > > > On Tue, Aug 14,

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: > On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: > > On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: > > > On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: > > > > > > > What if

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: > On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: > > What I think you should do is use rcu for access. > > And here sync rcu before freeing. > > Maybe an overkill but at least a documented synchronization > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: > On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: > > On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: > > > > > > What if there is more than one balloon device? > > > > > > > > > > Is it

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: > On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: > > > > > What if there is more than one balloon device? > > > > > > > > Is it possible to load this driver twice, or are you foreseeing a > > > > future case > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: > What I think you should do is use rcu for access. > And here sync rcu before freeing. > Maybe an overkill but at least a documented synchronization > primitive, and it is very light weight. > I liked your suggestion on

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: > > > > What if there is more than one balloon device? > > > > > > Is it possible to load this driver twice, or are you foreseeing a future > > > case > > > where this driver will be able to manage several distinct memory

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: > On Tue, Aug 14, 2012 at 03:22:45PM -0300, Rafael Aquini wrote: > > On Mon, Aug 13, 2012 at 11:41:23AM +0300, Michael S. Tsirkin wrote: > > > > @@ -141,7 +151,10 @@ static void fill_balloon(struct virtio_balloon > > > > *vb,

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 03:22:45PM -0300, Rafael Aquini wrote: > On Mon, Aug 13, 2012 at 11:41:23AM +0300, Michael S. Tsirkin wrote: > > > @@ -141,7 +151,10 @@ static void fill_balloon(struct virtio_balloon *vb, > > > size_t num) > > > set_page_pfns(vb->pfns + vb->num_pfns, page); > > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 03:44:09PM -0300, Rafael Aquini wrote: > On Tue, Aug 14, 2012 at 11:33:20AM +0300, Michael S. Tsirkin wrote: > > On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: > > > On Mon, 13 Aug 2012 11:41:23 +0300, "Michael S. Tsirkin" > > > wrote: > > > > On Fri, Aug

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 11:33:20AM +0300, Michael S. Tsirkin wrote: > On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: > > On Mon, 13 Aug 2012 11:41:23 +0300, "Michael S. Tsirkin" > > wrote: > > > On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: > > > > +/* > > > > +

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Mon, Aug 13, 2012 at 11:41:23AM +0300, Michael S. Tsirkin wrote: > > @@ -141,7 +151,10 @@ static void fill_balloon(struct virtio_balloon *vb, > > size_t num) > > set_page_pfns(vb->pfns + vb->num_pfns, page); > > vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: > On Mon, 13 Aug 2012 11:41:23 +0300, "Michael S. Tsirkin" > wrote: > > On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: > > > +/* > > > + * Populate balloon_mapping->a_ops->freepage method to help compaction on > > > +

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: On Mon, 13 Aug 2012 11:41:23 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: +/* + * Populate balloon_mapping-a_ops-freepage method to help compaction on + *

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Mon, Aug 13, 2012 at 11:41:23AM +0300, Michael S. Tsirkin wrote: @@ -141,7 +151,10 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) set_page_pfns(vb-pfns + vb-num_pfns, page); vb-num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 11:33:20AM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: On Mon, 13 Aug 2012 11:41:23 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: +/* + *

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 03:44:09PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 11:33:20AM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: On Mon, 13 Aug 2012 11:41:23 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Fri, Aug

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 03:22:45PM -0300, Rafael Aquini wrote: On Mon, Aug 13, 2012 at 11:41:23AM +0300, Michael S. Tsirkin wrote: @@ -141,7 +151,10 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) set_page_pfns(vb-pfns + vb-num_pfns, page);

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 03:22:45PM -0300, Rafael Aquini wrote: On Mon, Aug 13, 2012 at 11:41:23AM +0300, Michael S. Tsirkin wrote: @@ -141,7 +151,10 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: What if there is more than one balloon device? Is it possible to load this driver twice, or are you foreseeing a future case where this driver will be able to manage several distinct memory balloons for

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: What I think you should do is use rcu for access. And here sync rcu before freeing. Maybe an overkill but at least a documented synchronization primitive, and it is very light weight. I liked your suggestion on barriers, as

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: What if there is more than one balloon device? Is it possible to load this driver twice, or are you foreseeing a future case where this driver

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: What if there is more than one balloon device? Is it possible to load this

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 05:11:13PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:51:39PM +0300, Michael S. Tsirkin wrote: What I think you should do is use rcu for access. And here sync rcu before freeing. Maybe an overkill but at least a documented synchronization primitive, and

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 10:59:16PM +0300, Michael S. Tsirkin wrote: What if there is more

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 11:49:06PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rik van Riel
On 08/14/2012 04:54 PM, Michael S. Tsirkin wrote: To clarify, the global state that this patch adds, is ugly even if we didn't support multiple balloons yet. So I don't think I can accept such a patch. Rusty has a final word here, maybe he thinks differently. Before deciding that does not

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rafael Aquini
On Tue, Aug 14, 2012 at 11:49:06PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 05:08:31PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 04:56:59PM -0400, Rik van Riel wrote: On 08/14/2012 04:54 PM, Michael S. Tsirkin wrote: To clarify, the global state that this patch adds, is ugly even if we didn't support multiple balloons yet. So I don't think I can accept such a patch. Rusty has a final word

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Michael S. Tsirkin
On Tue, Aug 14, 2012 at 06:34:13PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 11:49:06PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at 05:29:50PM -0300, Rafael Aquini wrote: On Tue, Aug 14, 2012 at 11:24:01PM +0300, Michael S. Tsirkin wrote: On Tue, Aug 14, 2012 at

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-14 Thread Rusty Russell
On Tue, 14 Aug 2012 11:33:20 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Tue, Aug 14, 2012 at 09:29:49AM +0930, Rusty Russell wrote: On Mon, 13 Aug 2012 11:41:23 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote:

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-13 Thread Rusty Russell
On Mon, 13 Aug 2012 11:41:23 +0300, "Michael S. Tsirkin" wrote: > On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: > > +/* > > + * Populate balloon_mapping->a_ops->freepage method to help compaction on > > + * re-inserting an isolated page into the balloon page list. > > + */ > >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-13 Thread Michael S. Tsirkin
On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: > Memory fragmentation introduced by ballooning might reduce significantly > the number of 2MB contiguous memory blocks that can be used within a guest, > thus imposing performance penalties associated with the reduced number of >

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-13 Thread Michael S. Tsirkin
On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: Memory fragmentation introduced by ballooning might reduce significantly the number of 2MB contiguous memory blocks that can be used within a guest, thus imposing performance penalties associated with the reduced number of

Re: [PATCH v7 2/4] virtio_balloon: introduce migration primitives to balloon pages

2012-08-13 Thread Rusty Russell
On Mon, 13 Aug 2012 11:41:23 +0300, Michael S. Tsirkin m...@redhat.com wrote: On Fri, Aug 10, 2012 at 02:55:15PM -0300, Rafael Aquini wrote: +/* + * Populate balloon_mapping-a_ops-freepage method to help compaction on + * re-inserting an isolated page into the balloon page list. + */