xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated
@ 2014-08-07 16:28 Julien Grall
  2014-08-07 16:38 ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2014-08-07 16:28 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Keir Fraser, ian.campbell, Ian Jackson,
	Dario Faggioli, Julien Grall, tim, George Dunlap,
	stefano.stabellini, Jan Beulich

The commit "move domain to cpupool0 before destroying it" make Xen crashes
when a domain is destroyed with d->vcpus allocated but no VCPU initialized.

Assertion '!cpumask_empty(dom_cpumask)' failed at domain.c:452
Xen call trace:
    [<00207bd8>] domain_update_node_affinity+0x10c/0x238 (PC)
    [<00000004>] 00000004 (LR)
    [<00226870>] sched_move_domain+0x3cc/0x42c
    [<0020925c>] domain_kill+0xc8/0x178
    [<00206a0c>] do_domctl+0xaac/0x15e4
    [<002529c0>] do_trap_hypervisor+0xc5c/0xf94
    [<002559f0>] return_from_trap+0/0x4

Bail out early if there is d->VCPU is not allocated or VCPU 0 has not been
initialized.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>

---
    This patch should be backported to Xen 4.4

    Changes in v3:
        - Change commit message
        - Bail out early rather than modifying the ASSERT
---
 xen/common/domain.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index d7a84cf..f0d93e9 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -415,6 +415,9 @@ void domain_update_node_affinity(struct domain *d)
     struct vcpu *v;
     unsigned int cpu;
 
+    if ( !d->vcpu || !d->vcpu[0] )
+        return;
+
     if ( !zalloc_cpumask_var(&dom_cpumask) )
         return;
     if ( !zalloc_cpumask_var(&dom_cpumask_soft) )
-- 
1.7.10.4

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

* Re: [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated
  2014-08-07 16:28 Julien Grall
@ 2014-08-07 16:38 ` Andrew Cooper
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2014-08-07 16:38 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: Juergen Gross, Keir Fraser, ian.campbell, tim, Dario Faggioli,
	Ian Jackson, George Dunlap, stefano.stabellini, Jan Beulich

On 07/08/14 17:28, Julien Grall wrote:
> The commit "move domain to cpupool0 before destroying it" make Xen crashes
> when a domain is destroyed with d->vcpus allocated but no VCPU initialized.
>
> Assertion '!cpumask_empty(dom_cpumask)' failed at domain.c:452
> Xen call trace:
>     [<00207bd8>] domain_update_node_affinity+0x10c/0x238 (PC)
>     [<00000004>] 00000004 (LR)
>     [<00226870>] sched_move_domain+0x3cc/0x42c
>     [<0020925c>] domain_kill+0xc8/0x178
>     [<00206a0c>] do_domctl+0xaac/0x15e4
>     [<002529c0>] do_trap_hypervisor+0xc5c/0xf94
>     [<002559f0>] return_from_trap+0/0x4
>
> Bail out early if there is d->VCPU is not allocated or VCPU 0 has not been
> initialized.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Dario Faggioli <dario.faggioli@citrix.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Keir Fraser <keir@xen.org>
> Cc: Tim Deegan <tim@xen.org>
>
> ---
>     This patch should be backported to Xen 4.4
>
>     Changes in v3:
>         - Change commit message
>         - Bail out early rather than modifying the ASSERT
> ---
>  xen/common/domain.c |    3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index d7a84cf..f0d93e9 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -415,6 +415,9 @@ void domain_update_node_affinity(struct domain *d)
>      struct vcpu *v;
>      unsigned int cpu;
>  
> +    if ( !d->vcpu || !d->vcpu[0] )
> +        return;
> +

Please remove the d->vcpu conditional in sched_move_domain(), as it is
entirely redundant with this new check.

~Andrew

>      if ( !zalloc_cpumask_var(&dom_cpumask) )
>          return;
>      if ( !zalloc_cpumask_var(&dom_cpumask_soft) )

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

* [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated
@ 2014-08-08 13:06 Julien Grall
  2014-08-08 13:08 ` Julien Grall
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2014-08-08 13:06 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Keir Fraser, ian.campbell, Ian Jackson,
	Dario Faggioli, Julien Grall, tim, George Dunlap,
	stefano.stabellini, Jan Beulich

The commit "move domain to cpupool0 before destroying it" make Xen crashes
when a domain is destroyed with d->vcpus allocated but no VCPU initialized.

Assertion '!cpumask_empty(dom_cpumask)' failed at domain.c:452
Xen call trace:
    [<00207bd8>] domain_update_node_affinity+0x10c/0x238 (PC)
    [<00000004>] 00000004 (LR)
    [<00226870>] sched_move_domain+0x3cc/0x42c
    [<0020925c>] domain_kill+0xc8/0x178
    [<00206a0c>] do_domctl+0xaac/0x15e4
    [<002529c0>] do_trap_hypervisor+0xc5c/0xf94
    [<002559f0>] return_from_trap+0/0x4

Bail out early if there is d->VCPU is not allocated or VCPU 0 has not been
initialized.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>

---
    This patch should be backported to Xen 4.4

    Changes in v4:
        - Drop the check in common/schedule.c before calling
        domain_update_node_affinity
        - Comment the check in domain_update_node_affinity

    Changes in v3:
        - Change commit message
        - Bail out early rather than modifying the ASSERT
---
 xen/common/domain.c   |    4 ++++
 xen/common/schedule.c |    4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index d7a84cf..ca6174a 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -415,6 +415,10 @@ void domain_update_node_affinity(struct domain *d)
     struct vcpu *v;
     unsigned int cpu;
 
+    /* Do we have vcpus already? If not, no need to update node-affinity */
+    if ( !d->vcpu || !d->vcpu[0] )
+        return;
+
     if ( !zalloc_cpumask_var(&dom_cpumask) )
         return;
     if ( !zalloc_cpumask_var(&dom_cpumask_soft) )
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 9a49769..55503e0 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -310,9 +310,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c)
         SCHED_OP(old_ops, free_vdata, vcpudata);
     }
 
