From: Paolo Bonzini <pbonzini@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, armbru@redhat.com,
Mark Kanda <mark.kanda@oracle.com>
Subject: Re: [PATCH v5 02/10] kvm: Support for querying fd-based stats
Date: Wed, 8 Jun 2022 16:13:35 +0200 [thread overview]
Message-ID: <758db6b4-5786-adf4-d293-d8dc7793a21b@redhat.com> (raw)
In-Reply-To: <Yp+ObQxOi/EXc6PZ@work-vm>
On 6/7/22 19:44, Dr. David Alan Gilbert wrote:
>> + return NULL;
>> + }
>> + descriptors->kvm_stats_header = kvm_stats_header;
>> + descriptors->kvm_stats_desc = kvm_stats_desc;
>> + descriptors->ident = g_strdup(ident);
>
> There's something that confuses me here; you check your set of
> descriptors above to find any with the matching ident, and if you've
> already got it you return it; OK. Now, if you don't match then you
> read some stats and store it with that ident - but I don't see
> when you read the stats from the fd, what makes it read the stats that
> correspond to 'ident' ?
If you mean why not some other source, each source has a different file
descriptor:
+ int stats_fd = kvm_vcpu_ioctl(cpu, KVM_GET_STATS_FD, NULL);
but the descriptors are consistent every time KVM_GET_STATS_FD is
called, so basically "ident" can be used as a cache key.
If you mean how does it access the right stat, here it uses the offset
field in the descriptor
ret = pread(stats_fd, stats_data, size_data,
kvm_stats_header->data_offset);
...
for (i = 0; i < kvm_stats_header->num_desc; ++i) {
uint64_t *stats;
pdesc = (void *)kvm_stats_desc + i * size_desc;
/* Add entry to the list */
stats = (void *)stats_data + pdesc->offset;
Paolo
next prev parent reply other threads:[~2022-06-08 14:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-30 15:07 [PATCH v5 00/10] qmp, hmp: statistics subsystem and KVM suport Paolo Bonzini
2022-05-30 15:07 ` [PATCH v5 01/10] qmp: Support for querying stats Paolo Bonzini
2022-05-30 15:07 ` [PATCH v5 02/10] kvm: Support for querying fd-based stats Paolo Bonzini
2022-06-07 17:44 ` Dr. David Alan Gilbert
2022-06-08 14:13 ` Paolo Bonzini [this message]
2022-06-08 14:52 ` Dr. David Alan Gilbert
2022-06-08 15:58 ` Paolo Bonzini
2022-06-08 16:01 ` Dr. David Alan Gilbert
2022-06-08 16:10 ` Paolo Bonzini
2022-06-08 16:17 ` Dr. David Alan Gilbert
2022-05-30 15:07 ` [PATCH v5 03/10] qmp: add filtering of statistics by target vCPU Paolo Bonzini
2022-05-30 15:07 ` [PATCH v5 04/10] cutils: fix case for "kilo" and "kibi" Paolo Bonzini
2022-05-30 21:56 ` Philippe Mathieu-Daudé via
2022-05-30 15:07 ` [PATCH v5 05/10] cutils: add functions for IEC and SI prefixes Paolo Bonzini
2022-05-30 21:59 ` Philippe Mathieu-Daudé via
2022-05-31 10:28 ` Paolo Bonzini
2022-05-30 15:07 ` [PATCH v5 06/10] hmp: add basic "info stats" implementation Paolo Bonzini
2022-06-07 18:35 ` Dr. David Alan Gilbert
2022-06-08 14:27 ` Paolo Bonzini
2022-06-08 15:23 ` Dr. David Alan Gilbert
2022-05-30 15:07 ` [PATCH v5 07/10] qmp: add filtering of statistics by provider Paolo Bonzini
2022-06-08 11:52 ` Dr. David Alan Gilbert
2022-05-30 15:07 ` [PATCH v5 08/10] hmp: " Paolo Bonzini
2022-06-08 12:06 ` Dr. David Alan Gilbert
2022-05-30 15:07 ` [PATCH v5 09/10] qmp: add filtering of statistics by name Paolo Bonzini
2022-06-08 13:36 ` Dr. David Alan Gilbert
2022-05-30 15:07 ` [PATCH v5 10/10] hmp: " Paolo Bonzini
2022-06-08 13:40 ` Dr. David Alan Gilbert
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=758db6b4-5786-adf4-d293-d8dc7793a21b@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@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).