Re: [PATCH 04/12] mm: Allow compound zone device pages

2024-09-10 Thread Alistair Popple
Matthew Wilcox writes: > On Tue, Sep 10, 2024 at 02:14:29PM +1000, Alistair Popple wrote: >> @@ -337,6 +341,7 @@ struct folio { >> /* private: */ >> }; >> /* public: */ >> +struct dev_pagemap *pgmap; > > Shouldn't that be indented by on

Re: [PATCH] Documentation: livepatch: Correct release locks antonym

2024-09-10 Thread Bagas Sanjaya
On 9/4/24 18:48, Petr Mladek wrote: On Tue 2024-09-03 09:47:53, Bagas Sanjaya wrote: "get" doesn't properly fit as an antonym for "release" in the context of locking. Correct it with "acquire". Signed-off-by: Bagas Sanjaya Reviewed-by: Petr Mladek The patch is trivial. I have have committe

Re: [PATCH] Documentation: livepatch: Correct release locks antonym

2024-09-10 Thread Petr Mladek
On Tue 2024-09-10 17:27:42, Bagas Sanjaya wrote: > On 9/4/24 18:48, Petr Mladek wrote: > > On Tue 2024-09-03 09:47:53, Bagas Sanjaya wrote: > > > "get" doesn't properly fit as an antonym for "release" in the context > > > of locking. Correct it with "acquire". > > > > > > Signed-off-by: Bagas Sanj

Re: [PATCH 04/12] mm: Allow compound zone device pages

2024-09-10 Thread Matthew Wilcox
On Tue, Sep 10, 2024 at 04:57:41PM +1000, Alistair Popple wrote: > > Matthew Wilcox writes: > > > On Tue, Sep 10, 2024 at 02:14:29PM +1000, Alistair Popple wrote: > >> @@ -337,6 +341,7 @@ struct folio { > >>/* private: */ > >>}; > >>/* public: */ > >> +

Re: [PATCH 02/12] pci/p2pdma: Don't initialise page refcount to one

2024-09-10 Thread Bjorn Helgaas
In subject: PCI/P2PDMA: ... would match previous history. On Tue, Sep 10, 2024 at 02:14:27PM +1000, Alistair Popple wrote: > The reference counts for ZONE_DEVICE private pages should be > initialised by the driver when the page is actually allocated by the > driver allocator, not when they are

[PATCH 03/15] KVM: x86/mmu: Introduce exception flag for unmapped GPAs

2024-09-10 Thread Nikolas Wipper
Introduce a flag in x86_exception which signals that a page walk failed because a page table GPA wasn't backed by a memslot. This only applies to page tables; the final physical address is not checked. This extra flag is needed, because the normal page fault error code does not contain a bit to si

[PATCH 04/15] KVM: x86/mmu: Store GPA in exception if applicable

2024-09-10 Thread Nikolas Wipper
Store the GPA where the page walk failed within the walker's exception. Precisely this means, the PTE's GPA, if it couldn't be resolved or it caused an access violation, or the fully translated GPA in case the final page caused an access violation. Returning the GPA from the page walker directly i

[PATCH 00/15] KVM: x86: Introduce new ioctl KVM_TRANSLATE2

2024-09-10 Thread Nikolas Wipper
This series introduces a new ioctl KVM_TRANSLATE2, which expands on KVM_TRANSLATE. It is required to implement Hyper-V's HvTranslateVirtualAddress hyper-call as part of the ongoing effort to emulate HyperV's Virtual Secure Mode (VSM) within KVM and QEMU. The hyper- call requires several new KVM API

[PATCH 02/15] KVM: x86/mmu: Abort page walk if permission checks fail

2024-09-10 Thread Nikolas Wipper
Abort the page walk, if permission checks fail on any page table level, by moving the check to within the page walker loop. Currently, the page walker only checks for access flags after successfully walking the entire paging structure. This change is needed later to enable setting accessed bits in

[PATCH 01/15] KVM: Add API documentation for KVM_TRANSLATE2

2024-09-10 Thread Nikolas Wipper
Add API documentation for the new KVM_TRANSLATE2 ioctl. Signed-off-by: Nikolas Wipper --- Documentation/virt/kvm/api.rst | 131 + 1 file changed, 131 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index a4b7dc4a9dda..63

[PATCH 06/15] KVM: x86/mmu: Implement PWALK_SET_ACCESSED in page walker

2024-09-10 Thread Nikolas Wipper
Implement PWALK_SET_ACCESSED in the page walker. This flag allows controling whether the page walker will set the accessed bits after a successful page walk in all page table levels. If the page walk is aborted for any reason, none of the access bits are set. Signed-off-by: Nikolas Wipper --- ar

[PATCH 07/15] KVM: x86/mmu: Implement PWALK_SET_DIRTY in page walker

2024-09-10 Thread Nikolas Wipper
Implement PWALK_SET_DIRTY in the page walker. This flag allows controlling, whether the page walker will set the dirty bit after a successful page walk. If the page walk fails for any reason, the dirty flag is not set. Signed-off-by: Nikolas Wipper --- arch/x86/kvm/mmu/paging_tmpl.h | 3 ++- 1 f

[PATCH 08/15] KVM: x86/mmu: Implement PWALK_FORCE_SET_ACCESSED in page walker

