From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH] kvm tools: Make the whole guest memory mergeable Date: Fri, 16 Dec 2011 11:46:49 +0200 Message-ID: <1324028809.4496.40.camel@lappy> References: <1323997263-2031-1-git-send-email-zanghongyong@huawei.com> <1324014621.4496.3.camel@lappy> <4EEAED0E.5050106@huawei.com> <1324020188.4496.17.camel@lappy> <4EEB031B.2020806@huawei.com> <1324025135.4496.31.camel@lappy> <4EEB105F.9050307@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, penberg@kernel.org, xiaowei.yang@huawei.com, hanweidong@huawei.com, wusongwei@huawei.com, kongbo@huawei.com To: Zang Hongyong Return-path: Received: from mail-ee0-f46.google.com ([74.125.83.46]:32841 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180Ab1LPJrA (ORCPT ); Fri, 16 Dec 2011 04:47:00 -0500 Received: by eekc4 with SMTP id c4so3018491eek.19 for ; Fri, 16 Dec 2011 01:46:58 -0800 (PST) In-Reply-To: <4EEB105F.9050307@huawei.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, 2011-12-16 at 17:33 +0800, Zang Hongyong wrote: > > Do you see an issue with increasing kvm->ram_size? > > > Yes, it will cause some problems after simply increase the kvm->ram_size. > For examples: > In kvm__init_ram() code we use kvm->ram_size to calculate the size of > the second > RAM range from 4GB to the end of RAM (phys_size = kvm->ram_size - > phys_size;), > so after increase the kvm->ram_size, it will goes wrong. > This problem also happens in e820_setup() code and load_bzimage() code. Yup, but fixing it is much easier than having two different sizes of the same thing. For example, the fix for the problem in kvm__init_ram() (and e820_setup()) would be: @@ -112,7 +112,7 @@ void kvm__init_ram(struct kvm *kvm) /* Second RAM range from 4GB to the end of RAM: */ phys_start = 0x100000000ULL; - phys_size = kvm->ram_size - phys_size; + phys_size = kvm->ram_size - phys_start; host_mem = kvm->ram_start + phys_start; kvm__register_mem(kvm, phys_start, phys_size, host_mem); I basically want one memory map with one size which includes *everything*, even if that memory map includes a gap in the middle I still want the total size to include that gap. btw, what problem do you see in load_bzimage()? -- Sasha.