[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] kvm: reuse per-vcpu stats fd to avoid vcpu interruption
From: |
Markus Armbruster |
Subject: |
Re: [PATCH] kvm: reuse per-vcpu stats fd to avoid vcpu interruption |
Date: |
Wed, 14 Jun 2023 13:15:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Marcelo Tosatti <mtosatti@redhat.com> writes:
> 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>
[...]
> @@ -4038,7 +4040,8 @@ static StatsDescriptors
> *find_stats_descriptors(StatsTarget target, int stats_fd
> }
>
> static void query_stats(StatsResultList **result, StatsTarget target,
> - strList *names, int stats_fd, Error **errp)
> + strList *names, int stats_fd, Error **errp,
> + CPUState *cpu)
include/qapi/error.h:
* - Functions that use Error to report errors have an Error **errp
* parameter. It should be the last parameter, except for functions
* taking variable arguments.
> {
> struct kvm_stats_desc *kvm_stats_desc;
> struct kvm_stats_header *kvm_stats_header;
[...]