[PATCH] powerpc/papr_scm: Delete unnecessary assignment for the field “owner”

2019-11-03 Thread Markus Elfring
From: Markus Elfring Date: Sun, 3 Nov 2019 13:23:13 +0100 The field “owner” is set by the core. Thus delete an unneeded initialisation. Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Signed-off-by: Markus Elfring --- arch/powerpc/platforms/pseries/papr_scm.c | 1 - 1 file ch

Re: [PATCH 19/19] Documentation/vm: add pin_user_pages.rst

2019-11-03 Thread John Hubbard
On 10/30/19 3:49 PM, John Hubbard wrote: ... > +* struct page may not be increased in size for this, and all fields are > already > + used. > + > +* Given the above, we can overload the page->_refcount field by using, sort > of, > + the upper bits in that field for a dma-pinned count. "Sort of"

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

2019-11-03 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 set_page_

[PATCH v2 00/18] mm/gup: track dma-pinned pages: FOLL_PIN, FOLL_LONGTERM

2019-11-03 Thread John Hubbard
Hi, Changes since v1: * Changed the function signature of __huge_pt_done() from int to void. * Renamed __remove_refs_from_head() to put_compound_head(). * Improved the comment documentation in mm.h and gup.c * Merged Documentation/vm/pin_user_pages.rst into the "introduce FOLL_PIN" patch. * Fix

[PATCH v2 07/18] infiniband: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*()

2019-11-03 Thread John Hubbard
Convert infiniband to use the new wrapper calls, and stop explicitly setting FOLL_LONGTERM at the call sites. The new pin_longterm_*() calls replace get_user_pages*() calls, and set both FOLL_LONGTERM and a new FOLL_PIN flag. The FOLL_PIN flag requires that the caller must return the pages via put

[PATCH v2 12/18] mm/gup: track FOLL_PIN pages

2019-11-03 Thread John Hubbard
Add tracking of pages that were pinned via FOLL_PIN. As mentioned in the FOLL_PIN documentation, callers who effectively set FOLL_PIN are required to ultimately free such pages via put_user_page(). The effect is similar to FOLL_GET, and may be thought of as "FOLL_GET for DIO and/or RDMA use". Pag

[PATCH v2 09/18] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-11-03 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(). Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/gpu/drm/via/via

[PATCH v2 08/18] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-11-03 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 p

[PATCH v2 13/18] media/v4l2-core: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-11-03 Thread John Hubbard
1. Change v4l2 from get_user_pages(FOLL_LONGTERM), to pin_longterm_pages(), which sets both FOLL_LONGTERM and FOLL_PIN. 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(). Reviewed-by: Ira Weiny Cc: Ma

[PATCH v2 01/18] mm/gup: pass flags arg to __gup_device_* functions

2019-11-03 Thread John Hubbard
A subsequent patch requires access to gup flags, so pass the flags argument through to the __gup_device_* functions. Also placate checkpatch.pl by shortening a nearby line. Reviewed-by: Ira Weiny Cc: Kirill A. Shutemov Signed-off-by: John Hubbard --- mm/gup.c | 28 ++--

[PATCH v2 05/18] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-03 Thread John Hubbard
Introduce pin_user_pages*() variations of get_user_pages*() calls, and also pin_longterm_pages*() variations. These variants all set FOLL_PIN, which is also introduced, and thoroughly documented. The pin_longterm*() variants also set FOLL_LONGTERM, in addition to FOLL_PIN: pin_user_pages()

[PATCH v2 18/18] mm/gup: remove support for gup(FOLL_LONGTERM)

2019-11-03 Thread John Hubbard
Now that all other kernel callers of get_user_pages(FOLL_LONGTERM) have been converted to pin_longterm_pages(), lock it down: 1) Add an assertion to get_user_pages(), preventing callers from passing FOLL_LONGTERM (in addition to the existing assertion that prevents FOLL_PIN). 2) Remove the

