xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Jan Beulich <JBeulich@suse.com>, xen-devel@lists.xen.org
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com,
	stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH] tools: fix xen-detect to correctly identify domU type
Date: Wed, 23 Mar 2016 11:14:34 +0100	[thread overview]
Message-ID: <56F26C8A.5080701@suse.com> (raw)
In-Reply-To: <56F26FF602000078000DF8C8@suse.com>

On 23/03/16 10:29, Jan Beulich wrote:
>>>> On 23.03.16 at 10:19, <JGross@suse.com> wrote:
>> On 23/03/16 10:10, Jan Beulich wrote:
>>>>>> On 23.03.16 at 08:50, <JGross@suse.com> wrote:
>>>> xen-detect always thinks a domU is running as HVM guest as the cpuid
>>>> instruction used to identify a Xen guest will always work.
>>>>
>>>> In order to identify a pv guest first try the pv special case of
>>>> cpuid (prefixed with an ud2a instruction and "xen" in ASCII). This
>>>> will fail on HVM and thus can be used to distinguish the guest types.
>>>
>>> I don't think that's something to be relied upon, or even true
>>> universally (see hvm_ud_intercept()). With CPUID faulting in mind
>>> I can't see a purely CPUID based mechanism that would reliably
>>> allow to tell one from the other as well as from PVH/PVHv2. There
>>> is one feature flag specifically getting set for PV domains only
>>> (XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD), but that
>>> won't be available on older hypervisors afaict.
>>
>> So this would mean we have the following options:
>>
>> a) nuke xen-detect completely, as it is unreliable
>> b) do the modification I've suggested, being better than the current
>>    version
>> c) modify it to ask the OS (is there an interface available we can
>>    use?)
>>
>> Thoughts?
> 
> Nuking is bad I think. If the tool can't reliably detect the mode,
> then I guess it should simply indicate so to the user. And if we
> can't figure a reliable method (I don't have the time right now to
> try to find possible ways), perhaps it should try more than one
> approach?

This would mean:
1. Try whether cpuid is allowed at all. If not, skip following cpuid
   based tests.
2. Look for Xen signature using prefixed and non-prefixed cpuid. If
   only one variant succeeds, type is clear and can be reported.
3. If none of the variants work, report "no Xen".
4. We don't know type. On Linux we can check for entries in
   /sys/hypervisor. If not present, report "don't know".
5. If /sys/hypervisor/type is not "xen", report "no Xen".
6. Check /sys/hypervisor/properties/features. If not present, report
   "don't know".
7. Report type according to features found (this is a little bit
   ugly: we have to rely on the current hypervisor implementation
   regarding the bits set for the different guest types).

Would it make sense to add another file to /sys/hypervisor/properties?
Something like guest_type, containing "pv", "hvm" or "pvh"? If existing
this could be used to report the guest type.


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-03-23 10:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23  7:50 [PATCH] tools: fix xen-detect to correctly identify domU type Juergen Gross
2016-03-23  9:10 ` Jan Beulich
     [not found] ` <56F26B7C02000078000DF896@suse.com>
2016-03-23  9:19   ` Juergen Gross
2016-03-23  9:29     ` Jan Beulich
     [not found]     ` <56F26FF602000078000DF8C8@suse.com>
2016-03-23 10:14       ` Juergen Gross [this message]
2016-03-23 10:25         ` Jan Beulich
2016-03-23 10:32           ` David Vrabel
2016-03-23 10:52             ` Juergen Gross
2016-03-23 10:55               ` Andrew Cooper
2016-03-23 10:59                 ` David Vrabel
2016-03-23 11:12                   ` Andrew Cooper
2016-03-23 11:18                     ` David Vrabel
2016-03-23 11:25                       ` Andrew Cooper
2016-03-23 19:03                         ` Juergen Gross
2016-03-24 10:22                           ` David Vrabel
2016-03-24 10:58                             ` Juergen Gross
2016-03-24 11:23                               ` Andrew Cooper
2016-03-24 11:38                                 ` George Dunlap
2016-03-25  8:54                                   ` Juergen Gross
2016-03-29  6:49                                     ` Jan Beulich
2016-03-29 13:54                                     ` George Dunlap
2016-03-29 14:00                                       ` Juergen Gross
2016-03-29 14:05                                         ` George Dunlap
2016-03-23 11:33                 ` Juergen Gross
2016-03-23 12:50                   ` Boris Ostrovsky
2016-03-23 10:34           ` Andrew Cooper
2016-03-23 10:48             ` Juergen Gross
2016-03-23 10:29         ` Andrew Cooper

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=56F26C8A.5080701@suse.com \
    --to=jgross@suse.com \
    --cc=JBeulich@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --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).