[PATCH 10/18] powerpc: Support prefixed instructions in alignment handler

2019-11-25 Thread Jordan Niethe
Alignment interrupts can be caused by prefixed instructions accessing memory. In the alignment handler the instruction that caused the exception is loaded and attempted emulate. If the instruction is a prefixed instruction load the prefix and suffix to emulate. After emulating increment the NIP by

[PATCH 13/18] powerpc/xmon: Dump prefixed instructions

2019-11-25 Thread Jordan Niethe
Currently when xmon is dumping instructions it reads a word at a time and then prints that instruction (either as a hex number or by disassembling it). For prefixed instructions it would be nice to show its prefix and suffix as together. Use read_instr() so that if a prefix is encountered its

[PATCH 06/18] powerpc sstep: Add support for prefixed integer load/stores

2019-11-25 Thread Jordan Niethe
This adds emulation support for the following prefixed integer load/stores: * Prefixed Load Byte and Zero (plbz) * Prefixed Load Halfword and Zero (plhz) * Prefixed Load Halfword Algebraic (plha) * Prefixed Load Word and Zero (plwz) * Prefixed Load Word Algebraic (plwa) * Prefixed Load

[PATCH 09/18] powerpc sstep: Add support for prefixed fixed-point arithmetic

2019-11-25 Thread Jordan Niethe
This adds emulation support for the following prefixed Fixed-Point Arithmetic instructions: * Prefixed Add Immediate (paddi) Signed-off-by: Jordan Niethe --- arch/powerpc/lib/sstep.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c

[PATCH 11/18] powerpc/traps: Check for prefixed instructions in facility_unavailable_exception()

2019-11-25 Thread Jordan Niethe
If prefixed instructions are made unavailable by the [H]FSCR, attempting to use them will cause a facility unavailable exception. Add "PREFIX" to the facility_strings[]. Currently there are no prefixed instructions that are actually emulated by emulate_instruction() within

[PATCH 04/18] powerpc: Rename Bit 35 of SRR1 to indicate new purpose

2019-11-25 Thread Jordan Niethe
Bit 35 of SRR1 is called SRR1_ISI_N_OR_G. This name comes from it being used to indicate that an ISI was due to the access being no-exec or guarded. A future ISA version adds another purpose. Now it is also set if there is a access in a cache-inhibited location for prefixed instruction. Rename

[PATCH 16/18] powerpc/hw_breakpoints: Initial support for prefixed instructions

2019-11-25 Thread Jordan Niethe
Currently when getting an instruction to emulate in hw_breakpoint_handler() we do not load the suffix of a prefixed instruction. Ensure we load the suffix if the instruction we need to emulate is a prefixed instruction. Signed-off-by: Jordan Niethe --- arch/powerpc/kernel/hw_breakpoint.c | 8

[PATCH 17/18] powerpc: Add prefix support to mce_find_instr_ea_and_pfn()

2019-11-25 Thread Jordan Niethe
mce_find_instr_ea_and_pfn analyses an instruction to determine the effective address that caused the machine check. Update this to load and pass the suffix to analyse_instr for prefixed instructions. Signed-off-by: Jordan Niethe --- arch/powerpc/kernel/mce_power.c | 6 -- 1 file changed, 4

[PATCH 05/18] powerpc sstep: Prepare to support prefixed instructions

2019-11-25 Thread Jordan Niethe
Currently all instructions are a single word long. A future ISA version will include prefixed instructions which have a double word length. The functions used for analysing and emulating instructions need to be modified so that they can handle these new instruction types. A prefixed instruction

[PATCH 08/18] powerpc sstep: Add support for prefixed VSX load/stores

2019-11-25 Thread Jordan Niethe
This adds emulation support for the following prefixed VSX load/stores: * Prefixed Load VSX Scalar Doubleword (plxsd) * Prefixed Load VSX Scalar Single-Precision (plxssp) * Prefixed Load VSX Vector [0|1] (plxv, plxv0, plxv1) * Prefixed Store VSX Scalar Doubleword (pstxsd) * Prefixed

[PATCH 07/18] powerpc sstep: Add support for prefixed floating-point load/stores

