Re: [RFC 6/7] iommufd/selftest: Add test coverage for SIOV virtual device

2023-11-08 Thread Yi Liu
On 2023/10/10 16:30, Tian, Kevin wrote: From: Liu, Yi L Sent: Monday, October 9, 2023 4:51 PM @@ -2071,6 +2083,43 @@ TEST_F(iommufd_device_pasid, pasid_attach) IOMMU_HWPT_ALLOC_DATA_SELFTEST, , sizeof(data)); + if (variant->pasid) { +

Re: [PATCH] selftests: sud_test: return correct emulated syscall value on RISC-V

2023-11-08 Thread Palmer Dabbelt
On Wed, 13 Sep 2023 07:07:11 PDT (-0700), cle...@rivosinc.com wrote: Currently, the sud_test expects the emulated syscall to return the emulated syscall number. This assumption only works on architectures were the syscall calling convention use the same register for syscall number/syscall return

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-08 Thread Mina Almasry
On Wed, Nov 8, 2023 at 2:56 AM Yunsheng Lin wrote: > > On 2023/11/8 5:56, Mina Almasry wrote: > > On Tue, Nov 7, 2023 at 12:00 AM Yunsheng Lin wrote: > >> > >> On 2023/11/6 10:44, Mina Almasry wrote: > >>> Overload the LSB of struct page* to indicate that it's a page_pool_iov. > >>> > >>>

Re: [RFC PATCH v3 10/12] tcp: RX path for devmem TCP

2023-11-08 Thread Mina Almasry
On Tue, Nov 7, 2023 at 4:01 PM David Ahern wrote: > > On 11/7/23 4:55 PM, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 4:03 PM Willem de Bruijn > > wrote: > >> > >> On Mon, Nov 6, 2023 at 3:55 PM David Ahern wrote: > >>> > >>> On 11/6/23 4:32 PM, Stanislav Fomichev wrote: > > The concise

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-08 Thread Mina Almasry
On Wed, Nov 8, 2023 at 3:47 PM David Wei wrote: > > On 2023-11-05 18:44, Mina Almasry wrote: > > Add a netdev_dmabuf_binding struct which represents the > > dma-buf-to-netdevice binding. The netlink API will bind the dma-buf to > > rx queues on the netdevice. On the binding, the dma_buf_attach >

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-08 Thread Mina Almasry
On Tue, Nov 7, 2023 at 7:40 PM Yunsheng Lin wrote: > > On 2023/11/8 5:59, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 11:46 PM Yunsheng Lin wrote: > >> > >> On 2023/11/6 10:44, Mina Almasry wrote: > >>> + > >>> +void __netdev_devmem_binding_free(struct netdev_dmabuf_binding *binding) > >>> +{

Re: [PATCH v5 0/6] workload-specific and memory pressure-driven zswap writeback

2023-11-08 Thread Chris Li
On Wed, Nov 8, 2023 at 4:28 PM Nhat Pham wrote: > > Hmm my guess is that I probably sent this out based on an outdated > mm-unstable. There has since been a new zswap selftest merged > to mm-unstable (written by no other than myself - oh the irony), so > maybe it does not apply cleanly anymore

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-08 Thread Mina Almasry
> > On Mon, Nov 6, 2023 at 11:45 PM Yunsheng Lin wrote: > >> > >> On 2023/11/6 10:44, Mina Almasry wrote: > >>> + > >>> +void netdev_free_devmem(struct page_pool_iov *ppiov) > >>> +{ > >>> + struct netdev_dmabuf_binding *binding = > >>> page_pool_iov_binding(ppiov); > >>> + > >>> +

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-08 Thread David Wei
On 2023-11-07 15:03, Mina Almasry wrote: > On Tue, Nov 7, 2023 at 2:55 PM David Ahern wrote: >> >> On 11/7/23 3:10 PM, Mina Almasry wrote: >>> On Mon, Nov 6, 2023 at 3:44 PM David Ahern wrote: On 11/5/23 7:44 PM, Mina Almasry wrote: > diff --git a/include/linux/netdevice.h

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-08 Thread David Wei
On 2023-11-07 14:55, David Ahern wrote: > On 11/7/23 3:10 PM, Mina Almasry wrote: >> On Mon, Nov 6, 2023 at 3:44 PM David Ahern wrote: >>> >>> On 11/5/23 7:44 PM, Mina Almasry wrote: diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index eeeda849115c..1c351c138a5b

Re: [PATCH v5 0/6] workload-specific and memory pressure-driven zswap writeback

2023-11-08 Thread Nhat Pham
On Wed, Nov 8, 2023 at 3:12 PM Chris Li wrote: > > Hi Nhat, > > On Wed, Nov 8, 2023 at 1:15 PM Nhat Pham wrote: > > > > Ah that was meant to be a fixlet - so that on top of the original > > "zswap: make shrinking memcg-aware" patch. The intention was > > to eventually squash it... > > > > But

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-08 Thread David Wei
On 2023-11-05 18:44, Mina Almasry wrote: > Add a netdev_dmabuf_binding struct which represents the > dma-buf-to-netdevice binding. The netlink API will bind the dma-buf to > rx queues on the netdevice. On the binding, the dma_buf_attach > & dma_buf_map_attachment will occur. The entries in the

Re: [PATCH v5 0/6] workload-specific and memory pressure-driven zswap writeback

2023-11-08 Thread Chris Li
Hi Nhat, On Wed, Nov 8, 2023 at 1:15 PM Nhat Pham wrote: > > Ah that was meant to be a fixlet - so that on top of the original > "zswap: make shrinking memcg-aware" patch. The intention was > to eventually squash it... > > But this is getting a bit annoyingly confusing, I admit. I just rebased

Re: [PATCH v5 0/6] workload-specific and memory pressure-driven zswap writeback

2023-11-08 Thread Nhat Pham
On Wed, Nov 8, 2023 at 11:46 AM Chris Li wrote: > > Hi Nhat, > > Sorry for being late to the party. I want to take a look at your patches > series. > However I wasn't able to "git am" your patches series cleanly on current > mm-stable, mm-unstable or linux tip. > > $ git am >

[PATCH v5 3/6 REPLACE] zswap: make shrinking memcg-aware

2023-11-08 Thread Nhat Pham
From: Domenico Cerasuolo Currently, we only have a single global LRU for zswap. This makes it impossible to perform worload-specific shrinking - an memcg cannot determine which pages in the pool it owns, and often ends up writing pages from other memcgs. This issue has been previously observed

Re: [PATCH v5 0/6] workload-specific and memory pressure-driven zswap writeback

2023-11-08 Thread Chris Li
Hi Nhat, Sorry for being late to the party. I want to take a look at your patches series. However I wasn't able to "git am" your patches series cleanly on current mm-stable, mm-unstable or linux tip. $ git am

[PATCH v1 16/23] KVM: nVMX: Add FRED VMCS fields

2023-11-08 Thread Xin Li
Add FRED VMCS fields to nested VMX context management. Tested-by: Shan Kang Signed-off-by: Xin Li --- Documentation/virt/kvm/x86/nested-vmx.rst | 18 +++ arch/x86/include/asm/hyperv-tlfs.h| 18 +++ arch/x86/kvm/vmx/hyperv.c | 38 ++ arch/x86/kvm/vmx/nested.c

[PATCH v1 10/23] KVM: VMX: Add support for FRED context save/restore

2023-11-08 Thread Xin Li
Handle host initiated FRED MSR access requests to allow FRED context to be set/get from user level. During VM save/restore and live migration, FRED context needs to be saved/restored, which requires FRED MSRs to be accessed from a user level application, e.g., Qemu. Note, handling of

[PATCH v1 23/23] KVM: selftests: Add fred exception tests

2023-11-08 Thread Xin Li
From: Shan Kang Add tests for FRED event data and VMX nested-exception. FRED is designed to save a complete event context in its stack frame, e.g., FRED saves the faulting linear address of a #PF into a 64-bit event data field defined in FRED stack frame. As such, FRED VMX adds event data

[PATCH v1 21/23] KVM: selftests: Run debug_regs test with FRED enabled

2023-11-08 Thread Xin Li
Run another round of debug_regs test with FRED enabled if FRED is available. Signed-off-by: Xin Li --- .../selftests/kvm/include/x86_64/processor.h | 4 ++ .../testing/selftests/kvm/x86_64/debug_regs.c | 50 ++- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git

[PATCH v1 15/23] KVM: nVMX: Add support for the secondary VM exit controls

2023-11-08 Thread Xin Li
Enable the secondary VM exit controls to prepare for nested FRED. Tested-by: Shan Kang Signed-off-by: Xin Li --- Documentation/virt/kvm/x86/nested-vmx.rst | 1 + arch/x86/include/asm/hyperv-tlfs.h| 1 + arch/x86/kvm/vmx/capabilities.h | 1 + arch/x86/kvm/vmx/hyperv.c

[PATCH v1 17/23] KVM: nVMX: Add support for VMX FRED controls

2023-11-08 Thread Xin Li
Add VMX FRED controls to nested VMX controls and set the VMX nested-exception support bit (bit 58) in the nested IA32_VMX_BASIC MSR when FRED is enabled. Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/kvm/vmx/hyperv.c | 7 +-- arch/x86/kvm/vmx/nested.c | 14 ++

[PATCH v1 18/23] KVM: nVMX: Add VMCS FRED states checking

2023-11-08 Thread Xin Li
Add FRED related VMCS fields checkings. As real hardware, nested VMX performs checks on various VMCS fields, including both controls and guest/host states. With the introduction of VMX FRED, add FRED related VMCS fields checkings. Tested-by: Shan Kang Signed-off-by: Xin Li ---

[PATCH v1 14/23] KVM: VMX: Dump FRED context in dump_vmcs()

2023-11-08 Thread Xin Li
Add FRED related VMCS fields to dump_vmcs() to have it dump FRED context. Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/kvm/vmx/vmx.c | 48 -- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c

[PATCH v1 08/23] KVM: VMX: Initialize VMCS FRED fields

2023-11-08 Thread Xin Li
Initialize host VMCS FRED fields with host FRED MSRs' value and guest VMCS FRED fields to 0. FRED CPU states are managed in 9 new FRED MSRs, as well as a few existing CPU registers and MSRs, e.g., CR4.FRED. To support FRED context management, new VMCS fields corresponding to most of FRED CPU

[PATCH v1 22/23] KVM: selftests: Add a new VM guest mode to run user level code

2023-11-08 Thread Xin Li
Add a new VM guest mode VM_MODE_PXXV48_4K_USER to set the user bit of guest page table entries, thus allow user level code to run in guests. Suggested-by: Sean Christopherson Signed-off-by: Xin Li --- .../testing/selftests/kvm/include/kvm_util_base.h | 1 +

[PATCH v1 11/23] KVM: x86: Add kvm_is_fred_enabled()

2023-11-08 Thread Xin Li
Add kvm_is_fred_enabled() to get if FRED is enabled on a vCPU. Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/kvm/kvm_cache_regs.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h index

[PATCH v1 20/23] KVM: selftests: Add FRED VMCS fields to evmcs

2023-11-08 Thread Xin Li
Add FRED VMCS fields to evmcs. Signed-off-by: Xin Li --- .../selftests/kvm/include/x86_64/evmcs.h | 146 ++ .../selftests/kvm/include/x86_64/vmx.h| 20 +++ 2 files changed, 166 insertions(+) diff --git a/tools/testing/selftests/kvm/include/x86_64/evmcs.h

[PATCH v1 13/23] KVM: VMX: Handle VMX nested exception for FRED

2023-11-08 Thread Xin Li
Set VMX nested exception bit in the VM-entry interruption information VMCS field when injecting a nested exception using FRED event delivery to ensure: 1) The nested exception is injected on a correct stack level. 2) The nested bit defined in FRED stack frame is set. The event stack level

[PATCH v1 12/23] KVM: VMX: Handle FRED event data

2023-11-08 Thread Xin Li
Set injected-event data when injecting a #PF, #DB, or #NM caused by extended feature disable using FRED event delivery, and save original-event data for being used as injected-event data. Unlike IDT using some extra CPU register as part of an event context, e.g., %cr2 for #PF, FRED saves a

[PATCH v1 05/23] KVM: VMX: Initialize FRED VM entry/exit controls in vmcs_config

2023-11-08 Thread Xin Li
Setup the global vmcs_config for FRED: 1) Add VM_ENTRY_LOAD_IA32_FRED to KVM_OPTIONAL_VMX_VM_ENTRY_CONTROLS to have a FRED CPU load guest FRED MSRs from VMCS upon VM entry. 2) Add SECONDARY_VM_EXIT_SAVE_IA32_FRED to KVM_OPTIONAL_VMX_SECONDARY_VM_EXIT_CONTROLS to have a FRED CPU save guest

