Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1327376pxb; Wed, 4 Nov 2020 06:12:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqsu8zz2Y+ilFia5TLRD+f6x8S6xa/l7YiCq396p1/KjAxfB06xAhmzesjD/ZaCdIE7Yhg X-Received: by 2002:aa7:d493:: with SMTP id b19mr25244394edr.279.1604499135994; Wed, 04 Nov 2020 06:12:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604499135; cv=none; d=google.com; s=arc-20160816; b=HE//DG2yqrAqIOKTICps8ReMdUwetxAhWsy04RMCpEd/iRsAHer7Y5oSFrN9rueOZU hjxPu1CJwt60EcZHIbMFPulAZS7tQZEsheNUGYVEwR2ap8UAty1LiGlFvcZu2TXJgLnI UieVKR/8eu9oQjcei1Vvq307+28AJtvmSnWJ6iID2xf+x1N3i8xrPnRibqhMOjojCWmH J509gWW0WqTRqmo6D/EqOJo8MhkdBeCril7nq/6yL3a96Acn83Ilph4o5URYHGkNImhb mQ8wTzhF1GvTsdb9P/p2AsYGvmBTaiI7/24KQqYVsIwRM4HojGwhLJqVK1XyqPw0yik0 m8Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=pmyLw/3yaxkUSBgZwUheCXtJYf6t9S123fYbrNwNDhM=; b=ml+edmDjih3L3NdtaEz9VyUDBrsQ2ZVnrPrj3bjUkRPThwzi6Uyako3xl+0p8oYTK0 I/SlqBJzHhtTCszbTWCOLzJ5TocE54vkMhqvRzozGs7FdJtoJ3G+Fqa88N9qJHFYwTH5 7cYz/6vsTXV1uAwXWgIqJmzXMZHiwGkBkBOURyZGuXn07KZ8W+acp6YSGk8i0ea570jW ZeQSezAhDsPUQ1kMgeUNYbGaIdlblT9TXp5CqVW3quAAqce3f/xm8hQMdCBxZ3viyPA0 nvQSLbpuwFZs73z73wzjjUQsSKZ7PFIeklPcwerwQ2zYEz/DKqjx+dBPCR+zHGNDLaEh 8ecg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wW6kBfrV; 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 e14si1288270edl.270.2020.11.04.06.11.53; Wed, 04 Nov 2020 06:12:15 -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=wW6kBfrV; 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 S1729584AbgKDOIJ (ORCPT + 99 others); Wed, 4 Nov 2020 09:08:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:36964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727012AbgKDOII (ORCPT ); Wed, 4 Nov 2020 09:08:08 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-104-11.bvtn.or.frontiernet.net [50.39.104.11]) (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 1E23821734; Wed, 4 Nov 2020 14:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604498888; bh=Yvx2fvQyrz3qOckMm40aznFs4/Y5f0uOs+ZW1GEZBEA=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=wW6kBfrVC3gwxm3yJ6vQj6FKNi/EiXR4kQ1OS51RNJexL9W0MwcRrpDUa77WCvX7Z zVERx2xtJLZBsDjhSpRdRLxG3X1lPqNhtlnMv7kecWMl2NBb3cuHYnDtYJ1aTZFz3k xZc/xTSl/BMLmExpz3LfIt956Y/SB8v5gGVG3/M0= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id B5A823523170; Wed, 4 Nov 2020 06:08:07 -0800 (PST) Date: Wed, 4 Nov 2020 06:08:07 -0800 From: "Paul E. McKenney" To: Frederic Weisbecker 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: <20201104140807.GG3249@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20201103142603.1302207-1-joel@joelfernandes.org> <20201103142603.1302207-5-joel@joelfernandes.org> <20201103151731.GB432431@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103151731.GB432431@lothringen> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. Thanx, Paul