* [Qemu-devel] [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global()
@ 2017-07-17 16:37 Peter Maydell
2017-07-24 10:28 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2017-07-17 16:37 UTC (permalink / raw)
To: qemu-devel; +Cc: patches, qemu-trivial
The sm501 device uses vmstate_register_ram_global() to register its
memory region for migration. This means it gets a name that is
assumed to be global to the whole system, which in turn means that if
you create two of the device we assert because of the duplication:
qemu-system-ppc -device sm501 -device sm501
RAMBlock "sm501.local" already registered, abort!
Aborted (core dumped)
Changing this to just use memory_region_init_ram()'s automatic
registration of the memory region with a device-local name fixes
this. The downside is that it breaks migration compatibility, but
luckily we only added migration support to this device in the 2.10
release cycle so we haven't released a QEMU version with the broken
implementation.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Recent refactoring that renamed the old "memory_region_init_ram"
to memory_region_init_ram_nomigrate" made this bug a bit easier
to find via grep...
hw/display/sm501.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index af792c5..9aa515b 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1578,9 +1578,8 @@ static void sm501_init(SM501State *s, DeviceState *dev,
s->local_mem_size_index);
/* local memory */
- memory_region_init_ram_nomigrate(&s->local_mem_region, OBJECT(dev), "sm501.local",
+ memory_region_init_ram(&s->local_mem_region, OBJECT(dev), "sm501.local",
get_local_mem_size(s), &error_fatal);
- vmstate_register_ram_global(&s->local_mem_region);
memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA);
s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global()
2017-07-17 16:37 [Qemu-devel] [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global() Peter Maydell
@ 2017-07-24 10:28 ` Peter Maydell
2017-07-24 18:35 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2017-07-24 10:28 UTC (permalink / raw)
To: QEMU Developers; +Cc: QEMU Trivial, patches@linaro.org
Ping for review, please? Would be nice to get this into rc0.
thanks
-- PMM
On 17 July 2017 at 17:37, Peter Maydell <peter.maydell@linaro.org> wrote:
> The sm501 device uses vmstate_register_ram_global() to register its
> memory region for migration. This means it gets a name that is
> assumed to be global to the whole system, which in turn means that if
> you create two of the device we assert because of the duplication:
>
> qemu-system-ppc -device sm501 -device sm501
> RAMBlock "sm501.local" already registered, abort!
> Aborted (core dumped)
>
> Changing this to just use memory_region_init_ram()'s automatic
> registration of the memory region with a device-local name fixes
> this. The downside is that it breaks migration compatibility, but
> luckily we only added migration support to this device in the 2.10
> release cycle so we haven't released a QEMU version with the broken
> implementation.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Recent refactoring that renamed the old "memory_region_init_ram"
> to memory_region_init_ram_nomigrate" made this bug a bit easier
> to find via grep...
>
> hw/display/sm501.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> index af792c5..9aa515b 100644
> --- a/hw/display/sm501.c
> +++ b/hw/display/sm501.c
> @@ -1578,9 +1578,8 @@ static void sm501_init(SM501State *s, DeviceState *dev,
> s->local_mem_size_index);
>
> /* local memory */
> - memory_region_init_ram_nomigrate(&s->local_mem_region, OBJECT(dev), "sm501.local",
> + memory_region_init_ram(&s->local_mem_region, OBJECT(dev), "sm501.local",
> get_local_mem_size(s), &error_fatal);
> - vmstate_register_ram_global(&s->local_mem_region);
> memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA);
> s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region);
>
> --P
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global()
2017-07-24 10:28 ` Peter Maydell
@ 2017-07-24 18:35 ` Dr. David Alan Gilbert
2017-07-25 12:49 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2017-07-24 18:35 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, QEMU Trivial, patches@linaro.org
* Peter Maydell (peter.maydell@linaro.org) wrote:
> Ping for review, please? Would be nice to get this into rc0.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
> thanks
> -- PMM
>
> On 17 July 2017 at 17:37, Peter Maydell <peter.maydell@linaro.org> wrote:
> > The sm501 device uses vmstate_register_ram_global() to register its
> > memory region for migration. This means it gets a name that is
> > assumed to be global to the whole system, which in turn means that if
> > you create two of the device we assert because of the duplication:
> >
> > qemu-system-ppc -device sm501 -device sm501
> > RAMBlock "sm501.local" already registered, abort!
> > Aborted (core dumped)
> >
> > Changing this to just use memory_region_init_ram()'s automatic
> > registration of the memory region with a device-local name fixes
> > this. The downside is that it breaks migration compatibility, but
> > luckily we only added migration support to this device in the 2.10
> > release cycle so we haven't released a QEMU version with the broken
> > implementation.
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> > Recent refactoring that renamed the old "memory_region_init_ram"
> > to memory_region_init_ram_nomigrate" made this bug a bit easier
> > to find via grep...
> >
> > hw/display/sm501.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> > index af792c5..9aa515b 100644
> > --- a/hw/display/sm501.c
> > +++ b/hw/display/sm501.c
> > @@ -1578,9 +1578,8 @@ static void sm501_init(SM501State *s, DeviceState *dev,
> > s->local_mem_size_index);
> >
> > /* local memory */
> > - memory_region_init_ram_nomigrate(&s->local_mem_region, OBJECT(dev), "sm501.local",
> > + memory_region_init_ram(&s->local_mem_region, OBJECT(dev), "sm501.local",
> > get_local_mem_size(s), &error_fatal);
> > - vmstate_register_ram_global(&s->local_mem_region);
> > memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA);
> > s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region);
> >
> > --P
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global()
2017-07-24 18:35 ` Dr. David Alan Gilbert
@ 2017-07-25 12:49 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2017-07-25 12:49 UTC (permalink / raw)
To: Dr. David Alan Gilbert; +Cc: QEMU Developers, QEMU Trivial, patches@linaro.org
On 24 July 2017 at 19:35, Dr. David Alan Gilbert <dgilbert@redhat.com> wrote:
> * Peter Maydell (peter.maydell@linaro.org) wrote:
>> Ping for review, please? Would be nice to get this into rc0.
>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Thanks; applied to master.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-25 12:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-17 16:37 [Qemu-devel] [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global() Peter Maydell
2017-07-24 10:28 ` Peter Maydell
2017-07-24 18:35 ` Dr. David Alan Gilbert
2017-07-25 12:49 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).