From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31BA3C433F5 for ; Thu, 9 Dec 2021 17:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241333AbhLIRvP (ORCPT ); Thu, 9 Dec 2021 12:51:15 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:53638 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbhLIRvO (ORCPT ); Thu, 9 Dec 2021 12:51:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 45A50CE2778; Thu, 9 Dec 2021 17:47:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEDFEC004DD; Thu, 9 Dec 2021 17:47:36 +0000 (UTC) Date: Thu, 9 Dec 2021 12:47:35 -0500 From: Steven Rostedt To: Beau Belgrave Cc: mhiramat@kernel.org, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 02/13] user_events: Add minimal support for trace_event into ftrace Message-ID: <20211209124735.3d1a9707@gandalf.local.home> In-Reply-To: <20211209174050.GA21553@kbox> References: <20211201182515.2446-1-beaub@linux.microsoft.com> <20211201182515.2446-3-beaub@linux.microsoft.com> <20211208181905.62f8f999@gandalf.local.home> <20211209005823.GA21399@kbox> <20211208210336.40c7741b@yoga.local.home> <20211209174050.GA21553@kbox> 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 Thu, 9 Dec 2021 09:40:50 -0800 Beau Belgrave wrote: > No, this is not a fast path, and I don't have a problem moving to a > mutex if you feel that is better. I've likely become too close to this > code to know when things are confusing for others. Yeah. I really dislike the "protection by algorithms" then protection by locking unless it is a fast path. If this was a fast path then I'd be more concerned. I dislike global locks as well, but unless contention becomes a concern, I don't think we should worry about it. Also, for this comment: +static int user_events_release(struct inode *node, struct file *file) +{ + struct user_event_refs *refs; + struct user_event *user; + int i; + + /* + * refs is protected by RCU and could in theory change immediately + * before this call on another core. To ensure we read the latest + * version of refs we acquire the RCU read lock again. + */ + rcu_read_lock_sched(); + refs = rcu_dereference_sched(file->private_data); + rcu_read_unlock_sched(); How do you see refs changing on another core if this can only be called when nothing has a reference to it? I think this comment and grabbing the rcu locks is what is causing me concern. -- Steve