[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4041d98a-23df-e9ed-b245-5edd7151fec5@redhat.com>
Date: Tue, 23 Nov 2021 09:46:34 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Chao Peng <chao.p.peng@...ux.intel.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, qemu-devel@...gnu.org
Cc: Jonathan Corbet <corbet@....net>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H . Peter Anvin" <hpa@...or.com>,
Hugh Dickins <hughd@...gle.com>,
Jeff Layton <jlayton@...nel.org>,
"J . Bruce Fields" <bfields@...ldses.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Yu Zhang <yu.c.zhang@...ux.intel.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
luto@...nel.org, john.ji@...el.com, susie.li@...el.com,
jun.nakajima@...el.com, dave.hansen@...el.com, ak@...ux.intel.com,
david@...hat.com
Subject: Re: [RFC v2 PATCH 09/13] KVM: Introduce kvm_memfd_invalidate_range
On 11/19/21 14:47, Chao Peng wrote:
> +
> + /* Prevent memslot modification */
> + spin_lock(&kvm->mn_invalidate_lock);
> + kvm->mn_active_invalidate_count++;
> + spin_unlock(&kvm->mn_invalidate_lock);
> +
> + ret = __kvm_handle_useraddr_range(kvm, &useraddr_range);
> +
> + spin_lock(&kvm->mn_invalidate_lock);
> + kvm->mn_active_invalidate_count--;
> + spin_unlock(&kvm->mn_invalidate_lock);
> +
You need to follow this with a rcuwait_wake_up as in
kvm_mmu_notifier_invalidate_range_end.
It's probably best if you move the manipulations of
mn_active_invalidate_count from kvm_mmu_notifier_invalidate_range_* to
two separate functions.
Paolo
Powered by blists - more mailing lists