All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: aarcange@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, gleb@redhat.com
Subject: Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa<->hpa on 1GB boundary
Date: Tue, 29 Oct 2013 19:00:54 +0100	[thread overview]
Message-ID: <20131029190054.0c9faec5@nial.usersys.redhat.com> (raw)
In-Reply-To: <20131028140406.GA18025@amt.cnet>

On Mon, 28 Oct 2013 12:04:06 -0200
Marcelo Tosatti <mtosatti@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 automated, meaning if host uses 1Gb hugepages and
> > there is/are tail/s, QEMU should be able to figure out alignment
> > issues and allocate with appropriate pages.
> 
> Yes that would be ideal but the problem with hugetlbfs is that pages are
> preallocated.
> 
> So in the end you'd have to expose the split of guest RAM in 2MB/1GB types
> to the user (it would be necessary for the user to calculate the size of
> the hole, etc).
exposing it to the user might be not necessary,
QEMU could allocate 5Gb+3Mb ram without user intervention:
 3Gb low.ram.aligned.region // using huge pages
 1mb low.ram.unaligned.region if below_4g_ram_size - 3Gb; // so not to waste precious low ram, using fallback allocation
 //hypothetically hole starts at 3Gb+1mb
 2Gb high.ram.aligned.region // using huge pages
 2Mb high.ram.unaligned.region // so that not to waste 1Gb on memory using huge page
> 
> > Goal is separate host part allocation aspect from guest related one,
> > aliasing 32-bit hole size at the end doesn't help it at all, it's quite
> > opposite, it's making current code more complicated and harder to fix
> > in the future.
> 
> You can simply back the 1GB areas which the hole reside with 2MB pages.
I'm not getting what do you mean here.

> Can't see why having the tail of RAM map to the hole is problematic.
Problem I see is that with proposed aliasing there is no one-one
mapping to future "memdev" where each Dimm device (guest/model visible memory block)
has a corresponding memdev backend (host memory block).

Moreover with current hugepages handling in QEMU including this patch and usage of
1Gb hugepages, QEMU might loose ~1Gb if -m "hpagesize*n+1", which is by itself is a
good reason to use several allocations with different allocator backends.


> Understand your concern, but the complication is necessary: the host
> virtual/physical address and guest physical addresses must be aligned on
> largepage boundaries.
I don't argue against it, only about the best way to achieve it.

If we assume possible conversion from adhoc way of allocating initial RAM to
DIMM devices in the future then changing region layout several times in
incompatible way doesn't seems to be the best approach. If we are going to
change it, let at least minimize compatibility issues and do it right
in the first place.

I'll post RFC patch as reply to this thread.

> 
> Do you foresee any problem with memory hotplug?
I don't see any problem with memory hotplug so far, but as noted above
there will be problems with converting initial ram to DIMM devices.

> 
> 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 failure not fallback to malloc but abort and
tell user amount of hugepages needed to run guest with hugepage backend.

  parent reply	other threads:[~2013-10-29 18:01 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 21:11 [Qemu-devel] [patch 0/2] align >4GB guest RAM to a 1GB boundary, in case of 1GB-sized hugetlbfs Marcelo Tosatti
2013-10-24 21:11 ` [Qemu-devel] [patch 1/2] exec: add qemu_get_ram_hpagesize Marcelo Tosatti
2013-10-24 21:12 ` [Qemu-devel] [patch 2/2] i386: pc: align gpa<->hpa on 1GB boundary Marcelo Tosatti
2013-10-24 21:55   ` Peter Maydell
2013-10-24 22:48     ` Marcelo Tosatti
2013-10-24 23:55   ` Paolo Bonzini
2013-10-25  4:58     ` Marcelo Tosatti
2013-10-25  8:52       ` Paolo Bonzini
2013-10-25 19:50         ` Marcelo Tosatti
2013-10-25 22:53           ` Paolo Bonzini
2013-10-30 11:07             ` Gerd Hoffmann
2013-10-30 11:47               ` Paolo Bonzini
2013-10-25  9:57       ` igor Mammedov
2013-10-25 13:34         ` Marcelo Tosatti
2013-10-27 15:20           ` igor Mammedov
2013-10-28 14:04             ` Marcelo Tosatti
2013-10-28 14:20               ` Marcelo Tosatti
2013-10-29 18:00               ` Igor Mammedov [this message]
2013-10-29 21:21                 ` Marcelo Tosatti
2013-10-30  8:48                   ` Gleb Natapov
2013-10-30 18:30                     ` Marcelo Tosatti
2013-10-29 18:18               ` [Qemu-devel] [RFC PATCH] pc: align gpa<->hpa on 1GB boundary by splitting RAM on several regions Igor Mammedov
2013-10-29 21:38                 ` Marcelo Tosatti
2013-10-30 16:49                   ` Igor Mammedov
2013-10-30 18:51                     ` Marcelo Tosatti
2013-10-30 19:03                       ` Marcelo Tosatti
2013-10-30 19:56                       ` Igor Mammedov
2013-10-30 23:44                         ` Marcelo Tosatti
2013-11-07 15:25                           ` Igor Mammedov
2013-10-30 19:31                     ` Marcelo Tosatti
2013-10-30 20:28                       ` Paolo Bonzini
2013-11-06  1:49   ` [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v2) Marcelo Tosatti
2013-11-06  1:55     ` [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v3) Marcelo Tosatti
2013-11-06 11:59       ` Igor Mammedov
2013-11-06 12:07         ` Paolo Bonzini
2013-11-06 12:22           ` Igor Mammedov
2013-11-06 12:24             ` Paolo Bonzini
2013-11-06 21:31       ` [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v4) Marcelo Tosatti
2013-11-06 21:40         ` Michael S. Tsirkin
2013-11-06 21:53           ` Marcelo Tosatti
2013-11-06 22:15             ` Michael S. Tsirkin
2013-11-06 22:24               ` Marcelo Tosatti
2013-11-07 15:24         ` Igor Mammedov
2013-11-07 21:53           ` Marcelo Tosatti
2013-11-10 20:47             ` [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v5) Marcelo Tosatti
2013-11-12 12:45               ` Igor Mammedov
2013-11-12 20:32                 ` Marcelo Tosatti
2013-11-12 21:16               ` [Qemu-devel] i386: pc: align gpa<->hpa on 1GB boundary (v6) Marcelo Tosatti
2013-11-13 13:59                 ` Igor Mammedov
2013-11-13 17:13                 ` Paolo Bonzini
     [not found]                   ` <20131113195832.GA29433@amt.cnet>
2013-11-13 20:39                     ` Marcelo Tosatti
2013-11-13 21:49                       ` Paolo Bonzini
2013-11-13 19:08                 ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131029190054.0c9faec5@nial.usersys.redhat.com \
    --to=imammedo@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=gleb@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.