* [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size
@ 2015-01-16 5:45 Zhu Guihua
2015-01-16 6:00 ` Zhu Guihua
2015-01-19 15:55 ` Igor Mammedov
0 siblings, 2 replies; 4+ messages in thread
From: Zhu Guihua @ 2015-01-16 5:45 UTC (permalink / raw)
To: qemu-devel; +Cc: imammedo, Zhu Guihua, mst
If hot add 100MiB memory like this:
(monitor) object_add memory-backend-ram,id=ram0,size=100M
(monitor) device_add pc-dimm,id=d0,memdev=ram0
The hotplug operation will faile, and the guest will print error message:
Section-unaligned hotplug range: start 0x100000000, size 0x6400000
acpi PNP0C80:00: add_memory failed
acpi PNP0C80:00: acpi_memory_enable_device() error
Then I found that, according to the func check_hotplug_memory_range() in linux
kernel, backend memory size must be multiple of 128MiB, not 2MiB.
So this patch checks whether backend memory size is multiple of 128MiB.
Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
---
hw/mem/pc-dimm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index d431834..3b8a015 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -161,9 +161,9 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
goto out;
}
- if (QEMU_ALIGN_UP(size, align) != size) {
+ if (QEMU_ALIGN_UP(size, align * 64) != size) {
error_setg(errp, "backend memory size must be multiple of 0x%"
- PRIx64, align);
+ PRIx64, align * 64);
goto out;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size
2015-01-16 5:45 [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size Zhu Guihua
@ 2015-01-16 6:00 ` Zhu Guihua
2015-01-19 15:55 ` Igor Mammedov
1 sibling, 0 replies; 4+ messages in thread
From: Zhu Guihua @ 2015-01-16 6:00 UTC (permalink / raw)
To: qemu-devel; +Cc: imammedo, mst
Hi all,
I am sorry that this method to fix this bug was not perfect.
I will find another way to do this.
Plz ignore this patch.
Regards,
Zhu
On Fri, 2015-01-16 at 13:45 +0800, Zhu Guihua wrote:
> If hot add 100MiB memory like this:
> (monitor) object_add memory-backend-ram,id=ram0,size=100M
> (monitor) device_add pc-dimm,id=d0,memdev=ram0
>
> The hotplug operation will faile, and the guest will print error message:
> Section-unaligned hotplug range: start 0x100000000, size 0x6400000
> acpi PNP0C80:00: add_memory failed
> acpi PNP0C80:00: acpi_memory_enable_device() error
>
> Then I found that, according to the func check_hotplug_memory_range() in linux
> kernel, backend memory size must be multiple of 128MiB, not 2MiB.
>
> So this patch checks whether backend memory size is multiple of 128MiB.
>
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> ---
> hw/mem/pc-dimm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index d431834..3b8a015 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -161,9 +161,9 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
> goto out;
> }
>
> - if (QEMU_ALIGN_UP(size, align) != size) {
> + if (QEMU_ALIGN_UP(size, align * 64) != size) {
> error_setg(errp, "backend memory size must be multiple of 0x%"
> - PRIx64, align);
> + PRIx64, align * 64);
> goto out;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size
2015-01-16 5:45 [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size Zhu Guihua
2015-01-16 6:00 ` Zhu Guihua
@ 2015-01-19 15:55 ` Igor Mammedov
2015-01-20 1:34 ` Zhu Guihua
1 sibling, 1 reply; 4+ messages in thread
From: Igor Mammedov @ 2015-01-19 15:55 UTC (permalink / raw)
To: Zhu Guihua; +Cc: qemu-devel, mst
On Fri, 16 Jan 2015 13:45:06 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:
> If hot add 100MiB memory like this:
> (monitor) object_add memory-backend-ram,id=ram0,size=100M
> (monitor) device_add pc-dimm,id=d0,memdev=ram0
>
> The hotplug operation will faile, and the guest will print error message:
> Section-unaligned hotplug range: start 0x100000000, size 0x6400000
> acpi PNP0C80:00: add_memory failed
> acpi PNP0C80:00: acpi_memory_enable_device() error
>
> Then I found that, according to the func check_hotplug_memory_range() in linux
> kernel, backend memory size must be multiple of 128MiB, not 2MiB.
It's linux limitation, Windows guests work just fine with small blocks.
It should be fixed in linux kernel or/and limitation should be enforced by
libvirt/virt-install which knows what type of guest it installs/runs.
>
> So this patch checks whether backend memory size is multiple of 128MiB.
>
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> ---
> hw/mem/pc-dimm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index d431834..3b8a015 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -161,9 +161,9 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
> goto out;
> }
>
> - if (QEMU_ALIGN_UP(size, align) != size) {
> + if (QEMU_ALIGN_UP(size, align * 64) != size) {
> error_setg(errp, "backend memory size must be multiple of 0x%"
> - PRIx64, align);
> + PRIx64, align * 64);
> goto out;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size
2015-01-19 15:55 ` Igor Mammedov
@ 2015-01-20 1:34 ` Zhu Guihua
0 siblings, 0 replies; 4+ messages in thread
From: Zhu Guihua @ 2015-01-20 1:34 UTC (permalink / raw)
To: Igor Mammedov; +Cc: qemu-devel, mst
On Mon, 2015-01-19 at 16:55 +0100, Igor Mammedov wrote:
> On Fri, 16 Jan 2015 13:45:06 +0800
> Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:
>
> > If hot add 100MiB memory like this:
> > (monitor) object_add memory-backend-ram,id=ram0,size=100M
> > (monitor) device_add pc-dimm,id=d0,memdev=ram0
> >
> > The hotplug operation will faile, and the guest will print error message:
> > Section-unaligned hotplug range: start 0x100000000, size 0x6400000
> > acpi PNP0C80:00: add_memory failed
> > acpi PNP0C80:00: acpi_memory_enable_device() error
> >
> > Then I found that, according to the func check_hotplug_memory_range() in linux
> > kernel, backend memory size must be multiple of 128MiB, not 2MiB.
> It's linux limitation, Windows guests work just fine with small blocks.
>
> It should be fixed in linux kernel or/and limitation should be enforced by
> libvirt/virt-install which knows what type of guest it installs/runs.
>
Got it.
Thanks for your explanation.
Regards,
Zhu
> >
> > So this patch checks whether backend memory size is multiple of 128MiB.
> >
> > Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> > ---
> > hw/mem/pc-dimm.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> > index d431834..3b8a015 100644
> > --- a/hw/mem/pc-dimm.c
> > +++ b/hw/mem/pc-dimm.c
> > @@ -161,9 +161,9 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
> > goto out;
> > }
> >
> > - if (QEMU_ALIGN_UP(size, align) != size) {
> > + if (QEMU_ALIGN_UP(size, align * 64) != size) {
> > error_setg(errp, "backend memory size must be multiple of 0x%"
> > - PRIx64, align);
> > + PRIx64, align * 64);
> > goto out;
> > }
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-20 1:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 5:45 [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size Zhu Guihua
2015-01-16 6:00 ` Zhu Guihua
2015-01-19 15:55 ` Igor Mammedov
2015-01-20 1:34 ` Zhu Guihua
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).