Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-09-25 14:12:30 +0200
committerJiri Kosina <jkosina@suse.cz>2018-09-25 14:12:30 +0200
commit55fca67b330dc563338834e9d330f84ec3a379b0 (patch)
treed0956417d29d196f9166d85f51e0638d0ffb3791
parent41ba32faf66fcc8e00a367e3e550daa087853510 (diff)
parent96eac08cc92c8f840f2371d5f7baad57b7d03c14 (diff)
Merge remote-tracking branch 'origin/users/ykaukab/SLE15/for-next' into SLE15
Pull arm64 fixes from Mian-Yousaf Kaukab
-rw-r--r--patches.drivers/0001-kvm-arm64-Convert-kvm_set_s2pte_readonly-from-inline.patch58
-rw-r--r--patches.drivers/0002-arm64-Ignore-hardware-dirty-bit-updates-in-ptep_set_.patch69
-rw-r--r--series.conf2
3 files changed, 129 insertions, 0 deletions
diff --git a/patches.drivers/0001-kvm-arm64-Convert-kvm_set_s2pte_readonly-from-inline.patch b/patches.drivers/0001-kvm-arm64-Convert-kvm_set_s2pte_readonly-from-inline.patch
new file mode 100644
index 0000000000..35c678fe8a
--- /dev/null
+++ b/patches.drivers/0001-kvm-arm64-Convert-kvm_set_s2pte_readonly-from-inline.patch
@@ -0,0 +1,58 @@
+From: Catalin Marinas <catalin.marinas@arm.com>
+Date: Thu, 6 Jul 2017 11:46:39 +0100
+Subject: kvm: arm64: Convert kvm_set_s2pte_readonly() from inline asm to
+ cmpxchg()
+
+Git-commit: 0966253d7ccddc42a5211b3488bb4f202c04de1b
+Patch-mainline: v4.14-rc1
+References: bsc#1108010
+
+To take advantage of the LSE atomic instructions and also make the code
+cleaner, convert the kvm_set_s2pte_readonly() function to use the more
+generic cmpxchg().
+
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Reviewed-by: Will Deacon <will.deacon@arm.com>
+Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
+---
+ arch/arm64/include/asm/kvm_mmu.h | 21 +++++++++------------
+ 1 file changed, 9 insertions(+), 12 deletions(-)
+
+diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
+index a89cc22abadc..672c8684d5c2 100644
+--- a/arch/arm64/include/asm/kvm_mmu.h
++++ b/arch/arm64/include/asm/kvm_mmu.h
+@@ -175,18 +175,15 @@ static inline pmd_t kvm_s2pmd_mkwrite(pmd_t pmd)
+
+ static inline void kvm_set_s2pte_readonly(pte_t *pte)
+ {
+- pteval_t pteval;
+- unsigned long tmp;
+-
+- asm volatile("// kvm_set_s2pte_readonly\n"
+- " prfm pstl1strm, %2\n"
+- "1: ldxr %0, %2\n"
+- " and %0, %0, %3 // clear PTE_S2_RDWR\n"
+- " orr %0, %0, %4 // set PTE_S2_RDONLY\n"
+- " stxr %w1, %0, %2\n"
+- " cbnz %w1, 1b\n"
+- : "=&r" (pteval), "=&r" (tmp), "+Q" (pte_val(*pte))
+- : "L" (~PTE_S2_RDWR), "L" (PTE_S2_RDONLY));
++ pteval_t old_pteval, pteval;
++
++ pteval = READ_ONCE(pte_val(*pte));
++ do {
++ old_pteval = pteval;
++ pteval &= ~PTE_S2_RDWR;
++ pteval |= PTE_S2_RDONLY;
++ pteval = cmpxchg_relaxed(&pte_val(*pte), old_pteval, pteval);
++ } while (pteval != old_pteval);
+ }
+
+ static inline bool kvm_s2pte_readonly(pte_t *pte)
+--
+2.11.0
+
diff --git a/patches.drivers/0002-arm64-Ignore-hardware-dirty-bit-updates-in-ptep_set_.patch b/patches.drivers/0002-arm64-Ignore-hardware-dirty-bit-updates-in-ptep_set_.patch
new file mode 100644
index 0000000000..34c31cac94
--- /dev/null
+++ b/patches.drivers/0002-arm64-Ignore-hardware-dirty-bit-updates-in-ptep_set_.patch
@@ -0,0 +1,69 @@
+From: Catalin Marinas <catalin.marinas@arm.com>
+Date: Wed, 5 Jul 2017 10:59:42 +0100
+Subject: arm64: Ignore hardware dirty bit updates in ptep_set_wrprotect()
+
+Git-commit: 64c26841b34957ef8f33f7a9e8663aeee59c3ded
+Patch-mainline: v4.14-rc1
+References: bsc#1108010
+
+ptep_set_wrprotect() is only called on CoW mappings which are private
+(!VM_SHARED) with the pte either read-only (!PTE_WRITE && PTE_RDONLY) or
+writable and software-dirty (PTE_WRITE && !PTE_RDONLY && PTE_DIRTY).
+There is no race with the hardware update of the dirty state: clearing
+of PTE_RDONLY when PTE_WRITE (a.k.a. PTE_DBM) is set. This patch removes
+the code setting the software PTE_DIRTY bit in ptep_set_wrprotect() as
+superfluous. A VM_WARN_ONCE is introduced in case the above logic is
+wrong or the core mm code changes its use of ptep_set_wrprotect().
+
+Reviewed-by: Will Deacon <will.deacon@arm.com>
+Acked-by: Steve Capper <steve.capper@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
+---
+ arch/arm64/include/asm/pgtable.h | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
+index a04bfb869a80..0117cbcd62d4 100644
+--- a/arch/arm64/include/asm/pgtable.h
++++ b/arch/arm64/include/asm/pgtable.h
+@@ -634,23 +634,28 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
+ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+
+ /*
+- * ptep_set_wrprotect - mark read-only while trasferring potential hardware
+- * dirty status (PTE_DBM && !PTE_RDONLY) to the software PTE_DIRTY bit.
++ * ptep_set_wrprotect - mark read-only while preserving the hardware update of
++ * the Access Flag.
+ */
+ #define __HAVE_ARCH_PTEP_SET_WRPROTECT
+ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep)
+ {
+ pte_t old_pte, pte;
+
++ /*
++ * ptep_set_wrprotect() is only called on CoW mappings which are
++ * private (!VM_SHARED) with the pte either read-only (!PTE_WRITE &&
++ * PTE_RDONLY) or writable and software-dirty (PTE_WRITE &&
++ * !PTE_RDONLY && PTE_DIRTY); see is_cow_mapping() and
++ * protection_map[]. There is no race with the hardware update of the
++ * dirty state: clearing of PTE_RDONLY when PTE_WRITE (a.k.a. PTE_DBM)
++ * is set.
++ */
++ VM_WARN_ONCE(pte_write(*ptep) && !pte_dirty(*ptep),
++ "%s: potential race with hardware DBM", __func__);
+ pte = READ_ONCE(*ptep);
+ do {
+ old_pte = pte;
+- /*
+- * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY
+- * clear), set the PTE_DIRTY bit.
+- */
+- if (pte_hw_dirty(pte))
+- pte = pte_mkdirty(pte);
+ pte = pte_wrprotect(pte);
+ pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep),
+ pte_val(old_pte), pte_val(pte));
+--
+2.11.0
+
diff --git a/series.conf b/series.conf
index 886eb4d43b..995d9d3c8b 100644
--- a/series.conf
+++ b/series.conf
@@ -5313,7 +5313,9 @@
patches.arch/0037-arm64-add-on_accessible_stack.patch
patches.arch/0038-arm64-add-VMAP_STACK-overflow-detection.patch
patches.arch/0002-arm64-Convert-pte-handling-from-inline-asm-to-using-.patch
+ patches.drivers/0001-kvm-arm64-Convert-kvm_set_s2pte_readonly-from-inline.patch
patches.arch/0003-arm64-Move-PTE_RDONLY-bit-handling-out-of-set_pte_at.patch
+ patches.drivers/0002-arm64-Ignore-hardware-dirty-bit-updates-in-ptep_set_.patch
patches.suse/arm64-Remove-the-CONFIG_ARM64_HW_AFDBM-alternative-c.patch
patches.drivers/0019-usb-hcd-constify-attribute_group-structures.patch
patches.drivers/0001-xhci-add-definitions-for-all-port-link-states.patch