[PATCH v2 14/18] vfio, mm: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-11-03 Thread John Hubbard
1. Change vfio from get_user_pages(FOLL_LONGTERM), to pin_longterm_pages(), which sets both FOLL_LONGTERM and FOLL_PIN. 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(). Note that this effectively changes the co

[PATCH v2 02/18] mm/gup: factor out duplicate code from four routines

2019-11-03 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 functi

[PATCH v2 10/18] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-11-03 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(). Reviewed-by: Ira Weiny Reviewed-by: Jens Axboe Signed-off-by: John Hubbard ---

[PATCH v2 03/18] goldish_pipe: rename local pin_user_pages() routine

2019-11-03 Thread John Hubbard
1. Avoid naming conflicts: rename local static function from "pin_user_pages()" to "pin_goldfish_pages()". An upcoming patch will introduce a global pin_user_pages() function. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldfish_pipe.c | 18 +---

[PATCH v2 11/18] net/xdp: set FOLL_PIN via pin_user_pages()

2019-11-03 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. Reviewed-by: Ira Weiny Acked-by: Björn Töpel Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 4 ++-- 1 file changed, 2 insertion

[PATCH v2 17/18] selftests/vm: run_vmtests: invoke gup_benchmark with basic FOLL_PIN coverage

2019-11-03 Thread John Hubbard
It's good to have basic unit test coverage of the new FOLL_PIN behavior. Fortunately, the gup_benchmark unit test is extremely fast (a few milliseconds), so adding it the the run_vmtests suite is going to cause no noticeable change in running time. So, add two new invocations to run_vmtests: 1) R

[PATCH v2 06/18] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-11-03 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 i

[PATCH v2 15/18] powerpc: book3s64: convert to pin_longterm_pages() and put_user_page()

2019-11-03 Thread John Hubbard
1. Convert from get_user_pages(FOLL_LONGTERM) to pin_longterm_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

[PATCH v2 16/18] mm/gup_benchmark: support pin_user_pages() and related calls

2019-11-03 Thread John Hubbard
Up until now, gup_benchmark supported testing of the following kernel functions: * get_user_pages(): via the '-U' command line option * get_user_pages_longterm(): via the '-L' command line option * get_user_pages_fast(): as the default (no options required) Add test coverage for the new correspon

Re: [PATCH] powerpc/papr_scm: Delete unnecessary assignment for the field “owner”

2019-11-03 Thread Oliver O'Halloran
On Sun, Nov 3, 2019 at 11:31 PM Markus Elfring wrote: > > From: Markus Elfring > Date: Sun, 3 Nov 2019 13:23:13 +0100 > > The field “owner” is set by the core. > Thus delete an unneeded initialisation. Acked-by: Oliver O'Halloran > > Generated by: scripts/coccinelle/api/platform_no_drv_owner.c

[PATCH 1/1] powerpc/crypto: Add cond_resched() in crc-vpmsum self-test

2019-11-03 Thread Chris Smart
The stress test for vpmsum implementations executes a long for loop in the kernel. This blocks the scheduler, which prevents other tasks from running, resulting in a warning. This fix adds a call to cond_reshed() at the end of each loop, which allows the scheduler to run other tasks as required.

Re: PROBLEM: PCIe Bus Error atleast

2019-11-03 Thread Oliver O'Halloran
On Sat, Nov 2, 2019 at 5:46 AM Jeffrin Thalakkottoor wrote: > > hello , > > i found a error message as the output of "sudo dmesg -l err" > i have attached related to that in this email. > i think i found this in 5.3.8 kernel Use "uname -a" to get the current kernel version, architecture. > But

Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers

2019-11-03 Thread Anshuman Khandual
On 10/29/2019 04:01 PM, Qian Cai wrote: > > >> On Oct 28, 2019, at 1:29 AM, Anshuman Khandual >> wrote: >> >> This adds tests which will validate architecture page table helpers and >> other accessors in their compliance with expected generic MM semantics. >> This will help various architect

