All of lore.kernel.org
 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: jbeulich@suse.com
Subject: Re: [PATCH 2/3] x86/vpmu: Decrement vpmu_count early in vpmu_destroy()
Date: Mon, 13 Feb 2017 09:22:25 -0500	[thread overview]
Message-ID: <d75184fc-8044-07a5-ba97-9ba2c506dccb@oracle.com> (raw)
In-Reply-To: <0532dfed-2842-e71c-d692-0e3628e223c3@citrix.com>



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@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	other threads:[~2017-02-13 14:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13  2:29 [PATCH 0/3] VPMU fixes Boris Ostrovsky
2017-02-13  2:29 ` [PATCH 1/3] x86/vpmu: Calculate vpmu_enabled() based on vpmu_mode value Boris Ostrovsky
2017-02-13 10:33   ` Andrew Cooper
2017-02-13 12:50   ` Jan Beulich
2017-02-13 14:38     ` Boris Ostrovsky
2017-02-13 14:44       ` Jan Beulich
2017-02-13 15:02         ` Boris Ostrovsky
2017-02-13  2:29 ` [PATCH 2/3] x86/vpmu: Decrement vpmu_count early in vpmu_destroy() Boris Ostrovsky
2017-02-13 10:38   ` Andrew Cooper
2017-02-13 14:22     ` Boris Ostrovsky [this message]
2017-02-13  2:29 ` [PATCH 3/3] x86: Adjust which files need vpmu.h Boris Ostrovsky
2017-02-13  2:46   ` Tian, Kevin
2017-02-13 10:38   ` Andrew Cooper

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=d75184fc-8044-07a5-ba97-9ba2c506dccb@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.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.