[PATCH v1 04/23] KVM: x86: Mark CR4.FRED as not reserved

2023-11-08 Thread Xin Li
The CR4.FRED bit, i.e., CR4[32], is no longer a reserved bit when a guest enumerates FRED, otherwise it is still a reserved bit. Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/kvm/x86.h | 2 ++ 2 files changed, 4 insertions(+), 1

[PATCH v1 02/23] KVM: VMX: Cleanup VMX misc information defines and usages

2023-11-08 Thread Xin Li
Define VMX misc information fields with BIT_ULL()/GENMASK_ULL(), and move VMX misc field macros to vmx.h if used in multiple files or where they are used only once. Signed-off-by: Xin Li --- arch/x86/include/asm/msr-index.h | 5 - arch/x86/include/asm/vmx.h | 12 +--

[PATCH v1 03/23] KVM: VMX: Add support for the secondary VM exit controls

2023-11-08 Thread Xin Li
Enable the secondary VM exit controls to prepare for FRED enabling. The activation of the secondary VM exit controls is off now, and it will be switched on when a VMX feature needing it is enabled. Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/include/asm/msr-index.h | 1 +

[PATCH v1 06/23] KVM: VMX: Defer enabling FRED MSRs save/load until after set CPUID

2023-11-08 Thread Xin Li
Clear FRED VM entry/exit controls when initializing a vCPU, and set these controls only if FRED is enumerated after set CPUID. FRED VM entry/exit controls need to be set to establish context sufficient to support FRED event delivery immediately after VM entry and exit. However it is not required

