Some architectures (S390) depend on QEMU to compute baseline CPU model and expand a models feature set. Interacting with QEMU requires starting the QEMU process and completing one or more query-cpu-model-baseline QMP exchanges with QEMU in addition to a query-cpu-model-expansion QMP exchange to expand all features in the model. See "s390x CPU models: exposing features" patch set on Qemu-devel for discussion of QEMU aspects. This is part of resolution of: https://bugzilla.redhat.com/show_bug.cgi?id=1511999 ----- v6 addresses these issues from v5: qemu_process: Move process code from qemu_capabilities to qemu_process [x] Remove exception statement from commit message qemu_process: Use qemuProcessQmp prefix [x] s/ProcessQmp/ProcessQMP/ in this and all subsequent patches qemu_process: Refer to proc not cmd in process code [x] Back port indentation fix in qemuProcessQMPRun qemu_capabilities: Stop QEMU process before freeing [x] Back port !proc check in qemuProcessQmpStop qemu_process: Use qemuProcessQmp struct for a single process [x] Remove extra empty lines qemu_process: All ProcessQMP errors are fatal [x] Split into multiple patches qemu_process: Introduce qemuProcessQmpStart [x] Log function parameters separately in the first function debug message [x] Removed NULLSTR check on proc-binary (would fail previously on proc activate) [x] Back port referring to stderr rather than qmperr in comment [ ] Combine qemuProcessQmpStop and qemuProcessQmpFree (See reply to v5 email) emu_process: Collect monitor code in single function [x] Back port qemuMonitorOpen indent fix to earlier patch qemu_process: Don't open monitor if process failed [x] Drop patch qemu_process: Cleanup qemuProcessQmp alloc function [x] s/Qemu/QEMU/ in comments for qemuProcessQMPNew [x] Remove unneeded use of NULLSTR and NULL check before calling qemuProcessQmpFree qemu_process: Cleanup qemuProcessQmpStop function [x] Remove lines from from commit message [x] Remove capitalization from comment [x] Fix func def to match coding style [x] Back port !proc check to earlier patch qemu_process: Catch process free before process stop [x] Remove capitalization from comment [x] Don't do proc NULL check in VIR_DEBUG [ ] Combine qemuProcessQmpStop and qemuProcessQmpFree (See reply to v5 email) qemu_monitor: Make monitor callbacks optional [x] Drop patch qemu_process: Enter QMP command mode when starting QEMU Process [ ] Don't call qemuMonitorSetCapabilities in qemuProcessQMPConnectMonitor (See reply to v5 email) qemu_process: Use unique directories for QMP processes [x] s/qemu./qmp-/ for QMP process directory name prefix [x] Catch mkdtemp returns NULL qemu_process: Stop locking QMP process monitor immediately [x] Drop patch qemu_monitor: Introduce qemuMonitorCPUModelInfoNew [x] Use qemuMonitorCPUModelInfoNew to set model name [x] Drop variable initialization [x] Use qemuMonitorCPUModelInfoNew in qemuMonitorJSONGetCPUModelExpansion (Pull forward) [ ] Remove orig NULL check (Unit tests fail if I do this) qemu_monitor: Introduce qemuMonitorCPUModelInfo / JSON conversion [x] Make variable initialization easier to read in PropAdd [x] Require at least one "prop" (don't allow zero in this commit) qemu_capabilities: Introduce virQEMuCapsMigratablePropsDiff [x] Remove template txt in commit message [x] Change function name [x] Distinguish nmProp from mProp [x] Don't set cpuData->info to NULL [ ] Don't use tmp (defer to next patch set... out of time) qemu_monitor: qemuMonitorGetCPUModelExpansion inputs and outputs CPUModelInfo [x] Remove extra line from commit message [x] Change parameter order [x] Don't use VIR_STEAL_PTR qemu_capabilities: Introduce CPUModelInfo to virCPUDef function [x] Change comment [x] Change parameter order [x] Separate lines [x] Move debug message before alloc [x] Back port function spacing fix from next patch qemu_capabilities: Introduce virCPUDef to CPUModelInfo function [x] Change comment [x] Move debug message before alloc [x] Remove NULL check on feature->name [x] Document prop value semantics Reviewed in v5 but no changes required: qemu_process: Limit qemuProcessQmpNew to const input strings qemu_process: Use consistent name for stop process function qemu_process: Persist stderr in qemuProcessQmp struct qemu_process: Store libDir in qemuProcessQmp struct qemu_process: Setup paths within qemuProcessQmpInit qemu_process: Stop retaining Monitor config in qemuProcessQmp Not reviewed in v5: qemu_monitor: Support query-cpu-model-baseline QMP command qemu_driver: Consolidate code to baseline using libvirt qemu_driver: Decouple code for baseline using libvirt qemu_driver: Identify using libvirt as a distinct way to compute baseline qemu_driver: Support baseline calculation using QEMU qemu_driver: Support feature expansion via QEMU when baselining cpu qemu_driver: Remove unsupported props in expanded hypervisor baseline output qemu_monitor: Default props to migratable when expanding cpu model ----- v5: Fixes all process issues identified here: https://www.redhat.com/archives/libvir-list/2018-November/msg00349.html - Make the process code generic (not capabilities specific) for use by BaselineHypervisorCPU - Many of the process patches are simple code moves with implementation changes in other distinct patches - A thread safe library function creates a unique directory under libDir for each QEMU process (for QMP messaging) to decouple processes in terms of sockets and file system footprint. The remaining (non-process) patches in v4 address all issues in v1-v4 of 'BaselineHypervisorCPU using QEMU QMP exchanges' Thanks, Chris *** BLURB HERE *** Chris Venteicher (33): qEmu_process: Move process code from qemu_capabilities to qemu_process qemu_process: Use qemuProcessQMP prefix qemu_process: Limit qemuProcessQMPNew to const input strings qemu_process: Refer to proc not cmd in process code qemu_process: Use consistent name for stop process function qemu_capabilities: Stop QEMU process before freeing qemu_process: Use qemuProcessQMP struct for a single process qemu_process: All ProcessQMP errors are fatal qemu_process: Expose process exit status code qemu_process: Persist stderr in qemuProcessQMP struct qemu_process: Introduce qemuProcessQMPStart qemu_process: Collect monitor code in single function qemu_process: Store libDir in qemuProcessQMP struct qemu_process: Setup paths within qemuProcessQMPInit qemu_process: Stop retaining Monitor config in qemuProcessQMP qemu_process: Cleanup qemuProcessQMP alloc function qemu_process: Cleanup qemuProcessQMPStop function qemu_process: Catch process free before process stop qemu_process: Enter QMP command mode when starting QEMU Process qemu_process: Use unique directories for QMP processes qemu_monitor: Introduce qemuMonitorCPUModelInfoNew qemu_monitor: Introduce qemuMonitorCPUModelInfo / JSON conversion qemu_capabilities: Introduce virQEMuCapsMigratablePropsCalc qemu_monitor: qemuMonitorGetCPUModelExpansion inputs and outputs CPUModelInfo qemu_capabilities: Introduce CPUModelInfo to virCPUDef function qemu_capabilities: Introduce virCPUDef to CPUModelInfo function qemu_monitor: Support query-cpu-model-baseline QMP command qemu_driver: Consolidate code to baseline using libvirt qemu_driver: Decouple code for baseline using libvirt qemu_driver: Identify using libvirt as a distinct way to compute baseline qemu_driver: Support baseline calculation using QEMU qemu_driver: Support feature expansion via QEMU when baselining cpu qemu_monitor: Default props to migratable when expanding cpu model src/qemu/qemu_capabilities.c | 631 ++++++++---------- src/qemu/qemu_capabilities.h | 4 + src/qemu/qemu_driver.c | 216 +++++- src/qemu/qemu_monitor.c | 165 ++++- src/qemu/qemu_monitor.h | 29 +- src/qemu/qemu_monitor_json.c | 223 +++++-- src/qemu/qemu_monitor_json.h | 10 +- src/qemu/qemu_process.c | 345 ++++++++++ src/qemu/qemu_process.h | 32 + tests/cputest.c | 11 +- .../caps_2.10.0.s390x.xml | 60 +- .../caps_2.11.0.s390x.xml | 58 +- .../caps_2.12.0.s390x.xml | 56 +- .../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 32 +- .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 34 +- .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 64 +- tests/qemucapabilitiestest.c | 7 + 17 files changed, 1375 insertions(+), 602 deletions(-) -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list