Skip to contentSkip to conversation

FAILED: patch "[PATCH] s390/mm: make pmdp_invalidate() do invalidation only" failed to apply to 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 2, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 91c575b335766effa6103eba42a82aea560c365f Mon Sep 17 00:00:00 2001

From: Gerald Schaefer <[email protected]>
Date: Mon, 18 Sep 2017 16:10:35 +0200
Subject: [PATCH] s390/mm: make pmdp_invalidate() do invalidation only

Commit 227be799c39a ("s390/mm: uninline pmdp_xxx functions from pgtable.h") inadvertently changed the behavior of pmdp_invalidate(), so that it now clears the pmd instead of just marking it as invalid. Fix this by restoring the original behavior.

A possible impact of the misbehaving pmdp_invalidate() would be the MADV_DONTNEED races (see commits ced10803 and 58ceeb6b), although we should not have any negative impact on the related dirty/young flags, since those flags are not set by the hardware on s390.

Fixes 227be799c39a ("s390/mm: uninline pmdp_xxx functions from pgtable.h")
Cc <[email protected]> # v4.6+
arch/s390/include/asm/pgtable.h +3 -1
index dce708e061ea..20e75a2ca93a 100644
@@ -1507,7 +1507,9 @@ static inline pmd_t pmdp_huge_clear_flush(struct vm_area_struct *vma,
 static inline void pmdp_invalidate(struct vm_area_struct *vma,
 				   unsigned long addr, pmd_t *pmdp)
 {
-	pmdp_xchg_direct(vma->vm_mm, addr, pmdp, __pmd(_SEGMENT_ENTRY_EMPTY));
+	pmd_t pmd = __pmd(pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
+
+	pmdp_xchg_direct(vma->vm_mm, addr, pmdp, pmd);
 }
 
 #define __HAVE_ARCH_PMDP_SET_WRPROTECT