From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org, Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: aleksandar.qemu.devel@gmail.com, alexandru.elisei@arm.com,
anup.patel@wdc.com, aou@eecs.berkeley.edu, atish.patra@wdc.com,
bp@alien8.de, catalin.marinas@arm.com, chenhuacai@kernel.org,
dave.hansen@linux.intel.com, frankja@linux.ibm.com,
frederic@kernel.org, gor@linux.ibm.com, hca@linux.ibm.com,
james.morse@arm.com, jmattson@google.com, joro@8bytes.org,
maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au,
nsaenzju@redhat.com, palmer@dabbelt.com, paulmck@kernel.org,
paul.walmsley@sifive.com, pbonzini@redhat.com, seanjc@google.com,
suzuki.poulose@arm.com, svens@linux.ibm.com,
tsbogend@alpha.franken.de, vkuznets@redhat.com,
wanpengli@tencent.com, will@kernel.org
Subject: Re: [PATCH v2 1/7] entry: add arch_in_rcu_eqs()
Date: Wed, 19 Jan 2022 18:35:42 +0100 [thread overview]
Message-ID: <e66d71dd-aeb9-3905-754a-8fb36385db12@linux.ibm.com> (raw)
In-Reply-To: <20220119105854.3160683-2-mark.rutland@arm.com>
Am 19.01.22 um 11:58 schrieb Mark Rutland:
> All architectures have an interruptible RCU extended quiescent state
> (EQS) as part of their idle sequences, where interrupts can occur
> without RCU watching. Entry code must account for this and wake RCU as
> necessary; the common entry code deals with this in irqentry_enter() by
> treating any interrupt from an idle thread as potentially having
> occurred with an EQS and waking RCU for the duration of the interrupt
> via rcu_irq_enter() .. rcu_irq_exit().
>
> Some architectures may have other interruptible EQSs which require
> similar treatment. For example, on s390 is it necessary to enable
> interrupts around guest entry in the middle of a period where core KVM
> code has entered an EQS.
>
> So that architectueres can wake RCU in these cases, this patch adds a
^
> new arch_in_rcu_eqs() hook to the common entry code which is checked in
> addition to the existing is_idle_thread() check, with RCU woken if
> either returns true. A default implementation is provided which always
> returns false, which suffices for most architectures.
>
> As no architectures currently implement arch_in_rcu_eqs(), there should
> be no functional change as a result of this patch alone. A subsequent
> patch will add an s390 implementation to fix a latent bug with missing
> RCU wakeups.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Paul E. McKenney <paulmck@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Sven Schnelle <svens@linux.ibm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> include/linux/entry-common.h | 16 ++++++++++++++++
> kernel/entry/common.c | 3 ++-
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
> index 2e2b8d6140ed4..f1b91a13a15a6 100644
> --- a/include/linux/entry-common.h
> +++ b/include/linux/entry-common.h
> @@ -99,6 +99,22 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs
> }
> #endif
>
> +/**
> + * arch_in_rcu_eqs - Architecture specific check for RCU extended quiescent
> + * states.
> + *
> + * Returns: true if the CPU is potentially in an RCU EQS, false otherwise.
> + *
> + * Architectures only need to define this if threads other than the idle thread
> + * may have an interruptible EQS. This does not need to handle idle threads. It
> + * is safe to over-estimate at the cost of redundant RCU management work.
> + *
> + * Invoked from irqentry_enter()
> + */
> +#ifndef arch_in_rcu_eqs
> +static __always_inline bool arch_in_rcu_eqs(void) { return false; }
> +#endif
> +
> /**
> * enter_from_user_mode - Establish state when coming from user mode
> *
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index d5a61d565ad5d..b13d4e0b0b643 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
> @@ -349,7 +349,8 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs)
> * TINY_RCU does not support EQS, so let the compiler eliminate
> * this part when enabled.
> */
> - if (!IS_ENABLED(CONFIG_TINY_RCU) && is_idle_task(current)) {
> + if (!IS_ENABLED(CONFIG_TINY_RCU) &&
> + (is_idle_task(current) || arch_in_rcu_eqs())) {
> /*
> * If RCU is not watching then the same careful
> * sequence vs. lockdep and tracing is required
next prev parent reply other threads:[~2022-01-19 17:37 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 10:58 [PATCH v2 0/7] kvm: fix latent guest entry/exit bugs Mark Rutland
2022-01-19 10:58 ` [PATCH v2 1/7] entry: add arch_in_rcu_eqs() Mark Rutland
2022-01-19 17:35 ` Christian Borntraeger [this message]
2022-01-21 17:34 ` Nicolas Saenz Julienne
2022-01-19 10:58 ` [PATCH v2 2/7] kvm: add guest_state_{enter,exit}_irqoff() Mark Rutland
2022-01-20 11:00 ` Paolo Bonzini
2022-01-21 17:35 ` Nicolas Saenz Julienne
2022-01-19 10:58 ` [PATCH v2 3/7] kvm/arm64: rework guest entry logic Mark Rutland
2022-01-21 17:37 ` Nicolas Saenz Julienne
2022-01-19 10:58 ` [PATCH v2 4/7] kvm/mips: " Mark Rutland
2022-01-20 11:10 ` Paolo Bonzini
2022-01-20 13:33 ` Mark Rutland
2022-01-20 16:44 ` Mark Rutland
2022-01-20 16:57 ` Paolo Bonzini
2022-01-20 17:15 ` Mark Rutland
2022-01-20 17:17 ` Sean Christopherson
2022-01-20 17:29 ` Paolo Bonzini
2022-01-21 12:44 ` Mark Rutland
2022-01-19 10:58 ` [PATCH v2 5/7] kvm/riscv: " Mark Rutland
2022-01-20 11:18 ` Paolo Bonzini
2022-01-20 12:56 ` Mark Rutland
2022-01-20 13:13 ` Paolo Bonzini
2022-01-19 10:58 ` [PATCH v2 6/7] kvm/s390: " Mark Rutland
2022-01-19 10:58 ` [PATCH v2 7/7] kvm/x86: " Mark Rutland
2022-01-20 11:20 ` Paolo Bonzini
2022-01-21 17:40 ` Nicolas Saenz Julienne
2022-01-19 18:25 ` [PATCH v2 0/7] kvm: fix latent guest entry/exit bugs Christian Borntraeger
2022-01-19 18:28 ` Christian Borntraeger
2022-01-19 19:22 ` Mark Rutland
2022-01-19 19:30 ` Christian Borntraeger
2022-01-20 11:57 ` Mark Rutland
2022-01-20 12:02 ` Christian Borntraeger
2022-01-20 11:28 ` Paolo Bonzini
2022-01-20 12:03 ` Mark Rutland
2022-01-20 15:14 ` Christian Borntraeger
2022-01-21 9:53 ` Christian Borntraeger
2022-01-21 14:17 ` Christian Borntraeger
2022-01-21 14:30 ` Mark Rutland
2022-01-21 14:42 ` Christian Borntraeger
2022-01-21 15:29 ` Mark Rutland
2022-01-21 15:40 ` Christian Borntraeger
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=e66d71dd-aeb9-3905-754a-8fb36385db12@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=alexandru.elisei@arm.com \
--cc=anup.patel@wdc.com \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@wdc.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=frankja@linux.ibm.com \
--cc=frederic@kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=james.morse@arm.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=nsaenzju@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=suzuki.poulose@arm.com \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=will@kernel.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
Powered by JetHome