Re: [PATCH v5 00/13] KVM: mm: fd-based approach for supporting KVM guest private memory

2022-03-30 Thread Steven Price
On 29/03/2022 18:01, Quentin Perret wrote: > On Monday 28 Mar 2022 at 18:58:35 (+), Sean Christopherson wrote: >> On Mon, Mar 28, 2022, Quentin Perret wrote: >>> Hi Sean, >>> >>> Thanks for the reply, this helps a lot. >>> >>> On Monday 28 Mar 2022 at 17:13:10 (+), Sean Christopherson

Re: [PATCH v4 01/12] mm/shmem: Introduce F_SEAL_INACCESSIBLE

2022-02-23 Thread Steven Price
On 23/02/2022 11:49, Chao Peng wrote: > On Thu, Feb 17, 2022 at 11:09:35AM -0800, Andy Lutomirski wrote: >> On Thu, Feb 17, 2022, at 5:06 AM, Chao Peng wrote: >>> On Fri, Feb 11, 2022 at 03:33:35PM -0800, Andy Lutomirski wrote: On 1/18/22 05:21, Chao Peng wrote: > From: "Kirill A.

Re: [PATCH v4 00/12] KVM: mm: fd-based approach for supporting KVM guest private memory

2022-02-02 Thread Steven Price
Hi Jun, On 02/02/2022 02:28, Nakajima, Jun wrote: > >> On Jan 28, 2022, at 8:47 AM, Steven Price wrote: >> >> On 18/01/2022 13:21, Chao Peng wrote: >>> This is the v4 of this series which try to implement the fd-based KVM >>> guest private memory. Th

Re: [PATCH v4 00/12] KVM: mm: fd-based approach for supporting KVM guest private memory

2022-01-28 Thread Steven Price
On 18/01/2022 13:21, Chao Peng wrote: > This is the v4 of this series which try to implement the fd-based KVM > guest private memory. The patches are based on latest kvm/queue branch > commit: > > fea31d169094 KVM: x86/pmu: Fix available_event_types check for >REF_CPU_CYCLES

Re: [PATCH v4 02/12] mm/memfd: Introduce MFD_INACCESSIBLE flag

2022-01-21 Thread Steven Price
On 18/01/2022 13:21, Chao Peng wrote: > Introduce a new memfd_create() flag indicating the content of the > created memfd is inaccessible from userspace. It does this by force > setting F_SEAL_INACCESSIBLE seal when the file is created. It also set > F_SEAL_SEAL to prevent future sealing, which

Re: [RFC v2 PATCH 06/13] KVM: Register/unregister memfd backed memslot

2021-11-25 Thread Steven Price
On 19/11/2021 13:47, Chao Peng wrote: > Signed-off-by: Yu Zhang > Signed-off-by: Chao Peng > --- > virt/kvm/kvm_main.c | 23 +++ > 1 file changed, 19 insertions(+), 4 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 271cef8d1cd0..b8673490d301

Re: [PATCH v17 5/6] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-24 Thread Steven Price
On 24/06/2021 14:35, Marc Zyngier wrote: > Hi Steven, > > On Mon, 21 Jun 2021 12:17:15 +0100, > Steven Price wrote: >> >> The VMM may not wish to have it's own mapping of guest memory mapped >> with PROT_MTE because this causes problems if the VMM has tag checking

Re: [PATCH v17 0/6] MTE support for KVM guest

2021-06-23 Thread Steven Price
On 22/06/2021 15:21, Marc Zyngier wrote: > On Mon, 21 Jun 2021 12:17:10 +0100, Steven Price wrote: >> This series adds support for using the Arm Memory Tagging Extensions >> (MTE) in a KVM guest. >> >> Changes since v16[1]: >> >> - Dropped the first patc

Re: [PATCH v17 5/6] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-23 Thread Steven Price
On 22/06/2021 11:56, Fuad Tabba wrote: > Hi Marc, > > On Tue, Jun 22, 2021 at 11:25 AM Marc Zyngier wrote: >> >> Hi Fuad, >> >> On Tue, 22 Jun 2021 09:56:22 +0100, >> Fuad Tabba wrote: >>> >>> Hi, >>> >>> >>>

[PATCH v17 5/6] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-21 Thread Steven Price
to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 3 ++ arch/arm64/include/asm/mte

[PATCH v17 4/6] KVM: arm64: Expose KVM_ARM_CAP_MTE

2021-06-21 Thread Steven Price
It's now safe for the VMM to enable MTE in a guest, so expose the capability to user space. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 9 + arch/arm64/kvm/reset.c| 4 arch/arm64/kvm/sys_regs.c | 3 +++ 3 files changed, 16

[PATCH v17 3/6] KVM: arm64: Save/restore MTE registers

2021-06-21 Thread Steven Price
Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_arm.h | 3 +- arch/arm64

