From patchwork Thu Sep 28 17:06:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9976415 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 D6C2760365 for ; Thu, 28 Sep 2017 17:09:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C17282965C for ; Thu, 28 Sep 2017 17:09:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B628829688; Thu, 28 Sep 2017 17:09:19 +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 3E9AB296BA for ; Thu, 28 Sep 2017 17:09:19 +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 1dxcGi-0002y9-Mj; Thu, 28 Sep 2017 17:06:36 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxcGg-0002xX-K4 for xen-devel@lists.xenproject.org; Thu, 28 Sep 2017 17:06:34 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 74/85-02817-91C2DC95; Thu, 28 Sep 2017 17:06:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpileJIrShJLcpLzFFi42K5GNpwSFdS52y kwZwffBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bL+TfYC/YrViy/sYK1gXGndBcjJ4eQwHRG icNt5iA2i8AaVok7T8NAbAmBS6wS9zdVdzFyANlZEp92xECE0ySOH5jCCGFXSkxY8ZwNYoyKx M3tq5i6GLmA7O+MEg/65rCAJIQF9CSOHP3BDmEHScw4+pQJxGYTMJB4s2MvK4gtIqAkcW/VZL BmZoHnjBIb9m5hhThIVeJe2y6wbbwC3hInNh0Di3MC2YfOzGeH2OwlserNarAaUQE5iZWXW1g h6gUlTs58wgLyALOApsT6XfogYWYBeYntb+cwT2AUnYWkahZC1SwkVQsYmVcxahSnFpWlFuka muglFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQmFesl5+duYgTGBAMQ7GA8e9rzEKMkB5OSKK++9 tlIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8XCA5waLU9NSKtMwcYHTCpCU4eJREeNdpAaV5iw sSc4sz0yFSpxiNOS7cufSHiePAnlt/mIRY8vLzUqXEeT+DlAqAlGaU5sENgiWNS4yyUsK8jEC nCfEUpBblZpagyr9iFOdgVBLmrQS5hyczrwRu3yugU5iATpk88QzIKSWJCCmpBsZARadFOWHs mdZFAhUiWuuldBanNifnbTvsYrfscOWxuQk31wW7Vbvsbloz1/qqfWDnpw2tTftP8/vHV1lrP Ln9YOvRxyWVny+caXWcdthWdu3vAwJnp9fHms3YNo3958Mpb+/dDlbf0/uDSfXXgQ5r7a/xUn yXW6etbJdV/WTJ2dcxwUEmRU6JpTgj0VCLuag4EQCVbQ+GFQMAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1506618393!113575035!1 X-Originating-IP: [209.85.128.194] 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 57213 invoked from network); 28 Sep 2017 17:06:33 -0000 Received: from mail-wr0-f194.google.com (HELO mail-wr0-f194.google.com) (209.85.128.194) by server-8.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Sep 2017 17:06:33 -0000 Received: by mail-wr0-f194.google.com with SMTP id z1so2660611wre.1 for ; Thu, 28 Sep 2017 10:06:33 -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=fCXnl4eiPWNjUWXJ4deGJHyPK6Jrcn7dwBDgJVLZsBA=; b=NcXq3xjgMl3vOEMBdZ9IF5znl1ErxbNKTBNlGQVngT5+AGkbN0NUh3wnHaa65Le6yI vypJyt2Q8qqKspCMUTgcP0Sd4QZSGcOHNj4ThFBU2pVeavul3dlb/TkmFlgZtFPFM6wz psotPJepr/Ht3H7d6YrvKK0ari6o+ekZSFoW216TSHtgN26LS8Quagfc2oOTJQf9K3Kf lsJlx4pM7RsmBcUoH6GLfxNqZN3cF9aDeLOdZ4NR3KKbbpL4TWs6ZrGEJMEONaNZaIEi RfYcH4e8grFSaTlfTnoXw38t3c0XFsbvO20q81bWUZI+nBfhNhMvbAfD9HDknRpzzsUB yD7w== 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=fCXnl4eiPWNjUWXJ4deGJHyPK6Jrcn7dwBDgJVLZsBA=; b=uFy5NxbBCRVTIeGMeZGYZ+9MFWskIvqWC0jR0rxPm4UWQN5Q/7PNqcjNUMkltVuwQ9 wWloLzh1E4CKM+ac0sToHZpS3BRDI8RuK11D3zvMkFofRdCIYIsjIyKDHnQvTA9RQY5J 2Wzj7bvhzSEqhshYL5EQh4W8SdlfZRCcT+sv5BkysC7yViSwnhOPWfoEPoPLoGNT3+V5 vu5ps5klhT7j35aDlrMGgofe5zeJ0DhE375NRWVWppUi9rtH1MPmKOATx8yxmQS6urYQ kCgwc6EZm8q8DTNoBgPablm2hiHHtRUj+Wu022qGLUPUXhKSNNLiA9oXpoqp6qulP8Qp AQmQ== X-Gm-Message-State: AHPjjUjV2wlRJnd/ag5JIqZWnEJhwuypZCtEPcL6qKLHM5lWv2aC+xp6 NkEdGUpeFBk5X6LaVDKMQCU+MeEs X-Google-Smtp-Source: AOwi7QDd5slq5RPUOQgzCNNienJii69P6JU2+Z5vK0DqWtMx7y92f434ZELFfElFz+O0D9K3cuwIUw== X-Received: by 10.223.163.83 with SMTP id d19mr5227030wrb.84.1506618388202; Thu, 28 Sep 2017 10:06:28 -0700 (PDT) Received: from Solace.fritz.box ([80.66.223.52]) by smtp.gmail.com with ESMTPSA id 33sm648345wrd.23.2017.09.28.10.06.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Sep 2017 10:06:27 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Thu, 28 Sep 2017 19:06:26 +0200 Message-ID: <150661838615.4976.16412418219732512688.stgit@Solace.fritz.box> In-Reply-To: <150661816186.4976.5537636029076214002.stgit@Solace.fritz.box> References: <150661816186.4976.5537636029076214002.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 v3 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 Reviewed-by: Jan Beulich --- Cc: Jan Beulich Cc: Julien Grall Cc: Andrew Cooper Cc: George Dunlap Cc: Stefano Stabellini , Cc: Tim Deegan --- 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 +> `= ` + +> 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);