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

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>

v2
  Make sure user-only build works (Halil)

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] 10+ messages in thread

* [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared
  2017-03-09 13:22 [Qemu-devel] [PATCH v2 0/2] migration/postcopy: Disable shared RAM Dr. David Alan Gilbert (git)
@ 2017-03-09 13:22 ` Dr. David Alan Gilbert (git)
  2017-03-09 14:07   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory Dr. David Alan Gilbert (git)
  1 sibling, 3 replies; 10+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2017-03-09 13:22 UTC (permalink / raw)
  To: qemu-devel, quintela; +Cc: pbonzini, lvivier, pasic

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..1f25a12 100644
--- a/exec.c
+++ b/exec.c
@@ -2593,6 +2593,11 @@ MemoryRegion *get_system_io(void)
     return system_io;
 }
 
+bool qemu_ram_is_shared(RAMBlock *rb)
+{
+    return rb->flags & RAM_SHARED;
+}
+
 #endif /* !defined(CONFIG_USER_ONLY) */
 
 /* physical memory access (slow version, mainly for debug) */
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] 10+ messages in thread

* [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory
  2017-03-09 13:22 [Qemu-devel] [PATCH v2 0/2] migration/postcopy: Disable shared RAM Dr. David Alan Gilbert (git)
  2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
@ 2017-03-09 13:22 ` Dr. David Alan Gilbert (git)
  2017-03-09 16:00   ` Halil Pasic
  2017-03-13 10:50   ` Juan Quintela
  1 sibling, 2 replies; 10+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2017-03-09 13:22 UTC (permalink / raw)
  To: qemu-devel, quintela; +Cc: pbonzini, lvivier, pasic

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] 10+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared
  2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
@ 2017-03-09 14:07   ` Philippe Mathieu-Daudé
  2017-03-09 14:13   ` Halil Pasic
  2017-03-13 10:48   ` Juan Quintela
  2 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-03-09 14:07 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel, quintela
  Cc: lvivier, pbonzini, pasic

On 03/09/2017 10:22 AM, 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>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  exec.c                    | 5 +++++
>  include/exec/cpu-common.h | 1 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index aabb035..1f25a12 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2593,6 +2593,11 @@ MemoryRegion *get_system_io(void)
>      return system_io;
>  }
>
> +bool qemu_ram_is_shared(RAMBlock *rb)
> +{
> +    return rb->flags & RAM_SHARED;
> +}
> +
>  #endif /* !defined(CONFIG_USER_ONLY) */
>
>  /* physical memory access (slow version, mainly for debug) */
> 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);
>
>

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

* Re: [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared
  2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
  2017-03-09 14:07   ` Philippe Mathieu-Daudé
@ 2017-03-09 14:13   ` Halil Pasic
  2017-03-13 10:48   ` Juan Quintela
  2 siblings, 0 replies; 10+ messages in thread
From: Halil Pasic @ 2017-03-09 14:13 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel, quintela; +Cc: lvivier, pbonzini



On 03/09/2017 02:22 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>

Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.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..1f25a12 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2593,6 +2593,11 @@ MemoryRegion *get_system_io(void)
>      return system_io;
>  }
> 
> +bool qemu_ram_is_shared(RAMBlock *rb)
> +{
> +    return rb->flags & RAM_SHARED;
> +}
> +
>  #endif /* !defined(CONFIG_USER_ONLY) */
> 
>  /* physical memory access (slow version, mainly for debug) */
> 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);
> 

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

* Re: [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory
  2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory Dr. David Alan Gilbert (git)
@ 2017-03-09 16:00   ` Halil Pasic
  2017-03-09 16:06     ` Dr. David Alan Gilbert
  2017-03-13 10:50   ` Juan Quintela
  1 sibling, 1 reply; 10+ messages in thread
From: Halil Pasic @ 2017-03-09 16:00 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel, quintela; +Cc: lvivier, pbonzini



On 03/09/2017 02:22 PM, Dr. David Alan Gilbert (git) wrote:
> 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;
> +}
> +

Hm, this stuff with the iterator seemed a bit strange (too complicated)
first, but I'm not familiar with this code. I have no idea why is
RAMBlockIterFunc
 
typedef int (RAMBlockIterFunc)(const char *block_name, void *host_addr,
    ram_addr_t offset, ram_addr_t length, void *opaque)

and not 

typedef int (RAMBlockIterFunc)(RAMBlock *block, void *opaque).

The reason does not seem to be abstraction.

>  /*
>   * 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;
> +    }
> +

But using ram_list directly does not seem to be a good alternative to me,
and I do not see a third alternative.

So besides some cosmetic stuff I have nothing to add. Cosmetic stuff is:
* why range instead of block in test_range_shared
* I think we could move this up so that we can return directly
and do not acquire resources which need cleanup

Regardless of the cosmetics:
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>


>      /*
>       * userfault and mlock don't go together; we'll put it back later if
>       * it was enabled.
> 

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

* Re: [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory
  2017-03-09 16:00   ` Halil Pasic
@ 2017-03-09 16:06     ` Dr. David Alan Gilbert
  2017-03-09 17:04       ` Halil Pasic
  0 siblings, 1 reply; 10+ messages in thread
From: Dr. David Alan Gilbert @ 2017-03-09 16:06 UTC (permalink / raw)
  To: Halil Pasic; +Cc: qemu-devel, quintela, lvivier, pbonzini

* Halil Pasic (pasic@linux.vnet.ibm.com) wrote:
> 
> 
> On 03/09/2017 02:22 PM, Dr. David Alan Gilbert (git) wrote:
> > 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;
> > +}
> > +
> 
> Hm, this stuff with the iterator seemed a bit strange (too complicated)
> first, but I'm not familiar with this code. I have no idea why is
> RAMBlockIterFunc
>  
> typedef int (RAMBlockIterFunc)(const char *block_name, void *host_addr,
>     ram_addr_t offset, ram_addr_t length, void *opaque)
> 
> and not 
> 
> typedef int (RAMBlockIterFunc)(RAMBlock *block, void *opaque).
> 
> The reason does not seem to be abstraction.