[PATCH v17 2/6] KVM: arm64: Introduce MTE VM feature

2021-06-21 Thread Steven Price
are correctly saved/restored across swap. Actually exposing the new capability to user space happens in a later patch. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_emulate.h | 3 ++ arch/arm64/include/asm/kvm_host.h| 3 ++ arch/arm64/kvm/hyp/exception.c

[PATCH v17 1/6] arm64: mte: Sync tags for pages where PTE is untagged

2021-06-21 Thread Steven Price
as these will not have been swapped out. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/mte.h | 4 ++-- arch/arm64/include/asm/pgtable.h | 22 +++--- arch/arm64/kernel/mte.c | 18 +- 3 files changed, 34 insertions(+), 10 deletions

[PATCH v17 6/6] KVM: arm64: Document MTE capability and ioctl

2021-06-21 Thread Steven Price
mapping in userspace. The above capability gates access to the ioctl. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- Documentation/virt/kvm/api.rst | 61 ++ 1 file changed, 61 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation

[PATCH v17 0/6] MTE support for KVM guest

2021-06-21 Thread Steven Price
26.54670-1-steven.price%40arm.com Steven Price (6): arm64: mte: Sync tags for pages where PTE is untagged KVM: arm64: Introduce MTE VM feature KVM: arm64: Save/restore MTE registers KVM: arm64: Expose KVM_ARM_CAP_MTE KVM: arm64: ioctl to fetch/store tags in a guest KVM: arm64: Do

Re: [PATCH v16 3/7] KVM: arm64: Introduce MTE VM feature

2021-06-21 Thread Steven Price
On 21/06/2021 10:01, Marc Zyngier wrote: > On Fri, 18 Jun 2021 14:28:22 +0100, > Steven Price wrote: >> >> Add a new VM feature 'KVM_ARM_CAP_MTE' which enables memory tagging >> for a VM. This will expose the feature to the guest and automatically >> tag

Re: [PATCH v16 1/7] arm64: mte: Handle race when synchronising tags

2021-06-21 Thread Steven Price
On 18/06/2021 16:42, Marc Zyngier wrote: > On 2021-06-18 15:40, Catalin Marinas wrote: >> On Fri, Jun 18, 2021 at 02:28:20PM +0100, Steven Price wrote: >>> mte_sync_tags() used test_and_set_bit() to set the PG_mte_tagged flag >>> before restoring/zeroing the MTE tags

Re: [PATCH v16 7/7] KVM: arm64: Document MTE capability and ioctl

2021-06-21 Thread Steven Price
On 18/06/2021 15:52, Catalin Marinas wrote: > On Fri, Jun 18, 2021 at 02:28:26PM +0100, Steven Price wrote: >> +When this capability is enabled all memory in (non-device) memslots must not >> +used VM_SHARED, attempts to create a memslot with a VM_SHARED mmap will >> res

[PATCH v16 7/7] KVM: arm64: Document MTE capability and ioctl

2021-06-18 Thread Steven Price
mapping in userspace. The above capability gates access to the ioctl. Signed-off-by: Steven Price --- Documentation/virt/kvm/api.rst | 61 ++ 1 file changed, 61 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index

[PATCH v16 5/7] KVM: arm64: Expose KVM_ARM_CAP_MTE

2021-06-18 Thread Steven Price
It's now safe for the VMM to enable MTE in a guest, so expose the capability to user space. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 9 + arch/arm64/kvm/reset.c| 3 ++- arch/arm64/kvm/sys_regs.c | 3 +++ 3 files changed, 14 insertions

[PATCH v16 4/7] KVM: arm64: Save/restore MTE registers

2021-06-18 Thread Steven Price
Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_arm.h | 3 +- arch/arm64

[PATCH v16 3/7] KVM: arm64: Introduce MTE VM feature

2021-06-18 Thread Steven Price
are correctly saved/restored across swap. Actually exposing the new capability to user space happens in a later patch. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_emulate.h | 3 ++ arch/arm64/include/asm/kvm_host.h| 3 ++ arch/arm64/kvm/hyp/exception.c | 3 +- arch/arm64/kvm

[PATCH v16 6/7] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-18 Thread Steven Price
to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 3 ++ arch/arm64/include/asm/mte

[PATCH v16 2/7] arm64: mte: Sync tags for pages where PTE is untagged

2021-06-18 Thread Steven Price
as these will not have been swapped out. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/mte.h | 4 ++-- arch/arm64/include/asm/pgtable.h | 22 +++--- arch/arm64/kernel/mte.c | 17 + 3 files changed, 34 insertions(+), 9 deletions

[PATCH v16 0/7] MTE support for KVM guest

