Re: [PATCH 16/16] KVM: arm64: pkvm: Unshare guest structs during teardown

2021-10-19 Thread Quentin Perret
On Monday 18 Oct 2021 at 18:12:22 (+0100), Marc Zyngier wrote: > On 2021-10-18 15:03, Quentin Perret wrote: > > On Monday 18 Oct 2021 at 11:32:13 (+0100), Quentin Perret wrote: > > > Another option is to take a refcount on 'current' from > > > kvm_arch_vcpu_run_map_fp() before sharing thread-specif

Re: [PATCH 16/16] KVM: arm64: pkvm: Unshare guest structs during teardown

2021-10-18 Thread Quentin Perret
On Monday 18 Oct 2021 at 11:32:13 (+0100), Quentin Perret wrote: > Another option is to take a refcount on 'current' from > kvm_arch_vcpu_run_map_fp() before sharing thread-specific structs with > the hyp and release the refcount of the previous task after unsharing. > But that means we'll have to

Re: [PATCH 16/16] KVM: arm64: pkvm: Unshare guest structs during teardown

2021-10-18 Thread Marc Zyngier
On 2021-10-18 15:03, Quentin Perret wrote: On Monday 18 Oct 2021 at 11:32:13 (+0100), Quentin Perret wrote: Another option is to take a refcount on 'current' from kvm_arch_vcpu_run_map_fp() before sharing thread-specific structs with the hyp and release the refcount of the previous task after un

Re: [PATCH 16/16] KVM: arm64: pkvm: Unshare guest structs during teardown

2021-10-18 Thread Quentin Perret
On Saturday 16 Oct 2021 at 13:25:45 (+0100), Marc Zyngier wrote: > At this stage, the old thread may have been destroyed and the memory > recycled. What happens if, in the interval, that memory gets shared > again in another context? My guts feeling is that either the sharing > fails, or the unshar

Re: [PATCH 16/16] KVM: arm64: pkvm: Unshare guest structs during teardown

2021-10-16 Thread Marc Zyngier
On Wed, 13 Oct 2021 16:58:31 +0100, Quentin Perret wrote: > > Make use of the newly introduced unshare hypercall during guest teardown > to unmap guest-related data structures from the hyp stage-1. > > Signed-off-by: Quentin Perret > --- > arch/arm64/include/asm/kvm_host.h | 2 ++ > arch/arm6

[PATCH 16/16] KVM: arm64: pkvm: Unshare guest structs during teardown

2021-10-13 Thread Quentin Perret
Make use of the newly introduced unshare hypercall during guest teardown to unmap guest-related data structures from the hyp stage-1. Signed-off-by: Quentin Perret --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/include/asm/kvm_mmu.h | 1 + arch/arm64/kvm/arm.c | 2 ++