[PATCH v2] powerpc64/idle: Fix SP offsets when saving GPRs

2021-02-05 Thread Christopher M. Riedl
The idle entry/exit code saves/restores GPRs in the stack "red zone" (Protected Zone according to PowerPC64 ELF ABI v2). However, the offset used for the first GPR is incorrect and overwrites the back chain - the Protected Zone actually starts below the current SP. In practice this is probably not

Re: [PATCH v2 1/1] powerpc/kvm: Save Timebase Offset to fix sched_clock() while running guest code.

2021-02-05 Thread Nicholas Piggin
Excerpts from Leonardo Bras's message of February 5, 2021 5:01 pm: > Hey Nick, thanks for reviewing :) > > On Fri, 2021-02-05 at 16:28 +1000, Nicholas Piggin wrote: >> Excerpts from Leonardo Bras's message of February 5, 2021 4:06 pm: >> > Before guest entry, TBU40 register is changed to reflect g

[PATCH v3] powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm

2021-02-05 Thread Aneesh Kumar K.V
This fix the bad fault reported by KUAP when io_wqe_worker access userspace. Bug: Read fault blocked by KUAP! WARNING: CPU: 1 PID: 101841 at arch/powerpc/mm/fault.c:229 __do_page_fault+0x6b4/0xcd0 NIP [c009e7e4] __do_page_fault+0x6b4/0xcd0 LR [c009e7e0] __do_page_fault+0x6b0/0

Re: [PATCH v7 39/42] powerpc: move NMI entry/exit code into wrapper

2021-02-05 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of February 6, 2021 9:38 am: > Nicholas Piggin writes: >> Excerpts from Michael Ellerman's message of February 4, 2021 8:15 pm: >>> Nicholas Piggin writes: This moves the common NMI entry and exit code into the interrupt handler wrappers. >>

Re: [PATCH v7 28/42] powerpc: convert interrupt handlers to use wrappers

2021-02-05 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of February 5, 2021 6:09 pm: > > > Le 30/01/2021 à 14:08, Nicholas Piggin a écrit : >> Signed-off-by: Nicholas Piggin >> --- > >> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c >> index f70d3f6174c8..7ff915aae8ec 100644 >> --- a/a

Re: [PATCH] powerpc/8xx: Fix software emulation interrupt

2021-02-05 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of February 5, 2021 6:56 pm: > For unimplemented instructions or unimplemented SPRs, the 8xx triggers > a "Software Emulation Exception" (0x1000). That interrupt doesn't set > reason bits in SRR1 as the "Program Check Exception" does. > > Go through emulati

Re: [PATCH v3 28/32] powerpc/64s: interrupt implement exit logic in C

2021-02-05 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of February 5, 2021 4:04 pm: > > > Le 05/02/2021 à 03:16, Nicholas Piggin a écrit : >> Excerpts from Michael Ellerman's message of February 5, 2021 10:22 am: >>> Nicholas Piggin writes: Excerpts from Christophe Leroy's message of February 4, 2021 6:0

Re: [PATCH v7 39/42] powerpc: move NMI entry/exit code into wrapper

2021-02-05 Thread Michael Ellerman
Nicholas Piggin writes: > Excerpts from Michael Ellerman's message of February 4, 2021 8:15 pm: >> Nicholas Piggin writes: >>> This moves the common NMI entry and exit code into the interrupt handler >>> wrappers. >>> >>> This changes the behaviour of soft-NMI (watchdog) and HMI interrupts, and >

Re: [PATCH v2 1/1] powerpc/kvm: Save Timebase Offset to fix sched_clock() while running guest code.

2021-02-05 Thread Michael Ellerman
Nicholas Piggin writes: > Excerpts from Leonardo Bras's message of February 5, 2021 4:06 pm: >> Before guest entry, TBU40 register is changed to reflect guest timebase. >> After exitting guest, the register is reverted to it's original value. >> >> If one tries to get the timestamp from host betw

Re: [RFC PATCH 1/9] KVM: PPC: Book3S 64: move KVM interrupt entry to a common entry point

2021-02-05 Thread Fabiano Rosas
Nicholas Piggin writes: > Rather than bifurcate the call depending on whether or not HV is > possible, and have the HV entry test for PR, just make a single > common point which does the demultiplexing. This makes it simpler > to add another type of exit handler. > > Signed-off-by: Nicholas Piggi

Re: [PATCH v2 1/1] powerpc/kvm: Save Timebase Offset to fix sched_clock() while running guest code.

2021-02-05 Thread Leonardo Bras
Hello Fabiano, Thanks for reviewing!  (answers inline) On Fri, 2021-02-05 at 10:09 -0300, Fabiano Rosas wrote: > Leonardo Bras writes: > > > Before guest entry, TBU40 register is changed to reflect guest timebase. > > After exitting guest, the register is reverted to it's original value. > > >

