Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1344466pxb; Wed, 4 Nov 2020 06:37:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDMTJD1pABftS0ryjXWliOPFDG/f0zeIsUmwfjXf5nJ2aXjGsdl4aBLMLaye5yC6ob/vzZ X-Received: by 2002:a50:d587:: with SMTP id v7mr26074418edi.38.1604500651103; Wed, 04 Nov 2020 06:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604500651; cv=none; d=google.com; s=arc-20160816; b=HyIRYLug+l0C91MIXT4vAz6K3gvMgMRTEKQG1BMfoq4fZZ/GGJ/uikMnj0KZuEUxr2 gK+QPaOqlrXSZIkM3qIW7Hfr8uBMTJf+667ipJY2RaHCp+/mls4cNDLdYihNgcj4znch YgBFCRx05vBMlAicYNzPhW1xT5sw6C/ddNfCB83uj9xFTfdp9GZuipUybg3rbSWPbIYx stLOrqZiPbzERl248oQHvY8raOMjb4cF7RMXNSxNur4ovENh+lX6Lv+wt+tgNzu6NOkq cYWMr266UlHL0Qk8DodXV5AakRTnEsMB/DgWEYnhQgX/gFb9LMjv0FQx1nVDENrqYzDq l0fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3hvwBqrQGto4T0BCAtCTQ6MrT6T4aqFqzK6UpbRWCVc=; b=Tk4l97YaaXDZiBkpt4MvxCXdDy7rIWcx8zbnW3aynYYMrlCixRSCshZsIQm0rxjgxz kGchws997I9Q2Pj1G7QujwplYVxF0hgc22c4DMxp6/GGKNZH/s7sALpF61J/18BJfzyb djmyIPqSaKuBmyoNYNxvQqXd+hv8TI+bNuKl/8lxHnlfPbIWMayi4JrPjWD/KCpIGXHq Orbn/cr3V6135QMWkLQNlvcg2KU3oui+dDSNG5kb3eU96cGOehXlsomwO1CmRHytm3Pz vpum5Y7sLLaXJnqHYxA8WwjhsPPdYW+dFropOeLndumXfFTUYBs3PZ4KNLgYhofmuIVM 2L9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SP5EY6nH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si1498465ejv.433.2020.11.04.06.37.08; Wed, 04 Nov 2020 06:37:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SP5EY6nH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728522AbgKDOdS (ORCPT + 99 others); Wed, 4 Nov 2020 09:33:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:43006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgKDOdR (ORCPT ); Wed, 4 Nov 2020 09:33:17 -0500 Received: from localhost (bag30-h01-176-173-247-136.dsl.sta.abo.bbox.fr [176.173.247.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 15C4120709; Wed, 4 Nov 2020 14:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604500397; bh=NnJp6WqQ75IUkNYbLiM6d+6tCT5wOFaumDU8S+0D34c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SP5EY6nH1v+xZDf2xOWaLYt3eAFZDnPEjYfODepKd5fniGVt42rqj5ApSyYJAAnu3 zLpgg6sDJcK22r3XemA1/t2lAvIbdhCplWA6d7zCLE2vNDTfsVBqHieAIuh1czXWzm C4w0zQJiiEU8P9vBnRdbv5sTsZB1zBVav4hAj5K0= Date: Wed, 4 Nov 2020 15:33:14 +0100 From: Frederic Weisbecker To: "Paul E. McKenney" Cc: "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, Neeraj Upadhyay , Josh Triplett , Lai Jiangshan , Marco Elver , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt , "Uladzislau Rezki (Sony)" , fweisbec@gmail.com, neeraj.iitr10@gmail.com Subject: Re: [PATCH v9 4/7] rcu/trace: Add tracing for how segcb list changes Message-ID: <20201104143314.GC467220@lothringen> References: <20201103142603.1302207-1-joel@joelfernandes.org> <20201103142603.1302207-5-joel@joelfernandes.org> <20201103151731.GB432431@lothringen> <20201104140807.GG3249@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201104140807.GG3249@paulmck-ThinkPad-P72> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 04, 2020 at 06:08:07AM -0800, Paul E. McKenney wrote: > On Tue, Nov 03, 2020 at 04:17:31PM +0100, Frederic Weisbecker wrote: > > On Tue, Nov 03, 2020 at 09:26:00AM -0500, Joel Fernandes (Google) wrote: > > > +/* > > > + * Return how many CBs each segment along with their gp_seq values. > > > + * > > > + * This function is O(N) where N is the number of segments. Only used from > > > + * tracing code which is usually disabled in production. > > > + */ > > > +#ifdef CONFIG_RCU_TRACE > > > +static void rcu_segcblist_countseq(struct rcu_segcblist *rsclp, > > > + int cbcount[RCU_CBLIST_NSEGS], > > > + unsigned long gpseq[RCU_CBLIST_NSEGS]) > > > +{ > > > + int i; > > > + > > > + for (i = 0; i < RCU_CBLIST_NSEGS; i++) { > > > + cbcount[i] = rcu_segcblist_get_seglen(rsclp, i); > > > + gpseq[i] = rsclp->gp_seq[i]; > > > + } > > > +} > > > + > > > +void __trace_rcu_segcb_stats(struct rcu_segcblist *rsclp, const char *context) > > > +{ > > > + int cbs[RCU_CBLIST_NSEGS]; > > > + unsigned long gps[RCU_CBLIST_NSEGS]; > > > + > > > + if (!trace_rcu_segcb_stats_enabled()) > > > + return; > > > > Yes, very good! > > > > Paul just told me that RCU_TRACE can be used in production so that confirms that we > > wanted to avoid this loop of 8 iterations when tracing is disabled. > > RCU's "don't try this in production" Kconfig option is PROVE_RCU. > > I would be looking for checks that the sum of the segment lengths > match the overall ->len or checks that all of the segment lengths > are zero when ->cblist is empty to be guarded by something like > IS_ENABLED(CONFIG_PROVE_RCU). Of course, checks of this sort need to > be confined to those portions of rcu_do_batch() that are excluding other > accesses to ->cblist. Right. > > But if rcu_segcblist_countseq() is invoked only when a specific trace > event is enabled, it should be OK to have it guarded only by RCU_TRACE. Indeed, so I think we are good. Thanks.