diff mbox

[for,staging,2/2] x86: remove an ASSERT to avoid crash when destroy a domain.

Message ID 1501838977-63404-2-git-send-email-yi.y.sun@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yi Sun Aug. 4, 2017, 9:29 a.m. UTC
In 'psr_free_cos', we should not use 'ASSERT(socket_info)' because
the 'socket_info' is allocated only if 'psr' boot parameter is set.
So remove it and use 'psr_alloc_feat_enabled' to check if 'socket_info'
is valid or not to avoid crash.

Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
---
 xen/arch/x86/psr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jan Beulich Aug. 4, 2017, 4:49 p.m. UTC | #1
>>> Yi Sun <yi.y.sun@linux.intel.com> 08/04/17 11:45 AM >>>
>--- a/xen/arch/x86/psr.c
>+++ b/xen/arch/x86/psr.c
>@@ -1294,9 +1294,7 @@ static void psr_free_cos(struct domain *d)
>{
>unsigned int socket, cos;
 >
>- ASSERT(socket_info);
>-
>-    if ( !d->arch.psr_cos_ids )
>+    if ( !d->arch.psr_cos_ids || !psr_alloc_feat_enabled() )
>return;
 
Isn't it rather that you want to move the ASSERT() past this check? I don't see
why you need both checks, as d->arch.psr_cos_ids is only being allocated if
psr_alloc_feat_enabled() returns true.

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 7d9fa26..13c0daa 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -1294,9 +1294,7 @@  static void psr_free_cos(struct domain *d)
 {
     unsigned int socket, cos;
 
-    ASSERT(socket_info);
-
-    if ( !d->arch.psr_cos_ids )
+    if ( !d->arch.psr_cos_ids || !psr_alloc_feat_enabled() )
         return;
 
     /* Domain is destroyed so its cos_ref should be decreased. */