mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
I updated the vcpu_to_cpu string creation to include a field separator,
which gets rid of the -1 -> # hack and works for cpus > 9. I ran into some issues with stale vcpu_to_cpu lists when running the hotplug subprogram. I would take a vcpu offline, and then issue the command to bring it back and the vcpu_to_cpu list would not have changed to indicate the the vcpu actually went down. If I injected a xm list -v (which always showed the correct mapping) then subsequent hotplug commands would see the state change and fire off the hotplug request. I don't know that not sending the event when not changing state saves that much work so I took the state check out and now just send the hotplug event directly. > Also the whole hotplug stuff is still missing interrupt re-routing > when a vcpu is taken down. To do this, we need an evtchn operation to > change the vcpu affinity of a port by changing notify_vcpu_id. I don't fully understand all of the mappings that are happening, so this part of the patch might be way off. In any case, I've added a new evtchn op to set the notify_vcpu_id field of a channel. I updated the HOTPLUG_CPU code to use the new routines when bringing cpus up and down. When taking down a cpu, I route the IPI irq channels to CPU 0, and when the cpu comes up, it re-routes the channels back to the awakened CPU. From: Ryan Harper <ryanh@us.ibm.com> Signed-off-by: ian@xensource.com
This commit is contained in:
1 parent
108420db45
commit
8e1bda2932
6 files changed
+90
-22
No files matched your search
@@ -423,8 +423,10 @@ class XendDomainInfo:
|
||||
sxpr.append(['cpu_time', self.info['cpu_time']/1e9])
|
||||
sxpr.append(['vcpus', self.info['vcpus']])
|
||||
sxpr.append(['cpumap', self.info['cpumap']])
|
||||
sxpr.append(['vcpu_to_cpu', ''.join(map(lambda x: str(x),
|
||||
self.info['vcpu_to_cpu'][0:self.info['vcpus']]))])
|
||||
# build a string, using '|' to seperate items, show only up
|
||||
# to number of vcpus in domain, and trim the trailing '|'
|
||||
sxpr.append(['vcpu_to_cpu', ''.join(map(lambda x: str(x)+'|',
|
||||
self.info['vcpu_to_cpu'][0:self.info['vcpus']]))[:-1]])
|
||||
|
||||
if self.start_time:
|
||||
up_time = time.time() - self.start_time
|
||||
|
||||
@@ -410,8 +410,7 @@ class ProgList(Prog):
|
||||
print 'Name Id VCPU CPU CPUMAP'
|
||||
for dom in doms:
|
||||
info = server.xend_domain(dom)
|
||||
# XXX this is quite broken for cpu's > 9
|
||||
vcpu_to_cpu = sxp.child_value(info, 'vcpu_to_cpu', '?').replace('-1','#')
|
||||
vcpu_to_cpu = sxp.child_value(info, 'vcpu_to_cpu', '-1').split('|')
|
||||
cpumap = sxp.child_value(info, 'cpumap', [])
|
||||
mask = ((int(sxp.child_value(info, 'vcpus', '0')))**2) - 1
|
||||
count = 0
|
||||
@@ -420,10 +419,7 @@ class ProgList(Prog):
|
||||
d['name'] = sxp.child_value(info, 'name', '??')
|
||||
d['dom'] = int(sxp.child_value(info, 'id', '-1'))
|
||||
d['vcpu'] = int(count)
|
||||
if cpu == "#":
|
||||
d['cpu'] = int("-1")
|
||||
else:
|
||||
d['cpu'] = int(cpu)
|
||||
d['cpu'] = int(cpu)
|
||||
d['cpumap'] = int(cpumap[count])&mask
|
||||
count = count + 1
|
||||
print ("%(name)-16s %(dom)3d %(vcpu)4d %(cpu)3d 0x%(cpumap)x" % d)
|
||||
@@ -593,15 +589,7 @@ domain DOM"""
|
||||
state = int(args[3])
|
||||
dom = server.xend_domain(name)
|
||||
id = sxp.child_value(dom, 'id')
|
||||
vcpu_to_cpu = sxp.child_value(dom, 'vcpu_to_cpu', '-1')
|
||||
# only send state change if states differ
|
||||
try:
|
||||
# (down going up) or (up going down)
|
||||
if (vcpu_to_cpu[vcpu] == "-1" and state == 1) or \
|
||||
(vcpu_to_cpu[vcpu] != "-1" and state == 0):
|
||||
server.xend_domain_vcpu_hotplug(id, vcpu, state)
|
||||
except IndexError:
|
||||
print "Invalid VCPU(%d)"%(vcpu)
|
||||
server.xend_domain_vcpu_hotplug(id, vcpu, state)
|
||||
|
||||
xm.prog(ProgVcpuhotplug)
|
||||
|
||||
|
||||