From patchwork Tue Aug 1 00:13:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 12910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2361127vqg; Mon, 31 Jul 2023 17:58:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlEPbQLCNDgpsstN6CkIo3HU0fPbiGv0QLL9w2uD1oi0clyHFk/lTU4mXH/s/ICRFI0S2q99 X-Received: by 2002:a17:906:cc55:b0:99b:ebf9:90f2 with SMTP id mm21-20020a170906cc5500b0099bebf990f2mr1021262ejb.45.1690851517848; Mon, 31 Jul 2023 17:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690851517; cv=none; d=google.com; s=arc-20160816; b=QUFPXLAVdY4RTbthsAzxilRSqBnDgl8SkbVGXOvxS41JnIPy9yEYx+O0ciqhzIwYsX gHaBY7JAi9YRgRiuaS/Bn0jKGJGx3IMW2Xj5XZpq3ZQA/GlUA7RZrxSx9lt6O6/fxIfR 2HVN1NR/NjMs9Aahwtf+cDwSjC55t3g+e2T2pOl6U9x7lE1CjxGV5ZRD86gclT4stD3D S7o2HMAahLNfdDp+u2ERyPC9val0MDEET88lX38GOMQesmqaQewzxzY7hKUDlr7czZh1 9IRjN5jPWFEFuT5MLAE35/tJSdwShWMy3opOUocwNgE3pSneta0HXdGFQQluZYmLU/mi i8lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:user-agent:message-id; bh=JxUsnUek9+RgAwLdJVAVw6+iadFsvhOlCxyfgNTG66c=; fh=7dHtO4MxXqwfteul+ZQKMeuWAaROelUfxdRpGUpN7Wc=; b=EhF+UXUSA9DhmB9S0YTSnPBZKqeg42IOf8qKx/d4n5+d4ZoljWB9g36Vs6xoPDDHAx ++2B0L7hOEH8Osxas2wO1ysbeMHzAmYFbwsL9CX5FVjquWuxLBPol0QfVrBX9/O2TfFN DFxreOWeDcBtGXZqWB3ocyKXheIiUMmr+VbZ2Av82Hyy13o1iTqKqViD5I9pzB942yWb 3zdGyj/rD8EQxfbQmmq4boT/Gtjc/cZLrpEWA1d+qriCQrvgQUov+wqHkap8r3b8trvL 0NicMLxw54Y+hyIgBhSkNXVFS0E6hOZGdSkFAZCTiuQonZBDvJLnhmTLvWXVjXqeIpfi IOuA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170906074b00b00991f773d9b4si8044023ejb.268.2023.07.31.17.58.14; Mon, 31 Jul 2023 17:58:37 -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 S230190AbjHAAOl (ORCPT + 99 others); Mon, 31 Jul 2023 20:14:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjHAAOk (ORCPT ); Mon, 31 Jul 2023 20:14:40 -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 B4C5E173E; Mon, 31 Jul 2023 17:14:39 -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 030156134A; Tue, 1 Aug 2023 00:14:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60F48C433C8; Tue, 1 Aug 2023 00:14:38 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.96) (envelope-from ) id 1qQd24-003g8f-2n; Mon, 31 Jul 2023 20:14:36 -0400 Message-ID: <20230801001349.520930329@goodmis.org> User-Agent: quilt/0.66 Date: Mon, 31 Jul 2023 20:13:49 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Andrew Morton , Ajay Kaher , chinglinyu@google.com, lkp@intel.com, namit@vmware.com, oe-lkp@lists.linux.dev, amakhalov@vmware.com, er.ajay.kaher@gmail.com, srivatsa@csail.mit.edu, tkundu@vmware.com, vsirnapalli@vmware.com Subject: [PATCH 0/2] tracing: Remove eventfs_files by use of callbacks X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772986320907298179 X-GMAIL-MSGID: 1772986320907298179 This patch set is on top of: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git/ trace/core The first patch adds a file to tracefs that shows all the event_files that have been allocated for the dynamic eventfs file system. It also shows the dentries that were created and their current ref counts. This is useful for debugging and knowing when a dentry has been created and freed. I plan on adding the first patch to the next merge window. The second patch I plan on adding to the merge window after that. The second patch is a bit of a redesign of the way the eventfs is created. It no longer creates a descriptor representing every file but instead just the directories. These descriptors get an array of entries that represent the files within it (but not for sub directories). Each entry has a name and a callback, where the name is the name of the file (used for lookup) and a callback that is used to create the dentry and inode for the file. This saves more memory, this approach may be possible to create a dynamic way of doing this for other pseudo file systems. Steven Rostedt (Google) (2): tracefs: Add show_events_dentries eventfs: Remove eventfs_file and just use eventfs_inode ---- fs/tracefs/Makefile | 1 + fs/tracefs/event_inode.c | 781 ++++++++++++++++++++++--------------------- fs/tracefs/event_show.c | 125 +++++++ fs/tracefs/inode.c | 2 +- fs/tracefs/internal.h | 34 +- include/linux/trace_events.h | 2 +- include/linux/tracefs.h | 31 +- kernel/trace/trace.h | 4 +- kernel/trace/trace_events.c | 309 ++++++++++++----- 9 files changed, 795 insertions(+), 494 deletions(-) create mode 100644 fs/tracefs/event_show.c