xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Jan Beulich <JBeulich@suse.com>
Cc: kevin.tian@intel.com, jun.nakajima@intel.com,
	suravee.suthikulpanit@amd.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] x86/vpmu: Add get/put_vpmu() and VPMU_ENABLED
Date: Fri, 17 Feb 2017 15:58:29 +0000	[thread overview]
Message-ID: <fca9e12f-869e-72ef-39e4-d44466cf4c5e@citrix.com> (raw)
In-Reply-To: <3e8e61ce-564e-9499-d896-942854769c7a@oracle.com>

On 17/02/17 14:17, Boris Ostrovsky wrote:
>
>
> On 02/17/2017 03:27 AM, Jan Beulich wrote:
>>>>> On 16.02.17 at 19:09, <boris.ostrovsky@oracle.com> wrote:
>>> On 02/16/2017 12:09 PM, Andrew Cooper wrote:
>>>> Second, if it is available, has the toolstack chosen to allow the
>>>> domain
>>>> to use it.  This should determine whether features/information are
>>>> visible in CPUID.
>>>
>>> You mean if toolstack masks out leaf 0xa on Intel? I chould check this
>>> in get_vpmu(). Is this information available by the time
>>> vcpu_initialise() runs?
>>
>> You shouldn't rely on this, even if it happened to be that way
>> right now. Instead you'd have to adjust accordingly when CPUID
>> info gets updated by the tool stack (update_domain_cpuid_info()
>> as the root hook point).
>
> Right, that's what I was going to do --- destroy VPMU if CPUID
> indicates no support.

From a CPUID side of things, the way I would eventually like things to
work is this:

* Hardware support and Xen command line options influence the visibility
of vPMU bits in {hvm,pv}_max_policy.

* Using *_max_policy and domain.cfg settings, a toolstack opts in to
allowing vPMU by setting vPMU details in the domains policy.

The eventual plan for toolstack API will be that the entire policy is
got/set at once (rather than individual leaves as it currently exists). 
Xen audits the toolstacks choice against {hvm,pv}_max_policy, rejecting
the update wholesale if it is bad.

Then, Xen will compare the old and proposed new policies to see what has
changed, and use this to enable subsystems for a domain (either
passively by having the subsystem rely on CPUID values, or actively by
calling into the subsystem to initialise things).  nested-virt was my
main target here, but vPMU looks like it fits into the same category, as
well as some of the debugging facilities such as LBR etc.


I realise that this infrastructure doesn't all exist yet,  but it would
be helpful if your fix can easily be turned into API matching the above,
when I complete the missing CPUID pieces.

>
>
>> Which gets us to another point: Shouldn't
>> we disallow CPUID info updates after the guest started running?
>> Or do we mean to trust the tool stack to not do this if it doesn't
>> want to confuse a guest?
>
> I believe currently it's the latter. I don't see anything preventing
> CPUID update to a running guest (except for pausing it while the
> update is in progress).

This is on my TODO list longer than d->creation_finished has existed. 
The CPUID policy should be immutable even by the toolstack once the
guest is running.

~Andrew

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

  reply	other threads:[~2017-02-17 15:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 14:59 [PATCH] x86/vpmu: Add get/put_vpmu() and VPMU_ENABLED Boris Ostrovsky
2017-02-16 16:59 ` Jan Beulich
2017-02-16 17:09   ` Andrew Cooper
2017-02-16 18:09     ` Boris Ostrovsky
2017-02-17  8:27       ` Jan Beulich
2017-02-17 14:17         ` Boris Ostrovsky
2017-02-17 15:58           ` Andrew Cooper [this message]
2017-02-17 16:37             ` Boris Ostrovsky
2017-02-16 17:31   ` Boris Ostrovsky
2017-02-17  8:28     ` Jan Beulich
2017-02-17 14:24       ` Boris Ostrovsky

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=fca9e12f-869e-72ef-39e4-d44466cf4c5e@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=suravee.suthikulpanit@amd.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).