From patchwork Wed Sep 13 02:58:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp819540vqx; Tue, 12 Sep 2023 20:01:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdbjx1zvEPwXI5tg9se78T8iRv6HEJZ4IqYPpdZx7wiDuJaGkovCRfHqeMXoXjE7MeG910 X-Received: by 2002:a05:6a20:3d82:b0:14b:8023:33c8 with SMTP id s2-20020a056a203d8200b0014b802333c8mr1438718pzi.2.1694574063534; Tue, 12 Sep 2023 20:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694574063; cv=none; d=google.com; s=arc-20160816; b=jw344p+DSvV9iQ8Atr1Bz13nZwolyxNuMTwo09oeUmMI/MuC1/Dp8ve/AVovkyvLBE xLJRrtyKdDvRPungIiDEAXCLJKoP/lEY8sUIURoTzYwRf/5u5tD52lmABc6u2byN1iou 6ZbaDKO66PLkoOBIZBAGClGvpK4BCIQXN/8RNKG4d/ZYomBHQHlZgl/3gq1DIlPLv70n mNPnxFjCBH0NdugcRMj4x5CatobPNZa2j5nubuNCWzs6vFOcN71pLl+8KwJHdL9Nnet7 i2zHeII6ZTo6otTHwfCIMMf+28Rb4Zpu3C7zzjBPaXnOkC3a8nvFA698Wx/4DN6Y2kGY dPEw== 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=O0+oUT5qnSLa4cYD/fIhpsI6fQKCxlxOydKZ35stg3U=; fh=rjFf2Qs0A83L06RBhuRXHLiK/k7VWIWgHuoJoNWJMnQ=; b=R9ERXRZp11osg7S6WHu5Fb7LK4Iu1Qs9K4Wqfz0TGWCdP2w4/RmxeWTeXk/ajAVPsW T2X+hlmSp+TJtdSeqzsu7pWPBbaD8ukxjx1qK2Oii2NNl/rH4P5Glf3KzBqImuSFSnYt 1jNe1nhmRXKEJvmbWXIOQCgyPpNUSkORo9A8PRcYgKpyY2B0oBnP0hXFfnJZ49y4z6uc lfxQ+3JX1qVmfIB7bOQjikcayOD7/ROrcBXlTRRzLUtpUmT3kNLdOcvhsKHjZOtduLsi pwgWf3QLgvIe8+bCUSV6B0zydVwBJkJUrFKoxOj3hITgwREMTx5/sB9mYlTGbDki547w HEXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id d10-20020a170902654a00b001c3267ae318si8839046pln.247.2023.09.12.20.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 20:01:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5D83A81E5CFB; Tue, 12 Sep 2023 20:00:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234967AbjIMDAI (ORCPT + 36 others); Tue, 12 Sep 2023 23:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbjIMDAG (ORCPT ); Tue, 12 Sep 2023 23:00:06 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E039810C9; Tue, 12 Sep 2023 20:00:02 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 609C8C433C8; Wed, 13 Sep 2023 03:00:02 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.96) (envelope-from ) id 1qgG73-000QOv-1f; Tue, 12 Sep 2023 23:00:21 -0400 Message-ID: <20230913025855.615399273@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 12 Sep 2023 22:58:55 -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/3] tracing: Remove eventfs_files by use of callbacks Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Sep 2023 20:00:18 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776889693255810599 X-GMAIL-MSGID: 1776889693255810599 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 was suppose to add the first patch to this merge window. As it is an aid for debugging, I may push it still in my next pull request. 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. The third patch fixes the kprobe selftests yet again, and the function that it uses to attach to was renamed once again. Changes since v1: https://lore.kernel.org/all/20230801001349.520930329@goodmis.org/ - Rebased on mainline and some minor clean ups. - Fixed kprobe selftest Steven Rostedt (Google) (3): tracefs: Add show_events_dentries eventfs: Remove eventfs_file and just use eventfs_inode tracing/selftests: Update kprobe args char/string to match new functions ---- fs/tracefs/Makefile | 1 + fs/tracefs/event_inode.c | 809 ++++++++++----------- fs/tracefs/event_show.c | 125 ++++ fs/tracefs/inode.c | 2 +- fs/tracefs/internal.h | 40 +- include/linux/trace_events.h | 2 +- include/linux/tracefs.h | 31 +- kernel/trace/trace.c | 7 +- kernel/trace/trace.h | 4 +- kernel/trace/trace_events.c | 314 +++++--- .../ftrace/test.d/kprobe/kprobe_args_char.tc | 4 +- .../ftrace/test.d/kprobe/kprobe_args_string.tc | 4 +- 12 files changed, 812 insertions(+), 531 deletions(-) create mode 100644 fs/tracefs/event_show.c