From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
To: "Paul E. McKenney" <paulmck@kernel.org>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kernel-team@fb.com" <kernel-team@fb.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
Zhangfei Gao <zhangfei.gao@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: RE: [PATCH rcu 12/12] srcu: Block less aggressively for expedited grace periods
Date: Tue, 21 Jun 2022 07:43:08 +0000 [thread overview]
Message-ID: <fef4fbd55b88481490d52cbd65e1b1f8@huawei.com> (raw)
In-Reply-To: <20220620222032.3839547-12-paulmck@kernel.org>
> -----Original Message-----
> From: Paul E. McKenney [mailto:paulmck@kernel.org]
> Sent: 20 June 2022 23:21
> To: rcu@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; kernel-team@fb.com;
> rostedt@goodmis.org; Paul E. McKenney <paulmck@kernel.org>; Zhangfei
> Gao <zhangfei.gao@linaro.org>; Shameerali Kolothum Thodi
> <shameerali.kolothum.thodi@huawei.com>; Paolo Bonzini
> <pbonzini@redhat.com>
> Subject: [PATCH rcu 12/12] srcu: Block less aggressively for expedited grace
> periods
>
> Commit 282d8998e997 ("srcu: Prevent expedited GPs and blocking readers
> from consuming CPU") fixed a problem where a long-running expedited
> SRCU
> grace period could block kernel live patching. It did so by giving up
> on expediting once a given SRCU expedited grace period grew too old.
>
> Unfortunately, this added excessive delays to boots of embedded systems
> running on qemu that use the ARM IORT RMR feature.
As pointed out here[0]/[1], this delay has nothing to do with ARM IORT RMR
feature. The delay is due to the "-bios QEMU_EFI.fd" line which emulates flash
devices and requires excessive memslot ops during boot.
Thanks,
Shameer
[0] https://lore.kernel.org/all/110bbec5cee74efba0aad64360069a12@huawei.com/
[1] https://lore.kernel.org/all/8735g649ew.wl-maz@kernel.org/
This commit
> therefore
> makes the transition away from expediting less aggressive, increasing
> the per-grace-period phase number of non-sleeping polls of readers from
> one to three and increasing the required grace-period age from one jiffy
> (actually from zero to one jiffies) to two jiffies (actually from one
> to two jiffies).
>
> Fixes: 282d8998e997 ("srcu: Prevent expedited GPs and blocking readers
> from consuming CPU")
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Reported-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> Reported-by: chenxiang (M)" <chenxiang66@hisilicon.com>
> Cc: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Link:
> https://lore.kernel.org/all/20615615-0013-5adc-584f-2b1d5c03ebfc@linaro
> .org/
> ---
> kernel/rcu/srcutree.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index 50ba70f019dea..0db7873f4e95b 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -513,7 +513,7 @@ static bool srcu_readers_active(struct srcu_struct
> *ssp)
>
> #define SRCU_INTERVAL 1 // Base delay if no expedited GPs
> pending.
> #define SRCU_MAX_INTERVAL 10 // Maximum incremental delay from
> slow readers.
> -#define SRCU_MAX_NODELAY_PHASE 1 // Maximum per-GP-phase
> consecutive no-delay instances.
> +#define SRCU_MAX_NODELAY_PHASE 3 // Maximum per-GP-phase
> consecutive no-delay instances.
> #define SRCU_MAX_NODELAY 100 // Maximum consecutive no-delay
> instances.
>
> /*
> @@ -522,16 +522,22 @@ static bool srcu_readers_active(struct srcu_struct
> *ssp)
> */
> static unsigned long srcu_get_delay(struct srcu_struct *ssp)
> {
> + unsigned long gpstart;
> + unsigned long j;
> unsigned long jbase = SRCU_INTERVAL;
>
> if (ULONG_CMP_LT(READ_ONCE(ssp->srcu_gp_seq),
> READ_ONCE(ssp->srcu_gp_seq_needed_exp)))
> jbase = 0;
> - if (rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq)))
> - jbase += jiffies - READ_ONCE(ssp->srcu_gp_start);
> - if (!jbase) {
> - WRITE_ONCE(ssp->srcu_n_exp_nodelay,
> READ_ONCE(ssp->srcu_n_exp_nodelay) + 1);
> - if (READ_ONCE(ssp->srcu_n_exp_nodelay) >
> SRCU_MAX_NODELAY_PHASE)
> - jbase = 1;
> + if (rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq))) {
> + j = jiffies - 1;
> + gpstart = READ_ONCE(ssp->srcu_gp_start);
> + if (time_after(j, gpstart))
> + jbase += j - gpstart;
> + if (!jbase) {
> + WRITE_ONCE(ssp->srcu_n_exp_nodelay,
> READ_ONCE(ssp->srcu_n_exp_nodelay) + 1);
> + if (READ_ONCE(ssp->srcu_n_exp_nodelay) >
> SRCU_MAX_NODELAY_PHASE)
> + jbase = 1;
> + }
> }
> return jbase > SRCU_MAX_INTERVAL ? SRCU_MAX_INTERVAL : jbase;
> }
> --
> 2.31.1.189.g2e36527f23
next prev parent reply other threads:[~2022-06-21 7:44 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 22:20 [PATCH rcu 0/12] Miscellaneous fixes for v5.20 Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 01/12] rcu: Decrease FQS scan wait time in case of callback overloading Paul E. McKenney
2022-06-21 5:29 ` Neeraj Upadhyay
2022-06-21 22:19 ` Paul E. McKenney
2022-06-22 11:46 ` Neeraj Upadhyay
2022-06-20 22:20 ` [PATCH rcu 02/12] rcu: Avoid tracing a few functions executed in stop machine Paul E. McKenney
2022-06-21 5:47 ` Neeraj Upadhyay
2022-06-21 22:21 ` Paul E. McKenney
2022-06-22 11:50 ` Neeraj Upadhyay
2022-06-22 15:35 ` Paul E. McKenney
2022-06-22 15:49 ` Neeraj Upadhyay
2022-06-23 0:29 ` Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 03/12] rcu: Add rnp->cbovldmask check in rcutree_migrate_callbacks() Paul E. McKenney
2022-06-21 5:57 ` Neeraj Upadhyay
2022-06-21 22:22 ` Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 04/12] rcu: Immediately boost preempted readers for strict grace periods Paul E. McKenney
2022-06-21 6:00 ` Neeraj Upadhyay
2022-06-20 22:20 ` [PATCH rcu 05/12] rcu: Forbid RCU_STRICT_GRACE_PERIOD in TINY_RCU kernels Paul E. McKenney
2022-06-21 6:02 ` Neeraj Upadhyay
2022-06-20 22:20 ` [PATCH rcu 06/12] locking/csd_lock: Change csdlock_debug from early_param to __setup Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 07/12] rcu: tiny: Record kvfree_call_rcu() call stack for KASAN Paul E. McKenney
2022-06-21 6:31 ` Neeraj Upadhyay
2022-06-21 19:31 ` Paul E. McKenney
2022-06-21 21:14 ` Marco Elver
2022-06-21 22:17 ` Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 08/12] rcu: Cleanup RCU urgency state for offline CPU Paul E. McKenney
2022-06-21 7:03 ` Neeraj Upadhyay
2022-06-21 22:24 ` Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 09/12] rcu/kvfree: Remove useless monitor_todo flag Paul E. McKenney
2022-06-21 10:02 ` Neeraj Upadhyay
2022-06-20 22:20 ` [PATCH rcu 10/12] rcu: Initialize first_gp_fqs at declaration in rcu_gp_fqs() Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 11/12] rcu/tree: Add comment to describe GP-done condition in fqs loop Paul E. McKenney
2022-06-20 22:20 ` [PATCH rcu 12/12] srcu: Block less aggressively for expedited grace periods Paul E. McKenney
2022-06-21 2:00 ` Zhangfei Gao
2022-06-21 3:15 ` Paul E. McKenney
2022-06-21 7:43 ` Shameerali Kolothum Thodi [this message]
2022-06-21 19:36 ` Paul E. McKenney
2022-06-21 10:13 ` Neeraj Upadhyay
2022-06-21 22:25 ` Paul E. McKenney
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=fef4fbd55b88481490d52cbd65e1b1f8@huawei.com \
--to=shameerali.kolothum.thodi@huawei.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=zhangfei.gao@linaro.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