From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Tim Deegan <tim@xen.org>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v3 2/3] xen: RCU: make the period of the idle timer configurable.
Date: Thu, 28 Sep 2017 19:06:26 +0200 [thread overview]
Message-ID: <150661838615.4976.16412418219732512688.stgit@Solace.fritz.box> (raw)
In-Reply-To: <150661816186.4976.5537636029076214002.stgit@Solace.fritz.box>
Make it possible for the user to specify, with the boot
time parameter rcu-idle-timer-period-ms, how frequently
a CPU that went idle with pending RCU callbacks should be
woken up to check if the grace period ended.
Typical values (i.e., some of the values used by Linux as
the tick frequency) are 10, 4 or 1 ms. Default valus (used
when this parameter is not specified) is 10ms. Maximum is
100ms.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Cc: Tim Deegan <tim@xen.org>
---
Changes from v2:
- use '!= 0' and "(0,..]", while sanitizing the boot parameter value;
- move the param variable, as well as the integer_param() inside rcu_init().
Changes from v1:
- "-" instead of "_" in the boot parameter name;
- enforce a minimum value as well;
- use integer_param(), instead of custom_param().
---
docs/misc/xen-command-line.markdown | 10 ++++++++++
xen/common/rcupdate.c | 28 ++++++++++++++++++++++++----
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 9797c8d..3551143 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1422,6 +1422,16 @@ The following resources are available:
sum of CBMs is fixed, that means actual `cos_max` in use will automatically
reduce to half when CDP is enabled.
+### rcu-idle-timer-period-ms
+> `= <integer>`
+
+> Default: `10`
+
+How frequently a CPU which has gone idle, but with pending RCU callbacks,
+should be woken up to check if the grace period has completed, and the
+callbacks are safe to be executed. Expressed in milliseconds; maximum is
+100, and it can't be 0.
+
### reboot
> `= t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | e[fi] | n[o] [, [w]arm | [c]old]`
diff --git a/xen/common/rcupdate.c b/xen/common/rcupdate.c
index 252e01b..f07185f 100644
--- a/xen/common/rcupdate.c
+++ b/xen/common/rcupdate.c
@@ -110,10 +110,16 @@ struct rcu_data {
* About how far in the future the timer should be programmed each time,
* it's hard to tell (guess!!). Since this mimics Linux's periodic timer
* tick, take values used there as an indication. In Linux 2.6.21, tick
- * period can be 10ms, 4ms, 3.33ms or 1ms. Let's use 10ms, to enable
- * at least some power saving on the CPU that is going idle.
+ * period can be 10ms, 4ms, 3.33ms or 1ms.
+ *
+ * By default, we use 10ms, to enable at least some power saving on the
+ * CPU that is going idle. The user can change this, via a boot time
+ * parameter, but only up to 100ms.
*/
-#define RCU_IDLE_TIMER_PERIOD MILLISECS(10)
+#define IDLE_TIMER_PERIOD_MAX MILLISECS(100)
+#define IDLE_TIMER_PERIOD_DEFAULT MILLISECS(10)
+
+static s_time_t __read_mostly idle_timer_period;
static DEFINE_PER_CPU(struct rcu_data, rcu_data);
@@ -453,7 +459,7 @@ void rcu_idle_timer_start()
if (likely(!rdp->curlist))
return;
- set_timer(&rdp->idle_timer, NOW() + RCU_IDLE_TIMER_PERIOD);
+ set_timer(&rdp->idle_timer, NOW() + idle_timer_period);
rdp->idle_timer_active = true;
}
@@ -571,6 +577,20 @@ static struct notifier_block cpu_nfb = {
void __init rcu_init(void)
{
void *cpu = (void *)(long)smp_processor_id();
+ static unsigned int __initdata idle_timer_period_ms =
+ IDLE_TIMER_PERIOD_DEFAULT / MILLISECS(1);
+ integer_param("rcu-idle-timer-period-ms", idle_timer_period_ms);
+
+ /* We don't allow 0, or anything higher than IDLE_TIMER_PERIOD_MAX */
+ if ( idle_timer_period_ms == 0 ||
+ idle_timer_period_ms > IDLE_TIMER_PERIOD_MAX / MILLISECS(1) )
+ {
+ idle_timer_period_ms = IDLE_TIMER_PERIOD_DEFAULT / MILLISECS(1);
+ printk("WARNING: rcu-idle-timer-period-ms outside of "
+ "(0,%"PRI_stime"]. Resetting it to %u.\n",
+ IDLE_TIMER_PERIOD_MAX / MILLISECS(1), idle_timer_period_ms);
+ }
+ idle_timer_period = MILLISECS(idle_timer_period_ms);
cpumask_clear(&rcu_ctrlblk.idle_cpumask);
cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-28 17:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 17:06 [PATCH v3 0/3] xen: RCU: Improve the idle timer handling Dario Faggioli
2017-09-28 17:06 ` [PATCH v3 1/3] xen: RCU: let the RCU idle timer handler run Dario Faggioli
2017-10-09 9:49 ` Jan Beulich
2017-10-09 17:15 ` Dario Faggioli
2017-09-28 17:06 ` Dario Faggioli [this message]
2017-10-09 10:13 ` [PATCH v3 2/3] xen: RCU: make the period of the idle timer configurable Jan Beulich
2017-09-28 17:06 ` [PATCH v3 3/3] xen: RCU: make the period of the idle timer adaptive Dario Faggioli
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=150661838615.4976.16412418219732512688.stgit@Solace.fritz.box \
--to=dario.faggioli@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).