Re: [PATCHv3 2/6] qemu: use query-cpus-fast in JSON monitor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12.04.2018 17:52, John Ferlan wrote:
> 
> 
> On 04/04/2018 10:45 AM, Viktor Mihajlovski wrote:
>> Use query-cpus-fast instead of query-cpus if supported by QEMU.
>> Based on the QEMU_CAPS_QUERY_CPUS_FAST capability.
>>
>> Signed-off-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
>> ---
>>  src/qemu/qemu_domain.c       | 14 +++++++++++---
>>  src/qemu/qemu_monitor.c      | 30 ++++++++++++++++++------------
>>  src/qemu/qemu_monitor.h      |  7 +++++--
>>  src/qemu/qemu_monitor_json.c | 37 +++++++++++++++++++++++++++----------
>>  src/qemu/qemu_monitor_json.h |  3 ++-
>>  tests/qemumonitorjsontest.c  |  4 ++--
>>  6 files changed, 65 insertions(+), 30 deletions(-)
>>
>> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>> index 9d1c33b..662937b 100644
>> --- a/src/qemu/qemu_domain.c
>> +++ b/src/qemu/qemu_domain.c
>> @@ -9006,7 +9006,12 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
>>      if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
>>          return -1;
>>  
> 
> Count me as one of those that would prefer to see:
> 
>     bool fast;
> ...
>     fast = virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
>                           QEMU_CAPS_QUERY_CPUS_FAST);
> ...
> 
>> -    rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus, hotplug);
>> +    rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm),
>> +                               &info,
>> +                               maxvcpus,
>> +                               hotplug,
>> +                               virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
>> +                                              QEMU_CAPS_QUERY_CPUS_FAST));
> 
>    rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus,
>                               hotplug, fast);
> >>
>>      if (qemuDomainObjExitMonitor(driver, vm) < 0)
>>          goto cleanup;
>> @@ -9025,7 +9030,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
>>           * thread, but it runs every vCPU in that same thread. So it
>>           * is impossible to setup different affinity per thread.
>>           *
>> -         * What's more the 'query-cpus' command returns bizarre
>> +         * What's more the 'query-cpus[-fast]' command returns bizarre
>>           * data for the threads. It gives the TCG thread for the
>>           * vCPU 0, but for vCPUs 1-> N, it actually replies with
>>           * the main process thread ID.
>> @@ -9126,7 +9131,10 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
>>      if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
>>          return -1;
>>  
>> -    haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus);
> 
> 
>> +    haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm),
>> +                                        maxvcpus,
>> +                                        virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
>> +                                                       QEMU_CAPS_QUERY_CPUS_FAST));
> 
> Likewise,
> 
>  bool fast;
> ...
> 
>  fast = virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps,
>                        QEMU_CAPS_QUERY_CPUS_FAST);
>  haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus,
>                                      fast);
> 
>>  
>>      if (qemuDomainObjExitMonitor(driver, vm) < 0 || !haltedmap)
>>          goto cleanup;
> 
> [...]
> 
> John
> 
> If you're OK with this I can make the alterations...  What you have
> works - it's just one of those preferential things related to seeing
> and/or relying on function calls within function calls.
> 

Sure. On another day I might have used a local variable as well.
Appreciating and accepting your offer to squash in this changes.

-- 
Regards,
  Viktor Mihajlovski

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux