From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 1/4] mm: Correct ordering of *_clear_flush_young_notify Date: Thu, 08 Jan 2015 14:12:26 +0100 Message-ID: <54AE823A.5010509@redhat.com> References: <1420718349-24152-1-git-send-email-marc.zyngier@arm.com> <1420718349-24152-2-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Steve Capper , Andrea Arcangeli , Rik van Riel To: Marc Zyngier , Christoffer Dall , kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Return-path: Received: from mail-wg0-f49.google.com ([74.125.82.49]:51304 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754103AbbAHNMa (ORCPT ); Thu, 8 Jan 2015 08:12:30 -0500 Received: by mail-wg0-f49.google.com with SMTP id n12so2515050wgh.8 for ; Thu, 08 Jan 2015 05:12:29 -0800 (PST) In-Reply-To: <1420718349-24152-2-git-send-email-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: Andrea, Rik, please review this patch. Thanks in advance, Paolo On 08/01/2015 12:59, Marc Zyngier wrote: > From: Steve Capper > > ptep_clear_flush_young_notify and pmdp_clear_flush_young_notify both > call the notifiers *after* the pte/pmd has been made young. > > This can cause problems with KVM that relies on being able to block > MMU notifiers when carrying out maintenance of second stage > descriptors. > > This patch ensures that the MMU notifiers are called before ptes and > pmds are made old. > > Signed-off-by: Steve Capper > --- > include/linux/mmu_notifier.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h > index 95243d2..c454c76 100644 > --- a/include/linux/mmu_notifier.h > +++ b/include/linux/mmu_notifier.h > @@ -290,11 +290,11 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) > int __young; \ > struct vm_area_struct *___vma = __vma; \ > unsigned long ___address = __address; \ > - __young = ptep_clear_flush_young(___vma, ___address, __ptep); \ > - __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ > + __young = mmu_notifier_clear_flush_young(___vma->vm_mm, \ > ___address, \ > ___address + \ > PAGE_SIZE); \ > + __young |= ptep_clear_flush_young(___vma, ___address, __ptep); \ > __young; \ > }) > > @@ -303,11 +303,11 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) > int __young; \ > struct vm_area_struct *___vma = __vma; \ > unsigned long ___address = __address; \ > - __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \ > - __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ > + __young = mmu_notifier_clear_flush_young(___vma->vm_mm, \ > ___address, \ > ___address + \ > PMD_SIZE); \ > + __young |= pmdp_clear_flush_young(___vma, ___address, __pmdp); \ > __young; \ > }) > >