[PATCH v1 07/23] KVM: VMX: Disable intercepting FRED MSRs

2023-11-08 Thread Xin Li
Add FRED MSRs to the valid passthrough MSR list and disable intercepting FRED MSRs only if FRED is enumerated after set CPUID. Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/kvm/vmx/vmx.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c

[PATCH v1 01/23] KVM: VMX: Cleanup VMX basic information defines and usages

2023-11-08 Thread Xin Li
Define VMX basic information fields with BIT_ULL()/GENMASK_ULL(), and replace hardcoded VMX basic numbers with these field macros. Per Sean's ask, save the full/raw value of MSR_IA32_VMX_BASIC in the global vmcs_config as type u64 to get rid of the hi/lo crud, and then use VMX_BASIC helpers to

[PATCH v1 00/23] Enable FRED with KVM VMX

2023-11-08 Thread Xin Li
This patch set enables the Intel flexible return and event delivery (FRED) architecture with KVM VMX to allow guests to utilize FRED. The FRED architecture defines simple new transitions that change privilege level (ring transitions). The FRED architecture was designed with the following goals:

[PATCH v2] tools/nolibc: mips: add support for PIC

2023-11-08 Thread Thomas Weißschuh
. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Preserver 8-byte alignment of stack pointer - Link to v1: https://lore.kernel.org/r/20231108-nolibc-pic-v1-1-9b7a429d5...@weissschuh.net --- tools/include/nolibc/arch-mips.h| 7 ++- tools/testing/selftests/nolibc/Makefile | 2 +- 2

