提交 0df2524a 编写于 作者: P Peter Krempa

qemu: domain: Refresh vcpu halted state using qemuMonitorGetCpuHalted

Don't use qemuMonitorGetCPUInfo which does a lot of matching to get the
full picture which is not necessary and would be mostly discarded.

Refresh only the vcpu halted state using data from query-cpus.
上级 5d885f4f
...@@ -6367,39 +6367,34 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, ...@@ -6367,39 +6367,34 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
int asyncJob) int asyncJob)
{ {
virDomainVcpuDefPtr vcpu; virDomainVcpuDefPtr vcpu;
qemuMonitorCPUInfoPtr info = NULL; qemuDomainVcpuPrivatePtr vcpupriv;
size_t maxvcpus = virDomainDefGetVcpusMax(vm->def); size_t maxvcpus = virDomainDefGetVcpusMax(vm->def);
virBitmapPtr haltedmap = NULL;
size_t i; size_t i;
bool hotplug;
int rc;
int ret = -1; int ret = -1;
/* Not supported currently for TCG, see qemuDomainRefreshVcpuInfo */ /* Not supported currently for TCG, see qemuDomainRefreshVcpuInfo */
if (vm->def->virtType == VIR_DOMAIN_VIRT_QEMU) if (vm->def->virtType == VIR_DOMAIN_VIRT_QEMU)
return 0; return 0;
hotplug = qemuDomainSupportsNewVcpuHotplug(vm);
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1; return -1;
rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus, hotplug); haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus);
if (qemuDomainObjExitMonitor(driver, vm) < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0 || !haltedmap)
goto cleanup;
if (rc < 0)
goto cleanup; goto cleanup;
for (i = 0; i < maxvcpus; i++) { for (i = 0; i < maxvcpus; i++) {
vcpu = virDomainDefGetVcpu(vm->def, i); vcpu = virDomainDefGetVcpu(vm->def, i);
QEMU_DOMAIN_VCPU_PRIVATE(vcpu)->halted = info[i].halted; vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
vcpupriv->halted = virBitmapIsBitSet(haltedmap, vcpupriv->qemu_id);
} }
ret = 0; ret = 0;
cleanup: cleanup:
qemuMonitorCPUInfoFree(info, maxvcpus); virBitmapFree(haltedmap);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册