Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2862985ybi; Thu, 4 Jul 2019 21:11:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGuGau3e+O7yIB9dUI1UzaLU46icD620Bo0tdizPSJFkdvyiVMdxUEwqlw5TdR0X8lL+GW X-Received: by 2002:a17:90a:ad89:: with SMTP id s9mr2014607pjq.41.1562299865872; Thu, 04 Jul 2019 21:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562299865; cv=none; d=google.com; s=arc-20160816; b=wLNfeykQ2D2IgRIfRuiyZ0Y+v1cjEKgVTkkKvpHYdj9p3PZq9/W34uv4P2brSeD9UJ HgbZAruTWids+NWvkGIO0gdQBFriTLyRyVXwF1JeFFlQ4o51bhX1LF1rT0PnolRPg4w1 lJx4zg51xJ3W9EmHmn4UaY0HosgbrXFNyjHpiwkbRoL+BaOJFLYiKe2ZKz/TjIsZDW7W dDKUQLNOSU4Z+LdCaVcYDJ+AfH/90oToGnjdXXnCTKmik03igTJA8V/4bktbJrQL3SVv 0NjPrsJT3BHND79txQyjt/E1Bm0L/p9PPajnHNaT/eOCvbVAW6I/sP3YtsSxYafNcq1K Avew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=XAV/KmguRBxAAJmE0L7yGf/oO+tN861Dd+e1Y2mAHL0=; b=GNml/i5L/wmDwcX/q2wgHq8G5bn7LXsdd+rmzutEqqvLFIlAEkUti/60nYvkuPwS4H NDd2l0E7bQwesCnbnwLZkMmfBIpgAT+571w/4j4DPJuNBEtM/JA1JhG4aa2qjdpma6q0 gx4weZ8NSIvnTbrjtkdD891+diYERgO/Z8493nyQcA3U5vPSpaDidGIspmVll8bl0xyR KutX3MCObmvBP5Gc/sQzbdpgix63iFeIyHjE2FUueBvMtDyxewUq9i6p97llLfUCnvnk abqruDgPBux3dEndAfZhLhnx4AketqNzmGZ7k8mzPCZAtBXx7tKQUMrF5EqATrIfjEAd 6t/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a130si8190933pfa.7.2019.07.04.21.10.39; Thu, 04 Jul 2019 21:11:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727395AbfGEDxY (ORCPT + 99 others); Thu, 4 Jul 2019 23:53:24 -0400 Received: from lgeamrelo13.lge.com ([156.147.23.53]:41455 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727116AbfGEDxX (ORCPT ); Thu, 4 Jul 2019 23:53:23 -0400 Received: from unknown (HELO lgemrelse6q.lge.com) (156.147.1.121) by 156.147.23.53 with ESMTP; 5 Jul 2019 12:53:20 +0900 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO X58A-UD3R) (10.177.222.33) by 156.147.1.121 with ESMTP; 5 Jul 2019 12:53:20 +0900 X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Fri, 5 Jul 2019 12:52:31 +0900 From: Byungchul Park To: "Paul E. McKenney" Cc: "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, Davidlohr Bueso , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt , kernel-team@android.com Subject: Re: [PATCH] rcuperf: Make rcuperf kernel test more robust for !expedited mode Message-ID: <20190705035231.GA31088@X58A-UD3R> References: <20190704043431.208689-1-joel@joelfernandes.org> <20190704174044.GK26519@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190704174044.GK26519@linux.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 04, 2019 at 10:40:44AM -0700, Paul E. McKenney wrote: > On Thu, Jul 04, 2019 at 12:34:30AM -0400, Joel Fernandes (Google) wrote: > > It is possible that the rcuperf kernel test runs concurrently with init > > starting up. During this time, the system is running all grace periods > > as expedited. However, rcuperf can also be run for normal GP tests. > > Right now, it depends on a holdoff time before starting the test to > > ensure grace periods start later. This works fine with the default > > holdoff time however it is not robust in situations where init takes > > greater than the holdoff time to finish running. Or, as in my case: > > > > I modified the rcuperf test locally to also run a thread that did > > preempt disable/enable in a loop. This had the effect of slowing down > > init. The end result was that the "batches:" counter in rcuperf was 0 > > causing a division by 0 error in the results. This counter was 0 because > > only expedited GPs seem to happen, not normal ones which led to the > > rcu_state.gp_seq counter remaining constant across grace periods which > > unexpectedly happen to be expedited. The system was running expedited > > RCU all the time because rcu_unexpedited_gp() would not have run yet > > from init. In other words, the test would concurrently with init > > booting in expedited GP mode. > > > > To fix this properly, let us check if system_state if SYSTEM_RUNNING > > is set before starting the test. The system_state approximately aligns Just minor typo.. To fix this properly, let us check if system_state if SYSTEM_RUNNING is set before starting the test. ... Should be To fix this properly, let us check if system_state is set to SYSTEM_RUNNING before starting the test. ... Thanks, Byungchul > > with when rcu_unexpedited_gp() is called and works well in practice. > > > > I also tried late_initcall however it is still too early to be > > meaningful for this case. > > > > Signed-off-by: Joel Fernandes (Google) > > Good catch, queued, thank you! > > Thanx, Paul > > > --- > > kernel/rcu/rcuperf.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c > > index 4513807cd4c4..5a879d073c1c 100644 > > --- a/kernel/rcu/rcuperf.c > > +++ b/kernel/rcu/rcuperf.c > > @@ -375,6 +375,14 @@ rcu_perf_writer(void *arg) > > if (holdoff) > > schedule_timeout_uninterruptible(holdoff * HZ); > > > > + /* > > + * Wait until rcu_end_inkernel_boot() is called for normal GP tests > > + * so that RCU is not always expedited for normal GP tests. > > + * The system_state test is approximate, but works well in practice. > > + */ > > + while (!gp_exp && system_state != SYSTEM_RUNNING) > > + schedule_timeout_uninterruptible(1); > > + > > t = ktime_get_mono_fast_ns(); > > if (atomic_inc_return(&n_rcu_perf_writer_started) >= nrealwriters) { > > t_rcu_perf_writer_started = t; > > -- > > 2.22.0.410.gd8fdbe21b5-goog > >