Skip to content
Snippets Groups Projects
  1. Jul 20, 2022
  2. Jul 18, 2022
  3. Jun 22, 2022
  4. Jun 14, 2022
    • Paolo Bonzini's avatar
      hmp: add filtering of statistics by name · 39cd0c7f
      Paolo Bonzini authored
      
      Allow the user to request only a specific subset of statistics.
      This can be useful when working on a feature or optimization that is
      known to affect that statistic.
      
      Example:
      
         (qemu) info stats vcpu halt_poll_fail_ns
         provider: kvm
             halt_poll_fail_ns (cumulative, ns): 0
      
      In case multiple providers have the same statistic, the provider can be
      specified too:
      
         (qemu) info stats vcpu halt_poll_fail_ns kvm
         provider: kvm
             halt_poll_fail_ns (cumulative, ns): 0
      
      Extracted from a patch by Mark Kanda.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      39cd0c7f
    • Paolo Bonzini's avatar
      qmp: add filtering of statistics by name · cf7405bc
      Paolo Bonzini authored
      
      Allow retrieving only a subset of statistics.  This can be useful
      for example in order to plot a subset of the statistics many times
      a second: KVM publishes ~40 statistics for each vCPU on x86; retrieving
      and serializing all of them would be useless.
      
      Another use will be in HMP in the following patch; implementing the
      filter in the backend is easy enough that it was deemed okay to make
      this a public interface.
      
      Example:
      
      { "execute": "query-stats",
        "arguments": {
          "target": "vcpu",
          "vcpus": [ "/machine/unattached/device[2]",
                     "/machine/unattached/device[4]" ],
          "providers": [
            { "provider": "kvm",
              "names": [ "l1d_flush", "exits" ] } } }
      
      { "return": {
          "vcpus": [
            { "path": "/machine/unattached/device[2]"
              "providers": [
                { "provider": "kvm",
                  "stats": [ { "name": "l1d_flush", "value": 41213 },
                             { "name": "exits", "value": 74291 } ] } ] },
            { "path": "/machine/unattached/device[4]"
              "providers": [
                { "provider": "kvm",
                  "stats": [ { "name": "l1d_flush", "value": 16132 },
                             { "name": "exits", "value": 57922 } ] } ] } ] } }
      
      Extracted from a patch by Mark Kanda.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      cf7405bc
    • Paolo Bonzini's avatar
      hmp: add filtering of statistics by provider · 7716417e
      Paolo Bonzini authored
      
      Allow the user to request statistics for a single provider of interest.
      Extracted from a patch by Mark Kanda.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      7716417e
    • Paolo Bonzini's avatar
      qmp: add filtering of statistics by provider · 068cc51d
      Paolo Bonzini authored
      
      Allow retrieving the statistics from a specific provider only.
      This can be used in the future by HMP commands such as "info
      sync-profile" or "info profile".  The next patch also adds
      filter-by-provider capabilities to the HMP equivalent of
      query-stats, "info stats".
      
      Example:
      
      { "execute": "query-stats",
        "arguments": {
          "target": "vm",
          "providers": [
            { "provider": "kvm" } ] } }
      
      The QAPI is a bit more verbose than just a list of StatsProvider,
      so that it can be subsequently extended with filtering of statistics
      by name.
      
      If a provider is specified more than once in the filter, each request
      will be included separately in the output.
      
      Extracted from a patch by Mark Kanda.
      
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      068cc51d
    • Mark Kanda's avatar
      hmp: add basic "info stats" implementation · 433815f5
      Mark Kanda authored
      
      Add an HMP command to retrieve statistics collected at run-time.
      The command will retrieve and print either all VM-level statistics,
      or all vCPU-level statistics for the currently selected CPU.
      
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      433815f5
    • Paolo Bonzini's avatar
      qmp: add filtering of statistics by target vCPU · 467ef823
      Paolo Bonzini authored
      
      Introduce a simple filtering of statistics, that allows to retrieve
      statistics for a subset of the guest vCPUs.  This will be used for
      example by the HMP monitor, in order to retrieve the statistics
      for the currently selected CPU.
      
      Example:
      { "execute": "query-stats",
        "arguments": {
          "target": "vcpu",
          "vcpus": [ "/machine/unattached/device[2]",
                     "/machine/unattached/device[4]" ] } }
      
      Extracted from a patch by Mark Kanda.
      
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      467ef823
    • Mark Kanda's avatar
      qmp: Support for querying stats · b9f88dc0
      Mark Kanda authored
      
      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: default avatarMark Kanda <mark.kanda@oracle.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b9f88dc0
  5. May 26, 2022
  6. May 16, 2022
  7. Apr 27, 2022
  8. Apr 25, 2022
  9. Apr 21, 2022
  10. Apr 20, 2022
  11. Apr 06, 2022
  12. Mar 22, 2022
  13. Mar 21, 2022
  14. Mar 04, 2022
  15. Mar 02, 2022
  16. Feb 21, 2022
  17. Jan 28, 2022
  18. Jan 18, 2022
  19. Dec 21, 2021
  20. Dec 10, 2021
    • Yang Zhong's avatar
      numa: Enable numa for SGX EPC sections · 11058123
      Yang Zhong authored
      
      The basic SGX did not enable numa for SGX EPC sections, which
      result in all EPC sections located in numa node 0. This patch
      enable SGX numa function in the guest and the EPC section can
      work with RAM as one numa node.
      
      The Guest kernel related log:
      [    0.009981] ACPI: SRAT: Node 0 PXM 0 [mem 0x180000000-0x183ffffff]
      [    0.009982] ACPI: SRAT: Node 1 PXM 1 [mem 0x184000000-0x185bfffff]
      The SRAT table can normally show SGX EPC sections menory info in different
      numa nodes.
      
      The SGX EPC numa related command:
       ......
       -m 4G,maxmem=20G \
       -smp sockets=2,cores=2 \
       -cpu host,+sgx-provisionkey \
       -object memory-backend-ram,size=2G,host-nodes=0,policy=bind,id=node0 \
       -object memory-backend-epc,id=mem0,size=64M,prealloc=on,host-nodes=0,policy=bind \
       -numa node,nodeid=0,cpus=0-1,memdev=node0 \
       -object memory-backend-ram,size=2G,host-nodes=1,policy=bind,id=node1 \
       -object memory-backend-epc,id=mem1,size=28M,prealloc=on,host-nodes=1,policy=bind \
       -numa node,nodeid=1,cpus=2-3,memdev=node1 \
       -M sgx-epc.0.memdev=mem0,sgx-epc.0.node=0,sgx-epc.1.memdev=mem1,sgx-epc.1.node=1 \
       ......
      
      Signed-off-by: default avatarYang Zhong <yang.zhong@intel.com>
      Message-Id: <20211101162009.62161-2-yang.zhong@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      11058123
  21. Nov 02, 2021
Loading