Re: [Xen-devel] [Patch for staging 2/2] x86: remove an ASSERT to avoid crash when destroy a domain.

2017-08-04 Thread Jan Beulich
>>> Yi Sun  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


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [Patch for staging 2/2] x86: remove an ASSERT to avoid crash when destroy a domain.

2017-08-04 Thread Yi Sun
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 
---
 xen/arch/x86/psr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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. */
-- 
1.9.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel