From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDEgW-0006yQ-10 for qemu-devel@nongnu.org; Mon, 19 Jan 2015 10:56:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDEgR-00043O-D3 for qemu-devel@nongnu.org; Mon, 19 Jan 2015 10:56:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDEgR-00043H-4L for qemu-devel@nongnu.org; Mon, 19 Jan 2015 10:56:07 -0500 Date: Mon, 19 Jan 2015 16:55:58 +0100 From: Igor Mammedov Message-ID: <20150119165558.18df23f6@nial.brq.redhat.com> In-Reply-To: <1421387106-19101-1-git-send-email-zhugh.fnst@cn.fujitsu.com> References: <1421387106-19101-1-git-send-email-zhugh.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] pc-dimm: fix checking for backend memory size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua Cc: qemu-devel@nongnu.org, mst@redhat.com On Fri, 16 Jan 2015 13:45:06 +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. 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 > --- > 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; > } >