2021-06-18 Thread Steven Price
ped the Reviewed-by tags on patches 3 and 7 due to the changes. [1] https://lore.kernel.org/r/20210614090525.4338-1-steven.price%40arm.com Steven Price (7): arm64: mte: Handle race when synchronising tags arm64: mte: Sync tags for pages where PTE is untagged KVM: arm64: Introduce MTE VM feat

[PATCH v16 1/7] arm64: mte: Handle race when synchronising tags

2021-06-18 Thread Steven Price
the process. Instead implement a new (global) spinlock to protect the mte_sync_page_tags() function. Fixes: 34bfeea4a9e9 ("arm64: mte: Clear the tags when a page is mapped in user-space with PROT_MTE") Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/kernel/

Re: [PATCH v15 0/7] MTE support for KVM guest

2021-06-17 Thread Steven Price
On 17/06/2021 14:15, Marc Zyngier wrote: > On Thu, 17 Jun 2021 13:13:22 +0100, > Catalin Marinas wrote: >> >> On Mon, Jun 14, 2021 at 10:05:18AM +0100, Steven Price wrote: >>> I realise there are still open questions[1] around the performance of >>> this s

[PATCH v15 3/7] KVM: arm64: Introduce MTE VM feature

2021-06-14 Thread Steven Price
are correctly saved/restored across swap. Actually exposing the new capability to user space happens in a later patch. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_emulate.h | 3 ++ arch/arm64/include/asm/kvm_host.h| 3 ++ arch/arm64/include/asm/mte.h

[PATCH v15 0/7] MTE support for KVM guest

2021-06-14 Thread Steven Price
[2]: https://lore.kernel.org/r/20210607110816.25762-1-steven.pr...@arm.com/ [3]: https://lore.kernel.org/r/20210602235230.3928842-4-...@google.com/ Steven Price (7): arm64: mte: Handle race when synchronising tags arm64: mte: Sync tags for pages where PTE is untagged KVM: arm64: Introduce MTE

[PATCH v15 5/7] KVM: arm64: Expose KVM_ARM_CAP_MTE

2021-06-14 Thread Steven Price
It's now safe for the VMM to enable MTE in a guest, so expose the capability to user space. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 9 + arch/arm64/kvm/reset.c| 3 ++- arch/arm64/kvm/sys_regs.c | 3 +++ 3 files changed, 14 insertions

[PATCH v15 2/7] arm64: mte: Sync tags for pages where PTE is untagged

2021-06-14 Thread Steven Price
as these will not have been swapped out. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/mte.h | 4 ++-- arch/arm64/include/asm/pgtable.h | 22 +++--- arch/arm64/kernel/mte.c | 17 + 3 files changed, 34 insertions(+), 9 deletions

[PATCH v15 1/7] arm64: mte: Handle race when synchronising tags

2021-06-14 Thread Steven Price
the process. Instead implement a new (global) spinlock to protect the mte_sync_page_tags() function. Fixes: 34bfeea4a9e9 ("arm64: mte: Clear the tags when a page is mapped in user-space with PROT_MTE") Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/kernel/

[PATCH v15 7/7] KVM: arm64: Document MTE capability and ioctl

2021-06-14 Thread Steven Price
mapping in userspace. The above capability gates access to the ioctl. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- Documentation/virt/kvm/api.rst | 57 ++ 1 file changed, 57 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation

[PATCH v15 6/7] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-14 Thread Steven Price
to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 3 ++ arch/arm64/include/asm/mte

[PATCH v15 4/7] KVM: arm64: Save/restore MTE registers

2021-06-14 Thread Steven Price
Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_arm.h | 3 +- arch/arm64

Re: [PATCH v14 1/8] arm64: mte: Handle race when synchronising tags

2021-06-10 Thread Steven Price
On 09/06/2021 18:41, Catalin Marinas wrote: > On Wed, Jun 09, 2021 at 12:19:31PM +0100, Marc Zyngier wrote: >> On Wed, 09 Jun 2021 11:51:34 +0100, >> Steven Price wrote: >>> On 09/06/2021 11:30, Marc Zyngier wrote: >>>> On Mon, 07 Jun 2021 12:08:09 +0100,

Re: [PATCH v14 1/8] arm64: mte: Handle race when synchronising tags

2021-06-09 Thread Steven Price
On 09/06/2021 11:30, Marc Zyngier wrote: > On Mon, 07 Jun 2021 12:08:09 +0100, > Steven Price wrote: >> >> mte_sync_tags() used test_and_set_bit() to set the PG_mte_tagged flag >> before restoring/zeroing the MTE tags. However if another thread were to >> rac

Re: [PATCH v14 8/8] KVM: arm64: Document MTE capability and ioctl

2021-06-09 Thread Steven Price
On 07/06/2021 18:32, Catalin Marinas wrote: > On Mon, Jun 07, 2021 at 12:08:16PM +0100, Steven Price wrote: >> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst >> index 22d077562149..fc6f0cbc30b3 100644 >> --- a/Documentation/virt/kvm/api.rst >&g

