From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Marcelo Tosatti <mtosatti@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Mark Kanda <mark.kanda@oracle.com>
Subject: Re: [PATCH v2] kvm: reuse per-vcpu stats fd to avoid vcpu interruption
Date: Sun, 18 Jun 2023 01:00:54 +0200 [thread overview]
Message-ID: <e3705cba-d57d-27f7-aa1e-ad4a3c0bfe52@linaro.org> (raw)
In-Reply-To: <ZIyffW2qasdS4PVN@tpad>
Hi Marcelo,
On 16/6/23 19:44, Marcelo Tosatti wrote:
>
> A regression has been detected in latency testing of KVM guests.
> More specifically, it was observed that the cyclictest
> numbers inside of an isolated vcpu (running on isolated pcpu) are:
>
> # Max Latencies: 00090 00096 00141
>
> Where a maximum of 50us is acceptable.
>
> The implementation of KVM_GET_STATS_FD uses run_on_cpu to query
> per vcpu statistics, which interrupts the vcpu (and is unnecessary).
>
> To fix this, open the per vcpu stats fd on vcpu initialization,
> and read from that fd from QEMU's main thread.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> static void query_stats(StatsResultList **result, StatsTarget target,
> - strList *names, int stats_fd, Error **errp)
> + strList *names, int stats_fd, CPUState *cpu,
> + Error **errp)
> {
> struct kvm_stats_desc *kvm_stats_desc;
> struct kvm_stats_header *kvm_stats_header;
> @@ -4096,7 +4099,7 @@ static void query_stats(StatsResultList **result, StatsTarget target,
> break;
> case STATS_TARGET_VCPU:
> add_stats_entry(result, STATS_PROVIDER_KVM,
> - current_cpu->parent_obj.canonical_path,
> + cpu->parent_obj.canonical_path,
Can we get a NULL deref here ...
> stats_list);
> break;
> default:
> static void query_stats_cb(StatsResultList **result, StatsTarget target,
> @@ -4180,7 +4180,7 @@ static void query_stats_cb(StatsResultList **result, StatsTarget target,
> error_setg_errno(errp, errno, "KVM stats: ioctl failed");
> return;
> }
> - query_stats(result, target, names, stats_fd, errp);
> + query_stats(result, target, names, stats_fd, NULL, errp);
... from here?
> close(stats_fd);
> break;
> }
next prev parent reply other threads:[~2023-06-17 23:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 18:22 [PATCH] kvm: reuse per-vcpu stats fd to avoid vcpu interruption Marcelo Tosatti
2023-06-14 11:15 ` Markus Armbruster
2023-06-16 17:44 ` [PATCH v2] " Marcelo Tosatti
2023-06-17 23:00 ` Philippe Mathieu-Daudé [this message]
2023-06-18 21:39 ` Paolo Bonzini
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=e3705cba-d57d-27f7-aa1e-ad4a3c0bfe52@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=mark.kanda@oracle.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.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).