qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Mark Kanda" <mark.kanda@oracle.com>
Cc: qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [PATCH v2 1/3] qmp: Support for querying stats
Date: Mon, 17 Jan 2022 13:05:13 +0100	[thread overview]
Message-ID: <ee0d6990-06f3-9a1b-f7d5-7c379f0e9773@redhat.com> (raw)
In-Reply-To: <Ya+rLex1djU/1Wc1@redhat.com>

On 12/7/21 19:42, Daniel P. Berrangé wrote:
> Now onto the values being reported. AFAICT from the kernel
> docs, for all the types of data it currently reports
> (cumulative, instant, peak, none), there is only ever going
> to be a single value. I assume the ability to report multiple
> values is future proofing for a later requirement.

Yes, in fact histogram values have since been added.

> Second, for a given named statistic, AFAICT, the data type,
> unit, base and exponent are all fixed. I don't see a reason
> for us to be reporting that information every time we call
> 'query-stats'. Just report the name + value(s).  Apps that
> want a specific named stat won't care about the dimensions,
> because they'll already know what the value means.

I agree on this.

> The 'name' and 'type' are used for filtering I presume. Only allowing
> a single value for each feels pretty inflexible. I'd say we want to
> allow mutliple requests at a time for efficiency.
> 
> Bearing in mind my other suggestions above, I'd think we should have
> something  more like
> 
>   { 'enum': 'StatsProvider',
>     'data': ["kvm", "qemu", "tcg", ....],
>   }
> 
>   { 'struct': 'StatsRequest',
>     'data': {
>        'provider': 'StatsProvider',
>        // If omitted, report everything for this provider
>        '*fields': [ 'str' ]

I think provider should be optional as well.  See below.

>     }
>   }
> 
>   { 'struct': 'StatsVCPURequest',
>     'base': 'StatsRequest',
>     'data': {
>       // To request subset of vCPUs e.g.
>       //  "cpu_set": "0-3"
>       // Could use ['int'] instead if desired
>       '*cpu_set': str,

Yes, ['int'] is preferrable.

>     },
>   }
> 
>   { 'struct': 'StatsFilter',
>     'data': {
>       // If omitted means don't report that group of data
>       '*vcpu': 'StatsVCPURequest',
>       '*vm': 'StatsRequest',
>     },
>   }

I agree except that I think this and StatsResults should be unions, even 
if it means running multiple query-stats commands.  There should also be 
an enum ['vcpu', 'vm'] that acts as the discriminator for both 
StatsFilter and StatsResults:

  { 'enum': 'StatsTarget',
    'data': [ 'vcpu', 'vm' ] }

  { 'union': 'StatsFilter',
    'base': { 'target': 'StatsTarget', '*providers': ['StatsProvider'] },
    'discriminator': 'target',
    'data': { 'vcpu': ['*cpu-set': ['int']] }
}

  { 'union': 'StatsResults',
    'base': { 'target': 'StatsTarget', stats: ['StatsResultsEntry'] },
    'discriminator': 'target',
    'data': { 'vcpu': ['id': 'int'] }
}

Alternatively, the providers should simply be keys in the dictionary

Paolo

> 
>   { 'alternate': 'StatsValue',
>     'data': { 'scalar': 'int64',
>               'list': [ 'int64 ' ] }
>   }
> 
>   { 'struct': 'StatsResultsEntry',
>     'data': {
>       'provider': 'StatsProvider',
>       'stats': [ 'StatsValue' ]
>     }
>   }
> 
>   { 'struct': 'StatsResults':
>     'data': {
>       '*vcpu': [ [ 'StatsResultsEntry' ] ],
>       '*vm': [ 'StatsResultsEntry' ]
>     }
>   }
> 
>   { 'command': 'query-stats',
>     'data': { 'filter': '*StatsFilter' },
>     'returns': 'StatsResults' }


  reply	other threads:[~2022-01-17 12:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 19:51 [PATCH v2 0/3] Support fd-based KVM stats Mark Kanda
2021-11-19 19:51 ` [PATCH v2 1/3] qmp: Support for querying stats Mark Kanda
2021-12-07 18:42   ` Daniel P. Berrangé
2022-01-17 12:05     ` Paolo Bonzini [this message]
2022-01-17 15:17       ` Mark Kanda
2022-01-18 12:26         ` Paolo Bonzini
2022-01-18 12:52           ` Daniel P. Berrangé
2022-01-18 13:59             ` Mark Kanda
2022-01-19  8:48               ` Paolo Bonzini
2022-01-18 14:47             ` Igor Mammedov
2022-01-19  8:43               ` Paolo Bonzini
2022-01-19  9:11                 ` Daniel P. Berrangé
2021-11-19 19:51 ` [PATCH v2 2/3] hmp: " Mark Kanda
2021-11-19 19:51 ` [PATCH v2 3/3] kvm: Support for querying fd-based stats Mark Kanda
2022-01-15 16:22 ` [PATCH v2 0/3] Support fd-based KVM stats Paolo Bonzini
2022-01-16 23:17   ` Mark Kanda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee0d6990-06f3-9a1b-f7d5-7c379f0e9773@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=mark.kanda@oracle.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).