kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Liu, Jinsong" <jinsong.liu@intel.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] Expose tsc deadline timer cpuid to guest
Date: Sat, 21 Apr 2012 09:23:50 +0200	[thread overview]
Message-ID: <4F926086.3020307@web.de> (raw)
In-Reply-To: <20120420153656.GX3169@otherpad.lan.raisama.net>

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

On 2012-04-20 17:36, Eduardo Habkost wrote:
> On Fri, Apr 20, 2012 at 05:19:17PM +0200, Jan Kiszka wrote:
>> On 2012-04-20 17:00, Eduardo Habkost wrote:
>>> On Fri, Apr 20, 2012 at 12:12:38PM +0200, Jan Kiszka wrote:
>>>> On 2012-04-19 22:03, Eduardo Habkost wrote:
>>>>> Jan/Avi: ping?
>>>>>
>>>>> I would like to get this ABI detail clarified so it can be implemented
>>>>> the right way on Qemu and KVM.
>>>>>
>>>>> My proposal is to simply add tsc-deadline to the data returned by
>>>>> GET_SUPPORTED_CPUID, making KVM_CAP_TSC_DEADLINE_TIMER unnecessary.
>>>>>
>>>>
>>>> IIRC, there were problems with this model to exclude that the feature
>>>> gets reported this way without ensuring that in-kernel irqchip is
>>>> actually activated. Please browse the discussions, it should be
>>>> documented there.
>>>
>>> The flag was never added to GET_SUPPORTED_CPUID on any of the git
>>> repositories I have checked, and I don't see that being done anywhere on
>>> my KVM mailing list archives, either. So I don't see how we could have
>>> had issues with GET_SUPPORTED_CPUID, if it was never present on the
>>> code.
>>>
>>> What was present on the code before the fix, was coded that
>>> unconditinally enabled the flag even if Qemu never asked for it, and
>>> that really was wrong.
>>>
>>> GET_SUPPORTED_CPUID doesn't enable any flag: it just tells userspace
>>> that the hardware and KVM supports the feature (and, surprise, this is
>>> exactly what KVM_CAP_TSC_DEADLINE_TIMER means too, isn't it?). It's up
>>> to userspace to enable the CPUID bits according to user requirements and
>>> userspace capabilities (in other words: only when userspace knows it is
>>> safe because the in-kernel irqchip is enabled).
>>>
>>> If the above is not what GET_SUPPORTED_CPUID means, I would like to get
>>> that clarified, so I can submit an updated to KVM API documentation.
>>
>> Does old userspace filter out flags from GET_SUPPORTED_CPUID that it
>> does not understand?
> 
> It's even more strict than that: it only enables what was explicitly
> enabled on the CPU model asked by the user.
> 
> But:
> 
> The only exception is "-cpu host", that tries to enable everything, even
> flags Qemu never heard of, and that is something that may require some
> changes on the API design (or at least documentation clarifications).
> 
> Today "-cpu host" can't differentiate (A) "a feature that KVM supports
> and emulate by itself and can be enabled without any support from
> userspace" and (B) "a feature that KVM supports but need support from
> userspace to be enabled". I am sure we will be able to find multiple
> examples of (B) inside the flags returned by GET_SUPPORTED_CPUID today.

The problem remains that exposing TSC_DEADLINE via SUPPORTED_CPUID is
wrong in case userspace doesn't select the in-kernel APIC. The kernel
does _nothing_ about emulating the flag if userspace provides the APIC,
so it must not expose this feature. Even if this had no practical impact
(but it has: old qemu[-kvm] + userspace APIC + -cpu host), it would
still be semantically broken.

> 
> We could decide to never add any new flag to GET_SUPPORTED_CPUID if it
> requires additional userspace support to work, from now on, and create
> new KVM_CAP_* flags for them. But, we really want to do that for almost
> every new CPUID feature bit in the future?

Most CPU features do not depend on our in-kernel irqchips. But if there
is something to simplify in retrieving information about such
"conditional features", let's do it.

> 
> We also have the problem of defining what "requires support from
> userspace to work" means: I am not sure this has the same meaning for
> everybody. Many new features require userspace support only for
> migration, and nothing else, but some users don't need migration to
> work. Do those features qualify as (A), or as (B)?

"Works for most user" also means "breaks for some". And that is a bug,
isn't it?

Jan


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

  reply	other threads:[~2012-04-21  7:24 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28 21:55 [PATCH 2/2] Expose tsc deadline timer cpuid to guest Liu, Jinsong
2012-01-04 16:48 ` Jan Kiszka
2012-01-05 20:07   ` Liu, Jinsong
2012-01-05 20:34     ` Jan Kiszka
2012-01-07 18:23       ` Liu, Jinsong
2012-01-08 21:24         ` Jan Kiszka
2012-02-27 16:05           ` Liu, Jinsong
2012-02-27 17:18             ` Jan Kiszka
2012-02-28 10:30               ` Liu, Jinsong
2012-03-06  7:49                 ` [Qemu-devel] " Liu, Jinsong
2012-03-06 10:14                   ` Jan Kiszka
2012-03-09 18:27                     ` Liu, Jinsong
2012-03-09 18:56                       ` [Qemu-devel] " Jan Kiszka
2012-03-09 19:09                         ` Liu, Jinsong
2012-03-09 20:52                           ` Jan Kiszka
2012-03-10  1:07                             ` Andreas Färber
2012-03-11 18:54                             ` Liu, Jinsong
2012-03-12 17:21                             ` Eduardo Habkost
2012-03-25  8:51                               ` Liu, Jinsong
2012-03-09 19:29                       ` Liu, Jinsong
     [not found]                       ` <4F67B4C9.3010502@redhat.com>
     [not found]                         ` <DE8DF0795D48FD4CA783C40EC82923350F7D2F@SHSMSX101.ccr.corp.intel.com>
2012-03-20 13:33                           ` [Qemu-devel] " Eduardo Habkost
2012-03-23  3:49                             ` Liu, Jinsong
2012-03-23 13:46                               ` Eduardo Habkost
2012-03-23 14:17                                 ` Liu, Jinsong
2012-04-19 20:03                                   ` Eduardo Habkost
2012-04-20 10:12                                     ` Jan Kiszka
2012-04-20 15:00                                       ` Eduardo Habkost
2012-04-20 15:19                                         ` [Qemu-devel] " Jan Kiszka
2012-04-20 15:36                                           ` Eduardo Habkost
2012-04-21  7:23                                             ` Jan Kiszka [this message]
2012-04-23 14:48                                               ` Eduardo Habkost
2012-04-23 16:31                                                 ` Jan Kiszka
2012-04-23 20:02                                                   ` Eduardo Habkost
2012-04-24 16:06                                                     ` Jan Kiszka
2012-04-24 17:19                                                       ` [Qemu-devel] " Eduardo Habkost
2012-05-07 18:21                                                         ` Semantics of "-cpu host" (was Re: [Qemu-devel] [PATCH 2/2] Expose tsc deadline timer cpuid to guest) Eduardo Habkost
2012-05-08  0:58                                                           ` Semantics of "-cpu host" (was " Alexander Graf
2012-05-08 20:14                                                             ` Semantics of "-cpu host" (was Re: [Qemu-devel] " Eduardo Habkost
2012-05-08 22:07                                                               ` Alexander Graf
2012-05-09  8:14                                                                 ` Semantics of "-cpu host" (was " Gleb Natapov
2012-05-09  8:42                                                                   ` Semantics of "-cpu host" (was Re: [Qemu-devel] " Alexander Graf
2012-05-09  8:51                                                                     ` Gleb Natapov
2012-05-09  9:05                                                                       ` Alexander Graf
2012-05-09  9:38                                                                         ` Gleb Natapov
2012-05-09  9:54                                                                           ` Alexander Graf
2012-05-09 19:38                                                                           ` Eduardo Habkost
2012-05-09 20:30                                                                             ` Alexander Graf
2012-05-10 12:53                                                                             ` Semantics of "-cpu host" (was " Gleb Natapov
2012-05-10 13:21                                                                               ` Semantics of "-cpu host" (was Re: [Qemu-devel] " Alexander Graf
2012-05-10 13:39                                                                                 ` Gleb Natapov
2012-05-10 14:12                                                                                   ` Eduardo Habkost
2012-05-09  7:16                                                           ` Andre Przywara
2012-06-14 19:02                                                         ` [Qemu-devel] [PATCH 2/2] Expose tsc deadline timer cpuid to guest Liu, Jinsong
2012-06-14 19:12                                                           ` Eduardo Habkost
2012-06-14 19:18                                                             ` Liu, Jinsong

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=4F926086.3020307@web.de \
    --to=jan.kiszka@web.de \
    --cc=avi@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jinsong.liu@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.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).