kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: David Matlack <dmatlack@google.com>,
	kvm@vger.kernel.org, Venkatesh Srinivas <venkateshs@chromium.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Andrew Jones <drjones@redhat.com>,
	Ben Gardon <bgardon@google.com>, Peter Xu <peterx@redhat.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Janosch Frank <frankja@linux.ibm.com>
Subject: Re: [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()
Date: Tue, 8 Jun 2021 12:03:58 +0200	[thread overview]
Message-ID: <4d6513f3-d921-dff0-d883-51c6dbdcbe39@de.ibm.com> (raw)
In-Reply-To: <8cae6330-f88a-ec24-4e7d-bc999f49288d@de.ibm.com>

On 08.06.21 10:39, Christian Borntraeger wrote:
> 
> 
> On 21.05.21 19:38, David Matlack wrote:
>> vm_get_max_gfn() casts vm->max_gfn from a uint64_t to an unsigned int,
>> which causes the upper 32-bits of the max_gfn to get truncated.
>>
>> Nobody noticed until now likely because vm_get_max_gfn() is only used
>> as a mechanism to create a memslot in an unused region of the guest
>> physical address space (the top), and the top of the 32-bit physical
>> address space was always good enough.
>>
>> This fix reveals a bug in memslot_modification_stress_test which was
>> trying to create a dummy memslot past the end of guest physical memory.
>> Fix that by moving the dummy memslot lower.
>>
>> Fixes: 52200d0d944e ("KVM: selftests: Remove duplicate guest mode handling")
>> Reviewed-by: Venkatesh Srinivas <venkateshs@chromium.org>
>> Signed-off-by: David Matlack <dmatlack@google.com>
> 
> As a heads up:
> I have not yet looked into this, but this broke demand_paging_test and kvm_page_table_test
> on s390:
> 
> not ok 4 selftests: kvm: demand_paging_test # exit=254
> # selftests: kvm: dirty_log_test
> # ==== Test Assertion Failure ====
> #   lib/kvm_util.c:900: ret == 0
> #   pid=245410 tid=245410 errno=22 - Invalid argument
> #      1    0x0000000001005457: vm_userspace_mem_region_add at kvm_util.c:900
> #      2    0x0000000001002cbf: run_test at dirty_log_test.c:757
> #      3     (inlined by) run_test at dirty_log_test.c:702
> #      4    0x000000000100c055: for_each_guest_mode at guest_modes.c:37
> #      5    0x00000000010022b5: main at dirty_log_test.c:929 (discriminator 3)
> #      6    0x000003ff96fabdb3: ?? ??:0
> #      7    0x000000000100241d: .annobin_lto.hot at crt1.o:?
> #   KVM_SET_USER_MEMORY_REGION IOCTL failed,
> #   rc: -1 errno: 22
> #   slot: 1 flags: 0x1
> #   guest_phys_addr: 0xfffffbfe00000 size: 0x40100000

Ah. We do have a limit of 128TB for guest physical memory. The patch now made this
apparent as we no longer cut the upper bits off.

  reply	other threads:[~2021-06-08 10:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 17:38 [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn() David Matlack
2021-05-21 17:49 ` Peter Xu
2021-05-22 10:59 ` Andrew Jones
2021-05-24 12:30 ` Paolo Bonzini
2021-06-08  8:39 ` Christian Borntraeger
2021-06-08 10:03   ` Christian Borntraeger [this message]
2021-06-08 11:45     ` [PATCH] KVM: selftests: introduce P47V64 for s390x Christian Borntraeger
2021-06-08 11:49       ` Janosch Frank
2021-06-08 11:55         ` Christian Borntraeger
2021-06-08 12:18       ` Christian Borntraeger
2021-06-08 12:39     ` [PATCH v2] " Christian Borntraeger
2021-06-08 16:41       ` David Matlack
2021-06-08 17:19       ` Paolo Bonzini

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=4d6513f3-d921-dff0-d883-51c6dbdcbe39@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=bgardon@google.com \
    --cc=dmatlack@google.com \
    --cc=drjones@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=venkateshs@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).