Hi,
I saw strange information about CPU Affinity as follows.
My machine has two physical CPUs. When I set CPU Affinity with both
existing physical CPU numbers and non-existing physical CPU numbers,
the information of CPU Affinity occasionally was "any cpu".
# xm info | grep nr_cpus
nr_cpus : 2
# xm vcpu-pin vm1 0 1
# xm vcpu-list vm1
Name ID VCPU CPU State Time(s) CPU Affinity
vm1 6 0 1 -b- 33.6 1
# xm vcpu-pin vm1 0 1-2
# xm vcpu-list vm1
Name ID VCPU CPU State Time(s) CPU Affinity
vm1 6 0 1 -b- 33.6 any cpu <--
Why?
# xm debug-key q
# xm dmesg
(snip)
(XEN) VCPU information and callbacks for domain 6:
(XEN) VCPU0: CPU1 [has=F] flags=1 upcall_pend = 00, upcall_mask = 00
dirty_cpus={} cpu_affinity={1-2}
(XEN) 100 Hz periodic timer (period 10 ms)
(XEN) Notifying guest (virq 1, port 0, stat 0/-1/0)
# xm vcpu-pin vm1 0 1,3
# xm vcpu-list vm1
Name ID VCPU CPU State Time(s) CPU Affinity
vm1 6 0 1 -b- 33.6 1
# xm debug-key q
# xm dmesg
(snip)
(XEN) VCPU information and callbacks for domain 6:
(XEN) VCPU0: CPU1 [has=T] flags=0 upcall_pend = 00, upcall_mask = 00
dirty_cpus={1} cpu_affinity={1,3}
(XEN) 100 Hz periodic timer (period 10 ms)
(XEN) Notifying guest (virq 1, port 0, stat 0/-1/0)
# xm vcpu-pin vm1 0 1,4
# xm vcpu-list vm1
Name ID VCPU CPU State Time(s) CPU Affinity
vm1 6 0 1 -b- 33.6 any cpu <--
Why?
# xm debug-key q
# xm dmesg
(snip)
(XEN) VCPU information and callbacks for domain 6:
(XEN) VCPU0: CPU1 [has=T] flags=0 upcall_pend = 00, upcall_mask = 00
dirty_cpus={1} cpu_affinity={1,4}
(XEN) 100 Hz periodic timer (period 10 ms)
(XEN) Notifying guest (virq 1, port 0, stat 0/-1/0)
I investigated a cause why strange information was shown. The following
line had the cause.
diff -r d0817f08599a tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Fri May 16 09:37:19 2008 +0100
+++ b/tools/python/xen/xm/main.py Mon May 19 10:03:37 2008 +0900
@@ -1096,7 +1096,7 @@ def xm_vcpu_list(args):
# normalize cpumap by modulus nr_cpus, and drop duplicates
cpumap = dict.fromkeys(
- map(lambda x: x % nr_cpus, cpumap)).keys()
+ filter(lambda x: x < nr_cpus, cpumap)).keys()
if len(cpumap) == nr_cpus:
return "any cpu"
Because the line makes cpumap by using results of "x % nr_cpus",
non-existing physical CPU numbers are handled as existing physical CPU
numbers.
- 1 % 2 --> Physical CPU number 1
- 2 % 2 --> Physical CPU number 0
- 3 % 2 --> Physical CPU number 1
- 4 % 2 --> Physical CPU number 0
This patch removes non-existing physical CPU numbers from cpumap by
filter(), then this problem is solved.
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Best regards,
Kan
xm_vcpu_list.patch
Description: Binary data
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|