From patchwork Thu Jun 1 09:00:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kaher X-Patchwork-Id: 13263194 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 B696CC7EE29 for ; Thu, 1 Jun 2023 09:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbjFAJBA (ORCPT ); Thu, 1 Jun 2023 05:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbjFAJA7 (ORCPT ); Thu, 1 Jun 2023 05:00:59 -0400 Received: from DM4PR02CU002.outbound.protection.outlook.com (mail-centralusazon11013013.outbound.protection.outlook.com [52.101.64.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C769B3; Thu, 1 Jun 2023 02:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U6PLOkxBr2+Z7KnCP4H4Bk7jaE8K2yM9Vpvm9QsACBDak5eLf5Jp3h/dlAZvQxjtFG8Ylm8A2cU1bDjbJkPTHfiMY2SVR5VVhL3iGB94SydUQbI6vPm3u+nKj/cEXOyEty5faTHT2LeuT+sPvR+GVZv+KHDvfCDrJi6OVY5Kp55ImA1gEGP+kT5Y1N3y2NWBgHBDKh+euQyhICszh47ROn/yk0ZbGTS405JdhE/vDsdDzblpfHDM5wyHHg2n03jWVQr327wGbiHyG6mYcbgRFCzTWg8xClcBOHm5pj6qt8RzRL+Vif8ziw3B6VEvpOYmprACcymsoe6DcZzu2rxv3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t0XXlWq0uPPNa7k5cwB3q3MvwRr04OEmEH8Jz1GKZlI=; b=jmvLP6jV9cqLJW5Txce33p4kFBK3XRlWUDSMBUuhRcdza0SVJDNZN9BeSYWfNpZngYFHI4FRtwesQPDYqEkDj/2bcKeCYIz1gHCikOWvtjwbGfsUEL3N2Oo/HiG++O7QCEu5sJ53kMgdcpAg3EHPMoazYiEr/HcFefXqbXwhfQX5zvoQ9zaDyACyGQRJEuJAcYzBnMqfUPBVvZv8huN3H7VyjWnqWXRs/QRlTNTBw4btrnfYII0lWurx5JJjm/mgldC2psudkMXeGhjKhn3iPvBuK1CsVeL7Wo8ZyAb4D3wgWSS5cTA5bfz8prBmz+bgAaakx3+Haw6gDnIKwSbTWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t0XXlWq0uPPNa7k5cwB3q3MvwRr04OEmEH8Jz1GKZlI=; b=md4A3SLMa55BTUD3x5Xkw/Tgi8rc2E4zp0e7E6/IquAi7RE4Q4+044upqCaEnd1PdMKIn63/wAcNwqELJObejEUDw4zxbAxxII27CVNajykzk9habalEKaKDqHUSHxinC2Va2p7AWvDZ6FTXRG9v7H/VyofCYJ23D/c/Zjfklx4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; Received: from PH0PR05MB8703.namprd05.prod.outlook.com (2603:10b6:510:bd::5) by MW4PR05MB8617.namprd05.prod.outlook.com (2603:10b6:303:120::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Thu, 1 Jun 2023 09:00:54 +0000 Received: from PH0PR05MB8703.namprd05.prod.outlook.com ([fe80::5631:475a:58d4:cf66]) by PH0PR05MB8703.namprd05.prod.outlook.com ([fe80::5631:475a:58d4:cf66%6]) with mapi id 15.20.6455.020; Thu, 1 Jun 2023 09:00:54 +0000 From: Ajay Kaher To: rostedt@goodmis.org, mhiramat@kernel.org, shuah@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, chinglinyu@google.com, namit@vmware.com, srivatsa@csail.mit.edu, amakhalov@vmware.com, vsirnapalli@vmware.com, tkundu@vmware.com, er.ajay.kaher@gmail.com, Ajay Kaher Subject: [PATCH v3 00/10] tracing: introducing eventfs Date: Thu, 1 Jun 2023 14:30:03 +0530 Message-Id: <1685610013-33478-1-git-send-email-akaher@vmware.com> X-Mailer: git-send-email 2.7.4 X-ClientProxiedBy: SJ0PR03CA0181.namprd03.prod.outlook.com (2603:10b6:a03:2ef::6) To PH0PR05MB8703.namprd05.prod.outlook.com (2603:10b6:510:bd::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR05MB8703:EE_|MW4PR05MB8617:EE_ X-MS-Office365-Filtering-Correlation-Id: f27c6882-996f-40b7-033f-08db627eb4d1 X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kYUk40JpqhB04BaSzkI/5ajZ1ABLexttVUs33OMGh90PQZYQchk7iKWlF10Hat12rlksQGU/dw2xFNmjkbgtPOX51wDrRg35RvzaF0Ueheph8RbnMs4lSIArH3UMNyaHv0GKQPPRHyyy3lvKVKI7z4xQR/VeqOWL6zm4kK1D//0topqfcrgaSSfuS7fN0I94G5LgIpfoocDOdbp3ex2obqMP6DFAd+ipJwuKA6vTVTnG2cjNHTZK2GxVfGpStXEw0u70mbcld6qXmcJKyvQo/51YkxcnNf/9RAsScBnsS2/St6aEony7GIWNgekKQkiCpqedUF3Dvz0PDbqk+BvqNgbBuBBhOp7H8T/LP4VTgEeHF2reUnefG1AKY0k/kA8kIrq8Q2g1iMDXHDmGaGULjsFtlqNkFHBvzmfkfbT1mCljpimoa9nXLPwJG8dS5hn9FAv5hesfAfXvjPz/RFVc6NTpp5n/UIsCX4J0h5ZiE8g+IOb7HNTYPiNN0OKc+jxkCC4B/mY2cSLJrceNZOFADH/i6GK+MqJjfeh3ifMZ+FGvLpIDmyhmGUMFN2xAEG4g3FG4QiCmjE8s4VhdOJc+wGkjzUZ5qBQ4WSAjqCTEhNgASmlO0UcZbRPMzFFqdiMv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR05MB8703.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(346002)(136003)(376002)(366004)(451199021)(52116002)(6486002)(186003)(5660300002)(6666004)(41300700001)(107886003)(36756003)(8676002)(38100700002)(8936002)(26005)(6506007)(38350700002)(83380400001)(4326008)(66946007)(2906002)(66556008)(478600001)(66476007)(2616005)(6512007)(86362001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8qiBejyOGrKzvjlUnZE60JsNOJZW5WvEu/iBEbwdELwhPVj3zgZfb1Nas1ZibacQvDn5s/lVBbXPwpX9HNd0fdYU7Ep6cDXGz+LPp6WopvAWbXlhTSVXSznH4yPQJDUn7Zq1rnLIw/iinc4rx7GCL2WEjZcoS9bBPbEE0CY7SNULLXq6tR2sob4C6ZxeQg3HVe3MLu3IyrbgczOoSiPYcH8WQR/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A/J23hwMmTFe7QXRswJbklOYzsrPY1jA8sefPzYSYAmFbd3Upq49CtqifrDxFdJ1hvs0xd0/4VGVlzq+cmR7VGscj3rRgKle1dlffnrEG2sIz2c6DT2rlJSZqkwwZc2ElFl3KEkWPVlrZeDPt7HTIqTQFx7iVZ9BoWByWsAGqbGndz+7ED4VHUxWU2HlVm8mW6CJn3szNsHflHiyzb98tqhaAzOFnKVBpkdqlEjIu2OsiIIYJ0UWWeOIJIFnWOeqaym83b/fjaE3fuy0QsoRRum+/38FoUUlsEY6kwV7+kScj7Z X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: f27c6882-996f-40b7-033f-08db627eb4d1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR05MB8703.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 09:00:54.4282 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H70jLVt9kXIScuUAGou17hMqCdeg/SsgCbG0x1o/l7YgjSl03ErBQcZrHgfFk7DSkn2FaTFyOqCelz7PO0o90A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR05MB8617 Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org Events Tracing infrastructure contains lot of files, directories (internally in terms of inodes, dentries). And ends up by consuming memory in MBs. We can have multiple events of Events Tracing, which further requires more memory. Instead of creating inodes/dentries, eventfs could keep meta-data and skip the creation of inodes/dentries. As and when require, eventfs will create the inodes/dentries only for required files/directories. Also eventfs would delete the inodes/dentries once no more requires but preserve the meta data. Tracing events took ~9MB, with this approach it took ~4.5MB for ~10K files/dir. v2: Patch 01: new patch:'Require all trace events to have a TRACE_SYSTEM' Patch 02: moved from v1 1/9 Patch 03: moved from v1 2/9 As suggested by Zheng Yejian, introduced eventfs_prepare_ef() helper function to add files or directories to eventfs fix WARNING reported by kernel test robot in v1 8/9 Patch 04: moved from v1 3/9 used eventfs_prepare_ef() to add files fix WARNING reported by kernel test robot in v1 8/9 Patch 05: moved from v1 4/9 fix compiling warning reported by kernel test robot in v1 4/9 Patch 06: moved from v1 5/9 Patch 07: moved from v1 6/9 Patch 08: moved from v1 7/9 Patch 09: moved from v1 8/9 rebased because of v3 01/10 Patch 10: moved from v1 9/9 v1: Patch 1: add header file Patch 2: resolved kernel test robot issues protecting eventfs lists using nested eventfs_rwsem Patch 3: protecting eventfs lists using nested eventfs_rwsem Patch 4: improve events cleanup code to fix crashes Patch 5: resolved kernel test robot issues removed d_instantiate_anon() calls Patch 6: resolved kernel test robot issues fix kprobe test in eventfs_root_lookup() protecting eventfs lists using nested eventfs_rwsem Patch 7: remove header file Patch 8: pass eventfs_rwsem as argument to eventfs functions called eventfs_remove_events_dir() instead of tracefs_remove() from event_trace_del_tracer() Patch 9: new patch to fix kprobe test case fs/tracefs/Makefile | 1 + fs/tracefs/event_inode.c | 757 ++++++++++++++++++ fs/tracefs/inode.c | 124 ++- fs/tracefs/internal.h | 25 + include/linux/trace_events.h | 1 + include/linux/tracefs.h | 49 ++ kernel/trace/trace.h | 3 +- kernel/trace/trace_events.c | 78 +- .../ftrace/test.d/kprobe/kprobe_args_char.tc | 4 +- .../test.d/kprobe/kprobe_args_string.tc | 4 +- 10 files changed, 994 insertions(+), 52 deletions(-) create mode 100644 fs/tracefs/event_inode.c create mode 100644 fs/tracefs/internal.h