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 17:58:09 +0200 [thread overview]
Message-ID: <686d6426-f035-4218-25a2-c212af38ce58@redhat.com> (raw)
In-Reply-To: <YqC3pocwSjcp2y/3@work-vm>
On 6/8/22 16:52, Dr. David Alan Gilbert wrote:
>> 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.
>
> Ah OK, this is what I was after; it's a little weird that the caller
> does the ioctl to get the stats-fd, but it does the lookup internally
> with current_cpu for the ident.
Oh yeah that's weird.
Let me squash in this:
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 023bf4ea79..71896ad173 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3871,17 +3871,7 @@ static StatsDescriptors *find_stats_descriptors(StatsTarget target, int stats_fd
size_t size_desc;
ssize_t ret;
- switch (target) {
- case STATS_TARGET_VM:
- ident = StatsTarget_str(STATS_TARGET_VM);
- break;
- case STATS_TARGET_VCPU:
- ident = current_cpu->parent_obj.canonical_path;
- break;
- default:
- abort();
- }
-
+ ident = StatsTarget_str(target);
QTAILQ_FOREACH(descriptors, &stats_descriptors, next) {
if (g_str_equal(descriptors->ident, ident)) {
return descriptors;
@@ -3917,7 +3907,7 @@ static StatsDescriptors *find_stats_descriptors(StatsTarget target, int stats_fd
}
descriptors->kvm_stats_header = kvm_stats_header;
descriptors->kvm_stats_desc = kvm_stats_desc;
- descriptors->ident = g_strdup(ident);
+ descriptors->ident = ident;
QTAILQ_INSERT_TAIL(&stats_descriptors, descriptors, next);
return descriptors;
}
(once I test it).
Paolo
next prev parent reply other threads:[~2022-06-08 15:59 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
2022-06-08 14:52 ` Dr. David Alan Gilbert
2022-06-08 15:58 ` Paolo Bonzini [this message]
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=686d6426-f035-4218-25a2-c212af38ce58@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).