All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Cc: kevin.tian@intel.com, suravee.suthikulpanit@amd.com,
	jun.nakajima@intel.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] x86/vpmu: Add get/put_vpmu() and VPMU_ENABLED
Date: Thu, 16 Feb 2017 13:09:10 -0500	[thread overview]
Message-ID: <4e05af9a-38e2-3366-14cc-16dcb73a9d84@oracle.com> (raw)
In-Reply-To: <fbca21b2-719a-9e72-9f18-800be9f80816@citrix.com>



On 02/16/2017 12:09 PM, Andrew Cooper wrote:
> On 16/02/17 16:59, Jan Beulich wrote:
>>>>> On 16.02.17 at 15:59, <boris.ostrovsky@oracle.com> wrote:
>>> vpmu_enabled() (used by hvm/pv_cpuid() to properly report 0xa leaf
>>> for Intel processors) is based on the value of VPMU_CONTEXT_ALLOCATED
>>> bit. This is problematic:
>>> * For HVM guests VPMU context is allocated lazily, during the first
>>>   access to VPMU MSRs. Since the leaf is typically queried before guest
>>>   attempts to read or write the MSRs it is likely that CPUID will report
>>>   no PMU support
>>> * For PV guests the context is allocated eagerly but only in responce to
>>>   guest's XENPMU_init hypercall. There is a chance that the guest will
>>>   try to read CPUID before making this hypercall.
>>>
>>> This patch introduces VPMU_ENABLED flag which is set (subject to vpmu_mode
>>> constraints) during VCPU initialization for both PV and HVM guests. Since
>>> this flag is expected to be managed together with vpmu_count, get/put_vpmu()
>>> are added to simplify code.
>> I think VPMU_ENABLED is misleading, as it may as well mean the state
>> after the guest did enable it. How about VPMU_AVAILABLE?
>
> The problem is a little deeper than that.
>
> First, there is whether it is available based on hypervisor configuration.

This bit is set only if vpmu_mode permits it.

>
> 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?

>
> Finally, if vpmu is permitted, has the domain turned it on.

HVM domains always do and PV domains essentially too.


-boris

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

  reply	other threads:[~2017-02-16 18:09 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 [this message]
2017-02-17  8:27       ` Jan Beulich
2017-02-17 14:17         ` Boris Ostrovsky
2017-02-17 15:58           ` Andrew Cooper
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=4e05af9a-38e2-3366-14cc-16dcb73a9d84@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.