From: Hongyong Zang <zanghongyong@xxxxxxxxxx> 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. Signed-off-by: Hongyong Zang <zanghongyong@xxxxxxxxxx> --- tools/kvm/x86/kvm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tools/kvm/x86/kvm.c b/tools/kvm/x86/kvm.c index bc52ef3..6107a2c 100644 --- a/tools/kvm/x86/kvm.c +++ b/tools/kvm/x86/kvm.c @@ -175,7 +175,9 @@ void kvm__arch_init(struct kvm *kvm, const char *kvm_dev, const char *hugetlbfs_ if (kvm->ram_start == MAP_FAILED) die("out of memory"); - madvise(kvm->ram_start, kvm->ram_size, MADV_MERGEABLE); + madvise(kvm->ram_start, + (ram_size < KVM_32BIT_GAP_START) ? ram_size : (ram_size + KVM_32BIT_GAP_SIZE), + MADV_MERGEABLE); ret = ioctl(kvm->vm_fd, KVM_CREATE_IRQCHIP); if (ret < 0) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html