Re: [PATCH v6 0/4] Add perf interface to expose nvdimm

2022-02-24 Thread Aneesh Kumar K V
On Fri, 2022-02-25 at 12:08 +0530, kajoljain wrote: > > > On 2/25/22 11:25, Nageswara Sastry wrote: > > > > > > On 17/02/22 10:03 pm, Kajol Jain wrote: > > > > > > > > > Changelog > > > > Tested these patches with the automated tests at > > avocado-misc-tests/perf/perf_nmem.py > > URL:

Re: [PATCH v6 0/4] Add perf interface to expose nvdimm

2022-02-24 Thread kajoljain
On 2/25/22 11:25, Nageswara Sastry wrote: > > > On 17/02/22 10:03 pm, Kajol Jain wrote: >> Patchset adds performance stats reporting support for nvdimm. >> Added interface includes support for pmu register/unregister >> functions. A structure is added called nvdimm_pmu to be used for >>

Re: [PATCH v6 0/4] Add perf interface to expose nvdimm

2022-02-24 Thread Nageswara Sastry
On 17/02/22 10:03 pm, Kajol Jain wrote: Patchset adds performance stats reporting support for nvdimm. Added interface includes support for pmu register/unregister functions. A structure is added called nvdimm_pmu to be used for adding arch/platform specific data such as cpumask, nvdimm device

Re: [PATCH v2] usercopy: Check valid lifetime via stack depth

2022-02-24 Thread Kees Cook
On Thu, Feb 24, 2022 at 08:58:20AM +, David Laight wrote: > From: Kees Cook > > Sent: 24 February 2022 06:04 > > > > Under CONFIG_HARDENED_USERCOPY=y, when exact stack frame boundary checking > > is not available (i.e. everything except x86 with FRAME_POINTER), check > > a stack object as

Re: [PATCH v2 18/18] uaccess: drop maining CONFIG_SET_FS users

2022-02-24 Thread Dinh Nguyen
On 2/16/22 07:13, Arnd Bergmann wrote: From: Arnd Bergmann There are no remaining callers of set_fs(), so CONFIG_SET_FS can be removed globally, along with the thread_info field and any references to it. This turns access_ok() into a cheaper check against TASK_SIZE_MAX. With CONFIG_SET_FS

Re: [PATCH v2 13/18] uaccess: generalize access_ok()

2022-02-24 Thread Dinh Nguyen
On 2/16/22 07:13, Arnd Bergmann wrote: From: Arnd Bergmann There are many different ways that access_ok() is defined across architectures, but in the end, they all just compare against the user_addr_max() value or they accept anything. Provide one definition that works for most

Re: [PATCH v2 12/18] uaccess: fix type mismatch warnings from access_ok()

2022-02-24 Thread Dinh Nguyen
On 2/16/22 07:13, Arnd Bergmann wrote: From: Arnd Bergmann On some architectures, access_ok() does not do any argument type checking, so replacing the definition with a generic one causes a few warnings for harmless issues that were never caught before. Fix the ones that I found either

Re: [PATCH v2 02/18] uaccess: fix nios2 and microblaze get_user_8()

2022-02-24 Thread Dinh Nguyen
On 2/16/22 07:13, Arnd Bergmann wrote: From: Arnd Bergmann These two architectures implement 8-byte get_user() through a memcpy() into a four-byte variable, which won't fit. Use a temporary 64-bit variable instead here, and use a double cast the way that risc-v and openrisc do to avoid

Re: [PATCH v3 1/2] selftest/vm: Add util.h and and move helper functions there

2022-02-24 Thread Andrew Morton
On Thu, 17 Feb 2022 14:05:36 +0530 "Aneesh Kumar K.V" wrote: > Avoid code duplication by adding util.h. No functional change > in this patch. Sorry, but changes in linux-next have messed this patch up a bit more than I'm prepared to fix. Could you please redo these two against linux-next

Re: [PATCH V6 17/20] riscv: compat: vdso: Add setup additional pages implementation

2022-02-24 Thread Guo Ren
On Fri, Feb 25, 2022 at 1:57 AM Palmer Dabbelt wrote: > > On Thu, 24 Feb 2022 00:54:07 PST (-0800), guo...@kernel.org wrote: > > From: Guo Ren > > > > Reconstruct __setup_additional_pages() by appending vdso info > > pointer argument to meet compat_vdso_info requirement. And change > >

Re: [PATCH v2 02/13] tracing: Fix selftest config check for function graph start up test

2022-02-24 Thread Michael Ellerman
Steven Rostedt writes: > On Thu, 24 Feb 2022 13:43:02 + > Christophe Leroy wrote: > >> Hi Michael, >> >> Le 20/12/2021 à 17:38, Christophe Leroy a écrit : >> > CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS is required to test >> > direct tramp. >> > >> > Signed-off-by: Christophe Leroy >> >>

[PATCH V2] platforms/83xx: Use of_device_get_match_data()

