All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>, xen-devel@lists.xen.org
Cc: kevin.tian@intel.com, JBeulich@suse.com, jun.nakajima@intel.com,
	andrew.cooper3@citrix.com, tim@xen.org,
	Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com,
	dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v21 11/14] x86/VPMU: Handle PMU interrupts for PV(H) guests
Date: Mon, 18 May 2015 11:11:03 -0400	[thread overview]
Message-ID: <555A0107.9020903@oracle.com> (raw)
In-Reply-To: <2290839.Ioueb7rBvb@amur>

On 05/18/2015 05:43 AM, Dietmar Hahn wrote:
> Am Freitag 08 Mai 2015, 17:06:11 schrieb Boris Ostrovsky:
>>
>> +    if ( !is_hvm_vcpu(sampling) )
>> +    {
>> +        /* PV(H) guest */
>> +        const struct cpu_user_regs *cur_regs;
>> +        uint64_t *flags = &vpmu->xenpmu_data->pmu.pmu_flags;
>> +        domid_t domid = DOMID_SELF;
>> +
>> +        if ( !vpmu->xenpmu_data )
>> +            return;
>> +
>> +        if ( is_pvh_vcpu(sampling) &&
>> +             !vpmu->arch_vpmu_ops->do_interrupt(regs) )
>
> Here you expect vpmu->arch_vpmu_ops != NULL but ...
>
>> +            return;
>> +
>> +        if ( *flags & PMU_CACHED )
>> +            return;
>> +


...

>> +
>> +        return;
>> +    }
>>
>>       if ( vpmu->arch_vpmu_ops )
>
> ... here is a check.
> Maybe this check here is unnecessary because you would never get this interrupt
> without having arch_vpmu_ops != NULL to switch on the machinery?
>
> There are some other locations too with checks before calling
> vpmu->arch_vpmu_ops->... and some without. Maybe it would make sense to force
> always a complete set of arch_vpmu_ops - functions to avoid this?


I was actually thinking about (eventually) dropping ops tests and 
checking that all of them exist during VPMU initialization.

As for this particular test, it may be worth moving it to the beginning 
of the routine, mostly to guard against spurious interrupts (but also to 
avoid performing it more than once)


>>   }
>>
>> -void vpmu_load(struct vcpu *v)
>> +int vpmu_load(struct vcpu *v, bool_t verify)
>
> vpmu_load uses "verify" but within the arch_vpmu_load functions
> (core2_vpmu_load() and amd_vpmu_load()) you use "from_guest" for the same
> meaning. This is a little bit confusing.
> Always using "verify" would be clearer I think.


Then this will not be consistent with the save part (which doesn't use 
the flag to verify the context but rather to only state that the routine 
should copy it). So I think renaming 'verify' to 'from_guest' and 
keeping arch ops as they are now would be more consistent.

Thanks.
-boris

  reply	other threads:[~2015-05-18 15:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 21:06 [PATCH v21 00/14] x86/PMU: Xen PMU PV(H) support Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 01/14] common/symbols: Export hypervisor symbols to privileged guest Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 02/14] x86/VPMU: Add public xenpmu.h Boris Ostrovsky
2015-05-18 15:15   ` Jan Beulich
2015-05-18 16:12     ` Boris Ostrovsky
2015-05-19  6:48       ` Jan Beulich
2015-05-19 14:40         ` Boris Ostrovsky
2015-05-19 15:33           ` Jan Beulich
2015-05-08 21:06 ` [PATCH v21 03/14] x86/VPMU: Make vpmu not HVM-specific Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 04/14] x86/VPMU: Interface for setting PMU mode and flags Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 05/14] x86/VPMU: Initialize VPMUs with __initcall Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 06/14] x86/VPMU: Initialize PMU for PV(H) guests Boris Ostrovsky
2015-05-18 15:19   ` Jan Beulich
2015-05-08 21:06 ` [PATCH v21 07/14] x86/VPMU: Save VPMU state for PV guests during context switch Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 08/14] x86/VPMU: When handling MSR accesses, leave fault injection to callers Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 09/14] x86/VPMU: Add support for PMU register handling on PV guests Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 10/14] x86/VPMU: Use pre-computed masks when checking validity of MSRs Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 11/14] x86/VPMU: Handle PMU interrupts for PV(H) guests Boris Ostrovsky
2015-05-18  9:43   ` Dietmar Hahn
2015-05-18 15:11     ` Boris Ostrovsky [this message]
2015-05-18 15:39   ` Jan Beulich
2015-05-18 16:19     ` Boris Ostrovsky
2015-05-19  6:50       ` Jan Beulich
2015-05-08 21:06 ` [PATCH v21 12/14] x86/VPMU: Merge vpmu_rdmsr and vpmu_wrmsr Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 13/14] x86/VPMU: Add privileged PMU mode Boris Ostrovsky
2015-05-08 21:06 ` [PATCH v21 14/14] x86/VPMU: Move VPMU files up from hvm/ directory 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=555A0107.9020903@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=dietmar.hahn@ts.fujitsu.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tim@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 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.