Path: csiph.com!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod From: Boqun Feng Newsgroups: linux.kernel Subject: [PATCH] rcuperf: Don't treat gp_exp mis-setting as a WARN Date: Wed, 25 May 2016 03:30:02 +0200 Message-ID: X-Original-To: linux-kernel@vger.kernel.org Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=yXF5/N8G0eROsbg6KDieHCP/0BH5LBjhmaUjcMfk9cU=; b=HDXQ6kq5hS7gvNiWnKlG6sfDteJwE2WwbM0KiHc5FX8Iq2PejG+xW3hZDYCRd9SQYz +jK8D07GSdJlJm6Ynef6MmneTm7Grxu6aNc79vhhtm4j0a7YGe9V2FcIQRssK2MHGtpP xtP0eski20Algze5WulPwpvJ28qw4zDNshF/9XLEF69hv+8yc1CRY931M62uUsG7GaXe yfEpkoTqU+7K4rdCd01x1bSU5t8RJv693mIx+bpieWakhNPLQccFD+fHjytNE4QMitPN lEXgUIKnenFdkhDwuNn5pSKYaUv4ei1xsD7ZjahgT45ChPKkt4BCpboLJg+GoQSEZthw mBfg== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yXF5/N8G0eROsbg6KDieHCP/0BH5LBjhmaUjcMfk9cU=; b=PTO/VXiuT0v56T4QHwERAEOLGcARugsR6+wVwVI+5BUxpkIqr8bPfAiG9v8TZ14aMC jwLJuMgL+E42Jh9JFRjBoXA97G8VcWgcsa/1ZPyhUkkM9azVZVw+fR0salZ/Du4I5dwK 1Z1cFEpXQqIlxMyMPBNm341gB4cs/ojLI1tka104eytmVZbxfM1vMIWgwK6EUHk8R1G0 dWQ2oYfL4gusmPpyGR/qa8n2DmtdNiiCnSISBFxBQT1XST3joRajyoXDZzXXYnkgNzPO zZtewKLz7wSYqRpmQPHP4TbqTwdZNC1JMn6ticMFyiqNIIj9CnwTHL87RefON8P3uSe6 zRig== X-Gm-Message-State: ALyK8tKgJmkzlrUfKetWXfqpD0PtSXXJ3btBa0ZYUPJUP4pTp00Er44pazGJ7UG4ZkwZlA== X-Received: by 10.202.172.141 with SMTP id v135mr711876oie.123.1464139324489; Tue, 24 May 2016 18:22:04 -0700 (PDT) X-Mailer: git-send-email 2.8.2 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 69 Organization: linux.* mail to news gateway X-Original-Cc: "Paul E. McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , fengguang.wu@intel.com, Boqun Feng X-Original-Date: Wed, 25 May 2016 09:25:33 +0800 X-Original-Message-ID: <1464139533-26551-1-git-send-email-boqun.feng@gmail.com> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1406553 0day found a boot warning triggered in rcu_perf_writer() on !SMP kernel: WARN_ON(rcu_gp_is_normal() && gp_exp); , the root cause of which is trying to measure expedited grace periods(by setting gp_exp to true by default) when all the grace periods are normal(TINY RCU only has normal grace periods). However, such a mis-setting would only result in failing to measure the performance for a specific kind of grace periods, therefore using a WARN_ON to check this is a little overkilling. We could handle this inside rcuperf module via some error messages to tell users about the mis-settings. Therefore this patch removes the WARN_ON in rcu_perf_writer() and handles those checkings in rcu_perf_init() with plain if() code. Moreover, this patch changes the default value of gp_exp to 1) align with rcutorture tests and 2) make the default setting work for all RCU implementations by default. Suggested-by: Paul E. McKenney Signed-off-by: Boqun Feng Fixes: http://lkml.kernel.org/r/57411b10.mFvG0+AgcrMXGtcj%fengguang.wu@intel.com --- kernel/rcu/rcuperf.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c index 3cee0d8393ed..8ce4eecff319 100644 --- a/kernel/rcu/rcuperf.c +++ b/kernel/rcu/rcuperf.c @@ -58,7 +58,7 @@ MODULE_AUTHOR("Paul E. McKenney "); #define VERBOSE_PERFOUT_ERRSTRING(s) \ do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0) -torture_param(bool, gp_exp, true, "Use expedited GP wait primitives"); +torture_param(bool, gp_exp, false, "Use expedited GP wait primitives"); torture_param(int, holdoff, 10, "Holdoff time before test start (s)"); torture_param(int, nreaders, -1, "Number of RCU reader threads"); torture_param(int, nwriters, -1, "Number of RCU updater threads"); @@ -363,8 +363,6 @@ rcu_perf_writer(void *arg) u64 *wdpp = writer_durations[me]; VERBOSE_PERFOUT_STRING("rcu_perf_writer task started"); - WARN_ON(rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp); - WARN_ON(rcu_gp_is_normal() && gp_exp); WARN_ON(!wdpp); set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids)); sp.sched_priority = 1; @@ -631,6 +629,16 @@ rcu_perf_init(void) firsterr = -ENOMEM; goto unwind; } + if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp) { + VERBOSE_PERFOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!"); + firsterr = -EINVAL; + goto unwind; + } + if (rcu_gp_is_normal() && gp_exp) { + VERBOSE_PERFOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!"); + firsterr = -EINVAL; + goto unwind; + } for (i = 0; i < nrealwriters; i++) { writer_durations[i] = kcalloc(MAX_MEAS, sizeof(*writer_durations[i]), -- 2.8.2