Re: Does SMP work at all on 40x ?

2019-01-31 Thread Benjamin Herrenschmidt
On Wed, 2019-01-30 at 08:16 +0100, Christophe Leroy wrote: > In transfer_to_handler() (entry_32.S), we have: > > #if defined(CONFIG_40x) || defined(CONFIG_BOOKE) > ... > #ifdef CONFIG_SMP > CURRENT_THREAD_INFO(r9, r1) > lwz r9,TI_CPU(r9) > slwir9,r9,3 > add

Re: fix a layering violation in videobuf2 and improve dma_map_resource v2

2019-01-31 Thread Marek Szyprowski
Hi All, On 2019-01-18 12:37, Christoph Hellwig wrote: > Hi all, > > this series fixes a rather gross layering violation in videobuf2, which > pokes into arm DMA mapping internals to get a DMA address for memory that > does not have a page structure, and to do so fixes up the dma_map_resource >

Re: [PATCH] powerpc/mm: Add _PAGE_SAO to _PAGE_CACHE_CTL mask

2019-01-31 Thread Alexey Kardashevskiy
On 31/01/2019 00:35, Michael Ellerman wrote: > Reza Arbab writes: > >> On Tue, Jan 29, 2019 at 08:37:28PM +0530, Aneesh Kumar K.V wrote: >>> Not sure what the fix is about. We set the related hash pte flags via >>> >>> if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_TOLERANT) >>>

[PATCH RFC v2] powerpc/64s: rewriting interrupt entry code

2019-01-31 Thread Nicholas Piggin
Finally got around to making this more or less work. I didn't quite know where it would end up, so I haven't got patches in clean pieces yet. But for this RFC I would rather consider the end result from a higher level (mainly of kernel/exceptions-64s.S new style of macros). There are two

[PATCH] powerpc/powernv: Escalate reset when IODA reset fails

2019-01-31 Thread Oliver O'Halloran
The IODA reset is used to flush out any OS controlled state from the PHB. This reset can fail if a PHB fatal error has occurred in early boot, probably due to a because of a bad device. We already do a fundemental reset of the device in some cases, so this patch just adds a test to force a full

Re: [PATCH v02] powerpc/pseries: Check for ceded CPU's during LPAR migration

2019-01-31 Thread Tyrel Datwyler
On 01/31/2019 02:21 PM, Tyrel Datwyler wrote: > On 01/31/2019 01:53 PM, Michael Bringmann wrote: >> On 1/30/19 11:38 PM, Michael Ellerman wrote: >>> Michael Bringmann writes: This patch is to check for cede'ed CPUs during LPM. Some extreme tests encountered a problem ehere Linux has

Re: [PATCH v02] powerpc/pseries: Check for ceded CPU's during LPAR migration

2019-01-31 Thread Michael Bringmann
On 1/31/19 4:21 PM, Tyrel Datwyler wrote: > On 01/31/2019 01:53 PM, Michael Bringmann wrote: >> On 1/30/19 11:38 PM, Michael Ellerman wrote: >>> Michael Bringmann writes: This patch is to check for cede'ed CPUs during LPM. Some extreme tests encountered a problem ehere Linux has put

Re: [PATCH v02] powerpc/pseries: Check for ceded CPU's during LPAR migration

2019-01-31 Thread Tyrel Datwyler
On 01/31/2019 01:53 PM, Michael Bringmann wrote: > On 1/30/19 11:38 PM, Michael Ellerman wrote: >> Michael Bringmann writes: >>> This patch is to check for cede'ed CPUs during LPM. Some extreme >>> tests encountered a problem ehere Linux has put some threads to >>> sleep (possibly to save energy

Re: [PATCH v02] powerpc/pseries: Check for ceded CPU's during LPAR migration

2019-01-31 Thread Michael Bringmann
On 1/30/19 11:38 PM, Michael Ellerman wrote: > Michael Bringmann writes: >> This patch is to check for cede'ed CPUs during LPM. Some extreme >> tests encountered a problem ehere Linux has put some threads to >> sleep (possibly to save energy or something), LPM was attempted, >> and the Linux

[PATCH] powerpc: Enable kernel XZ compression option on 44x

2019-01-31 Thread Christian Lamparter
Enable kernel XZ compression option on 44x. Tested on a Western Digital - MyBook Live NAS. It takes 22 seconds for the 800 MHz CPU to decompress and boot a 2.63 MiB XZ-compressed kernel simpleImage. Signed-off-by: Christian Lamparter --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1

[PATCH] powerpc: drop page_is_ram() and walk_system_ram_range()

2019-01-31 Thread Christophe Leroy
Since commit c40dd2f76644 ("powerpc: Add System RAM to /proc/iomem") it is possible to use the generic walk_system_ram_range() and the generic page_is_ram(). Fixes: c40dd2f76644 ("powerpc: Add System RAM to /proc/iomem") Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig| 3