Re: [PATCH] powerpc/pseries/dlpar: handle ibm,configure-connector delay status

2021-02-05 Thread Tyrel Datwyler
On 1/6/21 6:59 PM, Nathan Lynch wrote: > dlpar_configure_connector() has two problems in its handling of > ibm,configure-connector's return status: > > 1. When the status is -2 (busy, call again), we call >ibm,configure-connector again immediately without checking whether >to schedule, whi

[PATCH v2] powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm

2021-02-05 Thread Aneesh Kumar K.V
This fix the bad fault reported by KUAP when io_wqe_worker access userspace. Bug: Read fault blocked by KUAP! WARNING: CPU: 1 PID: 101841 at arch/powerpc/mm/fault.c:229 __do_page_fault+0x6b4/0xcd0 NIP [c009e7e4] __do_page_fault+0x6b4/0xcd0 LR [c009e7e0] __do_page_fault+0x6b0/0

Re: [PATCH v2 1/2] ima: Free IMA measurement buffer on error

2021-02-05 Thread Lakshmi Ramasubramanian
On 2/5/21 9:49 AM, Mimi Zohar wrote: Hi Mimi, On Fri, 2021-02-05 at 09:39 -0800, Lakshmi Ramasubramanian wrote: On 2/5/21 2:05 AM, Greg KH wrote: On Thu, Feb 04, 2021 at 09:49:50AM -0800, Lakshmi Ramasubramanian wrote: IMA allocates kernel virtual memory to carry forward the measurement list

Re: [PATCH v2 1/2] ima: Free IMA measurement buffer on error

2021-02-05 Thread Mimi Zohar
On Fri, 2021-02-05 at 09:39 -0800, Lakshmi Ramasubramanian wrote: > On 2/5/21 2:05 AM, Greg KH wrote: > > On Thu, Feb 04, 2021 at 09:49:50AM -0800, Lakshmi Ramasubramanian wrote: > >> IMA allocates kernel virtual memory to carry forward the measurement > >> list, from the current kernel to the next

Re: [PATCH] mm/pmem: Avoid inserting hugepage PTE entry with fsdax if hugepage support is disabled

2021-02-05 Thread Dan Williams
[ add Andrew ] On Thu, Feb 4, 2021 at 6:40 PM Aneesh Kumar K.V wrote: > > Differentiate between hardware not supporting hugepages and user disabling THP > via 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' > > For the devdax namespace, the kernel handles the above via the > supported_

Re: [PATCH v2 1/2] ima: Free IMA measurement buffer on error

2021-02-05 Thread Lakshmi Ramasubramanian
On 2/5/21 2:05 AM, Greg KH wrote: On Thu, Feb 04, 2021 at 09:49:50AM -0800, Lakshmi Ramasubramanian wrote: IMA allocates kernel virtual memory to carry forward the measurement list, from the current kernel to the next kernel on kexec system call, in ima_add_kexec_buffer() function. In error cod

[PATCH] KVM: PPC: Don't always report hash MMU capability for P9 < DD2.2

2021-02-05 Thread Fabiano Rosas
These machines don't support running both MMU types at the same time, so remove the KVM_CAP_PPC_MMU_HASH_V3 capability when the host is using Radix MMU. Signed-off-by: Fabiano Rosas --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 10 ++ arch/powerpc/kv

Re: [PATCH] powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm

2021-02-05 Thread Zorro Lang
On Fri, Feb 05, 2021 at 07:19:36PM +0530, Aneesh Kumar K.V wrote: > Zorro Lang writes: > > > > > ... > > [ 530.180466] run fstests generic/617 at 2021-02-05 03:41:10 > > [ 530.707969] [ cut here ] > > [ 530.708006] kernel BUG at arch/powerpc/include/asm/book3s/64/

Re: [PATCH 1/2] PCI/AER: Disable AER interrupt during suspend

