Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35767745rwd; Mon, 10 Jul 2023 12:16:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlH2nMvMjmQz+dk9fIfDKk3jUXzocWgoyF4z3joxzlBSZKCsc7gtdTL7DmMfMRIjxIBnI1rv X-Received: by 2002:a05:6a20:3cab:b0:10a:e9ff:808d with SMTP id b43-20020a056a203cab00b0010ae9ff808dmr17162034pzj.0.1689016582180; Mon, 10 Jul 2023 12:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689016582; cv=none; d=google.com; s=arc-20160816; b=uySklC48TP+pgwgjeCsrpwfS2LwuGpERFDO70ybHQhFo8goQi7ot5SS3fsNjwCztpS ddf2YXcMJYcwZ0Vp25S3yhYjSL5dLeVMO+PpSHSpLNZhZOlTy52EY6k9vkedxH2aqm7M qAhqBk73fH5YcDL4jINOEXq9SXATLyGJ9r32AsYBMRmZGiH9JjvP7xyL6oxo4Sc3u/M6 JNt1rIjRSw1eAyZku2RzU0EAAlXP2msWA4c+S2/vOJapiPBLOsz1iGS/Kpa1dYcV69r2 3zOPk2gj+hm86TJ6AGn/ZFxwF9J1AEOLANGyXylSMz4Ap0kn3CimLBFkV+ZUe/JQXz+i 97FA== 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=HiGNrSGB+vqj+U+uobPE949/cA53MnaNz6yWrHtc5Bk=; fh=6dEWtyfz/7bj/r9nVlEqDuG45lXxr6JbDGVJY+z2zc8=; b=j8KU6JGNoDbxfbLkgIjX8JWzCMQwjDAVhAwCzOZRLMfIPLzrHBkf4FY1Tl0nqoTAbx F+AGn9Okkwleu1UO5fVUjMzN6VTtQqCsj+Lo0c/TY2/qYzmCOItx8IPNN4zyS2rRrIhu 20Y/fOGkDl52LPxbfayGIUWdTVngTnc87+iVtpIwL1LpumeyUCZDFM0nV/HHf/WgxboK buBS0FzGek6tKTHK1gDWIULD23E585A+eekmmJzfvxzzG8ueWXIAtLjynMTvjEwfZsbY +2mlTzyAEOPmVvHNXcYMelbJ8+BtGPVclY2quI8mx7RXyj8KzwAHD8kJ1F52SNEgoixE WF/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s68-20020a632c47000000b0055ae20ada77si79688pgs.591.2023.07.10.12.16.09; Mon, 10 Jul 2023 12:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230296AbjGJTGO convert rfc822-to-8bit (ORCPT + 99 others); Mon, 10 Jul 2023 15:06:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjGJTGN (ORCPT ); Mon, 10 Jul 2023 15:06:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C3913D; Mon, 10 Jul 2023 12:06:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03024611A5; Mon, 10 Jul 2023 19:06:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05C4AC433C7; Mon, 10 Jul 2023 19:06:07 +0000 (UTC) Date: Mon, 10 Jul 2023 15:06:06 -0400 From: Steven Rostedt To: Ajay Kaher Cc: "mhiramat@kernel.org" , "shuah@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , Ching-lin Yu , Nadav Amit , "srivatsa@csail.mit.edu" , Alexey Makhalov , Vasavi Sirnapalli , Tapas Kundu , "er.ajay.kaher@gmail.com" Subject: Re: [PATCH v3 03/10] eventfs: adding eventfs dir add functions Message-ID: <20230710150606.2c8d2236@gandalf.local.home> In-Reply-To: <285B9992-4DFB-4343-BD64-DAE9CCEFEE6B@vmware.com> References: <1685610013-33478-1-git-send-email-akaher@vmware.com> <1685610013-33478-4-git-send-email-akaher@vmware.com> <20230701095417.3de5baab@rorschach.local.home> <20230703110857.2d051af5@rorschach.local.home> <84CA259A-8A99-471C-B44C-08D289972F43@vmware.com> <20230703155226.1ab27bc1@gandalf.local.home> <20230709215447.536defa6@rorschach.local.home> <285B9992-4DFB-4343-BD64-DAE9CCEFEE6B@vmware.com> 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=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Jul 2023 18:53:53 +0000 Ajay Kaher wrote: > > On 10-Jul-2023, at 7:24 AM, Steven Rostedt wrote: > > > > !! External Email > > > > On Mon, 3 Jul 2023 15:52:26 -0400 > > Steven Rostedt wrote: > > > >> On Mon, 3 Jul 2023 18:51:22 +0000 > >> Ajay Kaher wrote: > >> > >>>> > >>>> We can also look to see if we can implement this with RCU. What exactly > >>>> is this rwsem protecting? > >>>> > >>> > >>> - struct eventfs_file holds the meta-data for file or dir. > >>> https://github.com/intel-lab-lkp/linux/blob/dfe0dc15a73261ed83cdc728e43f4b3d4e315aae/include/linux/tracefs.h#L28 > >>> - eventfs_rwsem is supposed to protect the 'link-list which is made of struct eventfs_file > >>> ' and elements of struct eventfs_file. > >> > >> RCU is usually the perfect solution for protecting link lists though. I'll > >> take a look at this when I get back to work. > >> > > > > So I did the below patch on top of this series. If you could fold this > > into the appropriate patches, it should get us closer to an acceptable > > solution. > > > > What I did was: > > > > 1. Moved the struct eventfs_file and eventfs_inode into event_inode.c as it > > really should not be exposed to all users. > > > > 2. Added a recursion check to eventfs_remove_rec() as it is really > > dangerous to have unchecked recursion in the kernel (we do have a fixed > > size stack). > > > > 3. Removed all the eventfs_rwsem code and replaced it with an srcu lock for > > the readers, and a mutex to synchronize the writers of the list. > > > > 4. Added a eventfs_mutex that is used for the modifications of the > > dentry itself (as well as modifying the list from 3 above). > > > > 5. Have the free use srcu callbacks. After the srcu grace periods are done, > > it adds the eventfs_file onto a llist (lockless link list) and wakes up a > > work queue. Then the work queue does the freeing (this needs to be done in > > task/workqueue context, as srcu callbacks are done in softirq context). > > > > This appears to pass through some of my instance stress tests as well as > > the in tree ftrace selftests. > > > > Awesome :) > > I have manually applied the patches and ftracetest results are same as v3. > No more complains from lockdep. > > I will merge this into appropriate patches of v3 and soon send v4. > > You have renamed eventfs_create_dir() to create_dir(), and kept eventfs_create_dir() > just a wrapper with lock, same for eventfs_create_file(). However these wrapper no where > used, I will drop these wrappers. Ah, I thought that because they started with "eventfs_" that they were used for some fops pointer. Note, I try to avoid using the "eventfs_" naming for static functions that are not exported elsewhere. > > I was trying to have independent lock for each instance of events. As common lock > for every instance of events is not must. We can find a way to make the lock for the root later. Let's get it working first before we optimize it. I do not want to expose any locking to the users of this interface. > > Something was broken in your mail (I guess cc list) and couldn’t reach to lkml or > ignored by lkml. I just wanted to track the auto test results from linux-kselftest. Yeah, claws-mail has an issue with some emails with quotes in it (sometimes drops the second quote). Sad part is, it happens after I hit send, and it is not part of the email. I'll send this reply now, but I bet it's going to happen again. Let's see :-/ I checked the To and Cc's and they all have the proper quotes. Let's see what ends up in my "Sent" folder. -- Steve