It is, it's because the contents of RAMBlock are private.

> >  /*
> >   * 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;
> > +    }
> > +
> 
> But using ram_list directly does not seem to be a good alternative to me,
> and I do not see a third alternative.
> 
> So besides some cosmetic stuff I have nothing to add. Cosmetic stuff is:
> * why range instead of block in test_range_shared
> * I think we could move this up so that we can return directly
> and do not acquire resources which need cleanup
> 
> Regardless of the cosmetics:
> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>

Dave

> 
> >      /*
> >       * userfault and mlock don't go together; we'll put it back later if
> >       * it was enabled.
> > 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory
  2017-03-09 16:06     ` Dr. David Alan Gilbert
@ 2017-03-09 17:04       ` Halil Pasic
  0 siblings, 0 replies; 10+ messages in thread
From: Halil Pasic @ 2017-03-09 17:04 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel, quintela, lvivier, pbonzini



On 03/09/2017 05:06 PM, Dr. David Alan Gilbert wrote:
> * Halil Pasic (pasic@linux.vnet.ibm.com) wrote:
>>
>>
>> On 03/09/2017 02:22 PM, Dr. David Alan Gilbert (git) wrote:
>>> 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;
>>> +}
>>> +
>>
>> Hm, this stuff with the iterator seemed a bit strange (too complicated)
>> first, but I'm not familiar with this code. I have no idea why is
>> RAMBlockIterFunc
>>  
>> typedef int (RAMBlockIterFunc)(const char *block_name, void *host_addr,
>>     ram_addr_t offset, ram_addr_t length, void *opaque)
>>
>> and not 
>>
>> typedef int (RAMBlockIterFunc)(RAMBlock *block, void *opaque).
>>
>> The reason does not seem to be abstraction.
> 
> It is, it's because the contents of RAMBlock are private.
> 


That's kind of half-backed abstraction. One can get a pointer to
RAMBlock, just like you did, and then do operations on it, just like you
did. So it would have been perfectly normal to use a pointer to RAMBlock
(incomplete type) and provide accessors (getters) reflecting the public
interface of RAMBlock. Well it may be helpful for making undesired usage
patterns hard, I do not know if this is the reason. (What I mean is if I
wanted to see these just for a single block I have a pointer to, I would
probably have to iterate over all blocks get a pointer by name and
compare it with my pointer, if it matches I have the values. So if such
usage is undesired, it's well reflected in the design).

The whole question is kind of off-topic -- my curious nature is making me
less productive again...

Regards,
Halil

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

* Re: [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared
  2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
  2017-03-09 14:07   ` Philippe Mathieu-Daudé
  2017-03-09 14:13   ` Halil Pasic
@ 2017-03-13 10:48   ` Juan Quintela
  2 siblings, 0 replies; 10+ messages in thread
From: Juan Quintela @ 2017-03-13 10:48 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, pbonzini, lvivier, pasic

"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> 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>

Reviewed-by: Juan Quintela <quintela@redhat.com>

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

* Re: [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory
  2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory Dr. David Alan Gilbert (git)
  2017-03-09 16:00   ` Halil Pasic
@ 2017-03-13 10:50   ` Juan Quintela
  1 sibling, 0 replies; 10+ messages in thread
From: Juan Quintela @ 2017-03-13 10:50 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, pbonzini, lvivier, pasic

"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> 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)


Direct question for the name?

ram_range_is_shared?



> +{
> +    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;
> +}

Wow, we still predate use of bool for questions :-p


> +
>  /*
>   * 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.

As my comments are only aestetic,

Reviewed-by: Juan Quintela <quintela@redhat.com>

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

end of thread, other threads:[~2017-03-13 10:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09 13:22 [Qemu-devel] [PATCH v2 0/2] migration/postcopy: Disable shared RAM Dr. David Alan Gilbert (git)
2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 1/2] RAMBlocks: qemu_ram_is_shared Dr. David Alan Gilbert (git)
2017-03-09 14:07   ` Philippe Mathieu-Daudé
2017-03-09 14:13   ` Halil Pasic
2017-03-13 10:48   ` Juan Quintela
2017-03-09 13:22 ` [Qemu-devel] [PATCH v2 2/2] postcopy: Check for shared memory Dr. David Alan Gilbert (git)
2017-03-09 16:00   ` Halil Pasic
2017-03-09 16:06     ` Dr. David Alan Gilbert
2017-03-09 17:04       ` Halil Pasic
2017-03-13 10:50   ` Juan Quintela

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.