[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOQ_QshrXJx42AS4Efu3gSZj1fnGgJ9FMFCydtdZ9h3Zj8cy=A@mail.gmail.com>
Date: Thu, 29 Jul 2021 13:23:52 -0700
From: Oliver Upton <oupton@...gle.com>
To: Jing Zhang <jingzhangos@...gle.com>
Cc: KVM ARM <kvmarm@...ts.cs.columbia.edu>, KVM <kvm@...r.kernel.org>,
linux-kernel@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
Marc Zyngier <maz@...nel.org>,
James Morse <james.morse@....com>,
Alexandru Elisei <Alexandru.Elisei@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
Peter Shier <pshier@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>,
Guangyu Shi <guangyus@...gle.com>
Subject: Re: [PATCH 1/3] KVM: arm64: Record number of signal exits as a vCPU stat
On Thu, Jul 29, 2021 at 1:07 PM Jing Zhang <jingzhangos@...gle.com> wrote:
>
> On Thu, Jul 29, 2021 at 12:56 PM Oliver Upton <oupton@...gle.com> wrote:
> >
> > Most other architectures that implement KVM record a statistic
> > indicating the number of times a vCPU has exited due to a pending
> > signal. Add support for that stat to arm64.
> >
> > Cc: Jing Zhang <jingzhangos@...gle.com>
> > Signed-off-by: Oliver Upton <oupton@...gle.com>
> > ---
> > arch/arm64/include/asm/kvm_host.h | 1 +
> > arch/arm64/kvm/arm.c | 1 +
> > arch/arm64/kvm/guest.c | 3 ++-
> > 3 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> > index 41911585ae0c..70e129f2b574 100644
> > --- a/arch/arm64/include/asm/kvm_host.h
> > +++ b/arch/arm64/include/asm/kvm_host.h
> > @@ -576,6 +576,7 @@ struct kvm_vcpu_stat {
> > u64 wfi_exit_stat;
> > u64 mmio_exit_user;
> > u64 mmio_exit_kernel;
> > + u64 signal_exits;
> > u64 exits;
> > };
> >
> > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> > index e9a2b8f27792..60d0a546d7fd 100644
> > --- a/arch/arm64/kvm/arm.c
> > +++ b/arch/arm64/kvm/arm.c
> > @@ -783,6 +783,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
> > if (signal_pending(current)) {
> > ret = -EINTR;
> > run->exit_reason = KVM_EXIT_INTR;
> > + ++vcpu->stat.signal_exits;
> > }
> >
> > /*
> > diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> > index 1dfb83578277..50fc16ad872f 100644
> > --- a/arch/arm64/kvm/guest.c
> > +++ b/arch/arm64/kvm/guest.c
> > @@ -50,7 +50,8 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = {
> > STATS_DESC_COUNTER(VCPU, wfi_exit_stat),
> > STATS_DESC_COUNTER(VCPU, mmio_exit_user),
> > STATS_DESC_COUNTER(VCPU, mmio_exit_kernel),
> > - STATS_DESC_COUNTER(VCPU, exits)
> > + STATS_DESC_COUNTER(VCPU, exits),
> > + STATS_DESC_COUNTER(VCPU, signal_exits),
> How about put signal_exits before exits as the same order in
> kvm_vcpu_stat just for readability?
Definitely.
> > };
> > static_assert(ARRAY_SIZE(kvm_vcpu_stats_desc) ==
> > sizeof(struct kvm_vcpu_stat) / sizeof(u64));
> > --
> > 2.32.0.554.ge1b32706d8-goog
> >
> Reviewed-by: Jing Zhang <jingzhangos@...gle.com>
Thanks Jing!
Powered by blists - more mailing lists