[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/3] x86/vpmu: Decrement vpmu_count early in vpmu_destroy()





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.ostrovsky@xxxxxxxxxx>

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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.