From patchwork Thu Sep 28 10:16:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9975715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6AC9E60568 for ; Thu, 28 Sep 2017 10:18:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BA8E29547 for ; Thu, 28 Sep 2017 10:18:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 508662954D; Thu, 28 Sep 2017 10:18:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CEC4729547 for ; Thu, 28 Sep 2017 10:18:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxVrX-00089D-I6; Thu, 28 Sep 2017 10:16:11 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxVrW-00088Y-CL for xen-devel@lists.xenproject.org; Thu, 28 Sep 2017 10:16:10 +0000 Received: from [193.109.254.147] by server-11.bemta-6.messagelabs.com id DA/D3-03616-9EBCCC95; Thu, 28 Sep 2017 10:16:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRWlGSWpSXmKPExsXiVRvkovvi9Jl Ig8k9Nhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bW7adYCs7IVxyY18rcwNgg1cXIySEkMINR 4slniy5GLg4WgTWsEi/O32QFcSQELrFKzP21hgmkSkIgTaJteS8LjP337CRmCLtC4v/3E8wQk 1Qkbm5fxQTSLCTwk1HiwYxvrCAJYQE9iSNHf7BD2EESy9pvgTWwCRhIvNmxF6xGREBJ4t6qyW DNzALPGSU27N0ClmARUJU40NIC1swr4C1x88BesCs4gex1Uz4A2RxA27wkWqeGgYRFBeQkVl5 uYYUoF5Q4OfMJWAmzgKbE+l36IGFmAXmJ7W/nME9gFJ2FpGoWQtUsJFULGJlXMWoUpxaVpRbp GhrpJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIExgUDEOxgvLwx4BCjJAeTkiivz okzkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeNmAcSYkWJSanlqRlpkDjFCYtAQHj5IILxNImr e4IDG3ODMdInWKUZdj355bf5iEWPLy81KlxHndQYoEQIoySvPgRsCSxSVGWSlhXkago4R4ClK LcjNLUOVfMYpzMCoJ86acAprCk5lXArfpFdARTEBHTJ4IdkRJIkJKqoEx64p1+4UpK9mfW658 6+BvwLu/PV6lx7y3xq426vf2vYqRE1aEuM4SZH1xyrJpMt+LrSyS/9uPud+/PDXSZY+Wc1aE0 D+zyHeTNjos9zZTuWa4zar37pTHHROtnNO29p0SyU12ymsOndu1lbOgtvlGi9WRmtrPm2vXf6 mcrHJ13Zpy++yp6i+UWIozEg21mIuKEwH1Rc0oEQMAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1506593768!108051947!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38135 invoked from network); 28 Sep 2017 10:16:08 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-8.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Sep 2017 10:16:08 -0000 Received: by mail-wm0-f68.google.com with SMTP id q124so1242879wmb.0 for ; Thu, 28 Sep 2017 03:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=hbuZUFapxE+49yfdExX1WX/HSNMh2sB5LHXF6IWj0VE=; b=S1tJ6nwN6Hi2Kq8+RvsCKO9eg+0LpwGbktnOgxMqCMy2am3y2pvC0+Ld3suym1axPL jsKsqbJ+JYEH1SjcPmmMoS/EzJz2qT6GS4IT7RrtLpLET7MrQ199DxwHCO+/EX4q7L/Q 2JnA37j8vNSI0KnaOFP7GaneJCc3xu0zFCHbeDNOK5orQ0JqCBJDrUcDPY5XUEAfhru9 HcHIvI8fSDPjjEX+nZHYeeeoFR9jlPqVSOTnYI7MhC2AVjMBiE9askptJ+Xd1xul2WiH bREyC3d55cLJbZdl6UrZxK94kH1jVfuylGz+rK5zHo1lfrrgtRuYzqe2BxkR0mPYubPe +lLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=hbuZUFapxE+49yfdExX1WX/HSNMh2sB5LHXF6IWj0VE=; b=onvsewXT1aouZa95NfyIBQEIE5B+wjoK87u02aDBixwI9plP5gASsKPbvDwS8KRsop WyNUV8Ymn2u2YYmKwWE0AWnT8tpAWgT8MXxWG6PaV1JZbmYJXOUBkG6WRiLZYkBLaapY 3gx9CB5iHBPTsW2SuWOSEMOrnWElzzYnYlFTXQrHtXhHrcPkhULeLSkOMfW/L+y0Hhgf NfnS54kbbHeBOpEd4mOUq5cnGR+QOrJPyqngiYwwjXEU26pMG8ScgoHDevsPEQ1ppmh5 jCbf/XcZCaPfCF2NrKxQs5Y11j9EXritfIEjirOzZfflBNhuyNeXdYI8qSPOClbn2DL4 ZUyQ== X-Gm-Message-State: AHPjjUgtZABwIDR8vEAAtCTcOcM6VuRGKdBAzgTzsuyhlaQpsfzCKvN0 Mo4nSOTCt94+T5EgxUkonqM= X-Google-Smtp-Source: AOwi7QB0IscgO3k+M49GYhrBFrWVmwgbPjRbP1EZ0x86PHcro9feYJ9XEhpMWZRiYJlg2xF76KBDDQ== X-Received: by 10.28.12.134 with SMTP id 128mr619477wmm.147.1506593768600; Thu, 28 Sep 2017 03:16:08 -0700 (PDT) Received: from Solace.fritz.box ([80.66.223.52]) by smtp.gmail.com with ESMTPSA id i134sm247456wmf.31.2017.09.28.03.16.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Sep 2017 03:16:08 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Thu, 28 Sep 2017 12:16:06 +0200 Message-ID: <150659376652.4057.12723423135216244659.stgit@Solace.fritz.box> In-Reply-To: <150659250903.4057.6425247157210641083.stgit@Solace.fritz.box> References: <150659250903.4057.6425247157210641083.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Stefano Stabellini , Andrew Cooper , Tim Deegan , George Dunlap , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH v2 2/3] xen: RCU: make the period of the idle timer configurable. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Cc: Jan Beulich Cc: Julien Grall Cc: Andrew Cooper Cc: George Dunlap Cc: Stefano Stabellini , Cc: Tim Deegan --- 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..8eb800e 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 +> `= ` + +> 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; minimum is 1ms, +maximum is 100. + ### 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 4a02cdd..2381df1 100644 --- a/xen/common/rcupdate.c +++ b/xen/common/rcupdate.c @@ -110,10 +110,20 @@ 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 unsigned int __initdata idle_timer_period_ms = + IDLE_TIMER_PERIOD_DEFAULT / MILLISECS(1); +integer_param("rcu-idle-timer-period-ms", idle_timer_period_ms); static DEFINE_PER_CPU(struct rcu_data, rcu_data); @@ -453,7 +463,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; } @@ -569,6 +579,16 @@ void __init rcu_init(void) { void *cpu = (void *)(long)smp_processor_id(); + /* We don't allow 0, or anything higher than IDLE_TIMER_PERIOD_MAX */ + if ( idle_timer_period_ms < 1 || + idle_timer_period_ms > IDLE_TIMER_PERIOD_MAX / MILLISECS(1) ) + { + printk("WARNING: rcu-idle-timer-period-ms outside of [%d,%ld]ms!\n", + 1, IDLE_TIMER_PERIOD_MAX / MILLISECS(1)); + idle_timer_period_ms = IDLE_TIMER_PERIOD_DEFAULT / MILLISECS(1); + } + idle_timer_period = MILLISECS(idle_timer_period_ms); + cpumask_clear(&rcu_ctrlblk.idle_cpumask); cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); register_cpu_notifier(&cpu_nfb);