All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Peter Xu <peterx@redhat.com>, qemu-devel@nongnu.org
Cc: Marc Zyngier <maz@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] KVM: dirty ring: Add memory barrier when marking pfn collected
Date: Fri, 23 Sep 2022 09:33:52 +1000	[thread overview]
Message-ID: <3965dfdb-0c38-f28d-8e99-df16aea482aa@redhat.com> (raw)
In-Reply-To: <20220922213522.68861-1-peterx@redhat.com>

On 9/23/22 7:35 AM, Peter Xu wrote:
> Following commit 4802bf910eee9, add the other missing barrier when marking
> the PFN as collected.  This will also be required just like 4802bf910eee9
> on weak ordering architectures like aarch64.
> 
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Gavin Shan <gshan@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>   accel/kvm/kvm-all.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 136c8eaed3..60a044048e 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -728,7 +728,11 @@ static bool dirty_gfn_is_dirtied(struct kvm_dirty_gfn *gfn)
>   
>   static void dirty_gfn_set_collected(struct kvm_dirty_gfn *gfn)
>   {
> -    gfn->flags = KVM_DIRTY_GFN_F_RESET;
> +    /*
> +     * Write the flags after reading the entry.  Should pair with another
> +     * smp_load_acquire() in KVM when reset dirty rings.
> +     */
> +    qatomic_store_release(&gfn->flags, KVM_DIRTY_GFN_F_RESET);
>   }
>   
>   /*
> 



  parent reply	other threads:[~2022-09-22 23:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 21:35 [PATCH] KVM: dirty ring: Add memory barrier when marking pfn collected Peter Xu
2022-09-22 21:52 ` Philippe Mathieu-Daudé via
2022-09-22 23:33 ` Gavin Shan [this message]
2022-10-14 16:33 ` Peter Xu

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=3965dfdb-0c38-f28d-8e99-df16aea482aa@redhat.com \
    --to=gshan@redhat.com \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.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.