kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	peterx@redhat.com, Andrew Jones <drjones@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: GET_SUPPORTED_CPUID and irqchip (was Re: kvm_pv_unhalt and kernel_irqchip=off)
Date: Sat, 13 Aug 2016 14:43:03 +0200	[thread overview]
Message-ID: <20160813124303.GA20960@potion> (raw)
In-Reply-To: <20160812183742.GM5627@thinpad.lan.raisama.net>

2016-08-12 15:37-0300, Eduardo Habkost:
> Now I have another question: are features that require the
> in-kernel irqchip supposed to be present in GET_SUPPORTED_CPUID?

I don't think so.  Simply removing X2APIC and PV_UNHALT would disable
them on old userspaces, though, which would probably cause more bugs.

(The blunder doesn't seem to be bad enough for a new capability or
 interface and a deprecation protocol on these features.)

> We have examples of both cases in KVM:
> 
> * TSC_DEADLINE_TIMER is _not_ present in GET_SUPPORTED_CPUID,
>   and is reported through KVM_CAP_TSC_DEADLINE_TIMER.
> * X2APIC is present in GET_SUPPORTED_CPUID, but the bit
>   makes sense only if the in-kernel irqchip is used.
> * KVM_PV_UNHALT is present in GET_SUPPORTED_CPUID, but
>   requires the in-kernel irqchip to work.

Well ... no excuses for that.

> Should userspace expect more cases like x2apic and kvm_pv_unhalt
> in the future?

At least one userspace (QEMU) doesn't filter unknown features from
GET_SUPPORTED_CPUID, so KVM cannot plan to pass conditionally buggy
features.
KVM would need to define a new interface to handle these issues, so I
think that userspace can ignore unknown KVM bugs.

I would like to return -EINVAL from KVM_SET_CPUID2 if userspace
requested a new CPUID feature that cannot work in given situation.

Another way would be to disable buggy features in KVM_SET_CPUID2, which
would require userspace to call KVM_GET_CPUID2 afterwards to learn what
the guest is actually using.

I have patches that implement the latter for X2APIC and PV_UNHALT, but
I'm not sure if it's better than leaving the bug unfixed, because QEMU
doesn't use KVM_GET_CPUID2 and migration to older KVM would change
CPUID, which is a very subtle bug.
What do you think?

  reply	other threads:[~2016-08-13 12:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 18:27 kvm_pv_unhalt and kernel_irqchip=off Eduardo Habkost
2016-08-10 19:04 ` Radim Krčmář
2016-08-10 20:58   ` Radim Krčmář
2016-08-12 18:37   ` GET_SUPPORTED_CPUID and irqchip (was Re: kvm_pv_unhalt and kernel_irqchip=off) Eduardo Habkost
2016-08-13 12:43     ` Radim Krčmář [this message]
2016-08-15 13:03       ` Eduardo Habkost
2016-08-15 13:21         ` Paolo Bonzini
2016-08-15 17:50         ` Radim Krčmář
2016-08-15 18:00           ` Eduardo Habkost
2016-08-15 18:32             ` Radim Krčmář

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=20160813124303.GA20960@potion \
    --to=rkrcmar@redhat.com \
    --cc=drjones@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@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).