[PATCH v5 0/6] powerpc: convert cache asm to C

2019-11-03 Thread Alastair D'Silva
From: Alastair D'Silva This series addresses a few issues discovered in how we flush caches: 1. Flushes were truncated at 4GB, so larger flushes were incorrect. 2. Flushing the dcache in arch_add_memory was unnecessary This series also converts much of the cache assembler to C, with the aim of m

[PATCH v5 1/6] powerpc: Allow flush_icache_range to work across ranges >4GB

2019-11-03 Thread Alastair D'Silva
From: Alastair D'Silva When calling flush_icache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Signed-off-by: Alastair D'

[PATCH v5 2/6] powerpc: Allow 64bit VDSO __kernel_sync_dicache to work across ranges >4GB

2019-11-03 Thread Alastair D'Silva
From: Alastair D'Silva When calling __kernel_sync_dicache with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Signed-off-by: Alastair

[PATCH v5 3/6] powerpc: define helpers to get L1 icache sizes

2019-11-03 Thread Alastair D'Silva
From: Alastair D'Silva This patch adds helpers to retrieve icache sizes, and renames the existing helpers to make it clear that they are for dcache. Signed-off-by: Alastair D'Silva --- arch/powerpc/include/asm/cache.h | 29 +++ arch/powerpc/include/asm/cacheflush.h

[PATCH v5 4/6] powerpc: Convert flush_icache_range & friends to C

2019-11-03 Thread Alastair D'Silva
From: Alastair D'Silva Similar to commit 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") this patch converts the following ASM symbols to C: flush_icache_range() __flush_dcache_icache() __flush_dcache_icache_phys() This was done as we discovered a long-sta

[PATCH v5 5/6] powerpc: Chunk calls to flush_dcache_range in arch_*_memory

2019-11-03 Thread Alastair D'Silva
From: Alastair D'Silva When presented with large amounts of memory being hotplugged (in my test case, ~890GB), the call to flush_dcache_range takes a while (~50 seconds), triggering RCU stalls. This patch breaks up the call into 1GB chunks, calling cond_resched() inbetween to allow the scheduler

[PATCH v5 6/6] powerpc: Don't flush caches when adding memory

2019-11-03 Thread Alastair D'Silva
From: Alastair D'Silva This operation takes a significant amount of time when hotplugging large amounts of memory (~50 seconds with 890GB of persistent memory). This was orignally in commit fb5924fddf9e ("powerpc/mm: Flush cache on memory hot(un)plug") to support memtrace, but the flush on add i

Re: Pull request: scottwood/linux.git next

2019-11-03 Thread Jason Yan
On 2019/11/2 1:01, Scott Wood wrote: On Thu, 2019-10-31 at 10:01 +0800, Jason Yan wrote: Hi Michael, Can you pull this to linux-next so that we can test it on linux-next for some time? Thanks, Jason FWIW, my tree is included in linux-next. Ah, I found it in linux-next. Thank you so much

Re: Pull request: scottwood/linux.git next

2019-11-03 Thread Jason Yan
On 2019/11/2 18:38, Michael Ellerman wrote: Jason Yan writes: Hi Michael, Can you pull this to linux-next so that we can test it on linux-next for some time? Yes I plan to, I've just been busy doing other things. As Scott said it's in linux-next anyway. Yeah, I found it in linux-next.

[PATCH v10 0/8] KVM: PPC: Driver to manage pages of secure guest

2019-11-03 Thread Bharata B Rao
Hi, This is the next version of the patchset that adds required support in the KVM hypervisor to run secure guests on PEF-enabled POWER platforms. The major change in this version is about not using kvm.arch->rmap[] array to store device PFNs, thus not depending on the memslot availability to rea

[PATCH v10 1/8] mm: ksm: Export ksm_madvise()

