From: Ankur Arora <ankur.a.arora@oracle.com>
To: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
npiggin@gmail.com, maddy@linux.ibm.com,
christophe.leroy@csgroup.eu, peterz@infradead.org,
bigeasy@linutronix.de, ankur.a.arora@oracle.com
Subject: Re: [PATCH] powerpc: Add preempt lazy support
Date: Fri, 08 Nov 2024 11:06:18 -0800 [thread overview]
Message-ID: <87fro135qt.fsf@oracle.com> (raw)
In-Reply-To: <20241108101853.277808-1-sshegde@linux.ibm.com>
Shrikanth Hegde <sshegde@linux.ibm.com> writes:
> Define preempt lazy bit for Powerpc. Use bit 9 which is free and within
> 16 bit range of NEED_RESCHED, so compiler can issue single andi.
>
> Since Powerpc doesn't use the generic entry/exit, add lazy check at exit
> to user. CONFIG_PREEMPTION is defined for lazy/full/rt so use it for
> return to kernel.
>
> Ran a few benchmarks and db workload on Power10. Performance is close to
> preempt=none/voluntary. It is possible that some patterns would
> differ in lazy[2]. More details of preempt lazy is here [1]
>
> Since Powerpc system can have large core count and large memory,
> preempt lazy is going to be helpful in avoiding soft lockup issues.
>
> [1]: https://lore.kernel.org/lkml/20241007074609.447006177@infradead.org/
> [2]: https://lore.kernel.org/all/1a973dda-c79e-4d95-935b-e4b93eb077b8@linux.ibm.com/
>
> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Looks good. Reviewed-by: <ankur.a.arora@oracle.com>
However, I just checked and powerpc does not have
CONFIG_KVM_XFER_TO_GUEST_WORK. Do you need this additional patch
for handling the lazy bit at KVM guest entry?
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index f14329989e9a..7bdf7015bb65 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -84,7 +84,8 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
hard_irq_disable();
while (true) {
- if (need_resched()) {
+ unsigned long tf = read_thread_flags();
+ if (tf & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) {
local_irq_enable();
cond_resched();
hard_irq_disable();
Ankur
next prev parent reply other threads:[~2024-11-08 22:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 10:18 [PATCH] powerpc: Add preempt lazy support Shrikanth Hegde
2024-11-08 10:50 ` Sebastian Andrzej Siewior
2024-11-09 16:52 ` Shrikanth Hegde
2024-11-14 2:01 ` Michael Ellerman
2024-11-15 7:04 ` Shrikanth Hegde
2024-11-08 19:06 ` Ankur Arora [this message]
2024-11-09 16:54 ` Shrikanth Hegde
2024-11-15 7:19 ` Shrikanth Hegde
2024-11-15 21:32 ` Ankur Arora
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=87fro135qt.fsf@oracle.com \
--to=ankur.a.arora@oracle.com \
--cc=bigeasy@linutronix.de \
--cc=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=sshegde@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 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).