xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, xen-devel@lists.xen.org
Cc: kevin.tian@intel.com, jun.nakajima@intel.com, jbeulich@suse.com
Subject: Re: [PATCH v2 1/3] x86/vpmu: Add get/put_vpmu() and VPMU_AVAILABLE
Date: Tue, 21 Feb 2017 09:12:58 -0500	[thread overview]
Message-ID: <f2b3c3fc-3dad-bf93-aa77-f68f1e565555@oracle.com> (raw)
In-Reply-To: <262b0abb-91c3-46fd-de4c-9eb26da380e0@citrix.com>

On 02/21/2017 06:00 AM, Andrew Cooper wrote:
> On 17/02/17 17:40, Boris Ostrovsky wrote:
>> @@ -509,15 +498,63 @@ void vpmu_initialise(struct vcpu *v)
>>      if ( ret )
>>          printk(XENLOG_G_WARNING "VPMU: Initialization failed for %pv\n", v);
>>  
>> -    /* Intel needs to initialize VPMU ops even if VPMU is not in use */
>> -    if ( !is_priv_vpmu &&
>> -         (ret || (vpmu_mode == XENPMU_MODE_OFF) ||
>> -          (vpmu_mode == XENPMU_MODE_ALL)) )
>> +    return ret;
>> +}
>> +
>> +static void get_vpmu(struct vcpu *v)
>> +{
>> +    spin_lock(&vpmu_lock);
>> +
>> +    /*
>> +     * Count active VPMUs so that we won't try to change vpmu_mode while
>> +     * they are in use.
>> +     * vpmu_mode can be safely updated while dom0's VPMUs are active and
>> +     * so we don't need to include it in the count.
>> +     */
>> +    if ( !is_hardware_domain(v->domain) &&
>> +        (vpmu_mode & (XENPMU_MODE_SELF | XENPMU_MODE_HV)) )
>> +    {
>> +        vpmu_count++;
>> +        vpmu_set(vcpu_vpmu(v), VPMU_AVAILABLE);
>> +    }
>> +    else if ( is_hardware_domain(v->domain) &&
>> +              (vpmu_mode != XENPMU_MODE_OFF) )
>> +        vpmu_set(vcpu_vpmu(v), VPMU_AVAILABLE);
> Why do we recalculate AVAILABLE on every get()?
>
> (In the absence of toolstack control from the CPUID side), surely it
> should be set (or not) exactly once during domain creation, and be
> unchanged thereafter?

Yes, that's exactly what's happening -- get_vpmu() is only called from
vcpu_initialise() -> vpmu_initialise() and so we set VPMU_AVAILABLE only
once for a VCPU.

I am not sure what you are asking.

-boris


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

  reply	other threads:[~2017-02-21 14:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 17:40 [PATCH v2 0/3] VPMU management update Boris Ostrovsky
2017-02-17 17:40 ` [PATCH v2 1/3] x86/vpmu: Add get/put_vpmu() and VPMU_AVAILABLE Boris Ostrovsky
2017-02-21  8:09   ` Tian, Kevin
2017-02-21 14:09     ` Boris Ostrovsky
2017-02-22  3:05       ` Tian, Kevin
2017-02-22 14:06         ` Boris Ostrovsky
2017-02-21 11:00   ` Andrew Cooper
2017-02-21 14:12     ` Boris Ostrovsky [this message]
2017-02-17 17:40 ` [PATCH v2 2/3] x86/vpmu: Disable VPMU if guest's CPUID indicates no PMU support Boris Ostrovsky
2017-02-21  8:13   ` Tian, Kevin
2017-02-22  9:55   ` Jan Beulich
2017-02-22 14:15     ` Boris Ostrovsky
2017-02-22 14:38       ` Jan Beulich
2017-02-22 15:02         ` Boris Ostrovsky
2017-02-22 15:10           ` Andrew Cooper
2017-02-22 16:34             ` Boris Ostrovsky
2017-02-22 16:42               ` Andrew Cooper
2017-02-22 15:16           ` Jan Beulich
2017-02-17 17:40 ` [PATCH v2 3/3] libxc/x86: PV guests should see leaf 0xa on Intel Boris Ostrovsky
2017-02-20 14:15   ` Wei Liu
2017-02-20 14:16     ` Andrew Cooper
2017-02-20 14:17       ` Wei Liu

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=f2b3c3fc-3dad-bf93-aa77-f68f1e565555@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.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).