[RFC PATCH] powerpc/6xx: Don't set back MSR_RI before reenabling MMU

2019-01-31 Thread Christophe Leroy
By delaying the setting of MSR_RI, a 1% improvment is optained on null_syscall selftest on an mpc8321. Without this patch: root@vgoippro:~# ./null_syscall 1134.33 ns 378.11 cycles With this patch: root@vgoippro:~# ./null_syscall 1121.85 ns 373.95 cycles The drawback is that a

Re: [PATCH] powerpc/powernv/npu: Remove redundant change_pte() hook

2019-01-31 Thread Andrea Arcangeli
On Thu, Jan 31, 2019 at 06:30:22PM +0800, Peter Xu wrote: > The change_pte() notifier was designed to use as a quick path to > update secondary MMU PTEs on write permission changes or PFN changes. > For KVM, it could reduce the vm-exits when vcpu faults on the pages > that was touched up by KSM.

Re: [PATCH 3/3] videobuf2: replace a layering violation with dma_map_resource

2019-01-31 Thread Christoph Hellwig
Hi Marek, can chance you could retest the v2 version?

Re: [PATCH v2 19/21] treewide: add checks for the return value of memblock_alloc*()

2019-01-31 Thread Max Filippov
On Mon, Jan 21, 2019 at 12:06 AM Mike Rapoport wrote: > > Add check for the return value of memblock_alloc*() functions and call > panic() in case of error. > The panic message repeats the one used by panicing memblock allocators with > adjustment of parameters to include only relevant ones. > >

Re: [PATCH] powerpc: Ensure gcc doesn't move around cache flushing in __patch_instruction

2019-01-31 Thread Christophe Leroy
Le 18/05/2018 à 01:00, Segher Boessenkool a écrit : On Fri, May 18, 2018 at 08:30:27AM +1000, Benjamin Herrenschmidt wrote: On Thu, 2018-05-17 at 14:23 -0500, Segher Boessenkool wrote: On Thu, May 17, 2018 at 01:06:10PM +1000, Benjamin Herrenschmidt wrote: The current asm statement in

Re: use generic DMA mapping code in powerpc V4

2019-01-31 Thread Christian Zigotzky
Hi Christoph, I compiled kernels for the X5000 and X1000 from your branch 'powerpc-dma.6' today. Gitweb: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/powerpc-dma.6 git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a The X1000 and X5000 boot but

[PATCH] powerpc/powernv/npu: Remove redundant change_pte() hook

2019-01-31 Thread Peter Xu
The change_pte() notifier was designed to use as a quick path to update secondary MMU PTEs on write permission changes or PFN changes. For KVM, it could reduce the vm-exits when vcpu faults on the pages that was touched up by KSM. It's not used to do cache invalidations, for example, if we see

Re: Does SMP work at all on 40x ?

2019-01-31 Thread Christophe Leroy
Le 30/01/2019 à 12:43, Michael Ellerman a écrit : Christophe Leroy writes: In transfer_to_handler() (entry_32.S), we have: #if defined(CONFIG_40x) || defined(CONFIG_BOOKE) ... #ifdef CONFIG_SMP CURRENT_THREAD_INFO(r9, r1) lwz r9,TI_CPU(r9) slwir9,r9,3

Re: BUG: memcmp(): Accessing invalid memory location

2019-01-31 Thread Michael Ellerman
Adding Simon who wrote the code. Chandan Rajendra writes: > When executing fstests' generic/026 test, I hit the following call trace, > > [ 417.061038] BUG: Unable to handle kernel data access at 0xc0062ac4 > [ 417.062172] Faulting instruction address: 0xc0092240 > [

[PATCH v2] powerpc/32: Fix CONFIG_VIRT_CPU_ACCOUNTING_NATIVE for 40x/booke

2019-01-31 Thread Christophe Leroy
40x/booke have another path to reach 3f from transfer_to_handler, make sure it also calls ACCOUNT_CPU_USER_ENTRY() when CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is selected. Signed-off-by: Christophe Leroy --- v2: left inside the user entry path arch/powerpc/kernel/entry_32.S | 12 +++- 1

[PATCH v15 13/13] powerpc: clean stack pointers naming

2019-01-31 Thread Christophe Leroy
Some stack pointers used to also be thread_info pointers and were called tp. Now that they are only stack pointers, rename them sp. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 17 +++-- arch/powerpc/kernel/setup_64.c | 11 +++ 2 files changed, 10

[PATCH v15 12/13] powerpc/64: Remove CURRENT_THREAD_INFO

2019-01-31 Thread Christophe Leroy
Now that current_thread_info is located at the beginning of 'current' task struct, CURRENT_THREAD_INFO macro is not really needed any more. This patch replaces it by loads of the value at PACACURRENT(r13). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/exception-64s.h | 4