2021-02-05 Thread Kai-Heng Feng
On Fri, Feb 5, 2021 at 7:28 AM Bjorn Helgaas wrote: > > [+cc Alex] > > On Thu, Jan 28, 2021 at 12:09:37PM +0800, Kai-Heng Feng wrote: > > On Thu, Jan 28, 2021 at 4:51 AM Bjorn Helgaas wrote: > > > On Thu, Jan 28, 2021 at 01:31:00AM +0800, Kai-Heng Feng wrote: > > > > Commit 50310600ebda ("iommu/v

Re: [PATCH] powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm

2021-02-05 Thread Aneesh Kumar K.V
Zorro Lang writes: > ... > [ 530.180466] run fstests generic/617 at 2021-02-05 03:41:10 > [ 530.707969] [ cut here ] > [ 530.708006] kernel BUG at arch/powerpc/include/asm/book3s/64/kup.h:207! > [ 530.708013] Oops: Exception in kernel mode, sig: 5 [#1] > [ 530.7

Re: [PATCH] powerpc/pseries/dlpar: handle ibm, configure-connector delay status

2021-02-05 Thread Nathan Lynch
Nathan Lynch writes: > dlpar_configure_connector() has two problems in its handling of > ibm,configure-connector's return status: > > 1. When the status is -2 (busy, call again), we call >ibm,configure-connector again immediately without checking whether >to schedule, which can result in m

Re: [PATCH v2 1/1] powerpc/kvm: Save Timebase Offset to fix sched_clock() while running guest code.

2021-02-05 Thread Fabiano Rosas
Leonardo Bras writes: > Before guest entry, TBU40 register is changed to reflect guest timebase. > After exitting guest, the register is reverted to it's original value. > > If one tries to get the timestamp from host between those changes, it > will present an incorrect value. > > An example wou

Re: [PATCH v2 2/2] ima: Free IMA measurement buffer after kexec syscall

2021-02-05 Thread Greg KH
On Thu, Feb 04, 2021 at 09:49:51AM -0800, Lakshmi Ramasubramanian wrote: > IMA allocates kernel virtual memory to carry forward the measurement > list, from the current kernel to the next kernel on kexec system call, > in ima_add_kexec_buffer() function. This buffer is not freed before > completin

Re: [PATCH v2 1/2] ima: Free IMA measurement buffer on error

2021-02-05 Thread Greg KH
On Thu, Feb 04, 2021 at 09:49:50AM -0800, Lakshmi Ramasubramanian wrote: > IMA allocates kernel virtual memory to carry forward the measurement > list, from the current kernel to the next kernel on kexec system call, > in ima_add_kexec_buffer() function. In error code paths this memory > is not fr

Re: [PATCH] powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm

2021-02-05 Thread Zorro Lang
On Fri, Feb 05, 2021 at 08:34:26AM +0530, Aneesh Kumar K.V wrote: > This fix the bad fault reported by KUAP when io_wqe_worker access userspace. > > Bug: Read fault blocked by KUAP! > WARNING: CPU: 1 PID: 101841 at arch/powerpc/mm/fault.c:229 > __do_page_fault+0x6b4/0xcd0 > NIP [c009e7

Re: [PATCH] mm/memtest: Add ARCH_USE_MEMTEST

2021-02-05 Thread Vladimir Murzin
Hi Anshuman, On 2/5/21 4:10 AM, Anshuman Khandual wrote: > early_memtest() does not get called from all architectures. Hence enabling > CONFIG_MEMTEST and providing a valid memtest=[1..N] kernel command line > option might not trigger the memory pattern tests as would be expected in > normal circu

[PATCH V2] powerpc/perf: Record counter overflow always if SAMPLE_IP is unset

2021-02-05 Thread Athira Rajeev
While sampling for marked events, currently we record the sample only if the SIAR valid bit of Sampled Instruction Event Register (SIER) is set. SIAR_VALID bit is used for fetching the instruction address from Sampled Instruction Address Register(SIAR). But there are some usecases, where the user i

[PATCH] powerpc/8xx: Fix software emulation interrupt

2021-02-05 Thread Christophe Leroy
For unimplemented instructions or unimplemented SPRs, the 8xx triggers a "Software Emulation Exception" (0x1000). That interrupt doesn't set reason bits in SRR1 as the "Program Check Exception" does. Go through emulation_assist_interrupt() to set REASON_ILLEGAL. Fixes: fbbcc3bb139e ("powerpc/8xx:

Re: [PATCH] mm/pmem: Avoid inserting hugepage PTE entry with fsdax if hugepage support is disabled

2021-02-05 Thread David Hildenbrand
On 05.02.21 03:39, Aneesh Kumar K.V wrote: Differentiate between hardware not supporting hugepages and user disabling THP via 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' For the devdax namespace, the kernel handles the above via the supported_alignment attribute and failing to ini

Re: [PATCH] arch:powerpc simple_write_to_buffer return check

2021-02-05 Thread Mayank Suman
On 05/02/21 12:51 pm, Christophe Leroy wrote: > Please provide some description of the change. > > And please clarify the patch subject, because as far as I can see, the return > is already checked allthough the check seams wrong. This was my first patch. I will try to provide better description

Re: [PATCH v7 28/42] powerpc: convert interrupt handlers to use wrappers

2021-02-05 Thread Christophe Leroy
Le 30/01/2021 à 14:08, Nicholas Piggin a écrit : Signed-off-by: Nicholas Piggin --- diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index f70d3f6174c8..7ff915aae8ec 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -1462,7 +1474,7 @@ st