All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] migration/postcopy: Disable shared RAM
@ 2017-03-07 18:36 Dr. David Alan Gilbert (git)
  2017-03-07 18:36 ` [Qemu-devel] [PATCH 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
  2017-03-07 18:36 ` [Qemu-devel] [PATCH 2/2] postcopy: Check for shared memory Dr. David Alan Gilbert (git)
  0 siblings, 2 replies; 5+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2017-03-07 18:36 UTC (permalink / raw)
  To: qemu-devel, quintela; +Cc: pbonzini, lvivier

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Disable postcopy migration when there's shared RAM, we're
still figuring out the details.  Without this patch
there's a chance it might appear to succeed in some
cases.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Dr. David Alan Gilbert (2):
  RAMBlocks: qemu_ram_is_shared
  postcopy: Check for shared memory

 exec.c                    |  5 +++++
 include/exec/cpu-common.h |  1 +
 migration/postcopy-ram.c  | 18 ++++++++++++++++++
 3 files changed, 24 insertions(+)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 1/2] RAMBlocks: qemu_ram_is_shared
  2017-03-07 18:36 [Qemu-devel] [PATCH 0/2] migration/postcopy: Disable shared RAM Dr. David Alan Gilbert (git)
@ 2017-03-07 18:36 ` Dr. David Alan Gilbert (git)
  2017-03-08 17:36   ` Halil Pasic
  2017-03-07 18:36 ` [Qemu-devel] [PATCH 2/2] postcopy: Check for shared memory Dr. David Alan Gilbert (git)
  1 sibling, 1 reply; 5+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2017-03-07 18:36 UTC (permalink / raw)
  To: qemu-devel, quintela; +Cc: pbonzini, lvivier

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Provide a helper to say whether a RAMBlock was created as a
shared mapping.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 exec.c                    | 5 +++++
 include/exec/cpu-common.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/exec.c b/exec.c
index aabb035..c2cc455 100644
--- a/exec.c
+++ b/exec.c
@@ -1560,6 +1560,11 @@ const char *qemu_ram_get_idstr(RAMBlock *rb)
     return rb->idstr;
 }
 
+bool qemu_ram_is_shared(RAMBlock *rb)
+{
+    return rb->flags & RAM_SHARED;
+}
+
 /* Called with iothread lock held.  */
 void qemu_ram_set_idstr(RAMBlock *new_block, const char *name, DeviceState *dev)
 {
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index b62f0d8..4d45a72 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -69,6 +69,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
 void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
 void qemu_ram_unset_idstr(RAMBlock *block);
 const char *qemu_ram_get_idstr(RAMBlock *rb);
+bool qemu_ram_is_shared(RAMBlock *rb);
 size_t qemu_ram_pagesize(RAMBlock *block);
 size_t qemu_ram_pagesize_largest(void);
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/2] postcopy: Check for shared memory
  2017-03-07 18:36 [Qemu-devel] [PATCH 0/2] migration/postcopy: Disable shared RAM Dr. David Alan Gilbert (git)
  2017-03-07 18:36 ` [Qemu-devel] [PATCH 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
@ 2017-03-07 18:36 ` Dr. David Alan Gilbert (git)
  1 sibling, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2017-03-07 18:36 UTC (permalink / raw)
  To: qemu-devel, quintela; +Cc: pbonzini, lvivier

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Postcopy doesn't support migration of RAM shared with another process
yet (we've got a bunch of things to understand).
Check for the case and don't allow postcopy to be enabled.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/postcopy-ram.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index effbeb6..dc80dbb 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -95,6 +95,19 @@ static bool ufd_version_check(int ufd)
     return true;
 }
 
+/* Callback from postcopy_ram_supported_by_host block iterator.
+ */
+static int test_range_shared(const char *block_name, void *host_addr,
+                             ram_addr_t offset, ram_addr_t length, void *opaque)
+{
+    if (qemu_ram_is_shared(qemu_ram_block_by_name(block_name))) {
+        error_report("Postcopy on shared RAM (%s) is not yet supported",
+                     block_name);
+        return 1;
+    }
+    return 0;
+}
+
 /*
  * Note: This has the side effect of munlock'ing all of RAM, that's
  * normally fine since if the postcopy succeeds it gets turned back on at the
@@ -127,6 +140,11 @@ bool postcopy_ram_supported_by_host(void)
         goto out;
     }
 
+    /* We don't support postcopy with shared RAM yet */
+    if (qemu_ram_foreach_block(test_range_shared, NULL)) {
+        goto out;
+    }
+
     /*
      * userfault and mlock don't go together; we'll put it back later if
      * it was enabled.
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] RAMBlocks: qemu_ram_is_shared
  2017-03-07 18:36 ` [Qemu-devel] [PATCH 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
@ 2017-03-08 17:36   ` Halil Pasic
  2017-03-08 17:38     ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: Halil Pasic @ 2017-03-08 17:36 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel, quintela; +Cc: lvivier, pbonzini



On 03/07/2017 07:36 PM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Provide a helper to say whether a RAMBlock was created as a
> shared mapping.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  exec.c                    | 5 +++++
>  include/exec/cpu-common.h | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/exec.c b/exec.c
> index aabb035..c2cc455 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1560,6 +1560,11 @@ const char *qemu_ram_get_idstr(RAMBlock *rb)
>      return rb->idstr;
>  }
> 
> +bool qemu_ram_is_shared(RAMBlock *rb)
> +{
> +    return rb->flags & RAM_SHARED;

Hm, it appears to me RAM_SHARED is defined conditionally, that's within 
#if !defined(CONFIG_USER_ONLY)
#endif

The function however seems to be defined and using RAM_SHARED
unconditionally. Either one or the other seems inappropriate to me.

Regards,
Halil

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] RAMBlocks: qemu_ram_is_shared
  2017-03-08 17:36   ` Halil Pasic
@ 2017-03-08 17:38     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2017-03-08 17:38 UTC (permalink / raw)
  To: Halil Pasic; +Cc: qemu-devel, quintela, lvivier, pbonzini

* Halil Pasic (pasic@linux.vnet.ibm.com) wrote:
> 
> 
> On 03/07/2017 07:36 PM, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > Provide a helper to say whether a RAMBlock was created as a
> > shared mapping.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >  exec.c                    | 5 +++++
> >  include/exec/cpu-common.h | 1 +
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/exec.c b/exec.c
> > index aabb035..c2cc455 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -1560,6 +1560,11 @@ const char *qemu_ram_get_idstr(RAMBlock *rb)
> >      return rb->idstr;
> >  }
> > 
> > +bool qemu_ram_is_shared(RAMBlock *rb)
> > +{
> > +    return rb->flags & RAM_SHARED;
> 
> Hm, it appears to me RAM_SHARED is defined conditionally, that's within 
> #if !defined(CONFIG_USER_ONLY)
> #endif
> 
> The function however seems to be defined and using RAM_SHARED
> unconditionally. Either one or the other seems inappropriate to me.

Oops! Thanks for spotting that; I'll go and fix that.

Dave

> Regards,
> Halil
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-08 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-07 18:36 [Qemu-devel] [PATCH 0/2] migration/postcopy: Disable shared RAM Dr. David Alan Gilbert (git)
2017-03-07 18:36 ` [Qemu-devel] [PATCH 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
2017-03-08 17:36   ` Halil Pasic
2017-03-08 17:38     ` Dr. David Alan Gilbert
2017-03-07 18:36 ` [Qemu-devel] [PATCH 2/2] postcopy: Check for shared memory Dr. David Alan Gilbert (git)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.