2019-11-25 Thread Jordan Niethe
This adds emulation support for the follow prefixed floating-point load/stores: * Prefixed Load Floating-Point Single (plfs) * Prefixed Load Floating-Point Double (plfd) * Prefixed Store Floating-Point Single (pstfs) * Prefixed Store Floating-Point Double (pstfd) Signed-off-by: Jordan

[PATCH 12/18] powerpc/xmon: Add initial support for prefixed instructions

2019-11-25 Thread Jordan Niethe
A prefixed instruction is composed of a word prefix and a word suffix. It does not make sense to be able to have a breakpoint on the suffix of a prefixed instruction, so make this impossible. When leaving xmon_core() we check to see if we are currently at a breakpoint. If this is the case, the

[PATCH 14/18] powerpc/kprobes: Support kprobes on prefixed instructions

2019-11-25 Thread Jordan Niethe
A prefixed instruction is composed of a word prefix followed by a word suffix. It does not make sense to be able to have a kprobe on the suffix of a prefixed instruction, so make this impossible. Kprobes work by replacing an instruction with a trap and saving that instruction to be single stepped

[PATCH 15/18] powerpc/uprobes: Add support for prefixed instructions

2019-11-25 Thread Jordan Niethe
Uprobes can execute instructions out of line. Increase the size of the buffer used for this so that this works for prefixed instructions. Take into account the length of prefixed instructions when fixing up the nip. Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/uprobes.h | 18

[PATCH 18/18] powerpc/fault: Use analyse_instr() to check for store with updates to sp

2019-11-25 Thread Jordan Niethe
A user-mode access to an address a long way below the stack pointer is only valid if the instruction is one that would update the stack pointer to the address accessed. This is checked by directly looking at the instructions op-code. As a result is does not take into account prefixed instructions.

Re: [PATCH 07/19] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-25 Thread kbuild test robot
the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/John-Hubbard/pin_user_pages-reduced-risk-series-for-Linux-5-5/20191125-125637 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: arm

[PATCH] powerpc/32: drop unused ISA_DMA_THRESHOLD

2019-11-25 Thread Mike Rapoport
From: Mike Rapoport The ISA_DMA_THRESHOLD variable is set by several platforms but never referenced. Remove it. Signed-off-by: Mike Rapoport --- arch/powerpc/include/asm/dma.h | 3 +-- arch/powerpc/kernel/setup_32.c | 1 - arch/powerpc/platforms/44x/warp.c | 3 ---

Re: [PATCH 17/19] powerpc: book3s64: convert to pin_user_pages() and put_user_page()

2019-11-25 Thread Jan Kara
On Sun 24-11-19 20:20:09, John Hubbard wrote: > 1. Convert from get_user_pages() to pin_user_pages(). > > 2. As required by pin_user_pages(), release these pages via > put_user_page(). In this case, do so via put_user_pages_dirty_lock(). > > That has the side effect of calling

Re: Bug 205201 - Booting halts if Dawicontrol DC-2976 UW SCSI board installed, unless RAM size limited to 3500M

2019-11-25 Thread Mike Rapoport
On Mon, Nov 25, 2019 at 08:39:23AM +0100, Christoph Hellwig wrote: > On Sat, Nov 23, 2019 at 12:42:27PM +0100, Christian Zigotzky wrote: > > Hello Christoph, > > > > Please find attached the dmesg of your Git kernel. > > Thanks. It looks like on your platform the swiotlb buffer isn't > actually

Re: [PATCH v2] powerpc/kernel/sysfs: Add PMU_SYSFS config option to enable PMU SPRs sysfs file creation

2019-11-25 Thread Nageswara R Sastry
Kajol Jain wrote on 13/11/2019 09:40:56 PM: > From: Kajol Jain > To: linuxppc-dev@lists.ozlabs.org, m...@ellerman.id.au > Cc: kj...@linux.ibm.com, a...@linux.vnet.ibm.com, ma...@linux.vnet.ibm.com > Date: 26/11/2019 10:16 AM > Subject: [EXTERNAL] [PATCH v2] powerpc/kernel/sysfs: Add PMU_SYSFS

[PATCH 02/18] powerpc: Add BOUNDARY SRR1 bit for future ISA version

