From: Thomas Huth <thuth@redhat.com>
To: Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, David Gibson <david@gibson.dropbear.id.au>,
Sam Bobroff <sam.bobroff@au1.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] kvm: check KVM_CAP_SYNC_MMU with kvm_vm_check_extension()
Date: Fri, 15 Sep 2017 07:32:10 +0200 [thread overview]
Message-ID: <e0f55ca1-81e1-9c03-c6ad-0d099360db55@redhat.com> (raw)
In-Reply-To: <150541712226.1616.17581342887936984948.stgit@bahia.lan>
On 14.09.2017 21:25, Greg Kurz wrote:
> On a server-class ppc host, this capability depends on the KVM type,
> ie, HV or PR. If both KVM are present in the kernel, we will always
> get the HV specific value, even if we explicitely requested PR on
> the command line.
>
> This can have an impact if we're using hugepages or a balloon device.
>
> Since we've already created the VM at the time any user calls
> kvm_has_sync_mmu(), switching to kvm_vm_check_extension() is
> enough to fix any potential issue.
>
> It is okay for the other archs that also implement KVM_CAP_SYNC_MMU,
> ie, mips, s390, x86 and arm, because they don't depend on the VM being
> created or not.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> accel/kvm/kvm-all.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index f85553a85194..323c567cfb68 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2234,7 +2234,7 @@ int kvm_device_access(int fd, int group, uint64_t attr,
> /* Return 1 on success, 0 on failure */
> int kvm_has_sync_mmu(void)
> {
> - return kvm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
> + return kvm_vm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
> }
Reviewed-by: Thomas Huth <thuth@redhat.com>
... but while you're at it, maybe it would be better to use a bool
variable for the state of this extension, too, and only check for the
extension one time at the end of kvm_init() ? kvm_has_sync_mmu() is
apparently used multiple times in other source files, so we might be
able to save some cycles by doing the syscall only once?
Thomas
next prev parent reply other threads:[~2017-09-15 5:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 19:25 [Qemu-devel] [PATCH 0/3] kvm: use kvm_vm_check_extension() with VM capabilities Greg Kurz
2017-09-14 19:25 ` [Qemu-devel] [PATCH 1/3] kvm: check KVM_CAP_SYNC_MMU with kvm_vm_check_extension() Greg Kurz
2017-09-15 0:54 ` David Gibson
2017-09-15 5:32 ` Thomas Huth [this message]
2017-09-15 15:14 ` Greg Kurz
2017-09-14 19:25 ` [Qemu-devel] [PATCH 2/3] kvm: check KVM_CAP_NR_VCPUS " Greg Kurz
2017-09-15 1:00 ` David Gibson
2017-09-15 5:34 ` Thomas Huth
2017-09-14 19:25 ` [Qemu-devel] [PATCH 3/3] ppc/kvm: check some capabilities " Greg Kurz
2017-09-15 5:15 ` Thomas Huth
2017-09-15 6:35 ` David Gibson
2017-09-15 8:18 ` Thomas Huth
2017-09-15 8:39 ` David Gibson
2017-09-15 8:43 ` Greg Kurz
2017-09-15 8:52 ` Thomas Huth
2017-09-15 6:34 ` David Gibson
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=e0f55ca1-81e1-9c03-c6ad-0d099360db55@redhat.com \
--to=thuth@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sam.bobroff@au1.ibm.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 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).