[PATCH] tools/nolibc: mips: add support for PIC

2023-11-08 Thread Thomas Weißschuh
MIPS requires some extra instructions to set up the $gp register for the with a pointer to the global data area. This isn't needed for non-PIC builds, but this patch enables the code unconditionally to prevent bitrot. Also enable PIC in one of the test configurations for ongoing validation.

Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space

2023-11-08 Thread Jason Gunthorpe
On Wed, Nov 08, 2023 at 08:53:00AM +, Tian, Kevin wrote: > > There are many events related to object in guest memory or controlled > > by the guest, eg C_BAD_CD and C_BAD_STE. These should be relayed or > > the emulation is not working well. > > so that's the category of unrecoverable

Re: [PATCH 23/24] selftests/resctrl: Add L2 CAT test

2023-11-08 Thread Reinette Chatre
Hi Ilpo, On 11/7/2023 1:33 AM, Ilpo Järvinen wrote: > man perf_event_open() says this: > > "If type is PERF_TYPE_RAW, then a custom "raw" config value is needed. > Most CPUs support events that are not covered by the "generalized" > events. These are implementation defined; see your

Re: [RFC PATCH v3 10/12] tcp: RX path for devmem TCP

2023-11-08 Thread Edward Cree
On 06/11/2023 21:17, Stanislav Fomichev wrote: > I guess I'm just wondering whether other people have any suggestions > here. Not sure Jonathan's way was better, but we fundamentally > have two queues between the kernel and the userspace: > - userspace receiving tokens (recvmsg + magical flag) > -

