All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: Zang Hongyong <zanghongyong@huawei.com>
Cc: kvm@vger.kernel.org, penberg@kernel.org, xiaowei.yang@huawei.com,
	hanweidong@huawei.com, wusongwei@huawei.com, kongbo@huawei.com
Subject: Re: [PATCH] kvm tools: Make the whole guest memory mergeable
Date: Fri, 16 Dec 2011 10:45:35 +0200	[thread overview]
Message-ID: <1324025135.4496.31.camel@lappy> (raw)
In-Reply-To: <4EEB031B.2020806@huawei.com>

On Fri, 2011-12-16 at 16:36 +0800, Zang Hongyong wrote:
> 于 2011/12/16,星期五 15:23, Sasha Levin 写道:
> > On Fri, 2011-12-16 at 15:02 +0800, Zang Hongyong wrote:
> >> 于 2011/12/16,星期五 13:50, Sasha Levin 写道:
> >>> On Fri, 2011-12-16 at 09:01 +0800, zanghongyong@huawei.com wrote:
> >>>> If a guest's ram_size exceeds KVM_32BIT_GAP_START, the corresponding kvm tool's
> >>>> virtual address size should be (ram_size + KVM_32BIT_GAP_SIZE), rather than ram_size.
> >>> You're right.
> >>>
> >>> There are more places than just the madvise() code which make the same
> >>> error you've spotted (for example, the memslot allocation code), so
> >>> instead of trying to fix all of them I'd suggest to just update ram_size
> >>> in kvm__arch_init() before allocating everything - that should fix all
> >>> of them at once.
> >>>
> >> Yes. There are other scenarios with the same error.
> >> However ram_size sometimes means real guest ram size, and sometimes 
> >> means virtual address
> >> size of kvm tool's user space. Shall we define a new variable?
> > Let's keep it simple. If the user requests more than RAM than
> > KVM_32BIT_GAP_START just increase it by KVM_32BIT_GAP_SIZE, this way
> > mapped size == guest size always (we can madvise(MADV_DONTNEED) the gap
> > in the mmapped ram).
> >
> > Since a user which requests more than KVM_32BIT_GAP_START will have to
> > be on 64bit host anyway, there shouldn't be any issue with that.
> >
> Do you mean increase *kvm->ram_size* by KVM_32BIT_GAP_SIZE?
> but sometimes kvm->ram_size stands for guest physical ram size (for
> example in kvm__init_ram() code).

Yup, kvm->ram_size.

If the user requested more than KVM_32BIT_GAP_START, we pretty much have
to create the gap, so instead of playing around with different
interpretations of ram_size, lets add the gap size - this will let us
have just one ram_size.

mmap()ing extra space for the gap is free, and that was the plan in the
first place (we just got the math wrong :) ).

Do you see an issue with increasing kvm->ram_size?

-- 

Sasha.


  reply	other threads:[~2011-12-16  8:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16  1:01 [PATCH] kvm tools: Make the whole guest memory mergeable zanghongyong
2011-12-16  5:50 ` Sasha Levin
2011-12-16  7:02   ` Zang Hongyong
2011-12-16  7:23     ` Sasha Levin
2011-12-16  8:36       ` Zang Hongyong
2011-12-16  8:45         ` Sasha Levin [this message]
2011-12-16  9:33           ` Zang Hongyong
2011-12-16  9:46             ` Sasha Levin
2011-12-19  2:39               ` Zang Hongyong

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=1324025135.4496.31.camel@lappy \
    --to=levinsasha928@gmail.com \
    --cc=hanweidong@huawei.com \
    --cc=kongbo@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=wusongwei@huawei.com \
    --cc=xiaowei.yang@huawei.com \
    --cc=zanghongyong@huawei.com \
    /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.