[libvirt] [PATCH V2 3/4] qemu: Add domain support for VCPU halted state
Viktor Mihajlovski
mihajlov at linux.vnet.ibm.com
Thu Oct 6 07:10:31 UTC 2016
On 29.09.2016 16:34, John Ferlan wrote:
[...]
>> --- a/src/qemu/qemu_domain.c
>> +++ b/src/qemu/qemu_domain.c
>> @@ -5956,6 +5956,75 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
>> return ret;
>> }
>>
>> +/**
>> + * qemuDomainGetVcpuHalted:
>> + * @vm: domain object
>> + * @vcpu: cpu id
>> + *
>> + * Returns the vCPU halted state.
>> + */
>> +bool
>> +qemuDomainGetVcpuHalted(virDomainObjPtr vm,
>> + unsigned int vcpuid)
>> +{
>> + virDomainVcpuDefPtr vcpu = virDomainDefGetVcpu(vm->def, vcpuid);
>> + return QEMU_DOMAIN_VCPU_PRIVATE(vcpu)->halted;
>> +}
>> +
>> +/**
>> + * qemuDomainRefreshVcpuHalted:
>> + * @driver: qemu driver data
>> + * @vm: domain object
>> + * @asyncJob: current asynchronous job type
>> + *
>> + * Updates vCPU halted state in the private data of @vm.
>> + *
>> + * Returns number of detected vCPUs on success, -1 on error and reports
>> + * an appropriate error, -2 if the domain doesn't exist any more.
>
> Neither of the callers checks -1 or -2, just < 0, so is this really
> necessary?
>
yes, this is nonsense, IIRC this was needed in the first version of the
series to differentiate the two cases
>> + */
>> +int
>> +qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
>> + virDomainObjPtr vm,
>> + int asyncJob)
>> +{
>> + virDomainVcpuDefPtr vcpu;
>> + qemuMonitorCPUInfoPtr info = NULL;
>> + size_t maxvcpus = virDomainDefGetVcpusMax(vm->def);
>> + size_t i;
>> + bool hotplug;
>> + int rc;
>> + int ret = -1;
>> +
>> + /* Not supported currently for TCG, see qemuDomainRefreshVcpuInfo */
>> + if (vm->def->virtType == VIR_DOMAIN_VIRT_QEMU)
>> + return 0;
>
> Since the "default" is halted = true could we run into a situation where
> "halted" (or "running (inactive)") is always set for TCG...
>
good point, "halted" as the new kid in town should actually be false by
default, as you have observed the issue is introduced in patch 2/4
(monitors).
[...]
--
Mit freundlichen Grüßen/Kind Regards
Viktor Mihajlovski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
More information about the libvir-list
mailing list