2022-02-24 Thread cgel . zte
From: Minghao Chi (CGEL ZTE) Use of_device_get_match_data() to simplify the code. v1->v2: Add a judgment on the return value of the A function as NULL Reported-by: Zeal Robot Signed-off-by: Minghao Chi (CGEL ZTE) --- arch/powerpc/platforms/83xx/suspend.c | 7 ++- 1 file changed,

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Nicholas Piggin
Excerpts from Segher Boessenkool's message of February 25, 2022 3:12 am: > On Thu, Feb 24, 2022 at 03:05:28PM +1000, Nicholas Piggin wrote: >> + * gcc 10 started to emit a .machine directive at the beginning of generated >> + * .s files, which overrides assembler -Wa,-m options passed down. >> + *

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Nicholas Piggin
Excerpts from Segher Boessenkool's message of February 25, 2022 3:29 am: > On Thu, Feb 24, 2022 at 09:13:25PM +1000, Nicholas Piggin wrote: >> Excerpts from Arnd Bergmann's message of February 24, 2022 8:20 pm: >> > Again, there should be a minimum number of those .machine directives >> > in

Re: False positive kmemleak report for dtb properties names on powerpc

2022-02-24 Thread Ariel Marcovitch
Ping :) On 18/02/2022 21:45, Ariel Marcovitch wrote: Hello! I was running a powerpc 32bit kernel (built using qemu_ppc_mpc8544ds_defconfig buildroot config, with enabling DEBUGFS+KMEMLEAK+HIGHMEM in the kernel config) on qemu and invoked the kmemleak scan (twice. for some reason the first

[PATCH] powerpc/mm/numa: skip NUMA_NO_NODE onlining in parse_numa_properties()

2022-02-24 Thread Daniel Henrique Barboza
Executing node_set_online() when nid = NUMA_NO_NODE results in an undefined behavior. node_set_online() will call node_set_state(), into __node_set(), into set_bit(), and since NUMA_NO_NODE is -1 we'll end up doing a negative shift operation inside arch/powerpc/include/asm/bitops.h. This potential

Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API

2022-02-24 Thread Christophe JAILLET
Le 24/02/2022 à 08:07, Arnd Bergmann a écrit : On Thu, Feb 24, 2022 at 7:25 AM Christoph Hellwig wrote: On Wed, Feb 23, 2022 at 09:26:56PM +0100, Christophe JAILLET wrote: Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. They all still apply cleanly. 04 has been picked it up for

Re: [PATCH V6 17/20] riscv: compat: vdso: Add setup additional pages implementation

2022-02-24 Thread Palmer Dabbelt
On Thu, 24 Feb 2022 00:54:07 PST (-0800), guo...@kernel.org wrote: From: Guo Ren Reconstruct __setup_additional_pages() by appending vdso info pointer argument to meet compat_vdso_info requirement. And change vm_special_mapping *dm, *cm initialization into static. Signed-off-by: Guo Ren

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Segher Boessenkool
On Thu, Feb 24, 2022 at 11:39:16PM +1100, Michael Ellerman wrote: > > /* Calculate the parity of the value */ > > - asm ("popcntd %0,%1" : "=r" (parity) : "r" (val)); > > + asm (".machine \"push\"\n" > > +".machine \"power7\"\n" > > +"popcntd %0,%1\n" > > +".machine

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Segher Boessenkool
On Thu, Feb 24, 2022 at 09:13:25PM +1000, Nicholas Piggin wrote: > Excerpts from Arnd Bergmann's message of February 24, 2022 8:20 pm: > > Again, there should be a minimum number of those .machine directives > > in inline asm as well, which tends to work out fine as long as the > > entire kernel

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Segher Boessenkool
On Thu, Feb 24, 2022 at 03:05:28PM +1000, Nicholas Piggin wrote: > + * gcc 10 started to emit a .machine directive at the beginning of generated > + * .s files, which overrides assembler -Wa,-m options passed down. > + * Unclear if this behaviour will be reverted. It will not be reverted. If you

Re: cleanup swiotlb initialization

2022-02-24 Thread Boris Ostrovsky
On 2/24/22 11:39 AM, Christoph Hellwig wrote: On Thu, Feb 24, 2022 at 11:18:33AM -0500, Boris Ostrovsky wrote: On 2/24/22 10:58 AM, Christoph Hellwig wrote: Thanks. This looks really strange as early_amd_iommu_init should not interact much with the changes. I'll see if I can find a AMD

Re: cleanup swiotlb initialization

2022-02-24 Thread Christoph Hellwig
On Thu, Feb 24, 2022 at 11:18:33AM -0500, Boris Ostrovsky wrote: > > On 2/24/22 10:58 AM, Christoph Hellwig wrote: >> Thanks. >> >> This looks really strange as early_amd_iommu_init should not interact much >> with the changes. I'll see if I can find a AMD system to test on. > > > Just to be

[PATCHv2 2/3] powerpc: fix build errors

2022-02-24 Thread Anders Roxell
Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up: {standard input}: Assembler messages: {standard input}:1190: Error: unrecognized opcode: `stbcix' {standard input}:1433: Error: unrecognized opcode: `lwzcix' {standard

[PATCHv2 1/3] powerpc: lib: sstep: fix 'sthcx' instruction

2022-02-24 Thread Anders Roxell
Looks like there been a copy paste mistake when added the instruction 'stbcx' twice and one was probably meant to be 'sthcx'. Changing to 'sthcx' from 'stbcx'. Cc: # v4.13+ Fixes: 350779a29f11 ("powerpc: Handle most loads and stores in instruction emulation code") Reported-by: Arnd Bergmann

[PATCHv2 3/3] powerpc: lib: sstep: fix build errors

2022-02-24 Thread Anders Roxell
Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up: {standard input}: Assembler messages: {standard input}:10576: Error: unrecognized opcode: `stbcx.' {standard input}:10680: Error: unrecognized opcode: `lharx' {standard

Re: cleanup swiotlb initialization

2022-02-24 Thread Boris Ostrovsky
On 2/24/22 10:58 AM, Christoph Hellwig wrote: Thanks. This looks really strange as early_amd_iommu_init should not interact much with the changes. I'll see if I can find a AMD system to test on. Just to be clear: this crashes only as dom0. Boots fine as baremetal. -boris On Wed, Feb

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Anders Roxell
On Thu, 24 Feb 2022 at 13:39, Michael Ellerman wrote: > > Hi Anders, Hi Michael, > > Thanks for these, just a few comments below ... I will resolve the comments below and resend a v2 shortly. Cheers, Anders > > Anders Roxell writes: > > Building tinyconfig with gcc (Debian 11.2.0-16) and

Re: cleanup swiotlb initialization

2022-02-24 Thread Christoph Hellwig
Thanks. This looks really strange as early_amd_iommu_init should not interact much with the changes. I'll see if I can find a AMD system to test on. On Wed, Feb 23, 2022 at 07:57:49PM -0500, Boris Ostrovsky wrote: > [   37.377313] BUG: unable to handle page fault for address: c90042880018 >

Re: [PATCH v2 02/13] tracing: Fix selftest config check for function graph start up test

2022-02-24 Thread Steven Rostedt
On Thu, 24 Feb 2022 15:13:12 + Christophe Leroy wrote: > > But I'm working on a series to send to Linus. I can pick this patch up, as > > it touches just my code. > > > > That would be great, thanks. It's in my queue and running through my tests, which take 7 to 13 hours to complete

Re: [PATCH v7 05/14] sizes.h: Add SZ_1T macro

2022-02-24 Thread Lorenzo Pieralisi
On Fri, 21 Jan 2022 08:42:21 +, Christophe Leroy wrote: > Today drivers/pci/controller/pci-xgene.c defines SZ_1T > > Move it into linux/sizes.h so that it can be re-used elsewhere. > > Applied to pci/misc, thanks! [05/14] sizes.h: Add SZ_1T macro

Re: [PATCH v2 02/13] tracing: Fix selftest config check for function graph start up test

2022-02-24 Thread Christophe Leroy
Le 24/02/2022 à 15:53, Steven Rostedt a écrit : > On Thu, 24 Feb 2022 13:43:02 + > Christophe Leroy wrote: > >> Hi Michael, >> >> Le 20/12/2021 à 17:38, Christophe Leroy a écrit : >>> CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS is required to test >>> direct tramp. >>> >>> Signed-off-by:

Re: [PATCH v2 02/13] tracing: Fix selftest config check for function graph start up test

2022-02-24 Thread Steven Rostedt
On Thu, 24 Feb 2022 13:43:02 + Christophe Leroy wrote: > Hi Michael, > > Le 20/12/2021 à 17:38, Christophe Leroy a écrit : > > CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS is required to test > > direct tramp. > > > > Signed-off-by: Christophe Leroy > > You didn't apply this patch when you

Re: [PATCH v2 02/13] tracing: Fix selftest config check for function graph start up test

2022-02-24 Thread Christophe Leroy
Hi Michael, Le 20/12/2021 à 17:38, Christophe Leroy a écrit : > CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS is required to test > direct tramp. > > Signed-off-by: Christophe Leroy You didn't apply this patch when you merged the series. Without it I get the following : [6.191287] Testing

Re: [PATCH] powerpc/32: Clear volatile regs on syscall exit

2022-02-24 Thread Segher Boessenkool
Hi! On Thu, Feb 24, 2022 at 09:29:55AM +0100, Gabriel Paubert wrote: > On Wed, Feb 23, 2022 at 05:27:39PM -0600, Segher Boessenkool wrote: > > On Wed, Feb 23, 2022 at 09:48:09PM +0100, Gabriel Paubert wrote: > > > On Wed, Feb 23, 2022 at 06:11:36PM +0100, Christophe Leroy wrote: > > > > +

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Michael Ellerman
Hi Anders, Thanks for these, just a few comments below ... Anders Roxell writes: > Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian > 2.37.90.20220207) the following build error shows up: > > {standard input}: Assembler messages: > {standard input}:1190: Error:

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Nicholas Piggin
Excerpts from Arnd Bergmann's message of February 24, 2022 8:20 pm: > On Thu, Feb 24, 2022 at 11:11 AM Nicholas Piggin wrote: >> Excerpts from Arnd Bergmann's message of February 24, 2022 6:55 pm: >> > On Thu, Feb 24, 2022 at 6:05 AM Nicholas Piggin wrote: >> > We had the same thing on Arm a few

Re: [PATCH 05/11] swiotlb: pass a gfp_mask argument to swiotlb_init_late

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Let the caller chose a zone to allocate from. This is being used later via xen_swiotlb_gfp() on arm platform. > > Signed-off-by: Christoph Hellwig > --- > arch/x86/pci/sta2x11-fixup.c | 2 +- > include/linux/swiotlb.h | 2 +- >

Re: [PATCH 04/11] swiotlb: rename swiotlb_late_init_with_default_size

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > swiotlb_late_init_with_default_size is an overly verbose name that > doesn't even catch what the function is doing, given that the size is > not just a default but the actual requested size. > > Rename it to swiotlb_init_late. > > Signed-off-by:

Re: [PATCH 03/11] swiotlb: simplify swiotlb_max_segment

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Remove the bogus Xen override that was usually larger than the actual > size and just calculate the value on demand. Note that > swiotlb_max_segment still doesn't make sense as an interface and should > eventually be removed. > > Signed-off-by:

Re: [PATCH V6 11/20] riscv: compat: syscall: Add compat_sys_call_table implementation

2022-02-24 Thread Guo Ren
On Thu, Feb 24, 2022 at 5:38 PM Arnd Bergmann wrote: > > On Thu, Feb 24, 2022 at 9:54 AM wrote: > > > > From: Guo Ren > > > > Implement compat sys_call_table and some system call functions: > > truncate64, ftruncate64, fallocate, pread64, pwrite64, > > sync_file_range, readahead, fadvise64_64

Re: [PATCH 02/11] swiotlb: make swiotlb_exit a no-op if SWIOTLB_FORCE is set

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > If force bouncing is enabled we can't release the bufffers. typo > > Signed-off-by: Christoph Hellwig > --- > kernel/dma/swiotlb.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff

Re: [PATCH 01/11] dma-direct: use is_swiotlb_active in dma_direct_map_page

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Use the more specific is_swiotlb_active check instead of checking the > global swiotlb_force variable. > > Signed-off-by: Christoph Hellwig > --- > kernel/dma/direct.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 11:11 AM Nicholas Piggin wrote: > Excerpts from Arnd Bergmann's message of February 24, 2022 6:55 pm: > > On Thu, Feb 24, 2022 at 6:05 AM Nicholas Piggin wrote: > > We had the same thing on Arm a few years ago when binutils > > started enforcing this more strictly, and it

Re: [PATCH 07/11] x86: remove the IOMMU table infrastructure

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > The IOMMU table tries to separate the different IOMMUs into different > backends, but actually requires various cross calls. > > Rewrite the code to do the generic swiotlb/swiotlb-xen setup directly > in pci-dma.c and then just call into the IOMMU

Re: [PATCH 10/11] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-02-24 Thread Anshuman Khandual
On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Allow to pass a remap argument to the swiotlb initialization functions > to handle the Xen/x86 remap case. ARM/ARM64 never did any remapping > from xen_swiotlb_fixup, so we don't even need that quirk. > > Signed-off-by: Christoph Hellwig > --- >

Re: [PATCH V6 16/20] riscv: compat: vdso: Add rv32 VDSO base code implementation

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 9:54 AM wrote: > > From: Guo Ren > > There is no vgettimeofday supported in rv32 that makes simple to > generate rv32 vdso code which only needs riscv64 compiler. Other > architectures need change compiler or -m (machine parameter) to > support vdso32 compiling. If rv32

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Nicholas Piggin
Excerpts from Arnd Bergmann's message of February 24, 2022 6:55 pm: > On Thu, Feb 24, 2022 at 6:05 AM Nicholas Piggin wrote: >> Excerpts from Nicholas Piggin's message of February 24, 2022 12:54 pm: >> > >> > Not sure on the outlook for GCC fix. Either way unfortunately we have >> > toolchains in

Re: [PATCH V6 11/20] riscv: compat: syscall: Add compat_sys_call_table implementation

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 9:54 AM wrote: > > From: Guo Ren > > Implement compat sys_call_table and some system call functions: > truncate64, ftruncate64, fallocate, pread64, pwrite64, > sync_file_range, readahead, fadvise64_64 which need argument > translation. > > Signed-off-by: Guo Ren >

Re: [PATCH v4 0/3] KVM: PPC: Book3S PR: Fixes for AIL and SCV

2022-02-24 Thread Christian Borntraeger
Am 23.02.22 um 12:47 schrieb Nicholas Piggin: Excerpts from Christian Borntraeger's message of February 23, 2022 7:14 pm: Am 22.02.22 um 15:11 schrieb Paolo Bonzini: On 2/22/22 07:47, Nicholas Piggin wrote: Patch 3 requires a KVM_CAP_PPC number allocated. QEMU maintainers are happy with

[PATCH kernel v3] powerpc/64: Add UADDR64 relocation support

2022-02-24 Thread Alexey Kardashevskiy
When ld detects unaligned relocations, it emits R_PPC64_UADDR64 relocations instead of R_PPC64_RELATIVE. Currently R_PPC64_UADDR64 are detected by arch/powerpc/tools/relocs_check.sh and expected not to work. Below is a simple chunk to trigger this behaviour (this disables optimization for the

Re: [PATCH v3 3/4] powerpc/pseries/vas: Add VAS migration handler

2022-02-24 Thread Haren Myneni
On Wed, 2022-02-23 at 20:03 +1000, Nicholas Piggin wrote: > Excerpts from Haren Myneni's message of February 20, 2022 6:06 am: > > Since the VAS windows belong to the VAS hardware resource, the > > hypervisor expects the partition to close them on source partition > > and reopen them after the

Re: [PATCH V6 19/20] riscv: compat: ptrace: Add compat_arch_ptrace implement

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 9:54 AM wrote: > From: Guo Ren > > Signed-off-by: Guo Ren > Signed-off-by: Guo Ren > Reviewed-by: Palmer Dabbelt Reviewed-by: Arnd Bergmann

Re: [PATCH] powerpc/32: Clear volatile regs on syscall exit

2022-02-24 Thread Segher Boessenkool
On Wed, Feb 23, 2022 at 09:48:09PM +0100, Gabriel Paubert wrote: > On Wed, Feb 23, 2022 at 06:11:36PM +0100, Christophe Leroy wrote: > > + /* Zero volatile regs that may contain sensitive kernel data */ > > + li r0,0 > > + li r4,0 > > + li r5,0 > > + li r6,0 > > +

Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API

2022-02-24 Thread Christoph Hellwig
On Wed, Feb 23, 2022 at 09:26:56PM +0100, Christophe JAILLET wrote: > Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. > They all still apply cleanly. > > 04 has been picked it up for inclusion in the media subsystem for 5.18. > The other ones all have 1 or more Reviewed-by:/Acked-by:

RE: [PATCH v2] usercopy: Check valid lifetime via stack depth

2022-02-24 Thread David Laight
From: Kees Cook > Sent: 24 February 2022 06:04 > > Under CONFIG_HARDENED_USERCOPY=y, when exact stack frame boundary checking > is not available (i.e. everything except x86 with FRAME_POINTER), check > a stack object as being at least "current depth valid", in the sense > that any object within

[PATCH V6 20/20] riscv: compat: Add COMPAT Kbuild skeletal support

2022-02-24 Thread guoren
From: Guo Ren Adds initial skeletal COMPAT Kbuild (Running 32bit U-mode on 64bit S-mode) support. - Setup kconfig & dummy functions for compiling. - Implement compat_start_thread by the way. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann Cc: Palmer Dabbelt ---

[PATCH V6 19/20] riscv: compat: ptrace: Add compat_arch_ptrace implement

2022-02-24 Thread guoren
From: Guo Ren Now, you can use native gdb on riscv64 for rv32 app debugging. $ uname -a Linux buildroot 5.16.0-rc4-00036-gbef6b82fdf23-dirty #53 SMP Mon Dec 20 23:06:53 CST 2021 riscv64 GNU/Linux $ cat /proc/cpuinfo processor : 0 hart: 0 isa : rv64imafdcsuh mmu

[PATCH V6 18/20] riscv: compat: signal: Add rt_frame implementation

2022-02-24 Thread guoren
From: Guo Ren Implement compat_setup_rt_frame for sigcontext save & restore. The main process is the same with signal, but the rv32 pt_regs' size is different from rv64's, so we needs convert them. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Palmer Dabbelt Cc: Arnd Bergmann

[PATCH V6 17/20] riscv: compat: vdso: Add setup additional pages implementation

2022-02-24 Thread guoren
From: Guo Ren Reconstruct __setup_additional_pages() by appending vdso info pointer argument to meet compat_vdso_info requirement. And change vm_special_mapping *dm, *cm initialization into static. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Palmer Dabbelt Cc: Arnd Bergmann

[PATCH V6 16/20] riscv: compat: vdso: Add rv32 VDSO base code implementation

2022-02-24 Thread guoren
From: Guo Ren There is no vgettimeofday supported in rv32 that makes simple to generate rv32 vdso code which only needs riscv64 compiler. Other architectures need change compiler or -m (machine parameter) to support vdso32 compiling. If rv32 support vgettimeofday (which cause C compile) in

[PATCH V6 15/20] riscv: compat: Add hw capability check for elf

2022-02-24 Thread guoren
From: Guo Ren Detect hardware COMPAT (32bit U-mode) capability in rv64. If not support COMPAT mode in hw, compat_elf_check_arch would return false by compat_binfmt_elf.c Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann Cc: Christoph Hellwig --- arch/riscv/include/asm/elf.h |

[PATCH V6 14/20] riscv: compat: Add elf.h implementation

2022-02-24 Thread guoren
From: Guo Ren Implement necessary type and macro for compat elf. See the code comment for detail. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann --- arch/riscv/include/asm/elf.h | 46 +++- 1 file changed, 45 insertions(+), 1

[PATCH V6 13/20] riscv: compat: process: Add UXL_32 support in start_thread

2022-02-24 Thread guoren
From: Guo Ren If the current task is in COMPAT mode, set SR_UXL_32 in status for returning userspace. We need CONFIG _COMPAT to prevent compiling errors with rv32 defconfig. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann Cc: Palmer Dabbelt --- arch/riscv/kernel/process.c |

Re: [PATCH v2 07/18] nios2: drop access_ok() check from __put_user()

2022-02-24 Thread Dinh Nguyen
On 2/16/22 07:13, Arnd Bergmann wrote: From: Arnd Bergmann Unlike other architectures, the nios2 version of __put_user() has an extra check for access_ok(), preventing it from being used to implement __put_kernel_nofault(). Split up put_user() along the same lines as

[PATCH V6 12/20] riscv: compat: syscall: Add entry.S implementation

2022-02-24 Thread guoren
From: Guo Ren Implement the entry of compat_sys_call_table[] in asm. Ref to riscv-privileged spec 4.1.1 Supervisor Status Register (sstatus): BIT[32:33] = UXL[1:0]: - 1:32 - 2:64 - 3:128 Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Palmer Dabbelt Cc: Arnd Bergmann ---

[PATCH V6 11/20] riscv: compat: syscall: Add compat_sys_call_table implementation

2022-02-24 Thread guoren
From: Guo Ren Implement compat sys_call_table and some system call functions: truncate64, ftruncate64, fallocate, pread64, pwrite64, sync_file_range, readahead, fadvise64_64 which need argument translation. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann Cc: Palmer Dabbelt

[PATCH V6 10/20] riscv: compat: Re-implement TASK_SIZE for COMPAT_32BIT

2022-02-24 Thread guoren
From: Guo Ren Make TASK_SIZE from const to dynamic detect TIF_32BIT flag function. Refer to arm64 to implement DEFAULT_MAP_WINDOW_64 for efi-stub. Limit 32-bit compatible process in 0-2GB virtual address range (which is enough for real scenarios), because it could avoid address sign extend

[PATCH V6 09/20] riscv: compat: Add basic compat data type implementation

2022-02-24 Thread guoren
From: Guo Ren Implement riscv asm/compat.h for struct compat_xxx, is_compat_task, compat_user_regset, regset convert. The rv64 compat.h has inherited most of the structs from the generic one. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Cc: Arnd Bergmann Cc: Palmer Dabbelt ---

[PATCH V6 08/20] riscv: Fixup difference with defconfig

2022-02-24 Thread guoren
From: Guo Ren Let's follow the origin patch's spirit: The only difference between rv32_defconfig and defconfig is that rv32_defconfig has CONFIG_ARCH_RV32I=y. This is helpful to compare rv64-compat-rv32 v.s. rv32-linux. Fixes: 1b937e8faa87ccfb ("RISC-V: Add separate defconfig for 32bit

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 6:05 AM Nicholas Piggin wrote: > Excerpts from Nicholas Piggin's message of February 24, 2022 12:54 pm: > > > > Not sure on the outlook for GCC fix. Either way unfortunately we have > > toolchains in the wild now that will explode, so we might have to take > > your patches

[PATCH V6 07/20] syscalls: compat: Fix the missing part for __SYSCALL_COMPAT

2022-02-24 Thread guoren
From: Guo Ren Make "uapi asm unistd.h" could be used for architectures' COMPAT mode. The __SYSCALL_COMPAT is first used in riscv. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann Reviewed-by: Christoph Hellwig --- include/uapi/asm-generic/unistd.h | 4 ++--

[PATCH V6 06/20] asm-generic: compat: Cleanup duplicate definitions

2022-02-24 Thread guoren
From: Guo Ren There are 7 64bit architectures that support Linux COMPAT mode to run 32bit applications. A lot of definitions are duplicate: - COMPAT_USER_HZ - COMPAT_RLIM_INFINITY - COMPAT_OFF_T_MAX - __compat_uid_t, __compat_uid_t - compat_dev_t - compat_ipc_pid_t - struct compat_flock

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Nicholas Piggin
Excerpts from Anders Roxell's message of February 23, 2022 11:58 pm: > Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian > 2.37.90.20220207) the following build error shows up: > > {standard input}: Assembler messages: > {standard input}:1190: Error: unrecognized opcode:

[PATCH V6 05/20] fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT

2022-02-24 Thread guoren
From: Guo Ren RISC-V doesn't neeed compat_stat, so using __ARCH_WANT_COMPAT_STAT to exclude unnecessary SYSCALL functions. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Reviewed-by: Arnd Bergmann Reviewed-by: Christoph Hellwig Cc: Palmer Dabbelt --- arch/arm64/include/asm/unistd.h | 1 +

[PATCH V6 04/20] kconfig: Add SYSVIPC_COMPAT for all architectures

2022-02-24 Thread guoren
From: Guo Ren The existing per-arch definitions are pretty much historic cruft. Move SYSVIPC_COMPAT into init/Kconfig. Signed-off-by: Guo Ren Signed-off-by: Guo Ren Acked-by: Arnd Bergmann Reviewed-by: Christoph Hellwig Cc: Palmer Dabbelt --- arch/arm64/Kconfig | 4

[PATCH V6 03/20] compat: consolidate the compat_flock{, 64} definition

2022-02-24 Thread guoren
From: Christoph Hellwig Provide a single common definition for the compat_flock and compat_flock64 structures using the same tricks as for the native variants. Another extra define is added for the packing required on x86. Signed-off-by: Christoph Hellwig Signed-off-by: Guo Ren Reviewed-by:

[PATCH V6 02/20] uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h

2022-02-24 Thread guoren
From: Christoph Hellwig The F_GETLK64/F_SETLK64/F_SETLKW64 fcntl opcodes are only implemented for the 32-bit syscall APIs, but are also needed for compat handling on 64-bit kernels. Consolidate them in unistd.h instead of definining the internal compat definitions in compat.h, which is rather

[PATCH V6 01/20] uapi: simplify __ARCH_FLOCK{,64}_PAD a little

2022-02-24 Thread guoren
From: Christoph Hellwig Don't bother to define the symbols empty, just don't use them. That makes the intent a little more clear. Remove the unused HAVE_ARCH_STRUCT_FLOCK64 define and merge the 32-bit mips struct flock into the generic one. Add a new __ARCH_FLOCK_EXTRA_SYSID macro following

[PATCH V6 00/20] riscv: compat: Add COMPAT mode support for rv64

2022-02-24 Thread guoren
From: Guo Ren Currently, most 64-bit architectures (x86, parisc, powerpc, arm64, s390, mips, sparc) have supported COMPAT mode. But they all have history issues and can't use standard linux unistd.h. RISC-V would be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic /unistd.h. The

Re: [PATCH v3 2/4] powerpc/pseries/vas: Modify reconfig open/close functions for migration

2022-02-24 Thread Haren Myneni
On Wed, 2022-02-23 at 19:54 +1000, Nicholas Piggin wrote: > Excerpts from Haren Myneni's message of February 20, 2022 6:05 am: > > VAS is a hardware engine stays on the chip. So when the partition > > migrates, all VAS windows on the source system have to be closed > > and reopen them on the

[PATCH v2] usercopy: Check valid lifetime via stack depth

2022-02-24 Thread Kees Cook
Under CONFIG_HARDENED_USERCOPY=y, when exact stack frame boundary checking is not available (i.e. everything except x86 with FRAME_POINTER), check a stack object as being at least "current depth valid", in the sense that any object within the stack region but not between start-of-stack and

Re: [PATCH v2 18/18] uaccess: drop maining CONFIG_SET_FS users

2022-02-24 Thread Stafford Horne
On Wed, Feb 16, 2022 at 02:13:32PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > There are no remaining callers of set_fs(), so CONFIG_SET_FS > can be removed globally, along with the thread_info field and > any references to it. > > This turns access_ok() into a cheaper check against

Re: [PATCH V5 17/21] riscv: compat: vdso: Add setup additional pages implementation

2022-02-24 Thread Guo Ren
On Wed, Feb 23, 2022 at 9:42 AM Palmer Dabbelt wrote: > > On Tue, 01 Feb 2022 07:05:41 PST (-0800), guo...@kernel.org wrote: > > From: Guo Ren > > > > Reconstruct __setup_additional_pages() by appending vdso info > > pointer argument to meet compat_vdso_info requirement. And change > >

Re: [PATCH 1/3] powerpc: lib: sstep: fix 'sthcx' instruction

2022-02-24 Thread Nicholas Piggin
Excerpts from Anders Roxell's message of February 23, 2022 11:58 pm: > Looks like there been a copy paste mistake when added the instruction > 'stbcx' twice and one was probably meant to be 'sthcx'. > Changing to 'sthcx' from 'stbcx'. > > Cc: # v4.13+ > Fixes: 350779a29f11 ("powerpc: Handle most

Re: [PATCH v2 13/18] uaccess: generalize access_ok()

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 9:29 AM Stafford Horne wrote: > > - > > -#define access_ok(addr, size) > > \ > > -({ \ > > - __chk_user_ptr(addr);

Re: [PATCH] powerpc/32: Clear volatile regs on syscall exit

2022-02-24 Thread Christophe Leroy
Le 23/02/2022 à 20:34, Kees Cook a écrit : > On Wed, Feb 23, 2022 at 06:11:36PM +0100, Christophe Leroy wrote: >> Commit a82adfd5c7cb ("hardening: Introduce CONFIG_ZERO_CALL_USED_REGS") >> added zeroing of used registers at function exit. >> >> At the time being, PPC64 clears volatile registers

Re: [PATCH v6 0/4] Add perf interface to expose nvdimm

2022-02-24 Thread kajoljain
On 2/24/22 02:47, Dan Williams wrote: > On Wed, Feb 23, 2022 at 11:07 AM Dan Williams > wrote: >> >> On Fri, Feb 18, 2022 at 10:06 AM Dan Williams >> wrote: >>> >>> On Thu, Feb 17, 2022 at 8:34 AM Kajol Jain wrote: Patchset adds performance stats reporting support for nvdimm.

Re: [PATCH] powerpc/module_64: fix array_size.cocci warning

2022-02-24 Thread Russell Currey
On Wed, 2022-02-23 at 15:54 +0800, Guo Zhengkui wrote: > Fix following coccicheck warning: > ./arch/powerpc/kernel/module_64.c:432:40-41: WARNING: Use ARRAY_SIZE. > > ARRAY_SIZE(arr) is a macro provided by the kernel. It makes sure that > arr > is an array, so it's safer than sizeof(arr) /

Re: [PATCH] powerpc/32: Clear volatile regs on syscall exit

2022-02-24 Thread Gabriel Paubert
On Wed, Feb 23, 2022 at 05:27:39PM -0600, Segher Boessenkool wrote: > On Wed, Feb 23, 2022 at 09:48:09PM +0100, Gabriel Paubert wrote: > > On Wed, Feb 23, 2022 at 06:11:36PM +0100, Christophe Leroy wrote: > > > + /* Zero volatile regs that may contain sensitive kernel data */ > > > + li r0,0

Re: [PATCH v2 13/18] uaccess: generalize access_ok()

2022-02-24 Thread Stafford Horne
On Wed, Feb 16, 2022 at 02:13:27PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > There are many different ways that access_ok() is defined across > architectures, but in the end, they all just compare against the > user_addr_max() value or they accept anything. > > Provide one

Re: [PATCH v2 07/18] nios2: drop access_ok() check from __put_user()

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 12:30 AM Dinh Nguyen wrote: > On 2/16/22 07:13, Arnd Bergmann wrote: From: Arnd Bergmann > > > > Unlike other architectures, the nios2 version of __put_user() has an > > extra check for access_ok(), preventing it from being used to implement > > __put_kernel_nofault(). >

Re: [PATCH] powerpc/32: Clear volatile regs on syscall exit

2022-02-24 Thread Christophe Leroy
Le 23/02/2022 à 21:48, Gabriel Paubert a écrit : > On Wed, Feb 23, 2022 at 06:11:36PM +0100, Christophe Leroy wrote: >> Commit a82adfd5c7cb ("hardening: Introduce CONFIG_ZERO_CALL_USED_REGS") >> added zeroing of used registers at function exit. >> >> At the time being, PPC64 clears volatile

Re: cleanup swiotlb initialization

2022-02-24 Thread Boris Ostrovsky
On 2/22/22 10:35 AM, Christoph Hellwig wrote: Hi all, this series tries to clean up the swiotlb initialization, including that of swiotlb-xen. To get there is also removes the x86 iommu table infrastructure that massively obsfucates the initialization path. Git tree:

Re: [PATCH 00/16] Remove usage of the deprecated "pci-dma-compat.h" API

2022-02-24 Thread Arnd Bergmann
On Thu, Feb 24, 2022 at 7:25 AM Christoph Hellwig wrote: > > On Wed, Feb 23, 2022 at 09:26:56PM +0100, Christophe JAILLET wrote: > > Patch 01, 04, 05, 06, 08, 09 have not reached -next yet. > > They all still apply cleanly. > > > > 04 has been picked it up for inclusion in the media subsystem for

Re: [PATCH 2/3] powerpc: fix build errors

2022-02-24 Thread Nicholas Piggin
Excerpts from Nicholas Piggin's message of February 24, 2022 12:54 pm: > Excerpts from Anders Roxell's message of February 23, 2022 11:58 pm: >> Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian >> 2.37.90.20220207) the following build error shows up: >> >> {standard input}:

Re: [RFC PATCH 0/5] Avoid kdump service reload on CPU hotplug events

2022-02-24 Thread Sourabh Jain
Hello Baoquan, Hi, On 02/21/22 at 02:16pm, Sourabh Jain wrote: On hotplug event (CPU/memory) the CPU information prepared for the kdump kernel becomes stale unless it is prepared again. To keep the CPU information up-to-date a kdump service reload is triggered via the udev rule. The above