xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	jbeulich@suse.com, keir@xen.org
Cc: david.vrabel@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] x86/hvm: Provide list of emulated features in HVM CPUID leaf
Date: Wed, 3 Feb 2016 16:05:47 +0100	[thread overview]
Message-ID: <56B2174B.809@citrix.com> (raw)
In-Reply-To: <56B20F02.7050702@oracle.com>

El 3/2/16 a les 15:30, Boris Ostrovsky ha escrit:
> On 02/03/2016 03:43 AM, Roger Pau Monné wrote:
>> El 3/2/16 a les 1:17, Andrew Cooper ha escrit:
>>> On 02/02/2016 23:30, Boris Ostrovsky wrote:
>>>
>>>> I think for now I mostly care about APIC and for that I can use HW
>>>> CPUID bit (which I believe is cleared for HVMlite guests).
>>> The APIC bit in cpuid is magic and specified as a fast forward of the
>>> APICBASE_MSR enable bit.
>>>
>>> Therefore, the correct architectural behaviour is for this bit to be
>>> clear if the local APIC is disabled, or indeed not implemented.
>>>
>>> With my maintainers hat on, I will reject any attempt to introduce
>>> non-architectural behaviour; at the moment I am dealing with the
>>> stupidity that is the PV XSAVE interface, where broken bugfix piled on
>>> top of broken bugfix has resulted in a situation where many Linux PV
>>> guests crash if provided with architecturally correct behaviour of the
>>> OSXSAVE cpuid bit (yet another magic one).
>>>
>>>> The trouble is that I need to present Linux as having APIC (boot code
>>>> doesn't feel good if !cpu_has_apic) so I'll need to keep no-APIC
>>>> emulation private to Xen-related code. Which is doable.
>> I have to do the same for FreeBSD, I have to manually switch the APIC
>> cpuid bit,
> 
> How? In config file's 'cpuid' option?

Ah, no, I fix it inside FreeBSD. The FreeBSD kernel stores the result in
a local variable, which i fixup when booting under HVMlite:

cpu_feature |= CPUID_APIC;

> 
>> or else FreeBSD refuses to do SMP initialization. IMHO, what
>> we currently do (no APIC cpuid bit) is correct, and when a local APIC is
>> available the bit will indeed be enabled.
>>
>>> I see two choices.
>>>
>>> 1) Require that Linux DMLite guests require a Local APIC, and we allow
>>> that to be a configured option.  Exposing APIC definitely makes sense
>>> longer term, because APICV hardware acceleration outperforms the
>>> hypercall-based method.
>> This is what I aim to do long term, that is provide an emulated local
>> APIC. The plan was to then also provide ACPI tables in order to notify
>> the presence of the local and IO APICs (we are going to need both if we
>> plan to do pci-passthrough of devices with PCI interrupts). Of course
>> the APIC cpuid bit will also be enabled in this case.
> 
> One might say that in Linux we have APIC even for PV guests --- we
> provide PV APIC ops. That's what I am using as justification for stating
> that the HVMlite guest has APIC to force-set X86_FEATURE_APIC bit. So
> this is somewhat similar to what Andrew is proposing in his option#2
> (quoted below for convenience):
> 
>     2) Find a way of telling the Linux boot path "trust me - here is an
> APIC
>     driver - dont go looking under the hood".  Possibly by registering a
>     cpuid pvop which re-inserts the APIC bit, although this is liable to
>     cause the boot code to then inspect the APICBASE_MSR, which will cause
>     it to blow up slightly later on.

IMHO the APIC feature bit has a clear meaning: indicate the presence of
a local APIC. A Xen PV APIC, or however we want to call it it's not a
local APIC. I think OSes should fixup the CPUID feature bit if that's
needed for them to work properly, but fixing it in Xen it's an error.

Roger.

  parent reply	other threads:[~2016-02-03 15:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 23:17 [PATCH] x86/hvm: Provide list of emulated features in HVM CPUID leaf Boris Ostrovsky
2016-02-02 23:22 ` Andrew Cooper
2016-02-02 23:30   ` Boris Ostrovsky
2016-02-03  0:17     ` Andrew Cooper
2016-02-03  8:43       ` Roger Pau Monné
2016-02-03 14:30         ` Boris Ostrovsky
2016-02-03 14:37           ` Andrew Cooper
2016-02-03 14:46             ` Boris Ostrovsky
2016-02-03 15:05           ` Roger Pau Monné [this message]
2016-02-03 15:27             ` Boris Ostrovsky
2016-02-03  3:51 ` Tian, Kevin

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=56B2174B.809@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.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).