Re: [PATCH] arm64: paravirt: remove conduit check in has_pv_steal_clock

2022-11-04 Thread Steven Price
On 04/11/2022 06:16, Usama Arif wrote: > arm_smccc_1_1_invoke() which is called later on in the function > will return failure if there's no conduit (or pre-SMCCC 1.1), > hence the check is unnecessary. > > Suggested-by: Steven Price > Signed-off-by: Usama Arif Reviewe

Re: [PATCH] kvm/arm: Fix pvtime documentation

2022-11-03 Thread Steven Price
On 03/11/2022 13:12, Usama Arif wrote: > This includes table format and using reST labels for > cross-referencing to vcpu.rst. > > Suggested-by: Bagas Sanjaya > Signed-off-by: Usama Arif Reviewed-by: Steven Price > --- > Documentation/virt/kvm/

Re: [RFC 5/6] KVM: arm64: Support the VCPU preemption check

2022-11-03 Thread Steven Price
On 02/11/2022 16:13, Usama Arif wrote: > Support the vcpu_is_preempted() functionality under KVM/arm64. This will > enhance lock performance on overcommitted hosts (more runnable VCPUs > than physical CPUs in the system) as doing busy waits for preempted > VCPUs will hurt system performance far

Re: [PATCH v1] KVM: arm64: Fix bad dereference on MTE-enabled systems.

2022-10-27 Thread Steven Price
rts MTE (and therefore VHE). But, of course, about to get more usual with pKVM. Reviewed-by: Steven Price > --- > arch/arm64/kvm/hyp/exception.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/hyp/exception.c b/arch/arm64/kvm/hyp/exceptio

Re: [PATCH v4 4/8] mm: Add PG_arch_3 page flag

