From: Michael Ellerman <mpe@ellerman.id.au>
To: Vaibhav Jain <vaibhav@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org
Cc: Vaibhav Jain <vaibhav@linux.ibm.com>,
Nicholas Piggin <npiggin@gmail.com>,
Jordan Niethe <jniethe5@gmail.com>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
mikey@neuling.org, paulus@ozlabs.org, sbhat@linux.ibm.com,
gautam@linux.ibm.com, kconsul@linux.vnet.ibm.com,
amachhiw@linux.vnet.ibm.com, David.Laight@ACULAB.COM
Subject: Re: [PATCH v2] KVM: PPC: Book3S HV nestedv2: Cancel pending DEC exception
Date: Mon, 15 Apr 2024 22:27:32 +1000 [thread overview]
Message-ID: <8734rmdd57.fsf@mail.lhotse> (raw)
In-Reply-To: <20240415035731.103097-1-vaibhav@linux.ibm.com>
Vaibhav Jain <vaibhav@linux.ibm.com> writes:
> This reverts commit 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not
> cancel pending decrementer exception") [1] which prevented canceling a
> pending HDEC exception for nestedv2 KVM guests. It was done to avoid
> overhead of a H_GUEST_GET_STATE hcall to read the 'DEC expiry TB' register
> which was higher compared to handling extra decrementer exceptions.
>
> However recent benchmarks indicate that overhead of not handling 'DECR'
> expiry for Nested KVM Guest(L2) is higher and results in much larger exits
> to Pseries Host(L1) as indicated by the Unixbench-arithoh bench[2]
Any reason you chose that benchmark? At least on my system it seems to
compile to an infinite loop incrementing a single register.
Presumably the change is still good, but a more well known benchmark
would be good, even if it's just stress-ng, at least that's a bit more
standard.
cheers
> Metric | Current upstream | Revert [1] | Difference %
> ========================================================================
> arithoh-count (10) | 3244831634 | 3403089673 | +04.88%
> kvm_hv:kvm_guest_exit | 513558 | 152441 | -70.32%
> probe:kvmppc_gsb_recv | 28060 | 28110 | +00.18%
>
> N=1
>
> As indicated by the data above that reverting [1] results in substantial
> reduction in number of L2->L1 exits with only slight increase in number of
> H_GUEST_GET_STATE hcalls to read the value of 'DEC expiry TB'. This results
> in an overall ~4% improvement of arithoh[2] throughput.
>
> [1] commit 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception")
> [2] https://github.com/kdlucas/byte-unixbench/
>
> Fixes: 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception")
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
>
> ---
> Changelog:
> Since v1: https://lore.kernel.org/all/20240313072625.76804-1-vaibhav@linux.ibm.com
> * Updated/Corrected patch title and description
> * Included data on test benchmark results for Unixbench-arithoh bench.
> ---
> arch/powerpc/kvm/book3s_hv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 8e86eb577eb8..692a7c6f5fd9 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4857,7 +4857,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
> * entering a nested guest in which case the decrementer is now owned
> * by L2 and the L1 decrementer is provided in hdec_expires
> */
> - if (!kvmhv_is_nestedv2() && kvmppc_core_pending_dec(vcpu) &&
> + if (kvmppc_core_pending_dec(vcpu) &&
> ((tb < kvmppc_dec_expires_host_tb(vcpu)) ||
> (trap == BOOK3S_INTERRUPT_SYSCALL &&
> kvmppc_get_gpr(vcpu, 3) == H_ENTER_NESTED)))
> --
> 2.44.0
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Vaibhav Jain <vaibhav@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org
Cc: mikey@neuling.org, sbhat@linux.ibm.com,
amachhiw@linux.vnet.ibm.com, Jordan Niethe <jniethe5@gmail.com>,
gautam@linux.ibm.com, Nicholas Piggin <npiggin@gmail.com>,
David.Laight@ACULAB.COM, kconsul@linux.vnet.ibm.com,
Vaibhav Jain <vaibhav@linux.ibm.com>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Subject: Re: [PATCH v2] KVM: PPC: Book3S HV nestedv2: Cancel pending DEC exception
Date: Mon, 15 Apr 2024 22:27:32 +1000 [thread overview]
Message-ID: <8734rmdd57.fsf@mail.lhotse> (raw)
In-Reply-To: <20240415035731.103097-1-vaibhav@linux.ibm.com>
Vaibhav Jain <vaibhav@linux.ibm.com> writes:
> This reverts commit 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not
> cancel pending decrementer exception") [1] which prevented canceling a
> pending HDEC exception for nestedv2 KVM guests. It was done to avoid
> overhead of a H_GUEST_GET_STATE hcall to read the 'DEC expiry TB' register
> which was higher compared to handling extra decrementer exceptions.
>
> However recent benchmarks indicate that overhead of not handling 'DECR'
> expiry for Nested KVM Guest(L2) is higher and results in much larger exits
> to Pseries Host(L1) as indicated by the Unixbench-arithoh bench[2]
Any reason you chose that benchmark? At least on my system it seems to
compile to an infinite loop incrementing a single register.
Presumably the change is still good, but a more well known benchmark
would be good, even if it's just stress-ng, at least that's a bit more
standard.
cheers
> Metric | Current upstream | Revert [1] | Difference %
> ========================================================================
> arithoh-count (10) | 3244831634 | 3403089673 | +04.88%
> kvm_hv:kvm_guest_exit | 513558 | 152441 | -70.32%
> probe:kvmppc_gsb_recv | 28060 | 28110 | +00.18%
>
> N=1
>
> As indicated by the data above that reverting [1] results in substantial
> reduction in number of L2->L1 exits with only slight increase in number of
> H_GUEST_GET_STATE hcalls to read the value of 'DEC expiry TB'. This results
> in an overall ~4% improvement of arithoh[2] throughput.
>
> [1] commit 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception")
> [2] https://github.com/kdlucas/byte-unixbench/
>
> Fixes: 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception")
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
>
> ---
> Changelog:
> Since v1: https://lore.kernel.org/all/20240313072625.76804-1-vaibhav@linux.ibm.com
> * Updated/Corrected patch title and description
> * Included data on test benchmark results for Unixbench-arithoh bench.
> ---
> arch/powerpc/kvm/book3s_hv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 8e86eb577eb8..692a7c6f5fd9 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4857,7 +4857,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
> * entering a nested guest in which case the decrementer is now owned
> * by L2 and the L1 decrementer is provided in hdec_expires
> */
> - if (!kvmhv_is_nestedv2() && kvmppc_core_pending_dec(vcpu) &&
> + if (kvmppc_core_pending_dec(vcpu) &&
> ((tb < kvmppc_dec_expires_host_tb(vcpu)) ||
> (trap == BOOK3S_INTERRUPT_SYSCALL &&
> kvmppc_get_gpr(vcpu, 3) == H_ENTER_NESTED)))
> --
> 2.44.0
next prev parent reply other threads:[~2024-04-15 12:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 3:57 [PATCH v2] KVM: PPC: Book3S HV nestedv2: Cancel pending DEC exception Vaibhav Jain
2024-04-15 3:57 ` Vaibhav Jain
2024-04-15 12:27 ` Michael Ellerman [this message]
2024-04-15 12:27 ` Michael Ellerman
2024-05-08 13:45 ` Michael Ellerman
2024-05-08 13:45 ` Michael Ellerman
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=8734rmdd57.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=David.Laight@ACULAB.COM \
--cc=amachhiw@linux.vnet.ibm.com \
--cc=gautam@linux.ibm.com \
--cc=jniethe5@gmail.com \
--cc=kconsul@linux.vnet.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=npiggin@gmail.com \
--cc=paulus@ozlabs.org \
--cc=sbhat@linux.ibm.com \
--cc=svaidy@linux.vnet.ibm.com \
--cc=vaibhav@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.