-    /* Do we have vcpus already? If not, no need to update node-affinity */
-    if ( d->vcpu )
-        domain_update_node_affinity(d);
+    domain_update_node_affinity(d);
 
     domain_unpause(d);
 
-- 
1.7.10.4

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

* Re: [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated
  2014-08-08 13:06 [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated Julien Grall
@ 2014-08-08 13:08 ` Julien Grall
  0 siblings, 0 replies; 4+ messages in thread
From: Julien Grall @ 2014-08-08 13:08 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Keir Fraser, ian.campbell, Ian Jackson,
	Dario Faggioli, tim, George Dunlap, stefano.stabellini,
	Jan Beulich

It's the V4 not V3. I used the wrong command line when generating this
patch. Sorry.

On 08/08/2014 02:06 PM, Julien Grall wrote:
> The commit "move domain to cpupool0 before destroying it" make Xen crashes
> when a domain is destroyed with d->vcpus allocated but no VCPU initialized.
> 
> Assertion '!cpumask_empty(dom_cpumask)' failed at domain.c:452
> Xen call trace:
>     [<00207bd8>] domain_update_node_affinity+0x10c/0x238 (PC)
>     [<00000004>] 00000004 (LR)
>     [<00226870>] sched_move_domain+0x3cc/0x42c
>     [<0020925c>] domain_kill+0xc8/0x178
>     [<00206a0c>] do_domctl+0xaac/0x15e4
>     [<002529c0>] do_trap_hypervisor+0xc5c/0xf94
>     [<002559f0>] return_from_trap+0/0x4
> 
> Bail out early if there is d->VCPU is not allocated or VCPU 0 has not been
> initialized.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Dario Faggioli <dario.faggioli@citrix.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Keir Fraser <keir@xen.org>
> Cc: Tim Deegan <tim@xen.org>
> 
> ---
>     This patch should be backported to Xen 4.4
> 
>     Changes in v4:
>         - Drop the check in common/schedule.c before calling
>         domain_update_node_affinity
>         - Comment the check in domain_update_node_affinity
> 
>     Changes in v3:
>         - Change commit message
>         - Bail out early rather than modifying the ASSERT
> ---
>  xen/common/domain.c   |    4 ++++
>  xen/common/schedule.c |    4 +---
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index d7a84cf..ca6174a 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -415,6 +415,10 @@ void domain_update_node_affinity(struct domain *d)
>      struct vcpu *v;
>      unsigned int cpu;
>  
> +    /* Do we have vcpus already? If not, no need to update node-affinity */
> +    if ( !d->vcpu || !d->vcpu[0] )
> +        return;
> +
>      if ( !zalloc_cpumask_var(&dom_cpumask) )
>          return;
>      if ( !zalloc_cpumask_var(&dom_cpumask_soft) )
> diff --git a/xen/common/schedule.c b/xen/common/schedule.c
> index 9a49769..55503e0 100644
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -310,9 +310,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c)
>          SCHED_OP(old_ops, free_vdata, vcpudata);
>      }
>  
> -    /* Do we have vcpus already? If not, no need to update node-affinity */
> -    if ( d->vcpu )
> -        domain_update_node_affinity(d);
> +    domain_update_node_affinity(d);
>  
>      domain_unpause(d);
>  
> 


-- 
Julien Grall

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

end of thread, other threads:[~2014-08-08 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08 13:06 [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated Julien Grall
2014-08-08 13:08 ` Julien Grall
  -- strict thread matches above, loose matches on Subject: below --
2014-08-07 16:28 Julien Grall
2014-08-07 16:38 ` Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).