[GIT PULL] Please pull powerpc/linux.git powerpc-6.1-1 tag

Jason A. Donenfeld Jason at zx2c4.com
Tue Oct 11 09:26:10 AEDT 2022


On Mon, Oct 10, 2022 at 02:03:09PM -0600, Jason A. Donenfeld wrote:
> On Mon, Oct 10, 2022 at 01:25:25PM -0600, Jason A. Donenfeld wrote:
> > Hi Michael,
> > 
> > On Sun, Oct 09, 2022 at 10:01:39PM +1100, Michael Ellerman wrote:
> > > powerpc updates for 6.1
> > > 
> > >  - Remove our now never-true definitions for pgd_huge() and p4d_leaf().
> > > 
> > >  - Add pte_needs_flush() and huge_pmd_needs_flush() for 64-bit.
> > > 
> > >  - Add support for syscall wrappers.
> > > 
> > >  - Add support for KFENCE on 64-bit.
> > > 
> > >  - Update 64-bit HV KVM to use the new guest state entry/exit accounting API.
> > > 
> > >  - Support execute-only memory when using the Radix MMU (P9 or later).
> > > 
> > >  - Implement CONFIG_PARAVIRT_TIME_ACCOUNTING for pseries guests.
> > > 
> > >  - Updates to our linker script to move more data into read-only sections.
> > > 
> > >  - Allow the VDSO to be randomised on 32-bit.
> > > 
> > >  - Many other small features and fixes.
> > 
> > FYI, something in here broke the wireguard test suite, which runs the
> > iperf3 networking utility. The full log is here [1], but the relevant part
> > is: 
> > 
> > [+] NS1: iperf3 -Z -t 3 -c 192.168.241.2
> > Connecting to host 192.168.241.2, port 5201
> > iperf3: error - failed to read /dev/urandom: Bad address
> > 
> > I'll see if I can narrow it down a bit more and bisect. But just FYI, in
> > case you have an intuition.
> 
> Huh. From iov_iter.c:
> 
> static int copyout(void __user *to, const void *from, size_t n)
> {
>         size_t before = n;
>         if (should_fail_usercopy())
>                 return n;
>         if (access_ok(to, n)) {
>                 instrument_copy_to_user(to, from, n);
>                 n = raw_copy_to_user(to, from, n);
>                 if (n == before)
>                         pr_err("SARU n still %zu pointer is %lx\n", n, (unsigned long)to);
>         }
>         return n;
> }
> 
> I added the pr_err() there to catch the failure:
> [    3.443506] SARU n still 64 pointer is b78db000
> 
> Also I managed to extract the failing portion of iperf3 into something
> smaller:
> 
>         int temp;
>         char *x;
>         ssize_t l;
>         FILE *f;
>         char template[] = "/blah-XXXXXX";
> 
>         temp = mkstemp(template);
>         if (temp < 0)
>                 panic("mkstemp");
>         if (unlink(template) < 0)
>                 panic("unlink");
>         if (ftruncate(temp, 0x20000) < 0)
>                 panic("ftruncate");
>         x = mmap(NULL, 0x20000, PROT_READ|PROT_WRITE, MAP_PRIVATE, temp, 0);
>         if (x == MAP_FAILED)
>                 panic("mmap");
>         f = fopen("/dev/urandom", "rb");
>         if (!f)
>                 panic("fopen");
>         setbuf(f, NULL);
>         if (fread(x, 1, 0x20000, f) != 0x20000)
>                 panic("fread");
> 
> Jason

Bisected:

7e92e01b724526b98cbc7f03dd4afa0295780d56 is the first bad commit
commit 7e92e01b724526b98cbc7f03dd4afa0295780d56
Author: Rohan McLure <rmclure at linux.ibm.com>
Date:   Wed Sep 21 16:56:01 2022 +1000

    powerpc: Provide syscall wrapper

    Implement syscall wrapper as per s390, x86, arm64. When enabled
    cause handlers to accept parameters from a stack frame rather than
    from user scratch register state. This allows for user registers to be
    safely cleared in order to reduce caller influence on speculation
    within syscall routine. The wrapper is a macro that emits syscall
    handler symbols that call into the target handler, obtaining its
    parameters from a struct pt_regs on the stack.

    As registers are already saved to the stack prior to calling
    system_call_exception, it appears that this function is executed more
    efficiently with the new stack-pointer convention than with parameters
    passed by registers, avoiding the allocation of a stack frame for this
    method. On a 32-bit system, we see >20% performance increases on the
    null_syscall microbenchmark, and on a Power 8 the performance gains
    amortise the cost of clearing and restoring registers which is
    implemented at the end of this series, seeing final result of ~5.6%
    performance improvement on null_syscall.

    Syscalls are wrapped in this fashion on all platforms except for the
    Cell processor as this commit does not provide SPU support. This can be
    quickly fixed in a successive patch, but requires spu_sys_callback to
    allocate a pt_regs structure to satisfy the wrapped calling convention.

    Co-developed-by: Andrew Donnellan <ajd at linux.ibm.com>
    Signed-off-by: Andrew Donnellan <ajd at linux.ibm.com>
    Signed-off-by: Rohan McLure <rmclure at linux.ibm.com>
    Reviewed-by: Nicholas Piggin <npiggin at gmai.com>
    [mpe: Make incompatible with COMPAT to retain clearing of high bits of args]
    Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
    Link: https://lore.kernel.org/r/20220921065605.1051927-22-rmclure@linux.ibm.com

 arch/powerpc/Kconfig                       |  1 +
 arch/powerpc/include/asm/syscall.h         |  4 +++
 arch/powerpc/include/asm/syscall_wrapper.h | 51 ++++++++++++++++++++++++++++++
 arch/powerpc/include/asm/syscalls.h        | 24 ++++++++++++--
 arch/powerpc/kernel/syscall.c              | 34 ++++++++++----------
 arch/powerpc/kernel/systbl.c               |  7 ++++
 arch/powerpc/kernel/vdso.c                 |  2 ++
 7 files changed, 105 insertions(+), 18 deletions(-)
 create mode 100644 arch/powerpc/include/asm/syscall_wrapper.h


More information about the Linuxppc-dev mailing list