[PATCH v15 11/13] powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU

2019-01-31 Thread Christophe Leroy
Now that thread_info is similar to task_struct, its address is in r2 so CURRENT_THREAD_INFO() macro is useless. This patch removes it. This patch also moves the 'tovirt(r2, r2)' down just before the reactivation of MMU translation, so that we keep the physical address of 'current' in r2 until

[PATCH v15 10/13] powerpc: 'current_set' is now a table of task_struct pointers

2019-01-31 Thread Christophe Leroy
The table of pointers 'current_set' has been used for retrieving the stack and current. They used to be thread_info pointers as they were pointing to the stack and current was taken from the 'task' field of the thread_info. Now, the pointers of 'current_set' table are now both pointers to

[PATCH v15 09/13] powerpc: regain entire stack space

2019-01-31 Thread Christophe Leroy
thread_info is not anymore in the stack, so the entire stack can now be used. There is also no risk anymore of corrupting task_cpu(p) with a stack overflow so the patch removes the test. When doing this, an explicit test for NULL stack pointer is needed in validate_sp() as it is not anymore

[PATCH v15 08/13] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK

2019-01-31 Thread Christophe Leroy
This patch activates CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from corruption in the case of stack overflows. - Its address is harder to determine if stack addresses are

[PATCH v15 07/13] powerpc: Prepare for moving thread_info into task_struct

2019-01-31 Thread Christophe Leroy
This patch cleans the powerpc kernel before activating CONFIG_THREAD_INFO_IN_TASK: - The purpose of the pointer given to call_do_softirq() and call_do_irq() is to point the new stack ==> change it to void* and rename it 'sp' - Don't use CURRENT_THREAD_INFO() to locate the stack. - Fix a few

[PATCH v15 06/13] powerpc: Rename THREAD_INFO to TASK_STACK

2019-01-31 Thread Christophe Leroy
This patch renames THREAD_INFO to TASK_STACK, because it is in fact the offset of the pointer to the stack in task_struct so this pointer will not be impacted by the move of THREAD_INFO. Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- arch/powerpc/kernel/asm-offsets.c| 2

[PATCH v15 05/13] powerpc: prep stack walkers for THREAD_INFO_IN_TASK

2019-01-31 Thread Christophe Leroy
[text copied from commit 9bbd4c56b0b6 ("arm64: prep stack walkers for THREAD_INFO_IN_TASK")] When CONFIG_THREAD_INFO_IN_TASK is selected, task stacks may be freed before a task is destroyed. To account for this, the stacks are refcounted, and when manipulating the stack of another task, it is

[PATCH v15 04/13] powerpc: Only use task_struct 'cpu' field on SMP

2019-01-31 Thread Christophe Leroy
When moving to CONFIG_THREAD_INFO_IN_TASK, the thread_info 'cpu' field gets moved into task_struct and only defined when CONFIG_SMP is set. This patch ensures that TI_CPU is only used when CONFIG_SMP is set and that task_struct 'cpu' field is not used directly out of SMP code. Signed-off-by:

[PATCH v15 03/13] book3s/64: avoid circular header inclusion in mmu-hash.h

2019-01-31 Thread Christophe Leroy
When activating CONFIG_THREAD_INFO_IN_TASK, linux/sched.h includes asm/current.h. This generates a circular dependency. To avoid that, asm/processor.h shall not be included in mmu-hash.h In order to do that, this patch moves into a new header called asm/task_size_user64.h the information from

[PATCH v15 02/13] powerpc/32: Fix CONFIG_VIRT_CPU_ACCOUNTING_NATIVE for 40x/booke

2019-01-31 Thread Christophe Leroy
40x/booke have another path to reach 3f from transfer_to_handler, make sure it also calls ACCOUNT_CPU_USER_ENTRY() when CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is selected. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/entry_32.S | 12 +++- 1 file changed, 7 insertions(+), 5

[PATCH v15 00/13] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK

2019-01-31 Thread Christophe Leroy
The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from corruption in the case of stack overflows. - Its address is harder to determine if

[PATCH v15 01/13] powerpc/irq: use memblock functions returning virtual address

2019-01-31 Thread Christophe Leroy
Since only the virtual address of allocated blocks is used, lets use functions returning directly virtual address. Those functions have the advantage of also zeroing the block. Suggested-by: Mike Rapoport Acked-by: Mike Rapoport Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c

Re: linux-next: powerpc le qemu boot failure after merge of the akpm tree

2019-01-31 Thread Stephen Rothwell
Hi Mike, On Thu, 31 Jan 2019 09:40:18 +0200 Mike Rapoport wrote: > > Andrew, can you please add the below patch to as a fixup to "treewide: add > checks for the return value of memblock_alloc*()"? I have added that to linux-next for tomorrow (in case Andrew doesn't get to it). > From