s390 fixes for 6.18-rc6

- Fix a bug in the __ptep_rdp() inline assembly which may lead to
   missing TLB flushes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEECMNfWEw3SLnmiLkZIg7DeRspbsIFAmkYpckACgkQIg7DeRsp
 bsI0mg/+NMbrwwaj5G9nJuBxGuvWjXkQJalYxd/uLZIG5ErzpCitoLyBNgCWx3Ec
 wDR2W3tWeTtzRB1aXBN3ZZuYn2ADwe5jR/YMqqR5IT9XBoYsbxgRHnKaS4yD5D1i
 4UPdhkrZ8Kuw9+tnAepohYr4K29qCBQ1v3rH1O7RwfQ/ZccxgxS6KRlCrwAc2yx5
 d7r18q32fljg0uwaJB3vWjH35b8XG2XGALRRyF5uW4HjGrNje38d8eHRNbQ6aO12
 Mrf7Pj5WV68bTMQOP5gV2uQHv9oG8UiAnvGREBQXqAONGnqXKy4xHf+NHI0QT97Y
 lco7DyCaTCVjw9J6KZk7uHRwE12kcJPdDuU40csq3XOOL8jU2lC+G31fXf0gnW+N
 QKYNRQnN2F8oKwxhccnuGgrMEEengO77jfgfEtoVZM3uK9OeLAGX77M3koNTorgj
 BCTZEYlOPN1Ql6xGVJpB0ZyhtPBqd1lVE55SvRwGDFNZGtm/seMMj3ELrt+VNwgG
 bICeY8Tv8+5yji+icZPJSh76mvjw7uuksNYQQpqMp5idjtGkigEO4PiP1PZtKc6Y
 FZPldwzXue5Y5P0SiOjPRk/qgxeXFEtlYrWXuKybQWOfSWjwiTyJ0fZdPss2nMf7
 3lBN1GfPxH54OBkmNPrNkIBbrYxypcY65FVro7r3p4PGj7vPGlA=
 =5CBh
 -----END PGP SIGNATURE-----

Merge tag 's390-6.18-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fix from Heiko Carstens:

 - Fix a bug in the __ptep_rdp() inline assembly which may lead to
   missing TLB flushes

* tag 's390-6.18-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/mm: Fix __ptep_rdp() inline assembly
This commit is contained in:
Linus Torvalds 2025-11-15 09:01:00 -08:00
commit f824272b6e
2 changed files with 7 additions and 9 deletions

View File

@ -1154,17 +1154,15 @@ static inline pte_t pte_mkhuge(pte_t pte)
#define IPTE_NODAT 0x400
#define IPTE_GUEST_ASCE 0x800
static __always_inline void __ptep_rdp(unsigned long addr, pte_t *ptep,
unsigned long opt, unsigned long asce,
int local)
static __always_inline void __ptep_rdp(unsigned long addr, pte_t *ptep, int local)
{
unsigned long pto;
pto = __pa(ptep) & ~(PTRS_PER_PTE * sizeof(pte_t) - 1);
asm volatile(".insn rrf,0xb98b0000,%[r1],%[r2],%[asce],%[m4]"
asm volatile(".insn rrf,0xb98b0000,%[r1],%[r2],%%r0,%[m4]"
: "+m" (*ptep)
: [r1] "a" (pto), [r2] "a" ((addr & PAGE_MASK) | opt),
[asce] "a" (asce), [m4] "i" (local));
: [r1] "a" (pto), [r2] "a" (addr & PAGE_MASK),
[m4] "i" (local));
}
static __always_inline void __ptep_ipte(unsigned long address, pte_t *ptep,
@ -1348,7 +1346,7 @@ static inline void flush_tlb_fix_spurious_fault(struct vm_area_struct *vma,
* A local RDP can be used to do the flush.
*/
if (cpu_has_rdp() && !(pte_val(*ptep) & _PAGE_PROTECT))
__ptep_rdp(address, ptep, 0, 0, 1);
__ptep_rdp(address, ptep, 1);
}
#define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault

View File

@ -274,9 +274,9 @@ void ptep_reset_dat_prot(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
preempt_disable();
atomic_inc(&mm->context.flush_count);
if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))
__ptep_rdp(addr, ptep, 0, 0, 1);
__ptep_rdp(addr, ptep, 1);
else
__ptep_rdp(addr, ptep, 0, 0, 0);
__ptep_rdp(addr, ptep, 0);
/*
* PTE is not invalidated by RDP, only _PAGE_PROTECT is cleared. That
* means it is still valid and active, and must not be changed according