2024-09-10 Thread Nikolas Wipper
Implement PWALK_FORCE_SET_ACCESSED in the page walker. This flag forces the page walker to set the accessed flag in all successfully visited page table levels, regardless of the outcome of the page walk. For example, if the page walk fails on level 2, the accessed bit will still be set on levels 3

[PATCH 05/15] KVM: x86/mmu: Introduce flags parameter to page walker

2024-09-10 Thread Nikolas Wipper
Introduce the flags parameter to walk_addr_generic() which is needed to introduce fine grained control over the accessed/dirty bits. Also forward the parameter to several of the page walker's helper functions, so it can be used in an ioctl. Setting both PWALK_SET_ACCESSED and PWALK_SET_DIRTY will

[PATCH 09/15] KVM: x86/mmu: Introduce status parameter to page walker

2024-09-10 Thread Nikolas Wipper
Introduce the status parameter to walk_addr_generic() which is used in later patches to provide the caller with information on whether setting the accessed/dirty bits succeeded. No functional change intended. Signed-off-by: Nikolas Wipper --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kv

[PATCH 10/15] KVM: x86/mmu: Implement PWALK_STATUS_READ_ONLY_PTE_GPA in page walker

2024-09-10 Thread Nikolas Wipper
Implement PWALK_STATUS_READ_ONLY_PTE_GPA in the page walker. This status flag is set when setting an accessed or dirty bit fails, because the memory of the page table entry was marked as read-only Signed-off-by: Nikolas Wipper --- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/mmu/paging_t

[PATCH 12/15] KVM: Introduce KVM_TRANSLATE2

2024-09-10 Thread Nikolas Wipper
Introduce a new ioctl that extends the functionality of KVM_TRANSLATE. It allows the caller to specify an access mode that must be upheld throughout the entire page walk. Additionally, it provides control over whether the accessed/dirty bits in the page table should be set at all, and whether they

[PATCH 13/15] KVM: Add KVM_TRANSLATE2 stub

2024-09-10 Thread Nikolas Wipper
Add stub function for the KVM_TRANSLATE2 ioctl, as well as generic parameter verification. In a later commit, the ioctl will be properly implemented for x86. Signed-off-by: Nikolas Wipper --- include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 41

[PATCH 11/15] KVM: x86: Introduce generic gva to gpa translation function

2024-09-10 Thread Nikolas Wipper
Introduce a function to translate gvas to gpas with the ability to control set_bit_mode, access mode and flags, as well as receive status codes. Signed-off-by: Nikolas Wipper --- arch/x86/include/asm/kvm_host.h | 3 +++ arch/x86/kvm/x86.c | 11 +++ 2 files changed, 14 inser

[PATCH 14/15] KVM: x86: Implement KVM_TRANSLATE2

2024-09-10 Thread Nikolas Wipper
Implement KVM_TRANSLATE2 for x86 using the default KVM page walker. Signed-off-by: Nikolas Wipper --- arch/x86/kvm/x86.c | 76 ++ 1 file changed, 76 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 27fc71aaa1e4..3bcbad958324 10

[PATCH 15/15] KVM: selftests: Add test for KVM_TRANSLATE2

2024-09-10 Thread Nikolas Wipper
Add selftest for KVM_TRANSLATE2. There are four different subtests. A basic translate test that checks whether access permissions are handled correctly. A set bits test, that checks whether the accessed and dirty bits are set correctly. An errors test, that checks negative cases of the flags. And

Re: [PATCH v2] docs/process: fix typos

2024-09-10 Thread Jonathan Corbet
Andrew Kreimer writes: > Fix typos in documentation. > > Signed-off-by: Andrew Kreimer > --- > Synced with docs-next as requested. > > Documentation/process/coding-style.rst | 2 +- > Documentation/process/maintainer-tip.rst | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) Applied,

Re: [PATCH] Documentation: livepatch: Correct release locks antonym

2024-09-10 Thread Bagas Sanjaya
On 9/10/24 18:01, Petr Mladek wrote: On Tue 2024-09-10 17:27:42, Bagas Sanjaya wrote: On 9/4/24 18:48, Petr Mladek wrote: On Tue 2024-09-03 09:47:53, Bagas Sanjaya wrote: "get" doesn't properly fit as an antonym for "release" in the context of locking. Correct it with "acquire". Signed-off-by

Re: [PATCH 02/12] pci/p2pdma: Don't initialise page refcount to one

2024-09-10 Thread Logan Gunthorpe
On 2024-09-09 22:14, Alistair Popple wrote: > The reference counts for ZONE_DEVICE private pages should be > initialised by the driver when the page is actually allocated by the > driver allocator, not when they are first created. This is currently > the case for MEMORY_DEVICE_PRIVATE and MEMORY

Re: [PATCH 02/12] pci/p2pdma: Don't initialise page refcount to one

2024-09-10 Thread Alistair Popple
>> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c >> index 4f47a13..210b9f4 100644 >> --- a/drivers/pci/p2pdma.c >> +++ b/drivers/pci/p2pdma.c >> @@ -129,6 +129,12 @@ static int p2pmem_alloc_mmap(struct file *filp, struct >> kobject *kobj, >> } >> >> /* >> + * Initialis