2019-11-25 Thread Jordan Niethe
Add the bit definition for when the cause of an alignment exception is a prefixed instruction that crosses a 64-byte boundary. Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/reg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/reg.h

[PATCH 00/18] Initial Prefixed Instruction support

2019-11-25 Thread Jordan Niethe
A future revision of the ISA will introduce prefixed instructions. A prefixed instruction is composed of a 4-byte prefix followed by a 4-byte suffix. All prefixes have the major opcode 1. A prefix will never be a valid word instruction. A suffix may be an existing word instruction or a new

[PATCH 03/18] powerpc: Add PREFIXED SRR1 bit for future ISA version

2019-11-25 Thread Jordan Niethe
Add the bit definition for exceptions caused by prefixed instructions. Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/reg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 6f9fcc3d4c82..0a6d39fb4769 100644 ---

[PATCH 01/18] powerpc: Enable Prefixed Instructions

2019-11-25 Thread Jordan Niethe
From: Alistair Popple Prefix instructions have their own FSCR bit which needs to enabled via a CPU feature. The kernel will save the FSCR for problem state but it needs to be enabled initially. Signed-off-by: Alistair Popple --- arch/powerpc/include/asm/reg.h| 3 +++

Re: [PATCH v17 10/13] namei: LOOKUP_{IN_ROOT,BENEATH}: permit limited ".." resolution