Re: [PATCH v14 2/8] arm64: Handle MTE tags zeroing in __alloc_zeroed_user_highpage()

2021-06-09 Thread Steven Price
On 07/06/2021 18:07, Catalin Marinas wrote: > On Mon, Jun 07, 2021 at 12:08:10PM +0100, Steven Price wrote: >> From: Catalin Marinas >> >> Currently, on an anonymous page fault, the kernel allocates a zeroed >> page and maps it in user space. If the mapping is tagge

[PATCH v14 3/8] arm64: mte: Sync tags for pages where PTE is untagged

2021-06-07 Thread Steven Price
as these will not have been swapped out. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/mte.h | 4 ++-- arch/arm64/include/asm/pgtable.h | 22 +++--- arch/arm64/kernel/mte.c | 17 + 3 files changed, 34 insertions(+), 9 deletions

[PATCH v14 1/8] arm64: mte: Handle race when synchronising tags

2021-06-07 Thread Steven Price
the process. Instead implement a new (global) spinlock to protect the mte_sync_page_tags() function. Fixes: 34bfeea4a9e9 ("arm64: mte: Clear the tags when a page is mapped in user-space with PROT_MTE") Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/kernel/

[PATCH v14 0/8] MTE support for KVM guest

2021-06-07 Thread Steven Price
the code thanks to pointers from Catalin. [1] https://lore.kernel.org/r/20210524104513.13258-1-steven.price%40arm.com Catalin Marinas (1): arm64: Handle MTE tags zeroing in __alloc_zeroed_user_highpage() Steven Price (7): arm64: mte: Handle race when synchronising tags arm64: mte: Sync

[PATCH v14 2/8] arm64: Handle MTE tags zeroing in __alloc_zeroed_user_highpage()

2021-06-07 Thread Steven Price
ear the page tags on allocation in __alloc_zeroed_user_highpage() if the vma flags have VM_MTE set. Signed-off-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/page.h | 6 -- arch/arm64/mm/fault.c | 21 + 2 files changed, 25 insertions(+)

