[PATCH 5/5] exec: add a kernel_execveat helper

2020-06-27 Thread Christoph Hellwig
Add a kernel_execveat helper to execute a binary with kernel space argv and envp pointers. Switch executing init and user mode helpers to this new helper instead of relying on the implicit set_fs(KERNEL_DS) for early init code and kernel threads, and move the getname call into the do_execve

[PATCH 3/5] exec: cleanup the count() function

2020-06-27 Thread Christoph Hellwig
Remove the max argument as it is hard wired to MAX_ARG_STRINGS, and give the function a slightly less generic name. Signed-off-by: Christoph Hellwig --- fs/exec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index

Re: [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole

2020-06-27 Thread Christophe Leroy
Le 26/06/2020 à 21:04, Hari Bathini a écrit : Some archs can have special memory regions, within the given memory range, which can't be used for the buffer in a kexec segment. As kexec_add_buffer() function is being called from generic code as well, add weak arch_kexec_add_buffer definition

[PATCH 1/2] powerpc/mm/book3s54/pkeys: make pkey access check work on execute_only_key

2020-06-27 Thread Aneesh Kumar K.V
pkey_access_permitted() should not check for pkey is available in UAMOR or not. The kernel needs to do that check only while allocating keys. This also makes sure execute_only_key which is marked as non-manageable via UAMOR gives the right access check return w.r.t pkey_access_permitted(). This

[PATCH 2/5] exec: simplify the compat syscall handling

2020-06-27 Thread Christoph Hellwig
The only differenence betweeen the compat exec* syscalls and their native versions is that compat_ptr sign extension, and the fact that the pointer arithmetics for the two dimensional arrays needs to use the compat pointer size. Instead of the compat wrappers and the struct user_arg_ptr machinery

[PATCH 1/5] exec: cleanup the execve wrappers

2020-06-27 Thread Christoph Hellwig
Remove a whole bunch of wrappers that eventually all call __do_execve_file, and consolidate the execvce helpers to: (1) __do_execveat, which is the lowest level helper implementing the actual functionality (2) do_execvat, which is used by all callers that want native pointers

Re: [PATCH 02/11] powerpc/kexec_file: mark PPC64 specific code

2020-06-27 Thread Christophe Leroy
Le 26/06/2020 à 21:04, Hari Bathini a écrit : Some of the kexec_file_load code isn't PPC64 specific. Move PPC64 specific code from kexec/file_load.c to kexec/file_load_64.c. Also, rename purgatory/trampoline.S to purgatory/trampoline_64.S in the same spirit. At the time being,

[PATCH 2/2] powerpc/mm/books64/pkeys: Rename is_pkey_enabled()

2020-06-27 Thread Aneesh Kumar K.V
Rename is_pkey_enabled() to is_pkey_masked() to better indicates that this check is to make sure the key is available for userspace usage. For it to be made available both the bits in UAMOR should be set to 1 (0b11). Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 10

properly support exec with kernel pointers v3

2020-06-27 Thread Christoph Hellwig
Hi all, this series first cleans up the exec code and then adds proper kernel_execveat and kernel_wait callers instead of relying on the fact that the early init code and kernel threads implicitly run with the address limit set to KERNEL_DS. Note that the cleanup removes the compat execve(at)

[PATCH 2/8] opeinrisc: switch to generic version of pte allocation

2020-06-27 Thread Mike Rapoport
From: Mike Rapoport Replace pte_alloc_one(), pte_free() and pte_free_kernel() with the generic implementation. The only actual functional change is the addition of __GFP_ACCOUT for the allocation of the user page tables. The pte_alloc_one_kernel() is kept back because its implementation on

[PATCH 0/8] mm: cleanup usage of

2020-06-27 Thread Mike Rapoport
From: Mike Rapoport Hi, Most architectures have very similar versions of pXd_alloc_one() and pXd_free_one() for intermediate levels of page table. These patches add generic versions of these functions in and enable use of the generic functions where appropriate. In addition, functions

[PATCH 6/8] asm-generic: pgalloc: provide generic pgd_free()

2020-06-27 Thread Mike Rapoport
From: Mike Rapoport Most architectures define pgd_free() as a wrapper for free_page(). Provide a generic version in asm-generic/pgalloc.h and enable its use for most architectures. Signed-off-by: Mike Rapoport --- arch/alpha/include/asm/pgalloc.h | 6 --

[PATCH 5/8] asm-generic: pgalloc: provide generic pud_alloc_one() and pud_free_one()

2020-06-27 Thread Mike Rapoport
From: Mike Rapoport Several architectures define pud_alloc_one() as a wrapper for __get_free_page() and pud_free() as a wrapper for free_page(). Provide a generic implementation in asm-generic/pgalloc.h and use it where appropriate. Signed-off-by: Mike Rapoport ---

Re: [PATCH] powerpc/pseries: Use doorbells even if XIVE is available

2020-06-27 Thread Nicholas Piggin
Excerpts from Cédric Le Goater's message of June 26, 2020 5:17 pm: > Adding David, > > On 6/25/20 3:11 AM, Michael Ellerman wrote: >> Nicholas Piggin writes: >>> KVM supports msgsndp in guests by trapping and emulating the >>> instruction, so it was decided to always use XIVE for IPIs if it is

[PATCH 3/8] xtensa: switch to generic version of pte allocation

2020-06-27 Thread Mike Rapoport
From: Mike Rapoport xtensa clears PTEs during allocation of the page tables and pte_clear() sets the PTE to a non-zero value. Splitting ptes_clear() helper out of pte_alloc_one() and pte_alloc_one_kernel() allows reuse of base generic allocation methods (__pte_alloc_one() and

[PATCH 0/3] powerpc/pseries: IPI doorbell improvements

2020-06-27 Thread Nicholas Piggin
Thanks for the review, I think I incorporated all your comments, I also did add KVM detection which avoids introducing a performance regression. Thanks, Nick Nicholas Piggin (3): powerpc: inline doorbell sending functions powerpc/pseries: Use doorbells even if XIVE is available

[PATCH 8/8] mm: move p?d_alloc_track to separate header file

2020-06-27 Thread Mike Rapoport
From: Joerg Roedel The functions are only used in two source files, both residing in mm/ subdirectory, so there is no need for them to be in the global header. Move them to the new mm/pgalloc-track.h header and include it only where needed. [rppt: mv include/linux/pgalloc-track.h mm/] Link:

[PATCH 2/3] powerpc/pseries: Use doorbells even if XIVE is available

2020-06-27 Thread Nicholas Piggin
KVM supports msgsndp in guests by trapping and emulating the instruction, so it was decided to always use XIVE for IPIs if it is available. However on PowerVM systems, msgsndp can be used and gives better performance. On large systems, high XIVE interrupt rates can have sub-linear scaling, and

[PATCH 3/3] powerpc/pseries: Add KVM guest doorbell restrictions

2020-06-27 Thread Nicholas Piggin
KVM guests have certain restrictions and performance quirks when using doorbells. This patch tests for KVM environment in doorbell setup, and optimises IPI performance: - PowerVM guests may now use doorbells even if they are secure. - KVM guests no longer use doorbells if XIVE is available.

[PATCH 1/8] mm: remove unneeded includes of

2020-06-27 Thread Mike Rapoport
From: Mike Rapoport In the most cases header is required only for allocations of page table memory. Most of the .c files that include that header do not use symbols declared in and do not require that header. As for the other header files that used to include , it is possible to move that

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.8-4 tag

2020-06-27 Thread pr-tracker-bot
The pull request you sent on Sat, 27 Jun 2020 22:06:08 +1000: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.8-4 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/21d2f6850c09fdec730c11d35406da1dc541432d Thank you! --

[PATCH 9/8] mm: Account PMD tables like PTE tables

2020-06-27 Thread Matthew Wilcox
We account the PTE level of the page tables to the process in order to make smarter OOM decisions and help diagnose why memory is fragmented. For these same reasons, we should account pages allocated for PMDs. With larger process address spaces and ASLR, the number of PMDs in use is higher than it

Re: [PATCH 2/8] opeinrisc: switch to generic version of pte allocation

2020-06-27 Thread Stafford Horne
On Sat, Jun 27, 2020 at 05:34:47PM +0300, Mike Rapoport wrote: > From: Mike Rapoport > > Replace pte_alloc_one(), pte_free() and pte_free_kernel() with the generic > implementation. The only actual functional change is the addition of > __GFP_ACCOUT for the allocation of the user page tables. >

Re: [PATCH 4/8] asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()

2020-06-27 Thread Matthew Wilcox
On Sat, Jun 27, 2020 at 05:34:49PM +0300, Mike Rapoport wrote: > More elaborate versions on arm64 and x86 account memory for the user page > tables and call to pgtable_pmd_page_ctor() as the part of PMD page > initialization. > > Move the arm64 version to include/asm-generic/pgalloc.h and use the

Re: [PATCH 0/8] mm: cleanup usage of

2020-06-27 Thread Matthew Wilcox
On Sat, Jun 27, 2020 at 05:34:45PM +0300, Mike Rapoport wrote: > Most architectures have very similar versions of pXd_alloc_one() and > pXd_free_one() for intermediate levels of page table. > These patches add generic versions of these functions in > and enable use of the generic functions where

Re: [PATCH 1/3] powerpc: inline doorbell sending functions

2020-06-27 Thread kernel test robot
patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-pseries-IPI-doorbell-improvements/20200627-230544 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config

Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions

2020-06-27 Thread piliu
Hi Hari, After a quick through for this series, I have a few question/comment on this patch for the time being. Pls see comment inline. On 06/27/2020 03:05 AM, Hari Bathini wrote: > crashkernel region could have an overlap with special memory regions > like opal, rtas, tce-table & such. These

[PATCH 2/9] macintosh/via-macii: Poll the device most likely to respond

2020-06-27 Thread Finn Thain
Poll the most recently polled device by default, rather than the lowest device address that happens to be enabled in autopoll_devs. This improves input latency. Re-use macii_queue_poll() rather than duplicate that logic. This eliminates a static struct and function. Fixes: d95fd5fce88f0 ("m68k:

[PATCH 3/9] macintosh/via-macii: Handle /CTLR_IRQ signal correctly

2020-06-27 Thread Finn Thain
I'm told that the /CTLR_IRQ signal from the ADB transceiver gets interpreted by MacOS to mean SRQ, bus timeout or end-of-packet depending on the circumstances, and that Linux's via-macii driver does not correctly interpret this signal. Instead, the via-macii driver interprets certain received

[PATCH 5/9] macintosh/via-macii: Handle poll replies correctly

2020-06-27 Thread Finn Thain
Userspace applications may use /dev/adb to send Talk requests. Such requests always have req->reply_expected == 1. The same is true of Talk requests sent by the kernel, except for poll requests queued internally by the via-macii driver. Those requests have req->reply_expected == 0. Consequently,

[PATCH 1/9] macintosh/via-macii: Access autopoll_devs when inside lock

2020-06-27 Thread Finn Thain
The interrupt handler should be excluded when accessing the autopoll_devs variable. Fixes: d95fd5fce88f0 ("m68k: Mac II ADB fixes") # v5.0+ Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff

[PATCH] kbuild: introduce ccflags-remove-y and asflags-remove-y

2020-06-27 Thread Masahiro Yamada
CFLAGS_REMOVE_.o works per object, that is, there is no convenient way to filter out flags for every object in a directory. Add ccflags-remove-y and asflags-remove-y to make it easily. Use ccflags-remove-y to clean up some Makefiles. Suggested-by: Sami Tolvanen Signed-off-by: Masahiro Yamada

[PATCH 4/9] macintosh/via-macii: Remove read_done state

2020-06-27 Thread Finn Thain
The driver state machine may enter the 'read_done' state when leaving the 'idle' or 'reading' state. This transition is pointless, as is the extra interrupt it requires. The interrupt is produced by the transceiver (even when it has no data to send) because an extra EVEN/ODD toggle was signalled

[powerpc:next-test] BUILD SUCCESS 552e738289b6487cd82198369ddd00338b684c0b

2020-06-27 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test branch HEAD: 552e738289b6487cd82198369ddd00338b684c0b powerpc/selftest/ptrace-pkey: IAMR and uamor cannot be updated by ptrace elapsed time: 2179m configs tested: 148 configs skipped: 8 The following

Re: [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole

2020-06-27 Thread piliu
Hi Hari, If in [4/11], get_exclude_memory_ranges() turns out to be unnecessary ,then this patch is abundant either. As my understanding, memblock has already helped to achieved the purpose that get_exclude_memory_ranges() wants. Thanks, Pingfan On 06/27/2020 03:04 AM, Hari Bathini wrote: >

[PATCH 7/9] macintosh/via-macii: Use unsigned type for autopoll_devs variable

2020-06-27 Thread Finn Thain
Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c index e143ddb81de34..447273967e1e8 100644 --- a/drivers/macintosh/via-macii.c

[PATCH 6/9] macintosh/via-macii: Use bool type for reading_reply variable

2020-06-27 Thread Finn Thain
Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c index 8d5ef77b4a435..e143ddb81de34 100644 ---

[powerpc:merge] BUILD SUCCESS f66ebd048174992db612ec8157c83f6c6601e8b0

2020-06-27 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge branch HEAD: f66ebd048174992db612ec8157c83f6c6601e8b0 Automatic merge of 'master', 'next' and 'fixes' (2020-06-27 21:56) elapsed time: 822m configs tested: 139 configs skipped: 6 The following configs have

[powerpc:fixes-test] BUILD SUCCESS 896066aa0685af3434637998b76218c2045142a8

2020-06-27 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test branch HEAD: 896066aa0685af3434637998b76218c2045142a8 selftests/powerpc: Fix build failure in ebb tests elapsed time: 2777m configs tested: 159 configs skipped: 7 The following configs have been built

[PATCH 0/9] Macintosh II ADB driver fixes

2020-06-27 Thread Finn Thain
Various issues with the via-macii driver have become apparent over the years. Some examples: - A Talk command response can be lost. This can result in phantom devices being probed or an incorrect device handler ID being retrieved. - A reply packet containing a null byte can get truncated. Such

[PATCH 9/9] macintosh/via-macii: Clarify definition of macii_init()

2020-06-27 Thread Finn Thain
The function prototype correctly specifies the 'static' storage class. Let the function definition match the declaration for better readability. Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 8/9] macintosh/via-macii: Use the stack for reset request storage

2020-06-27 Thread Finn Thain
The adb_request struct can be stored on the stack because the request is synchronous and is completed before the function returns. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git