RE: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-08 Thread David Laight
From: Mina Almasry > Sent: 06 November 2023 02:44 > > For device memory TCP, we expect the skb headers to be available in host > memory for access, and we expect the skb frags to be in device memory > and unaccessible to the host. We expect there to be no mixing and > matching of device memory

Re: [RFC PATCH v3 08/12] net: support non paged skb frags

2023-11-08 Thread Yunsheng Lin
On 2023/11/8 5:19, Mina Almasry wrote: >> >> > > My personal immediate reaction is that this may just introduce code > churn without significant benefit. If an unsuspecting caller call > skb_frag_page() on devmem frag and doesn't correctly handle NULL > return, it will crash or error out anyway,

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-08 Thread Yunsheng Lin
On 2023/11/8 5:56, Mina Almasry wrote: > On Tue, Nov 7, 2023 at 12:00 AM Yunsheng Lin wrote: >> >> On 2023/11/6 10:44, Mina Almasry wrote: >>> Overload the LSB of struct page* to indicate that it's a page_pool_iov. >>> >>> Refactor mm calls on struct page* into helpers, and add page_pool_iov >>>

Re: [RFC 3/7] iommufd: Add iommufd_device_bind_pasid()

2023-11-08 Thread Yi Liu
On 2023/11/8 16:46, Tian, Kevin wrote: From: Liu, Yi L Sent: Wednesday, November 8, 2023 3:45 PM On 2023/10/10 16:19, Tian, Kevin wrote: From: Liu, Yi L Sent: Monday, October 9, 2023 4:51 PM +struct iommufd_device *iommufd_device_bind_pasid(struct iommufd_ctx *ictx, +

RE: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space

2023-11-08 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Wednesday, November 8, 2023 1:54 AM > > On Tue, Nov 07, 2023 at 08:35:10AM +, Tian, Kevin wrote: > > > From: Jason Gunthorpe > > > Sent: Thursday, November 2, 2023 8:48 PM > > > > > > On Thu, Oct 26, 2023 at 10:49:24AM +0800, Lu Baolu wrote: > > > > Hi folks,

RE: [RFC 3/7] iommufd: Add iommufd_device_bind_pasid()

2023-11-08 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Wednesday, November 8, 2023 3:45 PM > > On 2023/10/10 16:19, Tian, Kevin wrote: > >> From: Liu, Yi L > >> Sent: Monday, October 9, 2023 4:51 PM > >> > >> +struct iommufd_device *iommufd_device_bind_pasid(struct > iommufd_ctx > >> *ictx, > >> +