All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it
@ 2015-09-09  2:55 Boris Ostrovsky
  2015-09-09  6:55 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Boris Ostrovsky @ 2015-09-09  2:55 UTC (permalink / raw)
  To: jbeulich, andrew.cooper3, wei.liu2
  Cc: boris.ostrovsky, dietmar.hahn, xen-devel

Otherwise we may hit assertion in vpmu_initialise() if vcpu is offlined
and then onlined again.

For tidyness, set priv_context to NULL as well.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 xen/arch/x86/cpu/vpmu_amd.c   | 2 ++
 xen/arch/x86/cpu/vpmu_intel.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index 825be72..04da81a 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -438,6 +438,8 @@ static void amd_vpmu_destroy(struct vcpu *v)
         amd_vpmu_unset_msr_bitmap(v);
 
     xfree(vpmu->context);
+    vpmu->context = NULL;
+    vpmu->priv_context = NULL;
 
     if ( vpmu_is_set(vpmu, VPMU_RUNNING) )
         release_pmu_ownship(PMU_OWNER_HVM);
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index b3750d7..12f80ae 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -828,7 +828,9 @@ static void core2_vpmu_destroy(struct vcpu *v)
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
     xfree(vpmu->context);
+    vpmu->context = NULL;
     xfree(vpmu->priv_context);
+    vpmu->priv_context = NULL;
     if ( has_hvm_container_vcpu(v) && cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
     release_pmu_ownship(PMU_OWNER_HVM);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it
  2015-09-09  2:55 [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it Boris Ostrovsky
@ 2015-09-09  6:55 ` Jan Beulich
  2015-09-09  7:45 ` Dietmar Hahn
  2015-09-09  9:16 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2015-09-09  6:55 UTC (permalink / raw)
  To: Boris Ostrovsky; +Cc: andrew.cooper3, wei.liu2, dietmar.hahn, xen-devel

>>> On 09.09.15 at 04:55, <boris.ostrovsky@oracle.com> wrote:
> Otherwise we may hit assertion in vpmu_initialise() if vcpu is offlined
> and then onlined again.
> 
> For tidyness, set priv_context to NULL as well.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it
  2015-09-09  2:55 [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it Boris Ostrovsky
  2015-09-09  6:55 ` Jan Beulich
@ 2015-09-09  7:45 ` Dietmar Hahn
  2015-09-09  9:16 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Dietmar Hahn @ 2015-09-09  7:45 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, Boris Ostrovsky, wei.liu2, jbeulich

Am Dienstag 08 September 2015, 22:55:52 schrieb Boris Ostrovsky:
> Otherwise we may hit assertion in vpmu_initialise() if vcpu is offlined
> and then onlined again.
> 
> For tidyness, set priv_context to NULL as well.

Reviewed-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>

> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>  xen/arch/x86/cpu/vpmu_amd.c   | 2 ++
>  xen/arch/x86/cpu/vpmu_intel.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
> index 825be72..04da81a 100644
> --- a/xen/arch/x86/cpu/vpmu_amd.c
> +++ b/xen/arch/x86/cpu/vpmu_amd.c
> @@ -438,6 +438,8 @@ static void amd_vpmu_destroy(struct vcpu *v)
>          amd_vpmu_unset_msr_bitmap(v);
>  
>      xfree(vpmu->context);
> +    vpmu->context = NULL;
> +    vpmu->priv_context = NULL;
>  
>      if ( vpmu_is_set(vpmu, VPMU_RUNNING) )
>          release_pmu_ownship(PMU_OWNER_HVM);
> diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
> index b3750d7..12f80ae 100644
> --- a/xen/arch/x86/cpu/vpmu_intel.c
> +++ b/xen/arch/x86/cpu/vpmu_intel.c
> @@ -828,7 +828,9 @@ static void core2_vpmu_destroy(struct vcpu *v)
>      struct vpmu_struct *vpmu = vcpu_vpmu(v);
>  
>      xfree(vpmu->context);
> +    vpmu->context = NULL;
>      xfree(vpmu->priv_context);
> +    vpmu->priv_context = NULL;
>      if ( has_hvm_container_vcpu(v) && cpu_has_vmx_msr_bitmap )
>          core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
>      release_pmu_ownship(PMU_OWNER_HVM);
> 

-- 
Company details: http://ts.fujitsu.com/imprint.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it
  2015-09-09  2:55 [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it Boris Ostrovsky
  2015-09-09  6:55 ` Jan Beulich
  2015-09-09  7:45 ` Dietmar Hahn
@ 2015-09-09  9:16 ` Wei Liu
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2015-09-09  9:16 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: andrew.cooper3, wei.liu2, dietmar.hahn, jbeulich, xen-devel

On Tue, Sep 08, 2015 at 10:55:52PM -0400, Boris Ostrovsky wrote:
> Otherwise we may hit assertion in vpmu_initialise() if vcpu is offlined
> and then onlined again.
> 
> For tidyness, set priv_context to NULL as well.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Release-acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  xen/arch/x86/cpu/vpmu_amd.c   | 2 ++
>  xen/arch/x86/cpu/vpmu_intel.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
> index 825be72..04da81a 100644
> --- a/xen/arch/x86/cpu/vpmu_amd.c
> +++ b/xen/arch/x86/cpu/vpmu_amd.c
> @@ -438,6 +438,8 @@ static void amd_vpmu_destroy(struct vcpu *v)
>          amd_vpmu_unset_msr_bitmap(v);
>  
>      xfree(vpmu->context);
> +    vpmu->context = NULL;
> +    vpmu->priv_context = NULL;
>  
>      if ( vpmu_is_set(vpmu, VPMU_RUNNING) )
>          release_pmu_ownship(PMU_OWNER_HVM);
> diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
> index b3750d7..12f80ae 100644
> --- a/xen/arch/x86/cpu/vpmu_intel.c
> +++ b/xen/arch/x86/cpu/vpmu_intel.c
> @@ -828,7 +828,9 @@ static void core2_vpmu_destroy(struct vcpu *v)
>      struct vpmu_struct *vpmu = vcpu_vpmu(v);
>  
>      xfree(vpmu->context);
> +    vpmu->context = NULL;
>      xfree(vpmu->priv_context);
> +    vpmu->priv_context = NULL;
>      if ( has_hvm_container_vcpu(v) && cpu_has_vmx_msr_bitmap )
>          core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
>      release_pmu_ownship(PMU_OWNER_HVM);
> -- 
> 1.8.1.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-09  9:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09  2:55 [PATCH for 4.6] x86/VPMU: Set VPMU context pointer to NULL when freeing it Boris Ostrovsky
2015-09-09  6:55 ` Jan Beulich
2015-09-09  7:45 ` Dietmar Hahn
2015-09-09  9:16 ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.