From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr961-0007IF-2s for qemu-devel@nongnu.org; Tue, 27 Oct 2015 14:35:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zr95v-0003h9-UN for qemu-devel@nongnu.org; Tue, 27 Oct 2015 14:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr95v-0003gm-Lx for qemu-devel@nongnu.org; Tue, 27 Oct 2015 14:35:39 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 65E05C075D95 for ; Tue, 27 Oct 2015 18:35:39 +0000 (UTC) Date: Tue, 27 Oct 2015 20:35:36 +0200 From: "Michael S. Tsirkin" Message-ID: <20151027203520-mutt-send-email-mst@redhat.com> References: <1445848925-84796-1-git-send-email-imammedo@redhat.com> <20151026183318.GF4180@thinpad.lan.raisama.net> <20151027110716-mutt-send-email-mst@redhat.com> <20151027162417.GG4180@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151027162417.GG4180@thinpad.lan.raisama.net> Subject: Re: [Qemu-devel] [PATCH] pc: memhp: enforce minimal 128Mb alignment for pc-dimm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Igor Mammedov , qemu-devel@nongnu.org, pbonzini@redhat.com On Tue, Oct 27, 2015 at 02:24:17PM -0200, Eduardo Habkost wrote: > On Tue, Oct 27, 2015 at 11:08:26AM +0200, Michael S. Tsirkin wrote: > > On Mon, Oct 26, 2015 at 04:33:18PM -0200, Eduardo Habkost wrote: > > > On Mon, Oct 26, 2015 at 09:42:05AM +0100, Igor Mammedov wrote: > > > > commit aa8580cd "pc: memhp: force gaps between DIMM's GPA" > > > > regressed memory hot-unplug for linux guests triggering > > > > following BUGON > > > > ===== > > > > kernel BUG at mm/memory_hotplug.c:703! > > > > ... > > > > [] acpi_memory_device_remove+0x79/0xa5 > > > > [] acpi_bus_trim+0x5a/0x8d > > > > [] acpi_device_hotplug+0x1b7/0x418 > > > > === > > > > BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK); > > > > === > > > > > > > > reson for it is that x86-64 linux guest supports memory > > > > hotplug in chunks of 128Mb and memory section also should > > > > be 128Mb aligned. > > > > However gaps forced between 128Mb DIMMs with backend's > > > > natural alignment of 2Mb make the 2nd and following > > > > DIMMs not being aligned on 128Mb boundary as it was > > > > originally. To fix regression enforce minimal 128Mb > > > > alignment like it was done for PPC. > > > > > > > > Signed-off-by: Igor Mammedov > > > > --- > > > > hw/i386/pc.c | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > > > index 3d958ba..cd68169 100644 > > > > --- a/hw/i386/pc.c > > > > +++ b/hw/i386/pc.c > > > > @@ -1610,6 +1610,8 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) > > > > } > > > > } > > > > > > > > +#define MIN_DIMM_ALIGNMENT (1ULL << 27) /* 128Mb */ > > > > > > If you send a new version, could you include the explanation for the > > > 128MB value as a comment above the macro definition? > > > > The issue is that there's no good explanation yet. It's just something > > that seems to work for current linux. Why does linux do it, and what > > basis does it have in hardware, IIUC we don't know. > > We just need an explanation to why we chose that value, even if we don't > know yet why it works. Even "this is the only value we ever tested and > it seems to work, good luck figuring out why" would be better than no > explanation, IMO. Not by much though :) > -- > Eduardo