Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390: gmap use pte_unmap_unlock() not spin_unlock()

pte_alloc_map_lock() expects to be followed by pte_unmap_unlock(): to
keep balance in future, pass ptep as well as ptl to gmap_pte_op_end(),
and use pte_unmap_unlock() instead of direct spin_unlock() (even though
ptep ends up unused inside the macro).

Link: https://lkml.kernel.org/r/78873af-e1ec-4f9-47ac-483940ac6daa@google.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Ungerer <gerg@linux-m68k.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: John David Anglin <dave.anglin@bell.net>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Hugh Dickins and committed by
Andrew Morton
b2f58941 5c7f3bf0

+11 -11
+11 -11
arch/s390/mm/gmap.c
··· 895 895 896 896 /** 897 897 * gmap_pte_op_end - release the page table lock 898 - * @ptl: pointer to the spinlock pointer 898 + * @ptep: pointer to the locked pte 899 + * @ptl: pointer to the page table spinlock 899 900 */ 900 - static void gmap_pte_op_end(spinlock_t *ptl) 901 + static void gmap_pte_op_end(pte_t *ptep, spinlock_t *ptl) 901 902 { 902 - if (ptl) 903 - spin_unlock(ptl); 903 + pte_unmap_unlock(ptep, ptl); 904 904 } 905 905 906 906 /** ··· 1011 1011 { 1012 1012 int rc; 1013 1013 pte_t *ptep; 1014 - spinlock_t *ptl = NULL; 1014 + spinlock_t *ptl; 1015 1015 unsigned long pbits = 0; 1016 1016 1017 1017 if (pmd_val(*pmdp) & _SEGMENT_ENTRY_INVALID) ··· 1025 1025 pbits |= (bits & GMAP_NOTIFY_SHADOW) ? PGSTE_VSIE_BIT : 0; 1026 1026 /* Protect and unlock. */ 1027 1027 rc = ptep_force_prot(gmap->mm, gaddr, ptep, prot, pbits); 1028 - gmap_pte_op_end(ptl); 1028 + gmap_pte_op_end(ptep, ptl); 1029 1029 return rc; 1030 1030 } 1031 1031 ··· 1154 1154 /* Do *NOT* clear the _PAGE_INVALID bit! */ 1155 1155 rc = 0; 1156 1156 } 1157 - gmap_pte_op_end(ptl); 1157 + gmap_pte_op_end(ptep, ptl); 1158 1158 } 1159 1159 if (!rc) 1160 1160 break; ··· 1248 1248 if (!rc) 1249 1249 gmap_insert_rmap(sg, vmaddr, rmap); 1250 1250 spin_unlock(&sg->guest_table_lock); 1251 - gmap_pte_op_end(ptl); 1251 + gmap_pte_op_end(ptep, ptl); 1252 1252 } 1253 1253 radix_tree_preload_end(); 1254 1254 if (rc) { ··· 2156 2156 tptep = (pte_t *) gmap_table_walk(sg, saddr, 0); 2157 2157 if (!tptep) { 2158 2158 spin_unlock(&sg->guest_table_lock); 2159 - gmap_pte_op_end(ptl); 2159 + gmap_pte_op_end(sptep, ptl); 2160 2160 radix_tree_preload_end(); 2161 2161 break; 2162 2162 } ··· 2167 2167 rmap = NULL; 2168 2168 rc = 0; 2169 2169 } 2170 - gmap_pte_op_end(ptl); 2170 + gmap_pte_op_end(sptep, ptl); 2171 2171 spin_unlock(&sg->guest_table_lock); 2172 2172 } 2173 2173 radix_tree_preload_end(); ··· 2495 2495 continue; 2496 2496 if (ptep_test_and_clear_uc(gmap->mm, vmaddr, ptep)) 2497 2497 set_bit(i, bitmap); 2498 - spin_unlock(ptl); 2498 + pte_unmap_unlock(ptep, ptl); 2499 2499 } 2500 2500 } 2501 2501 gmap_pmd_op_end(gmap, pmdp);