qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr()
Date: Thu, 14 Sep 2017 13:27:49 +0200	[thread overview]
Message-ID: <20170914132749.14e35c64@bahia.lan> (raw)
In-Reply-To: <0cb6cfca-05e6-d2e2-7345-541fa21490dd@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2017 bytes --]

On Thu, 14 Sep 2017 13:17:48 +0200
Thomas Huth <thuth@redhat.com> wrote:

> On 14.09.2017 12:48, Greg Kurz wrote:
> > If the host has both KVM PR and KVM HV loaded and we pass:
> > 
> > 	-machine pseries,accel=kvm,kvm-type=PR
> > 
> > the kvmppc_is_pr() returns false instead of true. Since the helper
> > is mostly used as fallback, it doesn't have any real impact with
> > recent kernels. A notable exception is the workaround to allow
> > migration between compatible hosts with different PVRs (eg, POWER8
> > and POWER8E), since KVM still doesn't provide a way to check if a
> > specific PVR is supported (see commit c363a37a450f for details).
> > 
> > According to the official KVM API documentation [1], KVM_PPC_GET_PVINFO
> > is "vm ioctl", but we check it as a global ioctl. The following function
> > in KVM is hence called with kvm == NULL and considers we're in HV mode.
> > 
> > int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> > {
> > 	int r;
> > 	/* Assume we're using HV mode when the HV module is loaded */
> > 	int hv_enabled = kvmppc_hv_ops ? 1 : 0;
> > 
> > 	if (kvm) {
> > 		/*
> > 		 * Hooray - we know which VM type we're running on. Depend on
> > 		 * that rather than the guess above.
> > 		 */
> > 		hv_enabled = is_kvmppc_hv_enabled(kvm);
> > 	}
> > 
> > Let's use kvm_vm_check_extension() to fix the issue.  
> 
> By the way, what about the other CAPs that rely on hv_enabled? grepping
> through the QEMU sources, I can see:
> 
>  cap_ppc_smt = kvm_check_extension(s, KVM_CAP_PPC_SMT);
> 
>  cap_htab_fd = kvm_check_extension(s, KVM_CAP_PPC_HTAB_FD);
> 
>  int ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);
> 
>  return kvm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
> 
>  !kvm_check_extension(cs->kvm_state, KVM_CAP_SW_TLB)) {
> 
> ... do we need to fix them, too?
> 

I'm currently going through the KVM code to see which ones need to be
fixed. I'll send more patches shortly :)

Cheers,

--
Greg

>  Thomas


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2017-09-14 11:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 10:48 [Qemu-devel] [PATCH] ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr() Greg Kurz
2017-09-14 11:00 ` David Gibson
2017-09-14 11:05 ` Thomas Huth
2017-09-14 11:17 ` Thomas Huth
2017-09-14 11:27   ` Greg Kurz [this message]
2017-09-14 14:39     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz

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=20170914132749.14e35c64@bahia.lan \
    --to=groug@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.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).