[PATCH v14 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-07 Thread Steven Price
to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 3 ++ arch/arm64/include/asm/mte-def.h | 1 + arch/arm64

[PATCH v14 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-07 Thread Steven Price
are correctly saved/restored across swap. Actually exposing the new capability to user space happens in a later patch. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_emulate.h | 3 ++ arch/arm64/include/asm/kvm_host.h| 3 ++ arch/arm64/include/asm/mte.h

[PATCH v14 8/8] KVM: arm64: Document MTE capability and ioctl

2021-06-07 Thread Steven Price
mapping in userspace. The above capability gates access to the ioctl. Signed-off-by: Steven Price --- Documentation/virt/kvm/api.rst | 57 ++ 1 file changed, 57 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index

[PATCH v14 6/8] KVM: arm64: Expose KVM_ARM_CAP_MTE

2021-06-07 Thread Steven Price
It's now safe for the VMM to enable MTE in a guest, so expose the capability to user space. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 9 + arch/arm64/kvm/reset.c| 3 ++- arch/arm64/kvm/sys_regs.c | 3 +++ 3 files changed, 14 insertions

[PATCH v14 5/8] KVM: arm64: Save/restore MTE registers

2021-06-07 Thread Steven Price
Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_arm.h | 3 +- arch/arm64

Re: [PATCH v13 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-04 Thread Steven Price
On 04/06/2021 12:42, Catalin Marinas wrote: > On Fri, Jun 04, 2021 at 12:15:56PM +0100, Steven Price wrote: >> On 03/06/2021 18:13, Catalin Marinas wrote: >>> On Mon, May 24, 2021 at 11:45:12AM +0100, Steven Price wrote: >>>> diff --git a/arch/arm64/include/uap

Re: [PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-04 Thread Steven Price
On 04/06/2021 12:36, Catalin Marinas wrote: > On Fri, Jun 04, 2021 at 11:42:11AM +0100, Steven Price wrote: >> On 03/06/2021 17:00, Catalin Marinas wrote: >>> On Mon, May 24, 2021 at 11:45:09AM +0100, Steven Price wrote: >>>> diff --git a/arch/arm64/kvm/mmu.c b/a

Re: [PATCH v13 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-04 Thread Steven Price
On 03/06/2021 18:13, Catalin Marinas wrote: > On Mon, May 24, 2021 at 11:45:12AM +0100, Steven Price wrote: >> diff --git a/arch/arm64/include/uapi/asm/kvm.h >> b/arch/arm64/include/uapi/asm/kvm.h >> index 24223adae150..b3edde68bc3e 100644 >> --- a/arch/arm64/include/u

Re: [PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-04 Thread Steven Price
On 03/06/2021 17:00, Catalin Marinas wrote: > On Mon, May 24, 2021 at 11:45:09AM +0100, Steven Price wrote: >> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c >> index c5d1f3c87dbd..226035cf7d6c 100644 >> --- a/arch/arm64/kvm/mmu.c >> +++ b/arch/arm64/kvm

Re: [PATCH v12 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-05-27 Thread Steven Price
On 24/05/2021 19:11, Catalin Marinas wrote: > On Fri, May 21, 2021 at 10:42:09AM +0100, Steven Price wrote: >> On 20/05/2021 18:27, Catalin Marinas wrote: >>> On Thu, May 20, 2021 at 04:58:01PM +0100, Steven Price wrote: >>>> On 20/05/2021 13:05, Catalin Marinas wro

[PATCH v13 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-05-24 Thread Steven Price
to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 3 ++ arch/arm64/include/asm/mte-def.h | 1 + arch/arm64

[PATCH v13 5/8] KVM: arm64: Save/restore MTE registers

2021-05-24 Thread Steven Price
Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/include/asm/kvm_mte.h

[PATCH v13 6/8] KVM: arm64: Expose KVM_ARM_CAP_MTE

2021-05-24 Thread Steven Price
It's now safe for the VMM to enable MTE in a guest, so expose the capability to user space. Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 9 + arch/arm64/kvm/reset.c| 3 ++- arch/arm64/kvm/sys_regs.c | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git

[PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-05-24 Thread Steven Price
are correctly saved/restored across swap. Actually exposing the new capability to user space happens in a later patch. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_emulate.h | 3 ++ arch/arm64/include/asm/kvm_host.h| 3 ++ arch/arm64/kvm/hyp/exception.c | 3 +- arch/arm64/kvm

[PATCH v13 3/8] arm64: mte: Sync tags for pages where PTE is untagged

2021-05-24 Thread Steven Price
as these will not have been swapped out. Signed-off-by: Steven Price --- arch/arm64/include/asm/mte.h | 4 ++-- arch/arm64/include/asm/pgtable.h | 22 +++--- arch/arm64/kernel/mte.c | 16 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/arch/arm64

[PATCH v13 2/8] arm64: Handle MTE tags zeroing in __alloc_zeroed_user_highpage()

2021-05-24 Thread Steven Price
ear the page tags on allocation in __alloc_zeroed_user_highpage() if the vma flags have VM_MTE set. Signed-off-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/page.h | 6 -- arch/arm64/mm/fault.c | 21 + 2 files changed, 25 insertions(+)

[PATCH v13 8/8] KVM: arm64: Document MTE capability and ioctl

2021-05-24 Thread Steven Price
mapping in userspace. The above capability gates access to the ioctl. Signed-off-by: Steven Price --- Documentation/virt/kvm/api.rst | 52 ++ 1 file changed, 52 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index

[PATCH v13 0/8] MTE support for KVM guest

2021-05-24 Thread Steven Price
/ MTE_GRANULE_SIZE. * Correct the definition of struct kvm_arm_copy_mte_tags in the docs. Also avoid mentioning MTE_GRANULE_SIZE as it isn't exported to userspace. [1] https://lore.kernel.org/r/20210517123239.8025-1-steven.pr...@arm.com/ Catalin Marinas (1): arm64: Handle MTE tags zeroing i

[PATCH v13 1/8] arm64: mte: Handle race when synchronising tags

2021-05-24 Thread Steven Price
the process. Instead implement a new (global) spinlock to protect the mte_sync_page_tags() function. Fixes: 34bfeea4a9e9 ("arm64: mte: Clear the tags when a page is mapped in user-space with PROT_MTE") Reviewed-by: Catalin Marinas Signed-off-by: Steven Price --- --- arch/arm64/kernel/

Re: [PATCH v12 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-05-21 Thread Steven Price
On 20/05/2021 18:27, Catalin Marinas wrote: > On Thu, May 20, 2021 at 04:58:01PM +0100, Steven Price wrote: >> On 20/05/2021 13:05, Catalin Marinas wrote: >>> On Mon, May 17, 2021 at 01:32:38PM +0100, Steven Price wrote: >>>> diff --git a/arch/arm64/kvm/arm.c b/a

Re: [PATCH v12 4/8] arm64: kvm: Introduce MTE VM feature

2021-05-21 Thread Steven Price
On 20/05/2021 18:50, Catalin Marinas wrote: > On Thu, May 20, 2021 at 04:05:46PM +0100, Steven Price wrote: >> On 20/05/2021 12:54, Catalin Marinas wrote: >>> On Mon, May 17, 2021 at 01:32:35PM +0100, Steven Price wrote: >>>> diff --git a/arch/arm64/kvm/mmu.c b/a

Re: [PATCH v12 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-05-20 Thread Steven Price
On 20/05/2021 13:05, Catalin Marinas wrote: > On Mon, May 17, 2021 at 01:32:38PM +0100, Steven Price wrote: >> diff --git a/arch/arm64/include/uapi/asm/kvm.h >> b/arch/arm64/include/uapi/asm/kvm.h >> index 24223adae150..b3edde68bc3e 100644 >> --- a/arch/arm64/include/u

Re: [PATCH v12 5/8] arm64: kvm: Save/restore MTE registers

2021-05-20 Thread Steven Price
On 20/05/2021 10:46, Marc Zyngier wrote: > On Wed, 19 May 2021 14:04:20 +0100, > Steven Price wrote: >> >> On 17/05/2021 18:17, Marc Zyngier wrote: >>> On Mon, 17 May 2021 13:32:36 +0100, >>> Steven Price wrote: >>>> >>>> Define the

Re: [PATCH v12 4/8] arm64: kvm: Introduce MTE VM feature

2021-05-20 Thread Steven Price
On 20/05/2021 12:54, Catalin Marinas wrote: > On Mon, May 17, 2021 at 01:32:35PM +0100, Steven Price wrote: >> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c >> index c5d1f3c87dbd..8660f6a03f51 100644 >> --- a/arch/arm64/kvm/mmu.c >> +++ b/arch/arm64/kvm

Re: [PATCH v12 4/8] arm64: kvm: Introduce MTE VM feature

2021-05-20 Thread Steven Price
On 20/05/2021 09:51, Marc Zyngier wrote: > On Wed, 19 May 2021 11:48:21 +0100, > Steven Price wrote: >> >> On 17/05/2021 17:45, Marc Zyngier wrote: >>> On Mon, 17 May 2021 13:32:35 +0100, >>> Steven Price wrote: [...] >>>>

Re: [PATCH v12 3/8] arm64: mte: Sync tags for pages where PTE is untagged

2021-05-20 Thread Steven Price
On 20/05/2021 13:25, Catalin Marinas wrote: > On Thu, May 20, 2021 at 12:55:21PM +0100, Steven Price wrote: >> On 19/05/2021 19:06, Catalin Marinas wrote: >>> On Mon, May 17, 2021 at 01:32:34PM +0100, Steven Price wrote: >>>> A KVM guest could store tags in a page

Re: [PATCH v12 3/8] arm64: mte: Sync tags for pages where PTE is untagged

2021-05-20 Thread Steven Price
On 19/05/2021 19:06, Catalin Marinas wrote: > On Mon, May 17, 2021 at 01:32:34PM +0100, Steven Price wrote: >> A KVM guest could store tags in a page even if the VMM hasn't mapped >> the page with PROT_MTE. So when restoring pages from swap we will >> need to check to see i

Re: [PATCH v12 8/8] KVM: arm64: Document MTE capability and ioctl

2021-05-20 Thread Steven Price
On 20/05/2021 11:24, Marc Zyngier wrote: > On Wed, 19 May 2021 15:09:23 +0100, > Steven Price wrote: >> >> On 17/05/2021 19:09, Marc Zyngier wrote: >>> On Mon, 17 May 2021 13:32:39 +0100, >>> Steven Price wrote: [...]>>>> +bytes (i.e. 1/16t

Re: [PATCH v12 6/8] arm64: kvm: Expose KVM_ARM_CAP_MTE

2021-05-20 Thread Steven Price
On 20/05/2021 11:09, Marc Zyngier wrote: > On Wed, 19 May 2021 14:26:31 +0100, > Steven Price wrote: >> >> On 17/05/2021 18:40, Marc Zyngier wrote: >>> On Mon, 17 May 2021 13:32:37 +0100, >>> Steven Price wrote: >>>> >>>> I

Re: [PATCH v12 8/8] KVM: arm64: Document MTE capability and ioctl

2021-05-19 Thread Steven Price
On 17/05/2021 19:09, Marc Zyngier wrote: > On Mon, 17 May 2021 13:32:39 +0100, > Steven Price wrote: >> >> A new capability (KVM_CAP_ARM_MTE) identifies that the kernel supports >> granting a guest access to the tags, and provides a mechanism for the >> VMM t

Re: [PATCH v12 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-05-19 Thread Steven Price
On 17/05/2021 19:04, Marc Zyngier wrote: > On Mon, 17 May 2021 13:32:38 +0100, > Steven Price wrote: >> >> The VMM may not wish to have it's own mapping of guest memory mapped >> with PROT_MTE because this causes problems if the VMM has tag checking >> enable

Re: [PATCH v12 6/8] arm64: kvm: Expose KVM_ARM_CAP_MTE

2021-05-19 Thread Steven Price
On 17/05/2021 18:40, Marc Zyngier wrote: > On Mon, 17 May 2021 13:32:37 +0100, > Steven Price wrote: >> >> It's now safe for the VMM to enable MTE in a guest, so expose the >> capability to user space. >> >> Signed-off-by: Steven Price >> --- >>

Re: [PATCH v12 5/8] arm64: kvm: Save/restore MTE registers

2021-05-19 Thread Steven Price
On 17/05/2021 18:17, Marc Zyngier wrote: > On Mon, 17 May 2021 13:32:36 +0100, > Steven Price wrote: >> >> Define the new system registers that MTE introduces and context switch >> them. The MTE feature is still hidden from the ID register as it isn't >> supported

Re: [PATCH v12 4/8] arm64: kvm: Introduce MTE VM feature

2021-05-19 Thread Steven Price
On 17/05/2021 17:45, Marc Zyngier wrote: > On Mon, 17 May 2021 13:32:35 +0100, > Steven Price wrote: >> >> Add a new VM feature 'KVM_ARM_CAP_MTE' which enables memory tagging >> for a VM. This will expose the feature to the guest and automatically >> tag

Re: [PATCH v12 3/8] arm64: mte: Sync tags for pages where PTE is untagged

2021-05-19 Thread Steven Price
On 17/05/2021 17:14, Marc Zyngier wrote: > On Mon, 17 May 2021 13:32:34 +0100, > Steven Price wrote: >> >> A KVM guest could store tags in a page even if the VMM hasn't mapped >> the page with PROT_MTE. So when restoring pages from swap we will >> need to check to s

Re: [PATCH v12 1/8] arm64: mte: Handle race when synchronising tags

2021-05-17 Thread Steven Price
On 17/05/2021 15:03, Marc Zyngier wrote: > Hi Steven, Hi Marc, > On Mon, 17 May 2021 13:32:32 +0100, > Steven Price wrote: >> >> mte_sync_tags() used test_and_set_bit() to set the PG_mte_tagged flag >> before restoring/zeroing the MTE tags. However if another thread

[PATCH v12 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-05-17 Thread Steven Price
to easily read/write the tags from guest memory, allowing the VMM's mapping to be non-PROT_MTE while the VMM can still read/write the tags for the purpose of migration. Signed-off-by: Steven Price --- arch/arm64/include/uapi/asm/kvm.h | 11 + arch/arm64/kvm/arm.c | 69

[PATCH v12 6/8] arm64: kvm: Expose KVM_ARM_CAP_MTE

2021-05-17 Thread Steven Price
It's now safe for the VMM to enable MTE in a guest, so expose the capability to user space. Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 9 + arch/arm64/kvm/sys_regs.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c

[PATCH v12 8/8] KVM: arm64: Document MTE capability and ioctl

2021-05-17 Thread Steven Price
mapping in userspace. The above capability gates access to the ioctl. Signed-off-by: Steven Price --- Documentation/virt/kvm/api.rst | 53 ++ 1 file changed, 53 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index

[PATCH v12 3/8] arm64: mte: Sync tags for pages where PTE is untagged

2021-05-17 Thread Steven Price
as these will not have been swapped out. Signed-off-by: Steven Price --- arch/arm64/include/asm/pgtable.h | 9 +++-- arch/arm64/kernel/mte.c | 16 ++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h

[PATCH v12 5/8] arm64: kvm: Save/restore MTE registers

2021-05-17 Thread Steven Price
Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/include/asm/kvm_mte.h

[PATCH v12 2/8] arm64: Handle MTE tags zeroing in __alloc_zeroed_user_highpage()

2021-05-17 Thread Steven Price
ear the page tags on allocation in __alloc_zeroed_user_highpage() if the vma flags have VM_MTE set. Signed-off-by: Catalin Marinas Signed-off-by: Steven Price --- arch/arm64/include/asm/page.h | 6 -- arch/arm64/mm/fault.c | 21 + 2 files changed, 25 insertions(+)

[PATCH v12 1/8] arm64: mte: Handle race when synchronising tags

2021-05-17 Thread Steven Price
the process. Instead implement a new (global) spinlock to protect the mte_sync_page_tags() function. Fixes: 34bfeea4a9e9 ("arm64: mte: Clear the tags when a page is mapped in user-space with PROT_MTE") Signed-off-by: Steven Price --- --- arch/arm64/kernel/mte.c | 21 ++-

[PATCH v12 4/8] arm64: kvm: Introduce MTE VM feature

2021-05-17 Thread Steven Price
are correctly saved/restored across swap. Actually exposing the new capability to user space happens in a later patch. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_emulate.h | 3 +++ arch/arm64/include/asm/kvm_host.h| 3 +++ arch/arm64/kvm/hyp/exception.c | 3 ++- arch/arm64/kvm

[PATCH v12 0/8] MTE support for KVM guest

2021-05-17 Thread Steven Price
in __alloc_zeroed_user_highpage() Steven Price (7): arm64: mte: Handle race when synchronising tags arm64: mte: Sync tags for pages where PTE is untagged arm64: kvm: Introduce MTE VM feature arm64: kvm: Save/restore MTE registers arm64: kvm: Expose KVM_ARM_CAP_MTE KVM: arm64: ioctl to fetch/store tags

Re: [PATCH v11 2/6] arm64: kvm: Introduce MTE VM feature

2021-05-13 Thread Steven Price
On 12/05/2021 18:45, Catalin Marinas wrote: > On Wed, May 12, 2021 at 04:46:48PM +0100, Steven Price wrote: >> On 10/05/2021 19:35, Catalin Marinas wrote: >>> On Fri, May 07, 2021 at 07:25:39PM +0100, Catalin Marinas wrote: >>>> On Thu, May 06, 2021 at 05:15:

Re: [PATCH v11 2/6] arm64: kvm: Introduce MTE VM feature

2021-05-12 Thread Steven Price
On 10/05/2021 19:35, Catalin Marinas wrote: On Fri, May 07, 2021 at 07:25:39PM +0100, Catalin Marinas wrote: On Thu, May 06, 2021 at 05:15:25PM +0100, Steven Price wrote: On 04/05/2021 18:40, Catalin Marinas wrote: On Thu, Apr 29, 2021 at 05:06:41PM +0100, Steven Price wrote: Given

Re: [PATCH v11 5/6] KVM: arm64: ioctl to fetch/store tags in a guest

2021-05-07 Thread Steven Price
On 04/05/2021 18:44, Catalin Marinas wrote: On Thu, Apr 29, 2021 at 05:06:07PM +0100, Steven Price wrote: On 27/04/2021 18:58, Catalin Marinas wrote: On Fri, Apr 16, 2021 at 04:43:08PM +0100, Steven Price wrote: diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm

Re: [PATCH v11 2/6] arm64: kvm: Introduce MTE VM feature

2021-05-06 Thread Steven Price
On 04/05/2021 18:40, Catalin Marinas wrote: On Thu, Apr 29, 2021 at 05:06:41PM +0100, Steven Price wrote: On 28/04/2021 18:07, Catalin Marinas wrote: I probably asked already but is the only way to map a standard RAM page (not device) in stage 2 via the fault handler? One case I had in mind

Re: [PATCH v11 2/6] arm64: kvm: Introduce MTE VM feature

2021-04-29 Thread Steven Price
On 28/04/2021 18:07, Catalin Marinas wrote: On Fri, Apr 16, 2021 at 04:43:05PM +0100, Steven Price wrote: diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 77cb2d28f2a4..5f8e165ea053 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -879,6 +879,26 @@ static int

Re: [PATCH v11 5/6] KVM: arm64: ioctl to fetch/store tags in a guest

2021-04-29 Thread Steven Price
On 27/04/2021 18:58, Catalin Marinas wrote: On Fri, Apr 16, 2021 at 04:43:08PM +0100, Steven Price wrote: diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 24223adae150..2b85a047c37d 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include

Re: [PATCH v11 1/6] arm64: mte: Sync tags for pages where PTE is untagged

2021-04-29 Thread Steven Price
On 27/04/2021 18:43, Catalin Marinas wrote: On Fri, Apr 16, 2021 at 04:43:04PM +0100, Steven Price wrote: A KVM guest could store tags in a page even if the VMM hasn't mapped the page with PROT_MTE. So when restoring pages from swap we will need to check to see if there are any saved tags even

[PATCH v11 3/6] arm64: kvm: Save/restore MTE registers

2021-04-16 Thread Steven Price
Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/include/asm/kvm_mte.h

[PATCH v11 2/6] arm64: kvm: Introduce MTE VM feature

2021-04-16 Thread Steven Price
are correctly saved/restored across swap. Actually exposing the new capability to user space happens in a later patch. Signed-off-by: Steven Price --- arch/arm64/include/asm/kvm_emulate.h | 3 +++ arch/arm64/include/asm/kvm_host.h| 3 +++ arch/arm64/kvm/hyp/exception.c | 3 ++- arch/arm64/kvm

[PATCH v11 6/6] KVM: arm64: Document MTE capability and ioctl

2021-04-16 Thread Steven Price
mapping in userspace. The above capability gates access to the ioctl. Signed-off-by: Steven Price --- Documentation/virt/kvm/api.rst | 53 ++ 1 file changed, 53 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index

[PATCH v11 1/6] arm64: mte: Sync tags for pages where PTE is untagged

2021-04-16 Thread Steven Price
out. Signed-off-by: Steven Price --- arch/arm64/include/asm/pgtable.h | 2 +- arch/arm64/kernel/mte.c | 16 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index e17b96d0e4b5

  1   2   >