On 02/13/2017 05:38 AM, Andrew Cooper wrote:
On 13/02/17 02:29, Boris Ostrovsky wrote:
vpmu_count should be decremented even if VPMU_CONTEXT_ALLOCATED
is not set because on Intel processors the context is allocated
lazily and, in fact, might never happen.

Signed-off-by: Boris Ostrovsky <boris.ostrov...@oracle.com>

The code in vpmu_initialise() already subtracts 1 from the vpmu_count in
the Intel case.

Won't this now cause an underflow when shutting down a VM which didn't
enable vpmu to start with?

Right.

I think the comment about Intel always needing to initialize VPMU ops is no longer true so we should only be decrementing the count on error.

But then we'll still need to know whether or not to decrement it in vpmu_destroy().

How about

#define vpmu_enabled(v) !!vcpu_vpmu(v)->arch_vpmu_ops

and drop the first patch in the series?

I'll add a comment in each vendor's vpmu_initialize() that assignment of
arch_vpmu_ops should be the last thing?

-boris

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

Reply via email to