Re: [PATCH v2] x86/mem_sharing: support forks with active vPMU state

2022-07-21 Thread Tamas K Lengyel
On Thu, Jul 21, 2022 at 8:03 AM Andrew Cooper wrote: > > On 20/07/2022 19:47, Tamas K Lengyel wrote: > > diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c > > index 9bacc02ec1..4c76e24551 100644 > > --- a/xen/arch/x86/cpu/vpmu_amd.c > > +++ b/xen/arch/x86/cpu/vpmu_amd.c > > @@

Re: [PATCH v2] x86/mem_sharing: support forks with active vPMU state

2022-07-21 Thread Tamas K Lengyel
On Thu, Jul 21, 2022 at 6:19 AM Jan Beulich wrote: > > On 20.07.2022 20:47, Tamas K Lengyel wrote: > > --- a/xen/arch/x86/mm/mem_sharing.c > > +++ b/xen/arch/x86/mm/mem_sharing.c > > @@ -1653,6 +1653,46 @@ static void copy_vcpu_nonreg_state(struct vcpu > > *d_vcpu, struct vcpu *cd_vcpu) > >

Re: [PATCH v2] x86/mem_sharing: support forks with active vPMU state

2022-07-21 Thread Jan Beulich
On 20.07.2022 20:47, Tamas K Lengyel wrote: > --- a/xen/arch/x86/mm/mem_sharing.c > +++ b/xen/arch/x86/mm/mem_sharing.c > @@ -1653,6 +1653,46 @@ static void copy_vcpu_nonreg_state(struct vcpu > *d_vcpu, struct vcpu *cd_vcpu) > hvm_set_nonreg_state(cd_vcpu, &nrs); > } > > +static int copy_v

[PATCH v2] x86/mem_sharing: support forks with active vPMU state

2022-07-20 Thread Tamas K Lengyel
Currently the vPMU state from a parent isn't copied to VM forks. To enable the vPMU state to be copied to a fork VM we export certain vPMU functions. First, the vPMU context needs to be allocated for the fork if the parent has one. For this we introduce vpmu->allocate_context, which has previously