linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	vkuznets@redhat.com, dwmw@amazon.co.uk
Subject: Re: [PATCH 1/2] KVM: x86: reduce pvclock_gtod_sync_lock critical sections
Date: Wed, 7 Apr 2021 14:40:21 -0300	[thread overview]
Message-ID: <20210407174021.GA30046@fuller.cnet> (raw)
In-Reply-To: <20210330165958.3094759-2-pbonzini@redhat.com>

On Tue, Mar 30, 2021 at 12:59:57PM -0400, Paolo Bonzini wrote:
> There is no need to include changes to vcpu->requests into
> the pvclock_gtod_sync_lock critical section.  The changes to
> the shared data structures (in pvclock_update_vm_gtod_copy)
> already occur under the lock.
> 
> Cc: David Woodhouse <dwmw@amazon.co.uk>
> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/kvm/x86.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index fe806e894212..0a83eff40b43 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2562,10 +2562,12 @@ static void kvm_gen_update_masterclock(struct kvm *kvm)
>  
>  	kvm_hv_invalidate_tsc_page(kvm);
>  
> -	spin_lock(&ka->pvclock_gtod_sync_lock);
>  	kvm_make_mclock_inprogress_request(kvm);
> +

Might be good to serialize against two kvm_gen_update_masterclock
callers? Otherwise one caller could clear KVM_REQ_MCLOCK_INPROGRESS,
while the other is still at pvclock_update_vm_gtod_copy().

Otherwise, looks good.


  parent reply	other threads:[~2021-04-07 17:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 16:59 [PATCH 0/2] KVM: x86: fix lockdep splat due to Xen runstate update Paolo Bonzini
2021-03-30 16:59 ` [PATCH 1/2] KVM: x86: reduce pvclock_gtod_sync_lock critical sections Paolo Bonzini
2021-03-31  1:41   ` Wanpeng Li
2021-04-07 17:40   ` Marcelo Tosatti [this message]
2021-04-08  8:15     ` Paolo Bonzini
2021-04-08 12:00       ` Marcelo Tosatti
2021-04-08 12:25         ` Paolo Bonzini
2021-03-30 16:59 ` [PATCH 2/2] KVM: x86: disable interrupts while pvclock_gtod_sync_lock is taken Paolo Bonzini
2021-03-31  1:41   ` Wanpeng Li
2021-04-01 15:27   ` [EXTERNAL] " David Woodhouse
2021-04-01 16:36     ` Paolo Bonzini
2021-10-23 19:33   ` David Woodhouse
2021-10-23 20:29     ` [PATCH] KVM: x86: switch pvclock_gtod_sync_lock to a raw spinlock David Woodhouse
2021-10-25 12:15       ` 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=20210407174021.GA30046@fuller.cnet \
    --to=mtosatti@redhat.com \
    --cc=dwmw@amazon.co.uk \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).