2020-08-19 14:44:56 +02:00
|
|
|
util_ss.add(files(
|
|
|
|
'opts-visitor.c',
|
|
|
|
'qapi-clone-visitor.c',
|
|
|
|
'qapi-dealloc-visitor.c',
|
2021-07-18 08:49:22 +02:00
|
|
|
'qapi-forward-visitor.c',
|
2020-08-19 14:44:56 +02:00
|
|
|
'qapi-util.c',
|
|
|
|
'qapi-visit-core.c',
|
|
|
|
'qobject-input-visitor.c',
|
|
|
|
'qobject-output-visitor.c',
|
|
|
|
'string-input-visitor.c',
|
|
|
|
'string-output-visitor.c',
|
|
|
|
))
|
2021-10-08 16:09:00 +02:00
|
|
|
if have_system
|
|
|
|
util_ss.add(files('qapi-type-helpers.c'))
|
|
|
|
endif
|
2022-11-10 09:36:26 +01:00
|
|
|
if have_system or have_tools or have_ga
|
2021-01-22 21:44:39 +01:00
|
|
|
util_ss.add(files(
|
|
|
|
'qmp-dispatch.c',
|
|
|
|
'qmp-event.c',
|
|
|
|
'qmp-registry.c',
|
|
|
|
))
|
|
|
|
endif
|
2020-08-19 14:44:56 +02:00
|
|
|
|
|
|
|
qapi_all_modules = [
|
|
|
|
'authz',
|
|
|
|
'block',
|
2020-09-24 17:26:48 +02:00
|
|
|
'block-core',
|
|
|
|
'block-export',
|
2020-08-19 14:44:56 +02:00
|
|
|
'char',
|
|
|
|
'common',
|
2021-03-18 16:55:10 +01:00
|
|
|
'compat',
|
2020-08-19 14:44:56 +02:00
|
|
|
'control',
|
|
|
|
'crypto',
|
|
|
|
'dump',
|
|
|
|
'error',
|
|
|
|
'introspect',
|
|
|
|
'job',
|
|
|
|
'machine',
|
|
|
|
'machine-target',
|
|
|
|
'migration',
|
|
|
|
'misc',
|
|
|
|
'misc-target',
|
|
|
|
'net',
|
|
|
|
'pragma',
|
|
|
|
'qom',
|
2020-10-03 19:13:14 +02:00
|
|
|
'replay',
|
2020-08-19 14:44:56 +02:00
|
|
|
'run-state',
|
|
|
|
'sockets',
|
qmp: Support for querying stats
Gathering statistics is important for development, for monitoring and
for performance measurement. There are tools such as kvm_stat that do
this and they rely on the _user_ knowing the interesting data points
rather than the tool (which can treat them as opaque).
The commands introduced in this commit introduce QMP support for
querying stats; the goal is to take the capabilities of these tools
and making them available throughout the whole virtualization stack,
so that one can observe, monitor and measure virtual machines without
having shell access + root on the host that runs them.
query-stats returns a list of all stats per target type (only VM
and vCPU to start); future commits add extra options for specifying
stat names, vCPU qom paths, and providers. All these are used by the
HMP command "info stats". Because of the development usecases around
statistics, a good HMP interface is important.
query-stats-schemas returns a list of stats included in each target
type, with an option for specifying the provider. The concepts in the
schema are based on the KVM binary stats' own introspection data, just
translated to QAPI.
There are two reasons to have a separate schema that is not tied to
the QAPI schema. The first is the contents of the schemas: the new
introspection data provides different information than the QAPI data,
namely unit of measurement, how the numbers are gathered and change
(peak/instant/cumulative/histogram), and histogram bucket sizes.
There's really no reason to have this kind of metadata in the QAPI
introspection schema (except possibly for the unit of measure, but
there's a very weak justification).
Another reason is the dynamicity of the schema. The QAPI introspection
data is very much static; and while QOM is somewhat more dynamic,
generally we consider that to be a bug rather than a feature these days.
On the other hand, the statistics that are exposed by QEMU might be
passed through from another source, such as KVM, and the disadvantages of
manually updating the QAPI schema for outweight the benefits from vetting
the statistics and filtering out anything that seems "too unstable".
Running old QEMU with new kernel is a supported usecase; if old QEMU
cannot expose statistics from a new kernel, or if a kernel developer
needs to change QEMU before gathering new info from the new kernel,
then that is a poor user interface.
The framework provides a method to register callbacks for these QMP
commands. Most of the work in fact is done by the callbacks, and a
large majority of this patch is new QAPI structs and commands.
Examples (with KVM stats):
- Query all VM stats:
{ "execute": "query-stats", "arguments" : { "target": "vm" } }
{ "return": [
{ "provider": "kvm",
"stats": [
{ "name": "max_mmu_page_hash_collisions", "value": 0 },
{ "name": "max_mmu_rmap_size", "value": 0 },
{ "name": "nx_lpage_splits", "value": 148 },
... ] },
{ "provider": "xyz",
"stats": [ ... ] }
] }
- Query all vCPU stats:
{ "execute": "query-stats", "arguments" : { "target": "vcpu" } }
{ "return": [
{ "provider": "kvm",
"qom_path": "/machine/unattached/device[0]"
"stats": [
{ "name": "guest_mode", "value": 0 },
{ "name": "directed_yield_successful", "value": 0 },
{ "name": "directed_yield_attempted", "value": 106 },
... ] },
{ "provider": "kvm",
"qom_path": "/machine/unattached/device[1]"
"stats": [
{ "name": "guest_mode", "value": 0 },
{ "name": "directed_yield_successful", "value": 0 },
{ "name": "directed_yield_attempted", "value": 106 },
... ] },
] }
- Retrieve the schemas:
{ "execute": "query-stats-schemas" }
{ "return": [
{ "provider": "kvm",
"target": "vcpu",
"stats": [
{ "name": "guest_mode",
"unit": "none",
"base": 10,
"exponent": 0,
"type": "instant" },
{ "name": "directed_yield_successful",
"unit": "none",
"base": 10,
"exponent": 0,
"type": "cumulative" },
... ]
},
{ "provider": "kvm",
"target": "vm",
"stats": [
{ "name": "max_mmu_page_hash_collisions",
"unit": "none",
"base": 10,
"exponent": 0,
"type": "peak" },
... ]
},
{ "provider": "xyz",
"target": "vm",
"stats": [ ... ]
}
] }
Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-15 16:04:31 +01:00
|
|
|
'stats',
|
2020-08-19 14:44:56 +02:00
|
|
|
'trace',
|
|
|
|
'transaction',
|
2022-08-11 14:24:39 +02:00
|
|
|
'virtio',
|
2020-12-28 16:08:41 +01:00
|
|
|
'yank',
|
2020-08-19 14:44:56 +02:00
|
|
|
]
|
2021-01-22 21:44:38 +01:00
|
|
|
if have_system
|
|
|
|
qapi_all_modules += [
|
2021-01-22 21:44:40 +01:00
|
|
|
'acpi',
|
|
|
|
'audio',
|
2021-01-22 21:44:38 +01:00
|
|
|
'qdev',
|
2021-01-22 21:44:40 +01:00
|
|
|
'pci',
|
|
|
|
'rdma',
|
|
|
|
'rocker',
|
|
|
|
'tpm',
|
2021-01-22 21:44:38 +01:00
|
|
|
]
|
|
|
|
endif
|
2021-01-22 21:44:41 +01:00
|
|
|
if have_system or have_tools
|
|
|
|
qapi_all_modules += [
|
|
|
|
'ui',
|
|
|
|
]
|
|
|
|
endif
|
2020-08-19 14:44:56 +02:00
|
|
|
|
|
|
|
qapi_nonmodule_outputs = [
|
|
|
|
'qapi-introspect.c', 'qapi-introspect.h',
|
|
|
|
'qapi-types.c', 'qapi-types.h',
|
|
|
|
'qapi-visit.h', 'qapi-visit.c',
|
|
|
|
'qapi-commands.h', 'qapi-commands.c',
|
|
|
|
'qapi-init-commands.h', 'qapi-init-commands.c',
|
|
|
|
'qapi-events.h', 'qapi-events.c',
|
|
|
|
'qapi-emit-events.c', 'qapi-emit-events.h',
|
|
|
|
]
|
|
|
|
|
|
|
|
# First build all sources
|
|
|
|
qapi_util_outputs = [
|
|
|
|
'qapi-builtin-types.c', 'qapi-builtin-visit.c',
|
|
|
|
'qapi-builtin-types.h', 'qapi-builtin-visit.h',
|
|
|
|
]
|
|
|
|
|
|
|
|
qapi_inputs = []
|
|
|
|
qapi_specific_outputs = []
|
|
|
|
foreach module : qapi_all_modules
|
|
|
|
qapi_inputs += [ files(module + '.json') ]
|
|
|
|
qapi_module_outputs = [
|
|
|
|
'qapi-types-@0@.c'.format(module),
|
|
|
|
'qapi-types-@0@.h'.format(module),
|
|
|
|
'qapi-visit-@0@.c'.format(module),
|
|
|
|
'qapi-visit-@0@.h'.format(module),
|
|
|
|
]
|
2021-02-24 18:16:42 +01:00
|
|
|
if have_system or have_tools
|
|
|
|
qapi_module_outputs += [
|
|
|
|
'qapi-events-@0@.c'.format(module),
|
|
|
|
'qapi-events-@0@.h'.format(module),
|
|
|
|
'qapi-commands-@0@.c'.format(module),
|
|
|
|
'qapi-commands-@0@.h'.format(module),
|
2022-01-26 17:11:27 +01:00
|
|
|
'qapi-commands-@0@.trace-events'.format(module),
|
2021-02-24 18:16:42 +01:00
|
|
|
]
|
|
|
|
endif
|
2020-08-19 14:44:56 +02:00
|
|
|
if module.endswith('-target')
|
|
|
|
qapi_specific_outputs += qapi_module_outputs
|
|
|
|
else
|
|
|
|
qapi_util_outputs += qapi_module_outputs
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
qapi_files = custom_target('shared QAPI source files',
|
docs/interop: Convert qemu-qmp-ref to rST
Convert qemu-qmp-ref to rST format. This includes dropping
the plain-text, pdf and info format outputs for this document;
as with all our other Sphinx-based documentation, we provide
HTML and manpage only.
The qemu-qmp-ref.rst is somewhat more stripped down than
the .texi was, because we do not (currently) attempt to
generate indexes for the commands, events and data types
being documented.
Again, we drop the direct link from index.html.in now that
the QMP ref is part of the interop manual.
This commit removes the code from the root meson.build file that
handled the various Texinfo-based outputs, because we no longer
generate any documentation except for the Sphinx HTML manuals and the
manpages, and the code can't handle having an empty list of files
to process.. We'll do further cleanup of the remainders of
Texinfo support in subsequent commits.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200925162316.21205-10-peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Unicode legacy literal dumbed down to plain string literal, TODO
comment on displaying QEMU version added, "make html" fixed,
storage-daemon/qapi/meson.build updated]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-25 18:23:04 +02:00
|
|
|
output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
|
2020-08-19 14:44:56 +02:00
|
|
|
input: [ files('qapi-schema.json') ],
|
2022-01-26 17:11:30 +01:00
|
|
|
command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
|
2020-08-19 14:44:56 +02:00
|
|
|
depend_files: [ qapi_inputs, qapi_gen_depends ])
|
|
|
|
|
|
|
|
# Now go through all the outputs and add them to the right sourceset.
|
|
|
|
# These loops must be synchronized with the output of the above custom target.
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
foreach output : qapi_util_outputs
|
|
|
|
if output.endswith('.h')
|
|
|
|
genh += qapi_files[i]
|
|
|
|
endif
|
2022-01-26 17:11:27 +01:00
|
|
|
if output.endswith('.trace-events')
|
|
|
|
qapi_trace_events += qapi_files[i]
|
|
|
|
endif
|
2020-08-19 14:44:56 +02:00
|
|
|
util_ss.add(qapi_files[i])
|
|
|
|
i = i + 1
|
|
|
|
endforeach
|
|
|
|
|
2019-08-15 10:01:26 +02:00
|
|
|
foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
|
|
|
|
if output.endswith('.h')
|
|
|
|
genh += qapi_files[i]
|
|
|
|
endif
|
2022-01-26 17:11:27 +01:00
|
|
|
if output.endswith('.trace-events')
|
|
|
|
qapi_trace_events += qapi_files[i]
|
|
|
|
endif
|
2019-08-15 10:01:26 +02:00
|
|
|
specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
|
|
|
|
i = i + 1
|
|
|
|
endforeach
|