Skip to contentSkip to conversation

xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated

PATCH Superseded Julien Grall 2 participants 2 messages Aug 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated

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.

Cc George Dunlap <[email protected]>
Cc Dario Faggioli <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>

---
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(+)
xen/common/domain.c +3 -0
index d7a84cf..f0d93e9 100644
@@ -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) )
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 41 lines · Julien Grall

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.

Cc George Dunlap <[email protected]>
Cc Dario Faggioli <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>

---
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(+)
xen/common/domain.c +0 -0
index d7a84cf..f0d93e9 100644

xen/common/domain.c void domain_update_node_affinity(struct domain *d) · line 420

Quoted 6 lines
xen/common/domain.c +3 -0
@@ -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

Quoted 3 lines
xen/common/domain.c +0 -0
     if ( !zalloc_cpumask_var(&dom_cpumask) )
         return;
     if ( !zalloc_cpumask_var(&dom_cpumask_soft) )