2019-11-03 Thread Bharata B Rao
KVM PPC module needs ksm_madvise() for supporting secure guests. Guest pages that become secure are represented as device private pages in the host. Such pages shouldn't participate in KSM merging. Signed-off-by: Bharata B Rao --- mm/ksm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/k

[PATCH v10 2/8] KVM: PPC: Support for running secure guests

2019-11-03 Thread Bharata B Rao
A pseries guest can be run as secure guest on Ultravisor-enabled POWER platforms. On such platforms, this driver will be used to manage the movement of guest pages between the normal memory managed by hypervisor (HV) and secure memory managed by Ultravisor (UV). HV is informed about the guest's tr

[PATCH v10 3/8] KVM: PPC: Shared pages support for secure guests

2019-11-03 Thread Bharata B Rao
A secure guest will share some of its pages with hypervisor (Eg. virtio bounce buffers etc). Support sharing of pages between hypervisor and ultravisor. Shared page is reachable via both HV and UV side page tables. Once a secure page is converted to shared page, the device page that represents the

[PATCH v10 4/8] KVM: PPC: Radix changes for secure guest

2019-11-03 Thread Bharata B Rao
- After the guest becomes secure, when we handle a page fault of a page belonging to SVM in HV, send that page to UV via UV_PAGE_IN. - Whenever a page is unmapped on the HV side, inform UV via UV_PAGE_INVAL. - Ensure all those routines that walk the secondary page tables of the guest don't do s

[PATCH v10 5/8] KVM: PPC: Handle memory plug/unplug to secure VM

2019-11-03 Thread Bharata B Rao
Register the new memslot with UV during plug and unregister the memslot during unplug. In addition, release all the device pages during unplug. Signed-off-by: Bharata B Rao Signed-off-by: Sukadev Bhattiprolu [Added skip_page_out arg to kvmppc_uvmem_drop_pages()] --- arch/powerpc/include

[PATCH v10 6/8] KVM: PPC: Support reset of secure guest

2019-11-03 Thread Bharata B Rao
Add support for reset of secure guest via a new ioctl KVM_PPC_SVM_OFF. This ioctl will be issued by QEMU during reset and includes the the following steps: - Ask UV to terminate the guest via UV_SVM_TERMINATE ucall - Unpin the VPA pages so that they can be migrated back to secure side when guest

[PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-03 Thread Bharata B Rao
From: Sukadev Bhattiprolu Implement the H_SVM_INIT_ABORT hcall which the Ultravisor can use to abort an SVM after it has issued the H_SVM_INIT_START and before the H_SVM_INIT_DONE hcalls. This hcall could be used when Ultravisor encounters security violations or other errors when starting an SVM.

[PATCH v10 8/8] KVM: PPC: Ultravisor: Add PPC_UV config option

2019-11-03 Thread Bharata B Rao
From: Anshuman Khandual CONFIG_PPC_UV adds support for ultravisor. Signed-off-by: Anshuman Khandual Signed-off-by: Bharata B Rao Signed-off-by: Ram Pai [ Update config help and commit message ] Signed-off-by: Claudio Carvalho Reviewed-by: Sukadev Bhattiprolu --- arch/powerpc/Kconfig | 17 +

Re: [PATCH v5 4/6] powerpc: Convert flush_icache_range & friends to C

2019-11-03 Thread kbuild test robot
Hi Alastair, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on v5.4-rc6 next-20191031] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option

Re: [PATCH v3 28/36] serial: ucc_uart: explicitly include soc/fsl/cpm.h

2019-11-03 Thread Rasmus Villemoes
On 01/11/2019 17.19, Christophe Leroy wrote: > Le 01/11/2019 à 13:42, Rasmus Villemoes a écrit : >> This driver uses #defines from soc/fsl/cpm.h, so instead of relying on >> some other header pulling that in, do that explicitly. This is >> preparation for allowing this driver to build on ARM. >> >