Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-30 Thread Gleb Natapov
On Tue, Oct 29, 2013 at 07:21:59PM -0200, Marcelo Tosatti wrote: Could add a warning to memory API: if memory region is larger than 1GB and RAM is 1GB backed, and not properly aligned, warn. Perhaps it would be better do abort and ask user to fix configuration, and on hugepage allocation

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-30 Thread Gerd Hoffmann
On Fr, 2013-10-25 at 23:53 +0100, Paolo Bonzini wrote: Il 25/10/2013 20:50, Marcelo Tosatti ha scritto: On Fri, Oct 25, 2013 at 09:52:34AM +0100, Paolo Bonzini wrote: Because offsets are zero, and lengths match the RAM block lengths, you do not need any complication with aliasing. This

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-30 Thread Paolo Bonzini
Il 30/10/2013 12:07, Gerd Hoffmann ha scritto: On Fr, 2013-10-25 at 23:53 +0100, Paolo Bonzini wrote: Il 25/10/2013 20:50, Marcelo Tosatti ha scritto: On Fri, Oct 25, 2013 at 09:52:34AM +0100, Paolo Bonzini wrote: Because offsets are zero, and lengths match the RAM block lengths, you do not

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-30 Thread Marcelo Tosatti
On Wed, Oct 30, 2013 at 10:48:13AM +0200, Gleb Natapov wrote: On Tue, Oct 29, 2013 at 07:21:59PM -0200, Marcelo Tosatti wrote: Could add a warning to memory API: if memory region is larger than 1GB and RAM is 1GB backed, and not properly aligned, warn. Perhaps it would be better do

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-29 Thread Igor Mammedov
On Mon, 28 Oct 2013 12:04:06 -0200 Marcelo Tosatti mtosa...@redhat.com wrote: On Sun, Oct 27, 2013 at 04:20:44PM +0100, igor Mammedov wrote: Yes, thought of that, unfortunately its cumbersome to add an interface for the user to supply both 2MB and 1GB hugetlbfs pages. Could 2Mb tails be

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-29 Thread Marcelo Tosatti
On Tue, Oct 29, 2013 at 07:00:54PM +0100, Igor Mammedov wrote: On Mon, 28 Oct 2013 12:04:06 -0200 Marcelo Tosatti mtosa...@redhat.com wrote: On Sun, Oct 27, 2013 at 04:20:44PM +0100, igor Mammedov wrote: Yes, thought of that, unfortunately its cumbersome to add an interface for the

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-28 Thread Marcelo Tosatti
On Sun, Oct 27, 2013 at 04:20:44PM +0100, igor Mammedov wrote: Yes, thought of that, unfortunately its cumbersome to add an interface for the user to supply both 2MB and 1GB hugetlbfs pages. Could 2Mb tails be automated, meaning if host uses 1Gb hugepages and there is/are tail/s, QEMU should

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-28 Thread Marcelo Tosatti
On Mon, Oct 28, 2013 at 12:04:06PM -0200, Marcelo Tosatti wrote: On Sun, Oct 27, 2013 at 04:20:44PM +0100, igor Mammedov wrote: Yes, thought of that, unfortunately its cumbersome to add an interface for the user to supply both 2MB and 1GB hugetlbfs pages. Could 2Mb tails be automated,

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-27 Thread igor Mammedov
On Fri, 25 Oct 2013 11:34:22 -0200 Marcelo Tosatti mtosa...@redhat.com wrote: On Fri, Oct 25, 2013 at 11:57:18AM +0200, igor Mammedov wrote: On Fri, 25 Oct 2013 02:58:05 -0200 Marcelo Tosatti mtosa...@redhat.com wrote: On Fri, Oct 25, 2013 at 12:55:36AM +0100, Paolo Bonzini wrote:

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-25 Thread Paolo Bonzini
Il 25/10/2013 05:58, Marcelo Tosatti ha scritto: On Fri, Oct 25, 2013 at 12:55:36AM +0100, Paolo Bonzini wrote: +if (hpagesize == (130)) { +unsigned long holesize = 0x1ULL - below_4g_mem_size; + +memory_region_init_alias(ram_above_4g, NULL,

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-25 Thread igor Mammedov
On Fri, 25 Oct 2013 02:58:05 -0200 Marcelo Tosatti mtosa...@redhat.com wrote: On Fri, Oct 25, 2013 at 12:55:36AM +0100, Paolo Bonzini wrote: +if (hpagesize == (130)) { +unsigned long holesize = 0x1ULL - below_4g_mem_size; + +

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-25 Thread Marcelo Tosatti
On Fri, Oct 25, 2013 at 11:57:18AM +0200, igor Mammedov wrote: On Fri, 25 Oct 2013 02:58:05 -0200 Marcelo Tosatti mtosa...@redhat.com wrote: On Fri, Oct 25, 2013 at 12:55:36AM +0100, Paolo Bonzini wrote: +if (hpagesize == (130)) { +unsigned long holesize =

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-25 Thread Marcelo Tosatti
On Fri, Oct 25, 2013 at 09:52:34AM +0100, Paolo Bonzini wrote: Because offsets are zero, and lengths match the RAM block lengths, you do not need any complication with aliasing. This still has to be done only for new machine types. Not possible because you just wasted holesize bytes (if

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-25 Thread Paolo Bonzini
Il 25/10/2013 20:50, Marcelo Tosatti ha scritto: On Fri, Oct 25, 2013 at 09:52:34AM +0100, Paolo Bonzini wrote: Because offsets are zero, and lengths match the RAM block lengths, you do not need any complication with aliasing. This still has to be done only for new machine types. Not

[Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-24 Thread Marcelo Tosatti
Align guest physical address and host physical address beyond guest 4GB on a 1GB boundary, in case hugetlbfs is used. Otherwise 1GB TLBs cannot be cached for the range. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Index: qemu/hw/i386/pc.c

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-24 Thread Peter Maydell
On 24 October 2013 22:12, Marcelo Tosatti mtosa...@redhat.com wrote: Align guest physical address and host physical address beyond guest 4GB on a 1GB boundary, in case hugetlbfs is used. Otherwise 1GB TLBs cannot be cached for the range. +if (hpagesize == (130)) { +

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-24 Thread Paolo Bonzini
Il 24/10/2013 22:12, Marcelo Tosatti ha scritto: Align guest physical address and host physical address beyond guest 4GB on a 1GB boundary, in case hugetlbfs is used. Otherwise 1GB TLBs cannot be cached for the range. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Index:

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-24 Thread Marcelo Tosatti
On Thu, Oct 24, 2013 at 10:55:54PM +0100, Peter Maydell wrote: On 24 October 2013 22:12, Marcelo Tosatti mtosa...@redhat.com wrote: Align guest physical address and host physical address beyond guest 4GB on a 1GB boundary, in case hugetlbfs is used. Otherwise 1GB TLBs cannot be cached for

Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa-hpa on 1GB boundary

2013-10-24 Thread Marcelo Tosatti
On Fri, Oct 25, 2013 at 12:55:36AM +0100, Paolo Bonzini wrote: +if (hpagesize == (130)) { +unsigned long holesize = 0x1ULL - below_4g_mem_size; + +memory_region_init_alias(ram_above_4g, NULL, ram-above-4g, ram, +