powerpc fixes for 6.3 #4

- Fix a false positive warning in __pte_needs_flush() (with DEBUG_VM=y).
  - Fix oops when a PF_IO_WORKER thread tries to core dump.
  - Don't try to reconfigure VAS when it's disabled.
 
 Thanks to: Benjamin Gray, Haren Myneni, Jens Axboe, Nathan Lynch, Russell Currey.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmQpT20THG1wZUBlbGxl
 cm1hbi5pZC5hdQAKCRBR6+o8yOGlgBHsD/kB7wxwe+h/Xddx2l9le15HfSTlVOiU
 7CO3jDYs//jt7E4ZEeHE0ppPRWcW5ICEttCrqWyT8WDfwMv7f+iBU80enZ5Rg/a7
 tX5jOel1TmsStj2bfh/myI7CX/+mEwRZ1o3J6/UgaZDlI2OLzLP/gKet3rfSh3zJ
 ilqIZxoj+ARsaYIrxnopFHmSmD5oCAsvVM6COPd3epRnIWmfd7NxtKbZU3V4WdLy
 qL9Q9Dk+RmGDSzJe1j4cRR1fA6jRIFU1WYDFz38HIVX1grFKdsm2Eeta6OXwXWGz
 TZDp82IBka6SvFkPx2RE2bGqaWbjZbA8b1mK59s5hB9trU3qFgZjoRBJoR1hp/zc
 MjfKLTxW7qC/TQAwxBKzFgTm1njRY5H5aMDnV9+6fBBC6esTgBy/la8ZygPmqWJj
 fFulUobDul9xjMg7l0CS+cjyO31Bb68fmFJOH9fmXR3fYlkP9VgJh89demD4xbMQ
 UdtAdpI8xhV98e6pX+vSlfbaeUNqzJQ7UWtr6J08nY17dhcoPxJ9RaAZdsJkZIk3
 IM/jwdhvpG++VM5CbiX+4yQHUJkekIXpfnxZIXqOl+rqv5Z0A8gRQkY469FjqZy7
 EJoYIOBGiZEgiU4oqJRkp0ifMSPMt0I0gMmRq5NxS/64mxFHlwCsJvaiHQ/fd2m8
 3DTDKQd6KOT31A==
 =1Sli
 -----END PGP SIGNATURE-----

Merge tag 'powerpc-6.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Fix a false positive warning in __pte_needs_flush() (with DEBUG_VM=y)

 - Fix oops when a PF_IO_WORKER thread tries to core dump

 - Don't try to reconfigure VAS when it's disabled

Thanks to Benjamin Gray, Haren Myneni, Jens Axboe, Nathan Lynch, and
Russell Currey.

* tag 'powerpc-6.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/pseries/vas: Ignore VAS update for DLPAR if copy/paste is not enabled
  powerpc: Don't try to copy PPR for task with NULL pt_regs
  powerpc/64s: Fix __pte_needs_flush() false positive warning
This commit is contained in:
Linus Torvalds 2023-04-02 10:01:56 -07:00
commit 95d0b9d89d
3 changed files with 21 additions and 2 deletions

View file

@ -148,6 +148,11 @@ static inline void flush_tlb_fix_spurious_fault(struct vm_area_struct *vma,
*/
}
static inline bool __pte_protnone(unsigned long pte)
{
return (pte & (pgprot_val(PAGE_NONE) | _PAGE_RWX)) == pgprot_val(PAGE_NONE);
}
static inline bool __pte_flags_need_flush(unsigned long oldval,
unsigned long newval)
{
@ -164,8 +169,8 @@ static inline bool __pte_flags_need_flush(unsigned long oldval,
/*
* We do not expect kernel mappings or non-PTEs or not-present PTEs.
*/
VM_WARN_ON_ONCE(oldval & _PAGE_PRIVILEGED);
VM_WARN_ON_ONCE(newval & _PAGE_PRIVILEGED);
VM_WARN_ON_ONCE(!__pte_protnone(oldval) && oldval & _PAGE_PRIVILEGED);
VM_WARN_ON_ONCE(!__pte_protnone(newval) && newval & _PAGE_PRIVILEGED);
VM_WARN_ON_ONCE(!(oldval & _PAGE_PTE));
VM_WARN_ON_ONCE(!(newval & _PAGE_PTE));
VM_WARN_ON_ONCE(!(oldval & _PAGE_PRESENT));

View file

@ -290,6 +290,9 @@ static int gpr_set(struct task_struct *target, const struct user_regset *regset,
static int ppr_get(struct task_struct *target, const struct user_regset *regset,
struct membuf to)
{
if (!target->thread.regs)
return -EINVAL;
return membuf_write(&to, &target->thread.regs->ppr, sizeof(u64));
}
@ -297,6 +300,9 @@ static int ppr_set(struct task_struct *target, const struct user_regset *regset,
unsigned int pos, unsigned int count, const void *kbuf,
const void __user *ubuf)
{
if (!target->thread.regs)
return -EINVAL;
return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&target->thread.regs->ppr, 0, sizeof(u64));
}

View file

@ -856,6 +856,13 @@ int pseries_vas_dlpar_cpu(void)
{
int new_nr_creds, rc;
/*
* NX-GZIP is not enabled. Nothing to do for DLPAR event
*/
if (!copypaste_feat)
return 0;
rc = h_query_vas_capabilities(H_QUERY_VAS_CAPABILITIES,
vascaps[VAS_GZIP_DEF_FEAT_TYPE].feat,
(u64)virt_to_phys(&hv_cop_caps));
@ -1012,6 +1019,7 @@ static int __init pseries_vas_init(void)
* Linux supports user space COPY/PASTE only with Radix
*/
if (!radix_enabled()) {
copypaste_feat = false;
pr_err("API is supported only with radix page tables\n");
return -ENOTSUPP;
}