Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-21 Thread Kang, Luwei
> >>> On 18.05.17 at 16:23, wrote: > >> > --- a/xen/arch/x86/cpu/vpmu.c > >> > +++ b/xen/arch/x86/cpu/vpmu.c > >> > @@ -859,6 +859,7 @@ static int cpu_callback( > >> > { > >> > vpmu_save_force(vcpu); > >> > vpmu_reset(vpmu, VPMU_CONTEXT_LOADED); > >> > +per_cpu(last_

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Jan Beulich
>>> On 18.05.17 at 16:23, wrote: >> > --- a/xen/arch/x86/cpu/vpmu.c >> > +++ b/xen/arch/x86/cpu/vpmu.c >> > @@ -859,6 +859,7 @@ static int cpu_callback( >> > { >> > vpmu_save_force(vcpu); >> > vpmu_reset(vpmu, VPMU_CONTEXT_LOADED); >> > +per_cpu(last_vcpu, cpu) = NUL

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Dario Faggioli
On Thu, 2017-05-18 at 07:16 -0600, Jan Beulich wrote: > > > > On 18.05.17 at 15:03, wrote: > > > > As I said last time, I'd rename cpu_callback() to something less > > generic, like vpmu_cpu_callback() (or vpmu_cpuhp_callback()). > > The vpmu_ prefix is clearly pointless for a static function. >

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Kang, Luwei
> > --- a/xen/arch/x86/cpu/vpmu.c > > +++ b/xen/arch/x86/cpu/vpmu.c > > @@ -859,6 +859,7 @@ static int cpu_callback( > > { > > vpmu_save_force(vcpu); > > vpmu_reset(vpmu, VPMU_CONTEXT_LOADED); > > +per_cpu(last_vcpu, cpu) = NULL;// OR: this_cpu(last_vcpu) > >

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Jan Beulich
>>> On 18.05.17 at 15:06, wrote: On 18.05.17 at 13:51, wrote: >> In vpmu_load(), remote call will guarded by VPMU_CONTEXT_LOADED flag > check. As for vpmu->last_pcpu, we can't use some random online one to produce > false. >> What is your opinion? > > I continue to think that it n

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Jan Beulich
>>> On 18.05.17 at 15:03, wrote: > On 05/18/2017 05:07 AM, Jan Beulich wrote: > On 17.05.17 at 17:57, wrote: >>> @@ -581,9 +582,14 @@ static void vpmu_arch_destroy(struct vcpu *v) >>> >>> if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->arch_vpmu_destroy ) >>> { >>> -/* Un

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Jan Beulich
>>> On 18.05.17 at 13:51, wrote: >> >>> On 17.05.17 at 17:57, wrote: >> > @@ -581,9 +582,14 @@ static void vpmu_arch_destroy(struct vcpu *v) >> > >> > if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->arch_vpmu_destroy ) >> > { >> > -/* Unload VPMU first. This will stop counters

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Boris Ostrovsky
On 05/18/2017 05:07 AM, Jan Beulich wrote: On 17.05.17 at 17:57, wrote: >> @@ -581,9 +582,14 @@ static void vpmu_arch_destroy(struct vcpu *v) >> >> if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->arch_vpmu_destroy ) >> { >> -/* Unload VPMU first. This will stop counters *

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Kang, Luwei
> >>> On 17.05.17 at 17:57, wrote: > > @@ -581,9 +582,14 @@ static void vpmu_arch_destroy(struct vcpu *v) > > > > if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->arch_vpmu_destroy ) > > { > > -/* Unload VPMU first. This will stop counters */ > > -on_selected_cpus(cpumask

Re: [Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-18 Thread Jan Beulich
>>> On 17.05.17 at 17:57, wrote: > @@ -581,9 +582,14 @@ static void vpmu_arch_destroy(struct vcpu *v) > > if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->arch_vpmu_destroy ) > { > -/* Unload VPMU first. This will stop counters */ > -on_selected_cpus(cpumask_of(vcpu_vpm

[Xen-devel] [PATCH v2] x86/vpmu: add cpu hot unplug notifier for vpmu

2017-05-17 Thread Luwei Kang
Currently, Hot unplug a physical CPU with vpmu enabled may cause system hang due to send a remote call to an offlined pCPU. This patch add a cpu hot unplug notifer to save vpmu context before cpu offline. Consider one scenario, hot unplug pCPU N with vpmu enabled. The vcpu which running on this pC