]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.19/0001-KVM-mmu_notifier-Flush-TLBs-before-releasing-mmu_loc.patch
linux-ti33x-psp 3.2: update to 3.2.21, add libertas fixes
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.19 / 0001-KVM-mmu_notifier-Flush-TLBs-before-releasing-mmu_loc.patch
1 From e29e69cb6dff635429cbda9a9548c3d0390689f9 Mon Sep 17 00:00:00 2001
2 From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
3 Date: Fri, 10 Feb 2012 15:28:31 +0900
4 Subject: [PATCH 001/117] KVM: mmu_notifier: Flush TLBs before releasing
5  mmu_lock
7 (cherry picked from commit 565f3be2174611f364405bbea2d86e153c2e7e78
9 Other threads may process the same page in that small window and skip
10 TLB flush and then return before these functions do flush.
12 Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
13 Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 Signed-off-by: Avi Kivity <avi@redhat.com>
15 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16 ---
17  virt/kvm/kvm_main.c |   19 ++++++++++---------
18  1 file changed, 10 insertions(+), 9 deletions(-)
20 diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
21 index e401c1b..9ffac2e 100644
22 --- a/virt/kvm/kvm_main.c
23 +++ b/virt/kvm/kvm_main.c
24 @@ -289,15 +289,15 @@ static void kvm_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
25          */
26         idx = srcu_read_lock(&kvm->srcu);
27         spin_lock(&kvm->mmu_lock);
28 +
29         kvm->mmu_notifier_seq++;
30         need_tlb_flush = kvm_unmap_hva(kvm, address) | kvm->tlbs_dirty;
31 -       spin_unlock(&kvm->mmu_lock);
32 -       srcu_read_unlock(&kvm->srcu, idx);
33 -
34         /* we've to flush the tlb before the pages can be freed */
35         if (need_tlb_flush)
36                 kvm_flush_remote_tlbs(kvm);
37  
38 +       spin_unlock(&kvm->mmu_lock);
39 +       srcu_read_unlock(&kvm->srcu, idx);
40  }
41  
42  static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
43 @@ -335,12 +335,12 @@ static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
44         for (; start < end; start += PAGE_SIZE)
45                 need_tlb_flush |= kvm_unmap_hva(kvm, start);
46         need_tlb_flush |= kvm->tlbs_dirty;
47 -       spin_unlock(&kvm->mmu_lock);
48 -       srcu_read_unlock(&kvm->srcu, idx);
49 -
50         /* we've to flush the tlb before the pages can be freed */
51         if (need_tlb_flush)
52                 kvm_flush_remote_tlbs(kvm);
53 +
54 +       spin_unlock(&kvm->mmu_lock);
55 +       srcu_read_unlock(&kvm->srcu, idx);
56  }
57  
58  static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
59 @@ -378,13 +378,14 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn,
60  
61         idx = srcu_read_lock(&kvm->srcu);
62         spin_lock(&kvm->mmu_lock);
63 -       young = kvm_age_hva(kvm, address);
64 -       spin_unlock(&kvm->mmu_lock);
65 -       srcu_read_unlock(&kvm->srcu, idx);
66  
67 +       young = kvm_age_hva(kvm, address);
68         if (young)
69                 kvm_flush_remote_tlbs(kvm);
70  
71 +       spin_unlock(&kvm->mmu_lock);
72 +       srcu_read_unlock(&kvm->srcu, idx);
73 +
74         return young;
75  }
76  
77 -- 
78 1.7.9.5