All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	kvm@vger.kernel.org, "Wanpeng Li" <kernellwp@gmail.com>
Subject: Re: [PATCH] KVM: lapic: Reuse auto-adjusted timer advance of first stable vCPU
Date: Fri, 24 May 2019 13:23:33 -0700	[thread overview]
Message-ID: <20190524202333.GG365@linux.intel.com> (raw)
In-Reply-To: <3ea5ae51-89b2-ee0c-d156-88198af90b95@redhat.com>

On Mon, May 20, 2019 at 03:03:10PM +0200, Paolo Bonzini wrote:
> On 08/05/19 23:47, Sean Christopherson wrote:
> > +
> > +		/*
> > +		 * The first vCPU to get a stable advancement time "wins" and
> > +		 * sets the advancement time that is used for *new* vCPUS that
> > +		 * are created with auto-adjusting enabled.
> > +		 */
> > +		if (apic->lapic_timer.timer_advance_adjust_done)
> > +			(void)cmpxchg(&adjusted_timer_advance_ns, -1,
> > +				      timer_advance_ns);
> 
> This is relatively expensive, so it should only be done after setting
> timer_advance_adjust_done to true.

That's already the case, or am I missing something?

This code is inside "if (!apic->lapic_timer.timer_advance_adjust_done)",
and apic->lapic_timer.timer_advance_adjust_done is set to true at creation
time if "adjusted_timer_advance_ns != -1", i.e. the cmpxchg() will only
be reached on vCPUs that are created before adjusted_timer_advance_ns is
set and will be reached at most once per vCPU.

  reply	other threads:[~2019-05-24 20:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 21:47 [PATCH] KVM: lapic: Reuse auto-adjusted timer advance of first stable vCPU Sean Christopherson
2019-05-20 13:03 ` Paolo Bonzini
2019-05-24 20:23   ` Sean Christopherson [this message]
2019-05-24 20:48     ` Paolo Bonzini

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=20190524202333.GG365@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /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.