2019-11-25 Thread Aleksa Sarai
On 2019-11-25, Al Viro wrote: > On Sun, Nov 17, 2019 at 12:17:10PM +1100, Aleksa Sarai wrote: > > + if (unlikely(nd->flags & LOOKUP_IS_SCOPED)) { > > + /* > > +* If there was a racing rename or mount along our > > +* path, then

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-25 Thread Segher Boessenkool
On Mon, Nov 25, 2019 at 09:32:23PM +1100, Michael Ellerman wrote: > Segher Boessenkool writes: > >> > +static inline void call_do_irq(struct pt_regs *regs, void *sp) > >> > +{ > >> > +register unsigned long r3 asm("r3") = (unsigned long)regs; > >> > + > >> > +/* Temporarily switch

Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq()

2019-11-25 Thread Michael Ellerman
Segher Boessenkool writes: > On Thu, Nov 21, 2019 at 05:14:45PM +1100, Michael Ellerman wrote: >> Christophe Leroy writes: >> That breaks 64-bit with GCC9: >> >> arch/powerpc/kernel/irq.c: In function 'do_IRQ': >> arch/powerpc/kernel/irq.c:650:2: error: PIC register clobbered by 'r2' in >>

Re: [PATCH v3 1/2] powerpc: permanently include 8xx registers in reg.h

2019-11-25 Thread Michael Ellerman
On Thu, 2019-08-29 at 08:45:12 UTC, Christophe Leroy wrote: > Most 8xx registers have specific names, so just include > reg_8xx.h all the time in reg.h in order to have them defined > even when CONFIG_PPC_8xx is not selected. This will avoid > the need for #ifdefs in C code. > > Guard SPRN_ICTRL

Re: [PATCH] powerpc/reg: use ASM_FTR_IFSET() instead of opencoding fixup.

2019-11-25 Thread Michael Ellerman
On Wed, 2019-08-28 at 13:42:01 UTC, Christophe Leroy wrote: > mftb() includes a feature fixup for CELL ppc. > > Use ASM_FTR_IFSET() macro instead of opencoding the setup > of the fixup sections. > > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks.

Re: [PATCH] powerpc/sysdev: drop simple gpio

2019-11-25 Thread Michael Ellerman
On Thu, 2019-10-31 at 13:47:30 UTC, Christophe Leroy wrote: > There is a config item CONFIG_SIMPLE_GPIO which > provides simple memory mapped GPIOs specific to powerpc. > > However, the only platform which selects this option is > mpc5200, and this platform doesn't use it. > > There are three

Re: [PATCH 2/3] powerpc: refactoring BUG/WARN macros

2019-11-25 Thread Michael Ellerman
On Mon, 2019-08-19 at 13:06:30 UTC, Christophe Leroy wrote: > BUG(), WARN() and friends are using a similar inline > assembly to implement various traps with various flags. > > Lets refactor via a new BUG_ENTRY() macro. > > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks.

Re: [PATCH] powerpc/mm: drop #ifdef CONFIG_MMU in is_ioremap_addr()

2019-11-25 Thread Michael Ellerman
On Wed, 2019-08-21 at 10:13:32 UTC, Christophe Leroy wrote: > powerpc always selects CONFIG_MMU and CONFIG_MMU is not checked > anywhere else in powerpc code. > > Drop the #ifdef and the alternative part of is_ioremap_addr() > > Fixes: 9bd3bb6703d8("mm/nvdimm: add is_ioremap_addr and use that to

Re: [PATCH] powerpc/8xx: add __init to cpm1 init functions

2019-11-25 Thread Michael Ellerman
On Thu, 2019-09-12 at 13:22:55 UTC, Christophe Leroy wrote: > Functions cpm1_clk_setup(), cpm1_set_pin(), cpm_pic_init() and > mpc8xx_pic_init() are only called from __init functions, so mark > them __init as well. > > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks.

Re: [PATCH v4 1/2] powerpc/32: Split kexec low level code out of misc_32.S

2019-11-25 Thread Michael Ellerman
On Tue, 2019-10-29 at 12:13:57 UTC, Christophe Leroy wrote: > Almost half of misc_32.S is dedicated to kexec. > That's the relocation function for kexec. > > Drop it into a dedicated kexec_relocate_32.S > > Signed-off-by: Christophe Leroy Series applied to powerpc next, thanks.

Re: [PATCH] selftests/powerpc: spectre_v2 test must be built 64-bit

2019-11-25 Thread Michael Ellerman
On Wed, 2019-11-20 at 02:39:24 UTC, Michael Ellerman wrote: > The spectre_v2 test must be built 64-bit, it includes hand-written asm > that is 64-bit only, and segfaults if built 32-bit. > > Fixes: c790c3d2b0ec ("selftests/powerpc: Add a test of spectre_v2 > mitigations") > Signed-off-by:

[PATCH v2 06/14] powerpc: Replace cpu_up/down with device_online/offline

2019-11-25 Thread Qais Yousef
The core device API performs extra housekeeping bits that are missing from directly calling cpu_up/down. See commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and serialization during LPM") for an example description of what might go wrong. This also prepares to make cpu_up/down a

Re: [PATCH] powerpc/8xx: use the fixmapped IMMR in cpm_reset()

2019-11-25 Thread Michael Ellerman
On Thu, 2019-09-12 at 13:29:07 UTC, Christophe Leroy wrote: > Since commit f86ef74ed919 ("powerpc/8xx: Fix vaddr for IMMR early > remap"), the IMMR area has been mapped at startup with fixmap. > > Use that fixmap directly instead of calling ioremap(), this > avoids calling ioremap() early before

Re: [PATCH v1 4/4] powerpc/ioremap: warn on early use of ioremap()

2019-11-25 Thread Michael Ellerman
On Thu, 2019-09-12 at 13:49:44 UTC, Christophe Leroy wrote: > Powerpc now has EARLY_IOREMAP. > > Next step is to convert all early users of ioremap() to > early_ioremap(). > > Add a warning to help locate those users. > > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks.

Re: lockdep warning while booting POWER9 PowerNV

2019-11-25 Thread Daniel Axtens
powerpc: define arch_is_kernel_initmem_freed() for lockdep Under certain circumstances, we hit a warning in lockdep_register_key: if (WARN_ON_ONCE(static_obj(key))) return; This occurs when the key falls into initmem that has since been freed and can now be reused. This

Re: [PATCH] powerpc/32: Don't populate page tables for block mapped pages except on the 8xx.

2019-11-25 Thread Michael Ellerman
On Fri, 2019-08-23 at 09:56:21 UTC, Christophe Leroy wrote: > Commit d2f15e0979ee ("powerpc/32: always populate page tables for > Abatron BDI.") wrongly sets page tables for any PPC32 for using BDI, > and does't update them after init (remove RX on init section, set > text and rodata read-only) >

Re: [PATCH v1 2/4] powerpc/fixmap: Use __fix_to_virt() instead of fix_to_virt()

2019-11-25 Thread Michael Ellerman
On Thu, 2019-09-12 at 13:49:42 UTC, Christophe Leroy wrote: > Modify back __set_fixmap() to using __fix_to_virt() instead > of fix_to_virt() otherwise the following happens because it > seems GCC doesn't see idx as a builtin const. > > CC mm/early_ioremap.o > In file included from

Re: [PATCH v3 1/2] powerpc/32s: automatically allocate BAT in setbat()

2019-11-25 Thread Michael Ellerman
On Mon, 2019-09-16 at 20:25:39 UTC, Christophe Leroy wrote: > If no BAT is given to setbat(), select an available BAT. > > Signed-off-by: Christophe Leroy Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/cbcaff7d27ad5c5d2c2db113ec489be88adb815a cheers

Re: [PATCH] powerpc/mm: tell if a bad page fault on data is read or write.

2019-11-25 Thread Michael Ellerman
On Wed, 2019-08-21 at 15:21:55 UTC, Christophe Leroy wrote: > DSISR has a bit to tell if the fault is due to a read or a write. > > Display it. > > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/46ddcb3950a28c0df4815e8dbb8d4b91d5d9f22d

Re: [PATCH v1 3/4] powerpc: Add support for GENERIC_EARLY_IOREMAP

2019-11-25 Thread Michael Ellerman
On Thu, 2019-09-12 at 13:49:43 UTC, Christophe Leroy wrote: > Add support for GENERIC_EARLY_IOREMAP. > > Let's define 16 slots of 256Kbytes each for early ioremap. > > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks.

Re: [PATCH v2] powerpc/powernv: Disable native PCIe port management

2019-11-25 Thread Michael Ellerman
On Mon, 2019-11-18 at 06:55:53 UTC, Oliver O'Halloran wrote: > On PowerNV the PCIe topology is (currently) managed by the powernv platform > code in Linux in cooperation with the platform firmware. Linux's native > PCIe port service drivers operate independently of both and this can cause >

[PATCH v2 00/14] Convert cpu_up/down to device_online/offline

2019-11-25 Thread Qais Yousef
Changes in v2: * Add 2 new patches that create smp_shutdown_nonboot_cpus() to be used in machine_shutdown() in ia64, arm and arm64 * Use proper kernel-doc for the newly introduced functions * Renamed a function * Removed a stale comment in a function

Re: [PATCH v2] dma-mapping: treat dev->bus_dma_mask as a DMA limit

2019-11-25 Thread Robin Murphy
On 25/11/2019 7:44 am, Christoph Hellwig wrote: On Sat, Nov 23, 2019 at 09:51:08AM -0700, Nathan Chancellor wrote: Just as an FYI, this introduces a warning on arm32 allyesconfig for me: I think the dma_limit argument to iommu_dma_alloc_iova should be a u64 and/or we need to use min_t and

Re: Bug 205201 - Booting halts if Dawicontrol DC-2976 UW SCSI board installed, unless RAM size limited to 3500M

2019-11-25 Thread Christian Zigotzky
On 25 November 2019 at 08:39 am, Christoph Hellwig wrote: On Sat, Nov 23, 2019 at 12:42:27PM +0100, Christian Zigotzky wrote: Hello Christoph, Please find attached the dmesg of your Git kernel. Thanks. It looks like on your platform the swiotlb buffer isn't actually addressable based on the

Re: Bug 205201 - Booting halts if Dawicontrol DC-2976 UW SCSI board installed, unless RAM size limited to 3500M

2019-11-25 Thread Christian Zigotzky
On 25 November 2019 at 10:32 am, Mike Rapoport wrote: On Mon, Nov 25, 2019 at 08:39:23AM +0100, Christoph Hellwig wrote: On Sat, Nov 23, 2019 at 12:42:27PM +0100, Christian Zigotzky wrote: Hello Christoph, Please find attached the dmesg of your Git kernel. Thanks. It looks like on your

Re: [PATCH net 0/4] ibmvnic: Harden device commands and queries

2019-11-25 Thread Thomas Falcon
On 11/23/19 7:49 PM, Jakub Kicinski wrote: On Fri, 22 Nov 2019 13:41:42 -0600, Thomas Falcon wrote: This patch series fixes some shortcomings with the current VNIC device command implementation. The first patch fixes the initialization of driver completion structures used for device commands.

Re: [PATCH 07/19] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-25 Thread John Hubbard
ote to help > improve the system. BTW, we also suggest to use '--base' option to specify the > base tree in git format-patch, please see > https://stackoverflow.com/a/37406982] > > url: > https://github.com/0day-ci/linux/commits/John-Hubbard/pin_user_pages-reduced-risk-series-for-Li

Re: [PATCH 17/19] powerpc: book3s64: convert to pin_user_pages() and put_user_page()

2019-11-25 Thread John Hubbard
On 11/25/19 12:59 AM, Jan Kara wrote: > On Sun 24-11-19 20:20:09, John Hubbard wrote: >> 1. Convert from get_user_pages() to pin_user_pages(). >> >> 2. As required by pin_user_pages(), release these pages via >> put_user_page(). In this case, do so via put_user_pages_dirty_lock(). >> >> That has

[PATCH] powerpc/mpc85xx: also write addr_h to spin table for 64bit boot entry

2019-11-25 Thread yingjie_bai
From: Bai Yingjie CPU like P4080 has 36bit physical address, its DDR physical start address can be configured above 4G by LAW registers. For such systems in which their physical memory start address was configured higher than 4G, we need also to write addr_h into the spin table of the target

Re: [PATCH net 0/4] ibmvnic: Harden device commands and queries

2019-11-25 Thread Jakub Kicinski
On Mon, 25 Nov 2019 12:40:42 -0600, Thomas Falcon wrote: > On 11/23/19 7:49 PM, Jakub Kicinski wrote: > > On Fri, 22 Nov 2019 13:41:42 -0600, Thomas Falcon wrote: > >> This patch series fixes some shortcomings with the current > >> VNIC device command implementation. The first patch fixes > >>

[PATCH v2 01/19] mm/gup: factor out duplicate code from four routines

2019-11-25 Thread John Hubbard
There are four locations in gup.c that have a fair amount of code duplication. This means that changing one requires making the same changes in four places, not to mention reading the same code four times, and wondering if there are subtle differences. Factor out the common code into static

[PATCH v2 03/19] mm: Cleanup __put_devmap_managed_page() vs ->page_free()

2019-11-25 Thread John Hubbard
From: Dan Williams After the removal of the device-public infrastructure there are only 2 ->page_free() call backs in the kernel. One of those is a device-private callback in the nouveau driver, the other is a generic wakeup needed in the DAX case. In the hopes that all ->page_free() callbacks

[PATCH v2 02/19] mm/gup: move try_get_compound_head() to top, fix minor issues

2019-11-25 Thread John Hubbard
An upcoming patch uses try_get_compound_head() more widely, so move it to the top of gup.c. Also fix a tiny spelling error and a checkpatch.pl warning. Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup.c | 29

[PATCH v2 07/19] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-25 Thread John Hubbard
Introduce pin_user_pages*() variations of get_user_pages*() calls, and also pin_longterm_pages*() variations. For now, these are placeholder calls, until the various call sites are converted to use the correct get_user_pages*() or pin_user_pages*() API. These variants will eventually all set

[PATCH v2 06/19] vfio: fix FOLL_LONGTERM use, simplify get_user_pages_remote() call

2019-11-25 Thread John Hubbard
Update VFIO to take advantage of the recently loosened restriction on FOLL_LONGTERM with get_user_pages_remote(). Also, now it is possible to fix a bug: the VFIO caller is logically a FOLL_LONGTERM user, but it wasn't setting FOLL_LONGTERM. Also, remove an unnessary pair of calls that were

[PATCH v2 04/19] goldish_pipe: rename local pin_user_pages() routine

2019-11-25 Thread John Hubbard
1. Avoid naming conflicts: rename local static function from "pin_user_pages()" to "goldfish_pin_pages()". An upcoming patch will introduce a global pin_user_pages() function. Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John Hubbard ---

[PATCH v2 08/19] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-11-25 Thread John Hubbard
1. Call the new global pin_user_pages_fast(), from pin_goldfish_pages(). 2. As required by pin_user_pages(), release these pages via put_user_page(). In this case, do so via put_user_pages_dirty_lock(). That has the side effect of calling set_page_dirty_lock(), instead of set_page_dirty(). This

[PATCH v2 00/19] pin_user_pages(): reduced-risk series for Linux 5.5

2019-11-25 Thread John Hubbard
n the last patch (instead of put_user_page() ). * Rebased onto today's linux-next: c165016bac27 ("Add linux-next specific files for 20191125") Here is a set of well-reviewed (expect for one patch), lower-ris

[PATCH v2 10/19] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-11-25 Thread John Hubbard
Convert process_vm_access to use the new pin_user_pages_remote() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages. Also, release the pages via put_user_page*(). Also, rename "pages" to "pinned_pages", as this makes for easier reading of

[PATCH v2 05/19] mm: fix get_user_pages_remote()'s handling of FOLL_LONGTERM

2019-11-25 Thread John Hubbard
As it says in the updated comment in gup.c: current FOLL_LONGTERM behavior is incompatible with FAULT_FLAG_ALLOW_RETRY because of the FS DAX check requirement on vmas. However, the corresponding restriction in get_user_pages_remote() was slightly stricter than is actually required: it forbade all

[PATCH v2] of: unittest: fix memory leak in attach_node_and_children

2019-11-25 Thread Erhard Furtner
In attach_node_and_children memory is allocated for full_name via kasprintf. If the condition of the 1st if is not met the function returns early without freeing the memory. Add a kfree() to fix that. This has been detected with kmemleak: Link: https://bugzilla.kernel.org/show_bug.cgi?id=205327

Re: [PATCH][v2] powerpc: Set right value of Speculation_Store_Bypass in /proc//status

2019-11-25 Thread Michael Ellerman
Gustavo Walbon writes: > The issue has showed the value of status of Speculation_Store_Bypass in the > /proc//status as `unknown` for PowerPC systems. > > The patch fix the checking of the mitigation status of Speculation, and > can be reported as "not vulnerable", "globally mitigated" or

[PATCH v2 13/19] net/xdp: set FOLL_PIN via pin_user_pages()

2019-11-25 Thread John Hubbard
Convert net/xdp to use the new pin_longterm_pages() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages. In partial anticipation of this work, the net/xdp code was already calling put_user_page() instead of put_page(). Therefore, in order to

[PATCH v2 16/19] vfio, mm: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-11-25 Thread John Hubbard
1. Change vfio from get_user_pages_remote(), to pin_user_pages_remote(). 2. Because all FOLL_PIN-acquired pages must be released via put_user_page(), also convert the put_page() call over to put_user_pages_dirty_lock(). Note that this effectively changes the code's behavior in

[PATCH v2 14/19] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-11-25 Thread John Hubbard
After DMA is complete, and the device and CPU caches are synchronized, it's still required to mark the CPU pages as dirty, if the data was coming from the device. However, this driver was just issuing a bare put_page() call, without any set_page_dirty*() call. Fix the problem, by calling

[PATCH v2 12/19] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-11-25 Thread John Hubbard
Convert fs/io_uring to use the new pin_user_pages() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages, and therefore for any code that calls put_user_page(). In partial anticipation of this work, the io_uring code was already calling

[PATCH v2 18/19] mm/gup_benchmark: use proper FOLL_WRITE flags instead of hard-coding "1"

2019-11-25 Thread John Hubbard
Fix the gup benchmark flags to use the symbolic FOLL_WRITE, instead of a hard-coded "1" value. Also, clean up the filtering of gup flags a little, by just doing it once before issuing any of the get_user_pages*() calls. This makes it harder to overlook, instead of having little "gup_flags & 1"

[PATCH v2 17/19] powerpc: book3s64: convert to pin_user_pages() and put_user_page()

2019-11-25 Thread John Hubbard
1. Convert from get_user_pages() to pin_user_pages(). 2. As required by pin_user_pages(), release these pages via put_user_page(). In this case, do so via put_user_pages_dirty_lock(). That has the side effect of calling set_page_dirty_lock(), instead of set_page_dirty(). This is probably more

[PATCH net v2 2/4] ibmvnic: Terminate waiting device threads after loss of service

2019-11-25 Thread Thomas Falcon
If we receive a notification that the device has been deactivated or removed, force a completion of all waiting threads. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c

[PATCH net v2 0/4] ibmvnic: Harden device commands and queries

2019-11-25 Thread Thomas Falcon
This patch series fixes some shortcomings with the current VNIC device command implementation. The first patch fixes the initialization of driver completion structures used for device commands. Additionally, all waits for device commands are bounded with a timeout in the event that the device does

[PATCH net v2 4/4] ibmvnic: Serialize device queries

2019-11-25 Thread Thomas Falcon
Provide some serialization for device CRQ commands and queries to ensure that the shared variable used for storing return codes is properly synchronized. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 54 ++

[PATCH net v2 1/4] ibmvnic: Fix completion structure initialization

2019-11-25 Thread Thomas Falcon
Fix multiple calls to init_completion for device completion structures. Instead, initialize them during device probe and reinitialize them later as needed. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 19 +++ 1 file changed, 11 insertions(+), 8

Re: [PATCH v2] powerpc: Fix Kconfig indentation

2019-11-25 Thread Michael Ellerman
On Thu, 2019-11-21 at 03:21:01 UTC, Krzysztof Kozlowski wrote: > Adjust indentation from spaces to tab (+optional two spaces) as in > coding style with command like: > $ sed -e 's/^/\t/' -i */Kconfig > > Signed-off-by: Krzysztof Kozlowski Applied to powerpc next, thanks.

[PATCH v2 09/19] IB/{core, hw, umem}: set FOLL_PIN via pin_user_pages*(), fix up ODP

2019-11-25 Thread John Hubbard
Convert infiniband to use the new pin_user_pages*() calls. Also, revert earlier changes to Infiniband ODP that had it using put_user_page(). ODP is "Case 3" in Documentation/core-api/pin_user_pages.rst, which is to say, normal get_user_pages() and put_page() is the API to use there. The new

[PATCH v2 11/19] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-11-25 Thread John Hubbard
Convert drm/via to use the new pin_user_pages_fast() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages, and therefore for any code that calls put_user_page(). In partial anticipation of this work, the drm/via driver was already calling

[PATCH v2 19/19] mm, tree-wide: rename put_user_page*() to unpin_user_page*()

2019-11-25 Thread John Hubbard
In order to provide a clearer, more symmetric API for pinning and unpinning DMA pages. This way, pin_user_pages*() calls match up with unpin_user_pages*() calls, and the API is a lot closer to being self-explanatory. Reviewed-by: Jan Kara Signed-off-by: John Hubbard ---

[PATCH v2 15/19] media/v4l2-core: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-11-25 Thread John Hubbard
1. Change v4l2 from get_user_pages() to pin_user_pages(). 2. Because all FOLL_PIN-acquired pages must be released via put_user_page(), also convert the put_page() call over to put_user_pages_dirty_lock(). Acked-by: Hans Verkuil Cc: Ira Weiny Signed-off-by: John Hubbard ---

[PATCH net v2 3/4] ibmvnic: Bound waits for device queries

2019-11-25 Thread Thomas Falcon
Create a wrapper for wait_for_completion calls with additional driver checks to ensure that the driver does not wait on a disabled device. In those cases or if the device does not respond in an extended amount of time, this will allow the driver an opportunity to recover. Signed-off-by: Thomas

Re: [PATCH v1 1/4] powerpc/fixmap: don't clear fixmap area in paging_init()

2019-11-25 Thread Michael Ellerman
On Thu, 2019-09-12 at 13:49:41 UTC, Christophe Leroy wrote: > fixmap is intended to map things permanently like the IMMR region on > FSL SOC (8xx, 83xx, ...), so don't clear it when initialising paging() > > Signed-off-by: Christophe Leroy Applied to powerpc next, thanks.

Re: [PATCH v5 1/3] powerpc: Don't add -mabi= flags when building with Clang

2019-11-25 Thread Michael Ellerman
On Tue, 2019-11-19 at 04:57:10 UTC, Nathan Chancellor wrote: > When building pseries_defconfig, building vdso32 errors out: > > error: unknown target ABI 'elfv1' > > This happens because -m32 in clang changes the target to 32-bit, > which does not allow the ABI to be changed, as the setABI