diff mbox

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

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

Commit Message

Yi Sun Aug. 7, 2017, 1:50 a.m. UTC
In 'psr_free_cos', we should not use 'ASSERT(socket_info)' at the beginning
because the 'socket_info' is allocated only if 'psr' boot parameter is set.
So adjust its place to avoid crash.

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

Comments

Jan Beulich Aug. 7, 2017, 7:06 a.m. UTC | #1
>>> Yi Sun <yi.y.sun@linux.intel.com> 08/07/17 4:07 AM >>>
>In 'psr_free_cos', we should not use 'ASSERT(socket_info)' at the beginning
>because the 'socket_info' is allocated only if 'psr' boot parameter is set.
>So adjust its place to avoid crash.
>
>Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Wei Liu Aug. 7, 2017, 10:19 a.m. UTC | #2
Can we see about committing this patch as soon as possible? This is
blocking osstest pushgate.

On Mon, Aug 07, 2017 at 09:50:49AM +0800, Yi Sun wrote:
> In 'psr_free_cos', we should not use 'ASSERT(socket_info)' at the beginning
> because the 'socket_info' is allocated only if 'psr' boot parameter is set.
> So adjust its place to avoid crash.
> 
> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
> ---
>  xen/arch/x86/psr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
> index 7d9fa26..9ce8f17 100644
> --- a/xen/arch/x86/psr.c
> +++ b/xen/arch/x86/psr.c
> @@ -1294,11 +1294,11 @@ static void psr_free_cos(struct domain *d)
>  {
>      unsigned int socket, cos;
>  
> -    ASSERT(socket_info);
> -
>      if ( !d->arch.psr_cos_ids )
>          return;
>  
> +    ASSERT(socket_info);
> +
>      /* Domain is destroyed so its cos_ref should be decreased. */
>      for ( socket = 0; socket < nr_sockets; socket++ )
>      {
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
Wei Liu Aug. 7, 2017, 10:48 a.m. UTC | #3
On Mon, Aug 07, 2017 at 11:19:09AM +0100, Wei Liu wrote:
> Can we see about committing this patch as soon as possible? This is
> blocking osstest pushgate.

Andrew prodded me on irc to commit this patch. I have done so, along
with the doc patch.
diff mbox

Patch

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