Re: [PATCH v4 1/2] selftests/resctrl: Fix schemata write error check

2023-09-27 Thread Maciej Wieczór-Retman
Hi, thanks for the review! On 2023-09-27 at 15:15:06 -0700, Reinette Chatre wrote: >Hi Maciej, > >On 9/22/2023 1:10 AM, Maciej Wieczor-Retman wrote: >> Writing bitmasks to the schemata can fail when the bitmask doesn't >> adhere to constraints defined by what a particular CPU supports. >> Some exa

Re: [PATCH 1/5] pstore: add tty frontend

2023-09-27 Thread Greg KH
On Thu, Sep 28, 2023 at 10:42:40AM +0800, Yuanhe Shu wrote: > Provide a pstore frontend which can log all messages that are send > to tty drivers when there are some problems with drivers or there > is no access to serial ports. > > Using pmsg requires us to redirect the output of the user state.

Re: [PATCH v4 0/2] selftests/resctrl: Bug fix and optimization

2023-09-27 Thread Maciej Wieczór-Retman
Thanks for catching these, I'll remember to do that the next time. On 2023-09-27 at 15:16:18 -0700, Reinette Chatre wrote: >Hi Maciej, > >On 9/22/2023 1:09 AM, Maciej Wieczor-Retman wrote: >> The resctrlfs.c file defines functions that interact with the resctrl FS >> while resctrl_val.c file defin

Re: [PATCH] kunit: debugfs: Handle errors from alloc_string_stream()

2023-09-27 Thread Dan Carpenter
On Wed, Sep 27, 2023 at 05:50:58PM +0100, Richard Fitzgerald wrote: > In kunit_debugfs_create_suite() give up and skip creating the debugfs > file if any of the alloc_string_stream() calls return an error or NULL. > Only put a value in the log pointer of kunit_suite and kunit_test if it > is a vali

[PATCH 4/5] pstore: remove the module parameter "backend"

2023-09-27 Thread Yuanhe Shu
Since all enabled backends have corresponding subdir in /sys/fs/pstore, and the logic of finding unexpected is changed by using psinfo_list rather than parameter backend, it is not necessary to retain the parameter backend. Remove the unnecessary module parameter "backend". Signed-off-by: Xingrui

[PATCH 5/5] tools/pstore: update pstore selftests

2023-09-27 Thread Yuanhe Shu
Update pstore selftests as pstore now supports multi backends Signed-off-by: Yuanhe Shu --- tools/testing/selftests/pstore/common_tests | 4 1 file changed, 4 deletions(-) diff --git a/tools/testing/selftests/pstore/common_tests b/tools/testing/selftests/pstore/common_tests index 4509f0cc

[PATCH 3/5] pstore: add subdirs for multi-backends

2023-09-27 Thread Yuanhe Shu
With pstore supporting multiple backends, since different backends may enable different kinds of frontends, records in the file system are very confusing. By simply modifying the file system, subdirs are added for each backend, each dir has the same name as the corresponding backend. Signed-off-b

[PATCH 2/5] pstore: add multi-backends support

2023-09-27 Thread Yuanhe Shu
Currently, pstore supports only one backend open at a time. Specifically, due to the global variable "psinfo", pstore only accepts the first registered backend. If a new backend wants to register later, pstore will simply reject it and return an error. This design forced us to close existing backen

[PATCH 1/5] pstore: add tty frontend

2023-09-27 Thread Yuanhe Shu
Provide a pstore frontend which can log all messages that are send to tty drivers when there are some problems with drivers or there is no access to serial ports. Using pmsg requires us to redirect the output of the user state. When we need to globally view the serial output of various processes,

[PATCH 0/5] pstore: add tty frontend and multi-backend

2023-09-27 Thread Yuanhe Shu
In public cloud scenario, if kdump service works abnormally, users cannot get vmcore. Without vmcore, user has no idea why the kernel crashed. Meanwhile, there is no additional information to find the reason why the kdump service is abnormal. One way is to obtain console messages through VNC. The

RE: [RFC 3/8] iommufd: Support attach/replace hwpt per pasid

2023-09-27 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Wednesday, September 27, 2023 11:44 PM > > On Wed, Sep 27, 2023 at 10:49:29AM +0800, Baolu Lu wrote: > > On 9/26/23 5:26 PM, Yi Liu wrote: > > > From: Kevin Tian > > > > > > This introduces three APIs for device drivers to manage pasid attach/ > > > replace/detach.

RE: [RFC 3/3] vfio/pci: Expose PCIe PASID capability to userspace

2023-09-27 Thread Tian, Kevin
> From: Alex Williamson > Sent: Thursday, September 28, 2023 2:53 AM > > On Wed, 27 Sep 2023 08:07:54 + > "Tian, Kevin" wrote: > > > > From: Liu, Yi L > > > Sent: Tuesday, September 26, 2023 5:31 PM > > > > > > This exposes PCIe PASID capability to userspace and where to emulate > this > >

[PATCH 2/5] KVM: x86: Constrain guest-supported xfeatures only at KVM_GET_XSAVE{2}

2023-09-27 Thread Sean Christopherson
Mask off xfeatures that aren't exposed to the guest only when saving guest state via KVM_GET_XSAVE{2} instead of modifying user_xfeatures directly. Preserving the maximal set of xfeatures in user_xfeatures restores KVM's ABI for KVM_SET_XSAVE, which prior to commit ad856280ddea ("x86/kvm/fpu: Limit

[PATCH 5/5] KVM: selftests: Force load all supported XSAVE state in state test

2023-09-27 Thread Sean Christopherson
Extend x86's state to forcefully load *all* host-supported xfeatures by modifying xstate_bv in the saved state. Stuffing xstate_bv ensures that the selftest is verifying KVM's full ABI regardless of whether or not the guest code is successful in getting various xfeatures out of their INIT state, e

[PATCH 4/5] KVM: selftests: Load XSAVE state into untouched vCPU during state test

2023-09-27 Thread Sean Christopherson
Expand x86's state test to load XSAVE state into a "dummy" vCPU prior to KVM_SET_CPUID2, and again with an empty guest CPUID model. Except for off-by-default features, i.e. AMX, KVM's ABI for KVM_SET_XSAVE is that userspace is allowed to load xfeatures so long as they are supported by the host. T

[PATCH 3/5] KVM: selftests: Touch relevant XSAVE state in guest for state test

2023-09-27 Thread Sean Christopherson
Modify support XSAVE state in the "state test's" guest code so that saving and loading state via KVM_{G,S}ET_XSAVE actually does something useful, i.e. so that xstate_bv in XSAVE state isn't empty. Punt on BNDCSR for now, it's easier to just stuff that xfeature from the host side. Signed-off-by:

[PATCH 1/5] x86/fpu: Allow caller to constrain xfeatures when copying to uabi buffer

2023-09-27 Thread Sean Christopherson
Plumb an xfeatures mask into __copy_xstate_to_uabi_buf() so that KVM can constrain which xfeatures are saved into the userspace buffer without having to modify the user_xfeatures field in KVM's guest_fpu state. KVM's ABI for KVM_GET_XSAVE{2} is that features that are not exposed to guest must not

[PATCH 0/5] KVM: x86: Fix breakage in KVM_SET_XSAVE's ABI

2023-09-27 Thread Sean Christopherson
Rework how KVM limits guest-unsupported xfeatures to effectively hide only when saving state for userspace (KVM_GET_XSAVE), i.e. to let userspace load all host-supported xfeatures (via KVM_SET_XSAVE) irrespective of what features have been exposed to the guest. The effect on KVM_SET_XSAVE was know

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread Jann Horn
On Wed, Sep 27, 2023 at 11:08 PM Suren Baghdasaryan wrote: > On Wed, Sep 27, 2023 at 1:42 PM Suren Baghdasaryan wrote: > > > > On Wed, Sep 27, 2023 at 1:04 PM Jann Horn wrote: > > > > > > On Wed, Sep 27, 2023 at 8:08 PM Suren Baghdasaryan > > > wrote: > > > > On Wed, Sep 27, 2023 at 5:47 AM Ja

Re: [PATCH v4 0/2] selftests/resctrl: Bug fix and optimization

2023-09-27 Thread Reinette Chatre
Hi Maciej, On 9/22/2023 1:09 AM, Maciej Wieczor-Retman wrote: > The resctrlfs.c file defines functions that interact with the resctrl FS > while resctrl_val.c file defines functions that perform measurements on > the cache. Run_benchmark() fits logically into the second file before > resctrl_val()

Re: [PATCH v4 1/2] selftests/resctrl: Fix schemata write error check

2023-09-27 Thread Reinette Chatre
Hi Maciej, On 9/22/2023 1:10 AM, Maciej Wieczor-Retman wrote: > Writing bitmasks to the schemata can fail when the bitmask doesn't > adhere to constraints defined by what a particular CPU supports. > Some example of constraints are max length or having contiguous bits. > The driver should properly

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread Suren Baghdasaryan
On Wed, Sep 27, 2023 at 1:42 PM Suren Baghdasaryan wrote: > > On Wed, Sep 27, 2023 at 1:04 PM Jann Horn wrote: > > > > On Wed, Sep 27, 2023 at 8:08 PM Suren Baghdasaryan > > wrote: > > > On Wed, Sep 27, 2023 at 5:47 AM Jann Horn wrote: > > > > On Sat, Sep 23, 2023 at 3:31 AM Suren Baghdasaryan

Re: [PATCH] kunit: debugfs: Handle errors from alloc_string_stream()

2023-09-27 Thread Rae Moar
On Wed, Sep 27, 2023 at 12:51 PM 'Richard Fitzgerald' via KUnit Development wrote: > > In kunit_debugfs_create_suite() give up and skip creating the debugfs > file if any of the alloc_string_stream() calls return an error or NULL. > Only put a value in the log pointer of kunit_suite and kunit_test

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread Suren Baghdasaryan
On Wed, Sep 27, 2023 at 1:04 PM Jann Horn wrote: > > On Wed, Sep 27, 2023 at 8:08 PM Suren Baghdasaryan wrote: > > On Wed, Sep 27, 2023 at 5:47 AM Jann Horn wrote: > > > On Sat, Sep 23, 2023 at 3:31 AM Suren Baghdasaryan > > > wrote: > > > > From: Andrea Arcangeli > > > > > > > > This impleme

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread Jann Horn
On Wed, Sep 27, 2023 at 8:08 PM Suren Baghdasaryan wrote: > On Wed, Sep 27, 2023 at 5:47 AM Jann Horn wrote: > > On Sat, Sep 23, 2023 at 3:31 AM Suren Baghdasaryan > > wrote: > > > From: Andrea Arcangeli > > > > > > This implements the uABI of UFFDIO_REMAP. > > > > > > Notably one mode bitflag

Re: [RFC 3/3] vfio/pci: Expose PCIe PASID capability to userspace

2023-09-27 Thread Alex Williamson
On Wed, 27 Sep 2023 08:07:54 + "Tian, Kevin" wrote: > > From: Liu, Yi L > > Sent: Tuesday, September 26, 2023 5:31 PM > > > > This exposes PCIe PASID capability to userspace and where to emulate this > > capability if wants to further expose it to VM. > > > > And this only exposes PASID ca

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread Suren Baghdasaryan
On Wed, Sep 27, 2023 at 6:29 AM David Hildenbrand wrote: > > >> +static int remap_anon_pte(struct mm_struct *dst_mm, struct mm_struct > >> *src_mm, > >> + struct vm_area_struct *dst_vma, > >> + struct vm_area_struct *src_vma, > >> +

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread Suren Baghdasaryan
On Wed, Sep 27, 2023 at 5:47 AM Jann Horn wrote: > > On Sat, Sep 23, 2023 at 3:31 AM Suren Baghdasaryan wrote: > > From: Andrea Arcangeli > > > > This implements the uABI of UFFDIO_REMAP. > > > > Notably one mode bitflag is also forwarded (and in turn known) by the > > lowlevel remap_pages metho

Re: potential new userfaultfd vs khugepaged conflict [was: Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI]

2023-09-27 Thread Suren Baghdasaryan
On Wed, Sep 27, 2023 at 3:07 AM Jann Horn wrote: > > [moving Hugh into "To:" recipients as FYI for khugepaged interaction] > > On Sat, Sep 23, 2023 at 3:31 AM Suren Baghdasaryan wrote: > > From: Andrea Arcangeli > > > > This implements the uABI of UFFDIO_REMAP. > > > > Notably one mode bitflag i

[PATCH] kunit: debugfs: Handle errors from alloc_string_stream()

2023-09-27 Thread Richard Fitzgerald
In kunit_debugfs_create_suite() give up and skip creating the debugfs file if any of the alloc_string_stream() calls return an error or NULL. Only put a value in the log pointer of kunit_suite and kunit_test if it is a valid pointer to a log. This prevents the potential invalid dereference reporte

Re: [RFC 3/8] iommufd: Support attach/replace hwpt per pasid

2023-09-27 Thread Jason Gunthorpe
On Wed, Sep 27, 2023 at 10:49:29AM +0800, Baolu Lu wrote: > On 9/26/23 5:26 PM, Yi Liu wrote: > > From: Kevin Tian > > > > This introduces three APIs for device drivers to manage pasid attach/ > > replace/detach. > > > > int iommufd_device_pasid_attach(struct iommufd_device *idev, > >

[RFC PATCH] kunit: run test suites only after module initialization completes

2023-09-27 Thread Marco Pagani
Commit 2810c1e99867 ("kunit: Fix wild-memory-access bug in kunit_free_suite_set()") causes test suites to run while the test module is still in MODULE_STATE_COMING. In that state, the module is not fully initialized, lacking sysfs, module_memory, args, init function. This behavior can cause all sor

Re: [PATCH v2 0/9] KVM RISC-V Conditional Operations

2023-09-27 Thread Anup Patel
On Wed, Sep 27, 2023 at 8:31 PM Palmer Dabbelt wrote: > > On Wed, 27 Sep 2023 07:45:28 PDT (-0700), Conor Dooley wrote: > > On Wed, Sep 27, 2023 at 07:54:49PM +0530, Anup Patel wrote: > >> On Mon, Sep 25, 2023 at 9:07 PM Conor Dooley wrote: > >> > > >> > On Mon, Sep 25, 2023 at 04:33:15PM +0100,

Re: [PATCH v2 0/9] KVM RISC-V Conditional Operations

2023-09-27 Thread Palmer Dabbelt
On Wed, 27 Sep 2023 07:45:28 PDT (-0700), Conor Dooley wrote: On Wed, Sep 27, 2023 at 07:54:49PM +0530, Anup Patel wrote: On Mon, Sep 25, 2023 at 9:07 PM Conor Dooley wrote: > > On Mon, Sep 25, 2023 at 04:33:15PM +0100, Conor Dooley wrote: > > On Mon, Sep 25, 2023 at 07:08:50PM +0530, Anup Pate

Re: [PATCH v2 0/9] KVM RISC-V Conditional Operations

2023-09-27 Thread Conor Dooley
On Wed, Sep 27, 2023 at 07:54:49PM +0530, Anup Patel wrote: > On Mon, Sep 25, 2023 at 9:07 PM Conor Dooley wrote: > > > > On Mon, Sep 25, 2023 at 04:33:15PM +0100, Conor Dooley wrote: > > > On Mon, Sep 25, 2023 at 07:08:50PM +0530, Anup Patel wrote: > > > > This series extends KVM RISC-V to allow

Re: [PATCH v2 0/9] KVM RISC-V Conditional Operations

2023-09-27 Thread Anup Patel
On Mon, Sep 25, 2023 at 9:07 PM Conor Dooley wrote: > > On Mon, Sep 25, 2023 at 04:33:15PM +0100, Conor Dooley wrote: > > On Mon, Sep 25, 2023 at 07:08:50PM +0530, Anup Patel wrote: > > > This series extends KVM RISC-V to allow Guest/VM discover and use > > > conditional operations related ISA ext

[PATCH v1 02/20] arm64/sysreg: update CPACR_EL1 register

2023-09-27 Thread Joey Gouly
Add E0POE bit that traps accesses to POR_EL0 from EL0. Updated according to DDI0601 2023-03. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/tools/sysreg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tool

[PATCH v1 00/20] Permission Overlay Extension

2023-09-27 Thread Joey Gouly
Hi all, This series implements the Permission Overlay Extension introduced in 2022 VMSA enhancements [1]. It is based on v6.6-rc3. The Permission Overlay Extension allows to constrain permissions on memory regions. This can be used from userspace (EL0) without a system call or TLB invalidation.

[PATCH v1 17/20] arm64: enable POE and PIE to coexist

2023-09-27 Thread Joey Gouly
Set the EL0/userspace indirection encodings to be the overlay enabled variants of the permissions. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/pgtable-prot.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/incl

[PATCH v1 01/20] arm64/sysreg: add system register POR_EL{0,1}

2023-09-27 Thread Joey Gouly
Add POR_EL{0,1} according to DDI0601 2023-03. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/sysreg.h | 13 + arch/arm64/tools/sysreg | 8 2 files changed, 21 insertions(+) diff --git a/arch/arm64/include/asm/sysreg.h b/a

[PATCH v1 05/20] arm64: context switch POR_EL0 register

2023-09-27 Thread Joey Gouly
POR_EL0 is a register that can be modified by userspace directly, so it must be context switched. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/processor.h | 1 + arch/arm64/include/asm/sysreg.h| 3 +++ arch/arm64/kernel/process.c| 16 ++

[PATCH v1 19/20] selftests: mm: move fpregs printing

2023-09-27 Thread Joey Gouly
arm64's fpregs are not at a constant offset from sigcontext. Since this is not an important part of the test, don't print the fpregs pointer on arm64. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Andrew Morton Cc: Shuah Khan Cc: Dave Hansen Cc: Aneesh Kumar K.V --- too

[PATCH v1 14/20] arm64: implement PKEYS support

2023-09-27 Thread Joey Gouly
Implement the PKEYS interface, using the Permission Overlay Extension. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/mmu.h | 2 + arch/arm64/include/asm/mmu_context.h | 32 - arch/arm64/include/asm/pgtable.h | 23 +- a

[PATCH v1 18/20] kselftest/arm64: move get_header()

2023-09-27 Thread Joey Gouly
Put this function in the header so that it can be used by other tests, without needing to link to testcases.c. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Andrew Morton Cc: Shuah Khan Cc: Dave Hansen Cc: Aneesh Kumar K.V --- .../arm64/signal/testcases/testcases.c

[PATCH v1 15/20] arm64: add POE signal support

2023-09-27 Thread Joey Gouly
Add PKEY support to signals, by saving and restoring POR_EL0 from the stackframe. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/uapi/asm/sigcontext.h | 7 arch/arm64/kernel/signal.c | 51 2 files changed, 58 i

[PATCH v1 20/20] selftests: mm: make protection_keys test work on arm64

2023-09-27 Thread Joey Gouly
The encoding of the pkey register differs on arm64, than on x86/ppc. On those platforms, a bit in the register is used to disable permissions, for arm64, a bit enabled in the register indicates that the permission is allowed. This drops two asserts of the form: assert(read_pkey_reg() <= o

[PATCH v1 16/20] arm64: enable PKEY support for CPUs with S1POE

2023-09-27 Thread Joey Gouly
Now that PKEYs support has been implemented, enable it for CPUs that support S1POE. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/pkeys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pkeys.h b/arch/arm64/i

[PATCH v1 11/20] arm64: enable ARCH_HAS_PKEYS on arm64

2023-09-27 Thread Joey Gouly
Enable the ARCH_HAS_PKEYS config, but provide dummy functions for the entire interface. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/pkeys.h | 54 ++ arch/arm64/mm/mmu.c

[PATCH v1 12/20] arm64: handle PKEY/POE faults

2023-09-27 Thread Joey Gouly
If a memory fault occurs that is due to an overlay/pkey fault, report that to userspace with a SEGV_PKUERR. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/traps.h | 1 + arch/arm64/kernel/traps.c | 12 -- arch/arm64/mm/fault.c |

[PATCH v1 08/20] arm64: add POIndex defines

2023-09-27 Thread Joey Gouly
The 3-bit POIndex is stored in the PTE at bits 60..62. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/pgtable-hwdef.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtab

[PATCH v1 13/20] arm64: stop using generic mm_hooks.h

2023-09-27 Thread Joey Gouly
These functions will be extended to support pkeys. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/mmu_context.h | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64

[PATCH v1 03/20] arm64: cpufeature: add Permission Overlay Extension cpucap

2023-09-27 Thread Joey Gouly
This indicates if the system supports POE. This is a CPUCAP_BOOT_CPU_FEATURE as the boot CPU will enable POE if it has it, so secondary CPUs must also have this feature. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/kernel/cpufeature.c | 7 +++ arch/arm64/too

[PATCH v1 09/20] arm64: define VM_PKEY_BIT* for arm64

2023-09-27 Thread Joey Gouly
Define the VM_PKEY_BIT* values for arm64, and convert them into the arm64 specific pgprot values. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/mman.h | 6 +- arch/arm64/mm/mmap.c | 7 +++ fs/proc/task_mmu.c| 2 ++ incl

[PATCH v1 04/20] arm64: disable trapping of POR_EL0 to EL2

2023-09-27 Thread Joey Gouly
Allow EL0 or EL1 to access POR_EL0 without being trapped to EL2. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/el2_setup.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/i

[PATCH v1 06/20] KVM: arm64: Save/restore POE registers

2023-09-27 Thread Joey Gouly
Define the new system registers that POE introduces and context switch them. Signed-off-by: Joey Gouly Cc: Marc Zyngier Cc: Oliver Upton Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/kvm_host.h | 4 arch/arm64/kvm/sys_regs.c | 2 ++ 2 files changed, 6 insertions

[PATCH v1 07/20] arm64: enable the Permission Overlay Extension for EL0

2023-09-27 Thread Joey Gouly
Expose a HWCAP and ID_AA64MMFR3_EL1_S1POE to userspace, so they can be used to check if the CPU supports the feature. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- Documentation/arch/arm64/elf_hwcaps.rst | 3 +++ arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/inc

[PATCH v1 10/20] arm64: mask out POIndex when modifying a PTE

2023-09-27 Thread Joey Gouly
When a PTE is modified, the POIndex must be masked off so that it can be modified. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/pgtable.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arc

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread David Hildenbrand
+static int remap_anon_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, + struct vm_area_struct *dst_vma, + struct vm_area_struct *src_vma, + unsigned long dst_addr, unsigned long src_addr, + pte

[PATCH] drivers: base: test: Make property entry API test modular

2023-09-27 Thread Geert Uytterhoeven
There is no reason why the KUnit Tests for the property entry API can only be built-in. Add support for building these tests as a loadable module, like is supported by most other tests. Signed-off-by: Geert Uytterhoeven --- drivers/base/test/Kconfig | 4 ++-- drivers/base/test/pro

Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI

2023-09-27 Thread Jann Horn
On Sat, Sep 23, 2023 at 3:31 AM Suren Baghdasaryan wrote: > From: Andrea Arcangeli > > This implements the uABI of UFFDIO_REMAP. > > Notably one mode bitflag is also forwarded (and in turn known) by the > lowlevel remap_pages method. > > Signed-off-by: Andrea Arcangeli > Signed-off-by: Suren Bag

Re: [PATCH] selftests/x86/lam: Zero out buffer for readlink()

2023-09-27 Thread kirill . shutemov
On Sun, Sep 24, 2023 at 07:33:46AM +0800, Binbin Wu wrote: > Zero out the buffer for readlink() since readlink() does not append a > terminating null byte to the buffer. > > Fixes: 833c12ce0f430 ("selftests/x86/lam: Add inherit test cases for > linear-address masking") > > Signed-off-by: Binbin

[PATCH 3/3] selftests: timers: Convert nsleep-lat test to generate KTAP output

2023-09-27 Thread Mark Brown
Currently the nsleep-lat test does not produce KTAP output but rather a custom format. This means that we only get a pass/fail for the suite, not for each individual test that the suite does. Convert to using the standard kselftest output functions which result in KTAP output being generated. Sign

[PATCH 2/3] selftests: timers: Convert posix_timers test to generate KTAP output

2023-09-27 Thread Mark Brown
Currently the posix_timers test does not produce KTAP output but rather a custom format. This means that we only get a pass/fail for the suite, not for each individual test that the suite does. Convert to using the standard kselftest output functions which result in KTAP output being generated. As

[PATCH 1/3] kselftest: Add a ksft_perror() helper

2023-09-27 Thread Mark Brown
The standard library perror() function provides a convenient way to print an error message based on the current errno but this doesn't play nicely with KTAP output. Provide a helper which does an equivalent thing in a KTAP compatible format. nolibc doesn't have a strerror() and adding the table of

[PATCH 0/3] selftests: timers: Convert some more of the timers tests to KTAP

2023-09-27 Thread Mark Brown
KTAP is the standard output format for selftests, providing a method for systems running the selftests to get results from individual tests rather than just a pass/fail for the test program as a whole. While many of the timers tests use KTAP some have custom output formats, let's convert a few mor

potential new userfaultfd vs khugepaged conflict [was: Re: [PATCH v2 2/3] userfaultfd: UFFDIO_REMAP uABI]

2023-09-27 Thread Jann Horn
[moving Hugh into "To:" recipients as FYI for khugepaged interaction] On Sat, Sep 23, 2023 at 3:31 AM Suren Baghdasaryan wrote: > From: Andrea Arcangeli > > This implements the uABI of UFFDIO_REMAP. > > Notably one mode bitflag is also forwarded (and in turn known) by the > lowlevel remap_pages

[PATCH v4 2/4] kunit: Fix the wrong kfree of copy for kunit_filter_suites()

2023-09-27 Thread Jinjie Ruan
If the outer layer for loop is iterated more than once and it fails not in the first iteration, the copy pointer has been moved. So it should free the original copy's backup copy_start. Fixes: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()") Signed-off-by: Jinjie Ruan Rev

[PATCH v4 1/4] kunit: Fix missed memory release in kunit_free_suite_set()

2023-09-27 Thread Jinjie Ruan
modprobe cpumask_kunit and rmmod cpumask_kunit, kmemleak detect a suspected memory leak as below. If kunit_filter_suites() in kunit_module_init() succeeds, the suite_set.start will not be NULL and the kunit_free_suite_set() in kunit_module_exit() should free all the memory which has not been freed

[PATCH v4 4/4] kunit: test: Fix the possible memory leak in executor_test

2023-09-27 Thread Jinjie Ruan
When CONFIG_KUNIT_ALL_TESTS=y, making CONFIG_DEBUG_KMEMLEAK=y and CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y, the below memory leak is detected. If kunit_filter_suites() succeeds, not only copy but also filtered_suite and filtered_suite->test_cases should be freed. So as Rae suggested, to avoid the suite

[PATCH v4 0/4] kunit: Fix some bugs in kunit

2023-09-27 Thread Jinjie Ruan
The test_cases is not freed in kunit_free_suite_set(). And the copy pointer may be moved in kunit_filter_suites(). The filtered_suite and filtered_suite->test_cases allocated in the last kunit_filter_attr_tests() in last inner for loop may be leaked if kunit_filter_suites() fails. If kunit_filte

[PATCH v4 3/4] kunit: Fix possible memory leak in kunit_filter_suites()

2023-09-27 Thread Jinjie Ruan
If the outer layer for loop is iterated more than once and it fails not in the first iteration, the filtered_suite and filtered_suite->test_cases allocated in the last kunit_filter_attr_tests() in last inner for loop is leaked. So add a new free_filtered_suite err label and free the filtered_suite

Re: [PATCH] bridge: MTU auto tuning ignores IFLA_MTU on NEWLINK

2023-09-27 Thread Nikolay Aleksandrov
On 9/27/23 11:10, Nikolay Aleksandrov wrote: On 9/27/23 10:57, Trent Lloyd wrote: Commit 804b854d374e ("net: bridge: disable bridge MTU auto tuning if it was set manually") disabled auto-tuning of the bridge MTU when the MTU was explicitly set by the user, however that would only happen when the

Re: [PATCH] bridge: MTU auto tuning ignores IFLA_MTU on NEWLINK

2023-09-27 Thread Nikolay Aleksandrov
On 9/27/23 10:57, Trent Lloyd wrote: Commit 804b854d374e ("net: bridge: disable bridge MTU auto tuning if it was set manually") disabled auto-tuning of the bridge MTU when the MTU was explicitly set by the user, however that would only happen when the MTU was set after creation. This commit ensur

RE: [RFC 8/8] iommu/vt-d: Add set_dev_pasid callback for nested domain

2023-09-27 Thread Tian, Kevin
> From: Baolu Lu > Sent: Wednesday, September 27, 2023 3:58 PM > > On 2023/9/27 15:52, Tian, Kevin wrote: > >> From: Liu, Yi L > >> Sent: Tuesday, September 26, 2023 5:27 PM > >> > >> From: Lu Baolu > >> > >> This allows the upper layers to set a nested type domain to a PASID of a > >> device if

RE: [RFC 3/3] vfio/pci: Expose PCIe PASID capability to userspace

2023-09-27 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Tuesday, September 26, 2023 5:31 PM > > This exposes PCIe PASID capability to userspace and where to emulate this > capability if wants to further expose it to VM. > > And this only exposes PASID capability for devices which has PCIe PASID > extended struture in its con

[PATCH] bridge: MTU auto tuning ignores IFLA_MTU on NEWLINK

2023-09-27 Thread Trent Lloyd
Commit 804b854d374e ("net: bridge: disable bridge MTU auto tuning if it was set manually") disabled auto-tuning of the bridge MTU when the MTU was explicitly set by the user, however that would only happen when the MTU was set after creation. This commit ensures auto-tuning is also disabled when th

Re: [RFC 8/8] iommu/vt-d: Add set_dev_pasid callback for nested domain

2023-09-27 Thread Baolu Lu
On 2023/9/27 15:52, Tian, Kevin wrote: From: Liu, Yi L Sent: Tuesday, September 26, 2023 5:27 PM From: Lu Baolu This allows the upper layers to set a nested type domain to a PASID of a device if the PASID feature is supported by the IOMMU hardware. Signed-off-by: Lu Baolu Signed-off-by: Yi Liu

RE: [RFC 8/8] iommu/vt-d: Add set_dev_pasid callback for nested domain

2023-09-27 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Tuesday, September 26, 2023 5:27 PM > > From: Lu Baolu > > This allows the upper layers to set a nested type domain to a PASID of a > device if the PASID feature is supported by the IOMMU hardware. > > Signed-off-by: Lu Baolu > Signed-off-by: Yi Liu > --- > drivers

RE: [RFC 1/8] iommu: Introduce a replace API for device pasid

2023-09-27 Thread Tian, Kevin
> From: Baolu Lu > Sent: Wednesday, September 27, 2023 10:05 AM > > On 9/26/23 5:26 PM, Yi Liu wrote: > > > > +/** > > + * iommu_replace_device_pasid - replace the domain that a pasid is > attached to > > + * @domain: new IOMMU domain to replace with > > + * @dev: the physical device > > + * @pas

RE: [PATCH v5 11/11] iommu/vt-d: Disallow read-only mappings to nest parent domain

2023-09-27 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Thursday, September 21, 2023 3:55 PM > > From: Lu Baolu > > When remapping hardware is configured by system software in scalable > mode > as Nested (PGTT=011b) and with PWSNP field Set in the PASID-table-entry, > it may Set Accessed bit and Dirty bit (and Extended Acce