Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4910543pxb; Tue, 5 Oct 2021 13:07:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOUvURNF85RePeqNozH0XG7AMXzZmfZLSqLeeIcKqKyDBxgDcUcNuNeLgA0WAuiSocVNiH X-Received: by 2002:a17:907:7717:: with SMTP id kw23mr630141ejc.396.1633464421800; Tue, 05 Oct 2021 13:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633464421; cv=none; d=google.com; s=arc-20160816; b=UbxzAEc/VeJr6cBRZEGjXA9gytRGOifRsorlfOv4c2iNPND4P03TEWVygpw+MXOARW lDD38pCVs5JgoqYALXUnUi2hXbupvWx1to47JFb9u/XdD5V665DXFm9DAcqXMfrbI1si vZLirPiT87CHXBjeUxC3SxJTz7pnwTCJxKw2G84AdrzOZ191oRVo5hsQowh+uCnWnbE4 yQYWKrw9BIWUcRAoZDW31ulxw+5f7EfqCyFU2258AOCRBu1/djSvrZAxRX6tO6ZN2yPr Htgbp0rDDg6e+mZty+TQFwoD7B4+udQF3z8uDx7ITl4ryK1wJWTqDDtivMBv/NlUa0VE dqeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=KdXDf5sTd2YWMIo7627Tgr6hJOG8BbgGrEoWIqDN6Pk=; b=KS+NN1F/bUBW0L5J5fKyR61DL3G0Aa3Vskh7mFy9RcCvjqP8lWP2pJ3pprEKWXcElG RT7tjLDqlijOR11H6dVurKZz8vQ8qC2igEig5asgCx3x2Pen8NdDWGWP/mimk6ufAhmL 7TFeg/4yIZv1N9i7XZLoD+uoA5zRgeR4PSVXsU7xv5AOFRGbP4qzC88VSB4ecN4oF0ZY WEv8BLpLFKk72XsAaABCEbf/ANweYmc/8AwPz/osPvKtYSH239BWX9RLNYyK67vx55Jh XvgeLwsXLm9GzkqRYYxKhydFHm5WduEnDHJBZG6IugmjUUTArYmfwCpnIB5tWxzVKj62 QI6w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si7376845ejo.634.2021.10.05.13.06.37; Tue, 05 Oct 2021 13:07:01 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235679AbhJEUEs (ORCPT + 99 others); Tue, 5 Oct 2021 16:04:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:46014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbhJEUEr (ORCPT ); Tue, 5 Oct 2021 16:04:47 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 DD35E613B5; Tue, 5 Oct 2021 20:02:54 +0000 (UTC) Date: Tue, 5 Oct 2021 16:02:52 -0400 From: Steven Rostedt To: Linus Torvalds Cc: Jan Engelhardt , Mathieu Desnoyers , Rasmus Villemoes , linux-kernel , Paul , Josh Triplett , Lai Jiangshan , "Joel Fernandes, Google" , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , rcu , netfilter-devel , coreteam , netdev Subject: Re: [RFC][PATCH] rcu: Use typeof(p) instead of typeof(*p) * Message-ID: <20211005160252.54640350@gandalf.local.home> In-Reply-To: References: <20211005094728.203ecef2@gandalf.local.home> <639278914.2878.1633457192964.JavaMail.zimbra@efficios.com> <826o327o-3r46-3oop-r430-8qr0ssp537o3@vanv.qr> <20211005144002.34008ea0@gandalf.local.home> <20211005154029.46f9c596@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 5 Oct 2021 12:46:43 -0700 Linus Torvalds wrote: > On Tue, Oct 5, 2021 at 12:40 PM Steven Rostedt wrote: > > > > I may try it, because exposing the structure I want to hide, is pulling out > > a lot of other crap with it :-p > > One option is just "don't do rcu_access of a pointer that you're not > supposed to touch in a file that isn't supposed to touch it". The problem is, the RCU isn't for touching it, it is for knowing it exists. > > IOW, why are you doing that > > pid_list = rcu_dereference_sched(tr->function_pids); > > in a place that isn't supposed to look at the pid_list in the first place? > > Yeah, yeah, I see how you just pass it to trace_ignore_this_task() as > an argument, but maybe the real fix is to just pass that trace_array > pointer instead? > > IOW, if you want to keep that structure private, maybe you really just > shouldn't have non-private users of it randomly doing RCU lookups of > it? > Ideally, I wanted to keep the logic of the pid lists separate, and not have it know about the trace array at all. And this was the best "incremental" approach I had, as the code is currently all just open coded. The RCU lookups are not an internal use functionality of the pid lists. The updates to the pid list are done by allocating a new pid_list, copying the old pid_list with the new updates and then swapping the pointers. The logic of the pid_list is orthogonal to the RCU update. It's just "allocate some random thing" and use RCU to swap it with the old random thing. That is, the logic to synchronize updates is left to the user not the pid list itself. I also want to limit function calls, as this is called from the function tracer (every function being traced) and if the pid_list pointer is NULL it skips it. Hence, I want to avoid calling a function to know if the pointer is NULL or not. -- Steve