2022-09-21 Thread Steven Price
chnically tied to 64-bit (although in practise obviously 32-bit architectures won't have spare bits). > > Signed-off-by: Peter Collingbourne > Cc: Will Deacon > Cc: Marc Zyngier > Cc: Steven Price > [catalin.mari...@arm.com: added flag preserving in __split_huge_page_tail(

Re: [PATCH v4 1/8] mm: Do not enable PG_arch_2 for all 64-bit architectures

2022-09-21 Thread Steven Price
Marinas > Signed-off-by: Peter Collingbourne > Reported-by: kernel test robot > Cc: Andrew Morton > Cc: Steven Price Reviewed-by: Steven Price > --- > arch/arm64/Kconfig | 1 + > fs/proc/page.c | 2 +- > include/linux/page-flags.h | 2 +- &g

Re: [PATCH v3 4/7] arm64: mte: Lock a page for MTE tag initialisation

2022-09-05 Thread Steven Price
On 02/09/2022 17:58, Catalin Marinas wrote: > On Fri, Sep 02, 2022 at 05:28:47PM +0100, Catalin Marinas wrote: >> On Fri, Sep 02, 2022 at 03:47:33PM +0100, Steven Price wrote: >>> On 10/08/2022 20:30, Peter Collingbourne wrote: >>>> diff --git a/arch/arm64/mm/mtesw

Re: [PATCH v3 6/7] KVM: arm64: permit all VM_MTE_ALLOWED mappings with MTE enabled

2022-09-02 Thread Steven Price
ssage that it's a relaxation of the ABI). I'd > like Steven to have a look as well when he gets the time, in case we > missed anything on the KVM+MTE side. > > Reviewed-by: Catalin Marinas Looks fine to me, and thanks for doing the work: I was never very pleased with th

Re: [PATCH v3 5/7] KVM: arm64: unify the tests for VMAs in memslots when MTE is enabled

2022-09-02 Thread Steven Price
Peter Collingbourne Reviewed-by: Steven Price > --- > arch/arm64/kvm/mmu.c | 25 - > 1 file changed, 16 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 750a69a97994..d54be80e31dd 100644 > ---

Re: [PATCH v3 4/7] arm64: mte: Lock a page for MTE tag initialisation

2022-09-02 Thread Steven Price
ase semantics. > > The two-bit locking is based on Peter Collingbourne's idea. > > Signed-off-by: Catalin Marinas > Cc: Will Deacon > Cc: Marc Zyngier > Cc: Steven Price > Cc: Peter Collingbourne > --- > arch/arm64/include/asm/mte.h | 32 ++

Re: [PATCH v3 2/7] KVM: arm64: Simplify the sanitise_mte_tags() logic

2022-09-02 Thread Steven Price
spte_gfn() does > not have the vma, leave the page unmapped if not already tagged. Tag > initialisation will be done on a subsequent access fault in > user_mem_abort(). Looks correct to me. Reviewed-by: Steven Price > Signed-off-by: Catalin Marinas > Cc: Will Deacon > Cc: Marc Zyngier

Re: [PATCH v3 1/7] arm64: mte: Fix/clarify the PG_mte_tagged semantics

2022-09-02 Thread Steven Price
gers a > user_mem_abort(). > > Signed-off-by: Catalin Marinas > Cc: Will Deacon > Cc: Marc Zyngier > Cc: Steven Price > Cc: Peter Collingbourne Reviewed-by: Steven Price > --- > v3: > - fix build with CONFIG_ARM64_MTE disabled > > arch/arm64/include/

Re: [PATCH] KVM: arm64: permit MAP_SHARED mappings with MTE enabled

2022-07-04 Thread Steven Price
On 04/07/2022 13:19, Cornelia Huck wrote: > On Mon, Jul 04 2022, Steven Price wrote: > >> On 29/06/2022 09:45, Catalin Marinas wrote: >>> On Mon, Jun 27, 2022 at 05:55:33PM +0200, Cornelia Huck wrote: >>>> [I'm still in the process of trying to grok the is

Re: [PATCH] KVM: arm64: permit MAP_SHARED mappings with MTE enabled

2022-07-04 Thread Steven Price
that far ahead either ;). > >> On Sat, Jun 25 2022, Steven Price wrote: >>> On 24/06/2022 18:05, Catalin Marinas wrote: >>>> + Steven as he added the KVM and swap support for MTE. >>>> >>>> On Thu, Jun 23, 2022 at 04:49:44PM -0700, Peter Collingbou

Re: [PATCH] KVM: arm64: permit MAP_SHARED mappings with MTE enabled

2022-06-25 Thread Steven Price
On 24/06/2022 18:05, Catalin Marinas wrote: > + Steven as he added the KVM and swap support for MTE. > > On Thu, Jun 23, 2022 at 04:49:44PM -0700, Peter Collingbourne wrote: >> Certain VMMs such as crosvm have features (e.g. sandboxing, pmem) that >> depend on being able to map guest memory as

Re: [RFC PATCH 03/12] arm64: mm: use a fixmap slot for user page table modifications

2022-01-28 Thread Steven Price
Hi Ard, Interesting series - I attempted[1] something similar a few years ago, but only dealing with the page tables in the linear map. At first glace the series looks like it should work, but this patch caught my eye because there's only a single fixmap slot for page table modifications. The

[PATCH] KVM: arm64: Fix race when enabling KVM_ARM_CAP_MTE

2021-07-29 Thread Steven Price
setting mte_enabled. Close the race by taking kvm->lock. Reported-by: Alexandru Elisei Fixes: 673638f434ee ("KVM: arm64: Expose KVM_ARM_CAP_MTE") Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/a

Re: [PATCH 01/16] KVM: arm64: Generalise VM features into a set of flags

2021-07-28 Thread Steven Price
On 28/07/2021 10:41, Marc Zyngier wrote: > On Tue, 27 Jul 2021 19:10:27 +0100, > Will Deacon wrote: >> >> On Thu, Jul 15, 2021 at 05:31:44PM +0100, Marc Zyngier wrote: >>> We currently deal with a set of booleans for VM features, >>> while they could be better represented as set of flags >>>

Re: [PATCH] KVM: arm64: Fix detection of shared VMAs on guest fault

2021-07-13 Thread Steven Price
of the code. > > The blob having now come back to its senses, let's restore the > initial check that the original author got right the first place. > > Fixes: ea7fc1bb1cd1 ("KVM: arm64: Introduce MTE VM feature") > Cc: Steven Price > Cc: Catalin Marinas > Signed-of

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 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 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 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 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 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 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 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/

[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

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 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 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 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

[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 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 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

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 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

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

[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 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

[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 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 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 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

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 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 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 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 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 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/

[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

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 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 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 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 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 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 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(+)

  1   2   3   4   5   >