From patchwork Wed Apr 2 17:40:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 14036347 Received: from outbound-ip191a.ess.barracuda.com (outbound-ip191a.ess.barracuda.com [209.222.82.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81EB11E4A4 for ; Wed, 2 Apr 2025 18:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617642; cv=fail; b=OJLjW7Mna+Ey0UcyQJDjjvYauXVMRF0pwnwN8384E/0IMCexWrn2SKDH1AK7zTQtd/ANOSfer/uFJQEhZgCDUGhTR7nHaVtR2vNVhVzOXn1v+EbZnPecFkyBCpizCyr7svTfK/MdkJ0nPI1LFk0V9547tzUyHqffte4TRadPbjM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617642; c=relaxed/simple; bh=vsRd6HV0HXCXlPebFymnL4yroLUN+ejc4c0byL5fBaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gee6Z50i+Xtb8mGjNSAwUBGyorG98HbF2opZNrpHXHguMX9Kfl2pGQj4gzlqZqHfzP27zCjOg/9dXN6INum3PyodMkGwIVK2+9BX+05f8MI5ih4TxNaIT60BHbgfTe0beOp1mZKoGjivwTf2X26yG6qKj+HBJcl4rliv7IAFkAw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=Z5BdEph1; arc=fail smtp.client-ip=209.222.82.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="Z5BdEph1" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2041.outbound.protection.outlook.com [104.47.58.41]) by mx-outbound-ea8-37.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 02 Apr 2025 18:13:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PyyJhiRqvkDMimxIm5nBSY7xyVrk5PJO9Td8bgurtvfOZppteEOOrJvdgvERCG1DpSRKDqGfJChRIyavWQxEglTD9E06VDwr3JvdrbiP9QmWpi51YvaGGZJmvuET/gEyhj1R6bRjHfq87hTm8WxQ8QoajRU+JDjv2okVqI7MwMxg3psMI8vykYCfRIykvsdCuHe7fZBxehHqgauFmOj+vr9AVV+j3Sz4zl/5T2bmH5yxDscbU8j60q3PvDBqxEPOSyGIVNHGDG2UsJzA+XAhu2R5fJ5K/41T7YbkVXa70NHfSDbWqCPnjAWVDyd1Q97JROyJka19saT5C/lvd78zpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bWw7OH2SZGmam1SNR6oqhA2eZLnJ6zQW8Ev7HZdxNz4=; b=din3z+bbvPRptEDUH7As5fCysiGyySpqfvTBRQ6vahmfDH3jHRCZOSl6nHZTNu0KzL0qO+RDNxSE8sJvELOmBc/qBYWki6z41FuER+AEXRMhk2o6RBH0Tjl+C1vvStwfoPrSFtSBi7gz0Ypru59qi6dJwxh8DHd9aexzL8zAHJsWVriyBroCe7ztfXh/HJvbpGAXsdNyEWfkziKfLgMs92oy3zfbbWlzYFb5YjRkv7RtZpAux6XjEPX92AiV5aRRYT/45FVfykDYt015e/RtdydF3ABtOHPJEen4XJLhKYGJeYZ9gzzHEQqHNkTkm7bqTWl1aJ7/pN9n5S025fkaSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bWw7OH2SZGmam1SNR6oqhA2eZLnJ6zQW8Ev7HZdxNz4=; b=Z5BdEph11QqZSwDiIu7DORZ7EfnobW+pBhzd2K+X0nZlc0R/rlkpChVBwwhhdVE547Aswc5YBUy8auUNlmzxnXDeuHFXZZ+tizPWAuapgK8Ir3gdKjry/xoigbruCtc9sHHQ6mBWcozhUI0PHjKf8/jaFbqA3fhpYlLD6x7A77A= Received: from CH0PR03CA0390.namprd03.prod.outlook.com (2603:10b6:610:119::14) by SJ0PR19MB4793.namprd19.prod.outlook.com (2603:10b6:a03:2ca::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.50; Wed, 2 Apr 2025 17:41:01 +0000 Received: from CH2PEPF0000013B.namprd02.prod.outlook.com (2603:10b6:610:119:cafe::ca) by CH0PR03CA0390.outlook.office365.com (2603:10b6:610:119::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.24 via Frontend Transport; Wed, 2 Apr 2025 17:41:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH2PEPF0000013B.mail.protection.outlook.com (10.167.244.68) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Wed, 2 Apr 2025 17:41:00 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id E331F4E; Wed, 2 Apr 2025 17:40:59 +0000 (UTC) From: Bernd Schubert Date: Wed, 02 Apr 2025 19:40:51 +0200 Subject: [PATCH 1/4] fuse: Make the fuse_send_one request counter atomic Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250402-fuse-io-uring-trace-points-v1-1-11b0211fa658@ddn.com> References: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> In-Reply-To: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> To: Miklos Szeredi , Vivek Goyal , Stefan Hajnoczi , =?utf-8?q?Eugenio_P=C3=A9rez?= Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Josef Bacik , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1743615658; l=4149; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=vsRd6HV0HXCXlPebFymnL4yroLUN+ejc4c0byL5fBaE=; b=abcMhdpPvadcD2yNHp6IOl4W5uqJ/ekc50COjKIM5PKz2m5UTYIGF6MYwr4ZFu1W+nO0Q60Et Wlb0/nKoRJGBWZNVotIT/OJTeQIsY2LpTLcGJhWTeWlGsnro6x5k6rQ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000013B:EE_|SJ0PR19MB4793:EE_ X-MS-Office365-Filtering-Correlation-Id: ed426729-3c01-44f1-0a32-08dd720d88b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?qP8Aj/WuWHkiPaRM0oi/aQ/O5lENbjj?= =?utf-8?q?DJgdxO5ldWlZtdZ8ntHWgxVDgomI3MIMTGbj1JG+YOPcZnUCe38zuFiuKfasiV6WZ?= =?utf-8?q?CulAM9HLMAogPrTE4M3IwgFiQcWi3RIQTfCmDituYwCTeFdlOXg0tMgNYyYU2wMH6?= =?utf-8?q?L7nVj8hJCikXWdxLx7o/yCq3JcD9I8cFINoXe8XTmMdLux28R1R2xp/FUlVnIiZMF?= =?utf-8?q?EH8lw3W7p2lWYP3nXbJpI5RiVVQWIL+vKFFDNb2TuQYYPcwJJ1sgZxRVDlZWVFTy0?= =?utf-8?q?cS0IEiRNIaBujXCUl7Kgw7Ft1txdxXXHgtzkTucC6XIbj7TEXCdKiQmdlMrQLPLCL?= =?utf-8?q?Fk6l8jAUzoLnsQcF7UYpeRjASh81dS1IvBR8kr0tegNtTrSmLPTF1r3Rv8aeVUcIg?= =?utf-8?q?VsS2CUaixhgbZ6shHe2s3+SQb+lNHZWIqC3fWsidDZrA2WoAOsbXgK0BlfdhCIHve?= =?utf-8?q?k9/C9+0dlt02U7UIC7zMHLF3oAZlihLHWk7zYHiRldrKRHh+R4okiHXnPbPwKP+PL?= =?utf-8?q?UrNz17LqwZWN0K+PMWnYes/vRnfVPdx7x4F41YL/HmVtC6nTTQaWL3Xb1JFuUgzdv?= =?utf-8?q?QIwD5BV1EnYtXKLpUdR9zvxBh9z3g3KBXg+mBGpvpuaLUsBi8dM0+QVNLe2MyNHmm?= =?utf-8?q?beAN9fuq/LsetVWA+SKdDfjwO2/krcv5O7w6OWBUEG4xDKI3PcV40Ud9dyg3TqvOX?= =?utf-8?q?tlOTHmT6zImRF2O94yf8QBjiV88lb/HzRiH2NxD8oOy5kRaHxGDLCCJE+8hfdQAFZ?= =?utf-8?q?aBqxaOw0sB3BbJpmKORm9ZJo+0YP2V3ChYylS4dD+5cja71lW6MTONOkPAwMViqsv?= =?utf-8?q?WFCmZtm9inttRbBmb2CKEWkktTuvHK80khAdHebJ/KInD2VALMsU9RMvGGh80d4Ae?= =?utf-8?q?PUnIGgK7UWXeW6SO4BhGRrxmxLCT55cAlRGSMv8xWx10Agfv42rc0MUcnPD54nVjt?= =?utf-8?q?c4KJk1sx/qrktbbpvQ33g9D6VtQM6bOG1VlSlblerU1KVJ22RuO0YgcyU7Q9cUnhB?= =?utf-8?q?CP0VXepudS3Cz+dUkhScmVBCXUtEcUOrSQmpll2Cd9WhP3b9JCoujZ6JG1F+gcXoC?= =?utf-8?q?4q5MbbCNUyMNTiir+GK3VGbb2VoIhglelK1gTA1V25OTySE1+SDvnEIzYSYav+xST?= =?utf-8?q?ssxUE1+Flh2YOWk3TnDcMugDO3qxU0x/okgBTnpScIJeUSWxA1eFiT0wcEBnNqzQL?= =?utf-8?q?4hva4lkQm6VxZep+szq26I+n2Cg3Z+0T6nrNvHaAnYfqjWwGTg1T8fdp6tMpmaBt9?= =?utf-8?q?g97csW68oiKRxqIPLXyMVUDwBkBU4cu8U3OqAVkGg7kvf2EkQ8u9QkY0caPW9/Crd?= =?utf-8?q?lzCZ5maBNqhcELh8muQN+QHk+H1jt+7sq4K8C1qfsFBFLcHOf2Lhg4GED5aX9EfNj?= =?utf-8?q?kPrTlNyl4WxoiNeJKY1Ru78b++dZTdtN0cHP1Mbj/4jLfOX8Orzbqs=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cd4zi7mQaZU718EqMf3Ay8upi8lNwzMkHBvTtqqCkvvBIOTtGnpBA2hAh2KgvzqQMziWwsM9VJO2gBIXAqYbVywZgfgjWgGiNNleUz4PwMkN8XqABCmEV/uo+/1BxgNV2vZjlGirlOw6Yz6cDYvWWnD4dv96pl7MrvVSSn9exw7VF0yjQBBmfpHEy9YN07A0959v8TPS5Nx+9jBxBJkFuCtmdtik/s3FCrg6NZSgpVK0ecoOr8R2dAw9z9HpuxzarB02GmcjobXGlpfFW3BhMXDKmqjTqwcNdi0wZNUx7ERa6QrCC8yiaL8r2kCvrwv58cpVXsvA/aoG/GMNMa9NDwBHgtVmrfUHFNziaiAI47Njyp8LyHgq6i5TX3dwUEa0zJqUCrJnoxFL8JsN7DxCm8QAksfzR7V4D6zRBRrDBNz1WOIXCDyMLcSWCxuQXPQe+iagOXXBVIAcUsnlVuqQLfPI/b66bgSk9IpzPKZqxowXcIxE3Q8axh8DWaoRsjECnrlreHnXRKDYJ4mt+2sMdgULcDDXlvgYpQFt4bxfwFGUhgOnMbBH38wa6llSv4hvIMoUz2FYzvJbg+fLKVxodPWfBXWnsfAao7LJziCDC54yyqc1WGuxfO/oB9bmXbaVq6incFwYO0+pT28t172ycg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2025 17:41:00.8830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed426729-3c01-44f1-0a32-08dd720d88b1 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF0000013B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4793 X-OriginatorOrg: ddn.com X-BESS-ID: 1743617637-102085-5193-8330-1 X-BESS-VER: 2019.3_20250402.1543 X-BESS-Apparent-Source-IP: 104.47.58.41 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViYGhqZAVgZQ0DDV2NjSwCzN0M LIwDgpJcXQzDTV2MjQyMAw1cTYJDFJqTYWAOwnx0hBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.263603 [from cloudscan23-198.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 No need to take lock, we can have that in atomic way. fuse-io-uring and virtiofs especially benefit from it as they don't need the fiq lock at all. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 24 +++--------------------- fs/fuse/fuse_dev_i.h | 4 ---- fs/fuse/fuse_i.h | 18 +++++++++++++----- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 51e31df4c54613280a9c295f530b18e1d461a974..e9592ab092b948bacb5034018bd1f32c917d5c9f 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -204,24 +204,6 @@ unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args) } EXPORT_SYMBOL_GPL(fuse_len_args); -static u64 fuse_get_unique_locked(struct fuse_iqueue *fiq) -{ - fiq->reqctr += FUSE_REQ_ID_STEP; - return fiq->reqctr; -} - -u64 fuse_get_unique(struct fuse_iqueue *fiq) -{ - u64 ret; - - spin_lock(&fiq->lock); - ret = fuse_get_unique_locked(fiq); - spin_unlock(&fiq->lock); - - return ret; -} -EXPORT_SYMBOL_GPL(fuse_get_unique); - unsigned int fuse_req_hash(u64 unique) { return hash_long(unique & ~FUSE_INT_REQ_BIT, FUSE_PQ_HASH_BITS); @@ -278,7 +260,7 @@ static void fuse_dev_queue_req(struct fuse_iqueue *fiq, struct fuse_req *req) spin_lock(&fiq->lock); if (fiq->connected) { if (req->in.h.opcode != FUSE_NOTIFY_REPLY) - req->in.h.unique = fuse_get_unique_locked(fiq); + req->in.h.unique = fuse_get_unique(fiq); list_add_tail(&req->list, &fiq->pending); fuse_dev_wake_and_unlock(fiq); } else { @@ -1177,7 +1159,7 @@ __releases(fiq->lock) struct fuse_in_header ih = { .opcode = FUSE_FORGET, .nodeid = forget->forget_one.nodeid, - .unique = fuse_get_unique_locked(fiq), + .unique = fuse_get_unique(fiq), .len = sizeof(ih) + sizeof(arg), }; @@ -1208,7 +1190,7 @@ __releases(fiq->lock) struct fuse_batch_forget_in arg = { .count = 0 }; struct fuse_in_header ih = { .opcode = FUSE_BATCH_FORGET, - .unique = fuse_get_unique_locked(fiq), + .unique = fuse_get_unique(fiq), .len = sizeof(ih) + sizeof(arg), }; diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 3b2bfe1248d3573abe3b144a6d4bf6a502f56a40..e0afd837a8024450bab77312c7eebdcc7a39bd36 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,10 +8,6 @@ #include -/* Ordinary requests have even IDs, while interrupts IDs are odd */ -#define FUSE_INT_REQ_BIT (1ULL << 0) -#define FUSE_REQ_ID_STEP (1ULL << 1) - struct fuse_arg; struct fuse_args; struct fuse_pqueue; diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index fee96fe7887b30cd57b8a6bbda11447a228cf446..8aea23ffaf2fa44b284d4efef1e009fb1ca876a0 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -44,6 +44,10 @@ /** Number of dentries for each connection in the control filesystem */ #define FUSE_CTL_NUM_DENTRIES 5 +/* Ordinary requests have even IDs, while interrupts IDs are odd */ +#define FUSE_INT_REQ_BIT (1ULL << 0) +#define FUSE_REQ_ID_STEP (1ULL << 1) + /** Maximum of max_pages received in init_out */ extern unsigned int fuse_max_pages_limit; @@ -490,7 +494,7 @@ struct fuse_iqueue { wait_queue_head_t waitq; /** The next unique request id */ - u64 reqctr; + atomic64_t reqctr; /** The list of pending requests */ struct list_head pending; @@ -1065,6 +1069,14 @@ static inline void fuse_sync_bucket_dec(struct fuse_sync_bucket *bucket) rcu_read_unlock(); } +/** + * Get the next unique ID for a request + */ +static inline u64 fuse_get_unique(struct fuse_iqueue *fiq) +{ + return atomic64_add_return(FUSE_REQ_ID_STEP, &fiq->reqctr); +} + /** Device operations */ extern const struct file_operations fuse_dev_operations; @@ -1415,10 +1427,6 @@ int fuse_readdir(struct file *file, struct dir_context *ctx); */ unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args); -/** - * Get the next unique ID for a request - */ -u64 fuse_get_unique(struct fuse_iqueue *fiq); void fuse_free_conn(struct fuse_conn *fc); /* dax.c */ From patchwork Wed Apr 2 17:40:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 14036346 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44B251C5F13 for ; Wed, 2 Apr 2025 18:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617612; cv=fail; b=cGhzZPQXU9uqhJBJqjIEr5nO3MiEluCxdwSUWlaCaIVsk5m6EH7UldtN73iLknQohOBpoAPBZC4qiqVxLTnYEshQOyAkrqOAKW+NcoKfrtm9W7QbLx5GEZ8iehTajTsmzF3O8DC59YgDkRcoeRAvIzAPbPUrhLy4YRDDu97540E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617612; c=relaxed/simple; bh=ziYZV/W/d52W8kKfIYz5/3su24KBpyjnMK0qQasJq7c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aSwrd1EFCE2Sgm276an+jOorSlJsFyFzrsPYXTIS49YE1Lzkareh4hyscVIluoRdEGCnM4aVwQ8WGwV8dmtWMjdBdEegsvbYwR+MPeHCoJ6LzgczUw4SWQmF66Pg7IL4t2B01QlXHrKLyBbdp5GbOn2YDrjyxp3FcBwJU29PdHI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=qx0x3Eqm; arc=fail smtp.client-ip=209.222.82.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="qx0x3Eqm" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by mx-outbound22-72.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 02 Apr 2025 18:13:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nooMoxcU2cGrGMlzs/7qTgFF+0nRmoJ+GbiMLRq9l5GvzBqOMuYmua9Pzho95Ja+MJpvTcuu+TC91f7lFIlYz0z/TYuPuPUEBoRWaFJxaC8UJIVavOdPt8rRJAZPeuq8zIeODfXkyqaGn4AxpN9wxDQB5v39FkdxfefB2E2jN1Qi1I/VBisFM9SIyaK22eJ0ViWqfNDiGYmkxUBQYHTX6rtXRH9v7xWl16xiKc9pZTDS4MAJQWG/VRFKi52GLn2pk5g+a6v8MV87WsIzYKe6IxjaOXt7FS+/PDzGG/yEczAh+wl2E7SP/WUWizjaFoar8zLgLU6s3/XBHf+Ku4faHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Y/tm93HuADKuq/51kxy83RJV/L4xXQ5WraSoBE7nzxg=; b=KSA8d/rP0aWzV+KTb2yb1y5OB/crZql0GT5alghhwZNS71fV9Sg/bt7IHHcBV5hC/vqIyoZWLv8ufoFITiu+YSyMeLMsi2pJknE4TY85Yn18JKZXC8hMC7iOjbKrnktmtPLGscD/4Rs7z1HvHRbvRmhM2ENUXSNm1t36yTNS3oV77oNA5VzALFiqzr0dY7k/cfSf8KdnJjUrbg0bjibC2mchzrEpGzqrnGVX4PGmldGOgkKDqWbgxOKBvCHbjwmhVmH84qWMV+69LNGxeXs1lSLZ78EvQfGT1l+1PNlZX6PieMpcptTd04xaaP/Dy01Y+8xzJAOa1duBWan5fXgRLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y/tm93HuADKuq/51kxy83RJV/L4xXQ5WraSoBE7nzxg=; b=qx0x3EqmfVlepkvQHondwpPuw//XibFh2QBZgqDLrcqXWD5in4yFb3CUPaenRINB8Ti+G6rm37NSVuJTGIOG3UwllSOuvp/UwYyzK5/pA9cx9wBnThABtnrZ8mOli/MnZ4GF8/08UBroaVtfvdmVw3xkwgdngQcs6b4R5jIo2OM= Received: from SA1P222CA0110.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c5::22) by LV2PR19MB5792.namprd19.prod.outlook.com (2603:10b6:408:176::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.44; Wed, 2 Apr 2025 17:41:02 +0000 Received: from SN1PEPF0002636E.namprd02.prod.outlook.com (2603:10b6:806:3c5:cafe::ef) by SA1P222CA0110.outlook.office365.com (2603:10b6:806:3c5::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8583.42 via Frontend Transport; Wed, 2 Apr 2025 17:41:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SN1PEPF0002636E.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Wed, 2 Apr 2025 17:41:01 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id DAEC165; Wed, 2 Apr 2025 17:41:00 +0000 (UTC) From: Bernd Schubert Date: Wed, 02 Apr 2025 19:40:52 +0200 Subject: [PATCH RFC 2/4] fuse: Set request unique on allocation Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250402-fuse-io-uring-trace-points-v1-2-11b0211fa658@ddn.com> References: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> In-Reply-To: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> To: Miklos Szeredi , Vivek Goyal , Stefan Hajnoczi , =?utf-8?q?Eugenio_P=C3=A9rez?= Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Josef Bacik , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1743615658; l=2914; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=ziYZV/W/d52W8kKfIYz5/3su24KBpyjnMK0qQasJq7c=; b=EjvUYIPqrjJLjTCoGGesC3+7HHJz+Ww7VfOgAaN1LvKrmdHwiT4Tu5zaub632DnbDHi2yw5sj CQ+Q7fHZbE4DTFOjMr7c9ab0EHY5JgVfqMyfzq708L3Ezk1svquQ5Us X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636E:EE_|LV2PR19MB5792:EE_ X-MS-Office365-Filtering-Correlation-Id: 04206b5e-2ac1-4baa-a622-08dd720d8934 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?q+EZ/CcgXX77MPQDW78MNTmgeK85gu+?= =?utf-8?q?ijRu2/1/AHlnnUMsqO+D2LLbZ95RivrBjppoGt9Cq/Z0r2TBEqBcsiTLha1RyjhwE?= =?utf-8?q?pybbbUphl1UfnUCwhapi4fBlnjYUvgS7ZHxR1Fymdn+KdWLLMCNRIHCYtSHgWGcrM?= =?utf-8?q?R7ItpsbP6yk/132PZ6lShoFw3FnQQ5+Pk3iVZWxb71Wdytv+TfIzu7Lq990E3W/jL?= =?utf-8?q?pk3MZA0wgMGWZ6N8PUtUnKA+TobUX/CDD0b3HuykqBNFESYGvx6gKFQkFTH8R0T/G?= =?utf-8?q?sZqcxpsLankBvpWRp3LHwn9LzgPnWIir0xMNOF7CusGKFum6P/D+HJSn+LSx6q4/e?= =?utf-8?q?qPgl2MnL29NniAI9+vjDYSsdQVfTwC75rBsT/7wT8YaWbGK8HwAmGOCgv+CurMFS8?= =?utf-8?q?NneEZHPJli+LbzpkyaBxEzfPvB0K/dE2Alod1guJHCO7Jb91JiIHr6qPQfCN+oInJ?= =?utf-8?q?RlSIUfNzijPkUMQI6+f3Ao0VppL7z+vTtDRaiN2w2DOoBw+FpQVDjc8OO74jmA5p0?= =?utf-8?q?KhONWjoAMvMcdaMERU8n+dkA7ZJ7b5jE23xcUG5gRAsLYzMPDTTTXEgU1cLAC5qvj?= =?utf-8?q?5Nkl7rHq6cIW/2gzHB1U39ASYNWq7FH3JP3phmZLbAtyNQ7lR58Pmeyrozrp6XsVi?= =?utf-8?q?t5OFZq4pueGY1ONGpH3AdtCuTZvW6tR+OGe8x0tvWoO98BLEYygP/Ro7l07XqsVwQ?= =?utf-8?q?q/t3+JOu2KNRith5Yg38pNSfu93zwqCD7jhP6QRpoWyOj397sHtIWxjTo0R+Y7TFm?= =?utf-8?q?Q6femJSGNhmsW7Q0mW4/p3LJg/rrae3tRJ1lgXGbaXW/o8tTSGJpLYnS0D5/1VR6Y?= =?utf-8?q?6zrhN3jwvQ93Ave9/b42XjRRuTv74Gzzbd8tXKfD4h66iamB/ELI1qzLBJM62qIlG?= =?utf-8?q?p7dGqJGhFN6PuHDFee/3H5BC1IwnbkE5t2J9Beu+5E4MAYHY+/3QgCqqqIwoagMQy?= =?utf-8?q?HvcHR5KaouOrGIXXT493Jc4qSU9vWfnWbSlESYmBf7DuP6o/rip+N8Oi4F8QsvWcx?= =?utf-8?q?n8fWngFNvigGjc9smHn11g6nM9BVevGoOwEVOM+8/6t6Ha0gBRIsePtkSEbm1EyBN?= =?utf-8?q?v9b9v9vO9FTBVkAXiQEDHIaMKVsWOeTr0ft/vKdfl1K7vsKwaW5unFz1BvXdYH1dD?= =?utf-8?q?M5nq01ZvIZQbaslPTjTbiPR4d9klHiApZ2gpvMadPoT23RycvhBPE5CwBrVMLBYpz?= =?utf-8?q?3axnfq7hNz3ZeO+ra3kqviTBh9xdLtG2hXvysmvj9xo6yNGr4pbP082nHst9mZGvz?= =?utf-8?q?2LXab8mtxDj7Y8+53bWsDnvZ7UF9T4Tf6Q2nv2UDYtYNIqqUFvy4d+daW2CZdEozu?= =?utf-8?q?6RNbU++5jrb7570qoT4KxoCpjARTD5YDGVWcpepN5qXrPaAv5uxgw/tFymVFBn6bf?= =?utf-8?q?1WnJTQwtN7Fr0qJeuVHDAVlps6ErfdD4mr9PQcEBcpi0llZoRDDtccda/budm5Y/P?= =?utf-8?q?qWXnBj10Bb?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: iewMSV44R777UYbL1Y3Vv7PEtD6/Ilsz5b1k4LTOqjHl5U+5pJmFvT/yBb5i0FMD0Trd2KjGPCCVStzKUQYNnjKkAwhxQu9xiinPn2OJlYYVG2Q2O6S7ve8obn0yJgve0XIJk3EKfZiNRtcXFRwTp0wHNbwSIi5inC9uzioUGvIXj/1WlM5rFxURS/v1sucWCVy2YbrzfVrQsoWZSgkzl40zlvHD2oxLOuxiV1JsuUF/xYcrEFU+neIsMcfDKDVhBBxBM6rFihVOhfaV4OV/xWrY4CoIdDfrgV7+xQLPpX17G5HgF2TG6c1VTqmrdIqCOCi+CeeihlfNbq29wdKlD7Ogwhm7z5auTrZOhLxZWnRPrXr96iqgbgkRcdS+OiSl56wqP1BfINfdlqQv7oA4RQyfU9NtV0zGkT+xMU4uP72qTWP5UrB8kZuZPwbXLCc18GXNIHn0OM62xMSm/YGOnVTONV7/qjj7x4McXZC6u5CuqZiJTgJeYP0qP+wsPQLxCZb1Tdj4SANlSqaRlPtuU51QdH11fE3VVZSgkfecdg4CkyWLeSRWKVScKmsWudxLIx1SEgWnCxkavli+nXjQOmA3mtHfZ8FJrulszl+Q9p2pNtev7hQsfPP2cWqoQH9fQ+DgQuOokJ58gZ8IE+TZEw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2025 17:41:01.7142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 04206b5e-2ac1-4baa-a622-08dd720d8934 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR19MB5792 X-OriginatorOrg: ddn.com X-BESS-ID: 1743617608-105704-7814-4390-1 X-BESS-VER: 2019.1_20250401.1649 X-BESS-Apparent-Source-IP: 104.47.57.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkYWxmZAVgZQMNUiMc0g2dA0Mc 3S2MQ8zSzZKM00Oc08KdHIwMIi0SxNqTYWAEQDCDNBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.263603 [from cloudscan9-45.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This is especially needed for better ftrace analysis, for example to build histograms. So far the request unique was missing, because it was added after the first trace message. IDs/req-unique now might not come up perfectly sequentially anymore, but especially with cloned device or io-uring this did not work perfectly anyway. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 8 +++----- fs/fuse/dev_uring.c | 3 --- fs/fuse/virtio_fs.c | 3 --- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index e9592ab092b948bacb5034018bd1f32c917d5c9f..1ccf5a9c61ae2b11bc1d0b799c08e6da908a9782 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -259,8 +259,6 @@ static void fuse_dev_queue_req(struct fuse_iqueue *fiq, struct fuse_req *req) { spin_lock(&fiq->lock); if (fiq->connected) { - if (req->in.h.opcode != FUSE_NOTIFY_REPLY) - req->in.h.unique = fuse_get_unique(fiq); list_add_tail(&req->list, &fiq->pending); fuse_dev_wake_and_unlock(fiq); } else { @@ -508,6 +506,9 @@ static void fuse_args_to_req(struct fuse_req *req, struct fuse_args *args) req->in.h.total_extlen = args->in_args[args->ext_idx].size / 8; if (args->end) __set_bit(FR_ASYNC, &req->flags); + + if (req->in.h.opcode != FUSE_NOTIFY_REPLY) + req->in.h.unique = fuse_get_unique(&req->fm->fc->iq); } ssize_t __fuse_simple_request(struct mnt_idmap *idmap, @@ -555,9 +556,6 @@ ssize_t __fuse_simple_request(struct mnt_idmap *idmap, static bool fuse_request_queue_background_uring(struct fuse_conn *fc, struct fuse_req *req) { - struct fuse_iqueue *fiq = &fc->iq; - - req->in.h.unique = fuse_get_unique(fiq); req->in.h.len = sizeof(struct fuse_in_header) + fuse_len_args(req->args->in_numargs, (struct fuse_arg *) req->args->in_args); diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 82bf458fa9db5b2357ae2d1cf5621ed4db978892..5a05b76249d6fe6214e948955f23eed1e40bb751 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1230,9 +1230,6 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) if (!queue) goto err; - if (req->in.h.opcode != FUSE_NOTIFY_REPLY) - req->in.h.unique = fuse_get_unique(fiq); - spin_lock(&queue->lock); err = -ENOTCONN; if (unlikely(queue->stopped)) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 82afe78ec542358e2db6f4d955d521652ae363ec..ea13d57133c335554acae33b22e1604424886ac9 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -1482,9 +1482,6 @@ static void virtio_fs_send_req(struct fuse_iqueue *fiq, struct fuse_req *req) struct virtio_fs_vq *fsvq; int ret; - if (req->in.h.opcode != FUSE_NOTIFY_REPLY) - req->in.h.unique = fuse_get_unique(fiq); - clear_bit(FR_PENDING, &req->flags); fs = fiq->priv; From patchwork Wed Apr 2 17:40:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 14036344 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DF631C84DE for ; Wed, 2 Apr 2025 18:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617589; cv=fail; b=L301lIpPPFdf1pIGNECHvYBRbetV5hqQkIr+aka2kSlSN5+dvaba0PekTvECJJLZrpuzcBGMhOAUsoAegxvIGuhu3tLytOx/4F5LBkOFR10RlGkMB1qnweIO/N1fvGIMQM7N4ZJJxR3MZXrDjM5/rs/aQgpFzqmndJxUGfq13rM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617589; c=relaxed/simple; bh=t/qWU7S8DFwFw1ltRPZymLwhxW9CiMD3+kpjL0lZZRE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XKCATEIigzrL3H7TMCQZ4lKI0aNefO2ukcOd5io+TxV7p/33xdbrPCtCD5qHokodyS4QwIHW4SLP1or3BYfKUs6OlREDTWQaDg/oY3QvWK4kAk1XOUytOPWYYo6+EBHJft5Y52M0W0JWeyJ6k0Vt5IWtdzuSs/KsmQhUOBvqe5c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=viZlnAd1; arc=fail smtp.client-ip=209.222.82.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="viZlnAd1" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2176.outbound.protection.outlook.com [104.47.58.176]) by mx-outbound43-133.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 02 Apr 2025 18:13:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wK7FRoICOy7PZ9FZ5q0DaSHUbwb9XRuu3h5/aeNt91deVi/Komxr1gKg0EJN4ysNlZtO/SjwxUPADQmDMBglhyL/uh9Gs0l7Rl/9HkjQoAq/jVzJ0BFXs/aG7JvJvtAUd7dtGZKFWmZITWBQWWCeuKYNgmrGNmDJt3LD2Xh87NBIdfVwzOEIPgAAz3AE/VrwvrpsB4k++vBmi1zA6hAevoPp5sLIrSZpo6kfjBh50w2qOJwHn6C/5mL6NDWfv1/ln75drG+FN2baSchO6gLShLGo4QqgjNCsY6UOFMA8xfBsEuXb51gUfJc3c9ocw6q9WPbev8g1XVCXi0jnYHlp4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=w9c4thro/65LNTQvw9TViG04eyuC/g4rHehyEfqiU64=; b=hW5apI3wAOCVZtIriHgqlNefqcMR5Z7JFgJo9PMuKg95d1+1H75esrMBmjfP+DtB4TsTaWZMvcD0RgQYajv8IJecx2iC2SGPnp0s33DBhRo1k+b/hsRttIIlriO+KX1UJ3whINx4N8ziQ1vgMHgFxfQqe6TANGMdrp0+rYJTSU1cAiVfEzUCPxmfwg0sT7YW2sOvcAYD/6e225fS8WdDYA6Ii+hGfmU1mc3xLCPpVGRh6gAQQz/DOykK4pVOQ9UBUs9OanwW8ToD3nj6HE3amG3mGbBYLAuHAEgO3L2Evo8shHrGHX80bN48h83b5ZbzhN8ozYQDJKg7zWGR07iDUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w9c4thro/65LNTQvw9TViG04eyuC/g4rHehyEfqiU64=; b=viZlnAd15x49viFZQApGrGJayzVaXXIBG32FPV7nNb2vpPWqeEDnNOpeQPwfO6GhYl7SSB8p44HUZEblk8Ys0foexU2P5Pi1VBnDvXVIW+OmIM9muMaE/FI02j4nBwjq8Fp9+10zGHePPCoQkjHvx6eceXDkgQuibH7cAtL1BLc= Received: from SN7P222CA0030.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:124::25) by MN0PR19MB5756.namprd19.prod.outlook.com (2603:10b6:208:377::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.54; Wed, 2 Apr 2025 17:41:03 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:806:124:cafe::fb) by SN7P222CA0030.outlook.office365.com (2603:10b6:806:124::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.24 via Frontend Transport; Wed, 2 Apr 2025 17:41:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Wed, 2 Apr 2025 17:41:02 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id D1BCB4D; Wed, 2 Apr 2025 17:41:01 +0000 (UTC) From: Bernd Schubert Date: Wed, 02 Apr 2025 19:40:53 +0200 Subject: [PATCH 3/4] fuse: {io-uring} Avoid _send code dup Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250402-fuse-io-uring-trace-points-v1-3-11b0211fa658@ddn.com> References: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> In-Reply-To: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> To: Miklos Szeredi , Vivek Goyal , Stefan Hajnoczi , =?utf-8?q?Eugenio_P=C3=A9rez?= Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Josef Bacik , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1743615658; l=2416; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=t/qWU7S8DFwFw1ltRPZymLwhxW9CiMD3+kpjL0lZZRE=; b=mJoMr5Qs/hKit2AXIaU/I0ABXVAaSBA6h/F0WIkBAZIZuumrsPS2q8XVDuFthcnkMEI3uJwuo zSbm8KP+LGXB7cICg/nD+21FOO0w50kzoh0OpOhEEbmudb7U5561kFG X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636B:EE_|MN0PR19MB5756:EE_ X-MS-Office365-Filtering-Correlation-Id: 35577b6e-c763-4aa1-a15b-08dd720d89be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?eRWYC7S8PDcN37Njn+WwYaSWAZQTa1z?= =?utf-8?q?IIqsO+c7KFJA/p/L8qj0GmQ3HqP3iyCjUoprAWiSqaynywx/h76luoG6a0S3zmTgw?= =?utf-8?q?JfqSSuDIdBBXpmUjKMK3BWsj1buBVx+5hPF9ipIOCqAxFP9/5crlV4EvPqApOnPrY?= =?utf-8?q?P7PsswAx7kZY+Be7W5CVPzasoX6+s7A7/3wgeejYEaukZzH1LdahlXiPvfZy37OHL?= =?utf-8?q?IreRGba7HusXIHJklPHpjH9DrgbHu0RxzO3D4tfmCxLYvDHXFPTN6yON/ETOEM929?= =?utf-8?q?RcRSGC7b60O4lfVauNw518tHOgLT//PO8fincfae4ns6hgdv9lLDwb7Z96dokTHuc?= =?utf-8?q?wXfvEoBG1P78COcoO2KEbg6FZ5dk8GzWDMZV67sjj4/lDn0N6kJigfYVSXs0Zmv5a?= =?utf-8?q?5tZk9foDKJESgiBiocwTkQPm+awwIncF22eDzqE0mxCL8Kf4kIyEjRWIAFyarAMVO?= =?utf-8?q?kEFeRDRS+s4ii2ftltAchUDLDPaWxCUd3FnzMcC0LV5Ooh+cbxjGJarXkCSenzeby?= =?utf-8?q?AX9bOjjfxawfiOdnEbV+mcdQWeLq5cVgEQ/JNB4rRePNQR0LiwKJ0jYg5CJeET282?= =?utf-8?q?5AqDXio3+2ax3ume1fYlLGf8ivVLLydq3MarTH+JfF0g6kz0yOM7nz/Rmi0lbQRu/?= =?utf-8?q?b7IsYOWMrn68/Lozj8u5wTxqTweYkgx/Ygj6S25KYrExEljEL3PL2Zfhu8MDr3Y+n?= =?utf-8?q?ikKjVcVWVM3vfxToKUpStdjD5gVAMkxK7EsoY3DUiOAxElTjYEI94sxoktyvLKeXo?= =?utf-8?q?HdnE0GYZueeLPrJFk6DORJ8x6zTbjKwx2DMITgINxy8m4cL5eXoZlHL1IMcUnHNwJ?= =?utf-8?q?ZnkoUnnN1+geYQhlnO3DK+SWR7qSI8il7NNfJY0tHljFp/62fhr5qgzmPxwnzhp97?= =?utf-8?q?w3lXvbJQHnyVuOoHr+9rtS5F8+AUxgNAQy6C9quPdOaV2KqAfbwKxhmPTCjw3pD7f?= =?utf-8?q?RqbRT6dct4DdbpJRzD6PA0vZ5W+Ro0Xi9Bt7Z8ITf3yaCsuYGl09ALxDtw1HsPJDy?= =?utf-8?q?cHsYH/uwD5B62ODUISh0ewboKMtXn25FZHG6QE3N5gqF/pGOC5TwIOxkyZGhOFTVE?= =?utf-8?q?oGxg7p8HlRYBfnpqqSyhy6MjSssT8NFIztoKoc0y40B1yJUoU1ZEVP7r3oC4Aq5ep?= =?utf-8?q?0X6S1pvTiF20kntAduf4AN0Mj+8WK3DBu+emAIAyZREz2PdMwP9QZzpWPvmAZTlrS?= =?utf-8?q?l3hXnUeTZG9O/Nx0e34toT4UP+5LxgOS8DpOSFSWMUjmziCxoG80KfmiPf2OaylDW?= =?utf-8?q?+eAu+FNi6ExmUG6kbq/DrFJeu4ewZ8/1nNhv23Q+8E4M4gy8NOVpSqlabM42TMP0s?= =?utf-8?q?fLLHIzSa9miKOdzp49nOanKCN7d+WHVii7FWnPj3DFL0WNXphIUjgmRtld1O2HG36?= =?utf-8?q?+VJdUfcpksOvMUwTNpXuy75dUsvZzxM5GqTqrZuS02jMt5B1t8wDG8=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Y8xeged7GH1xPky9uMv8jVGA37kzHSggR9wBe0Oj2APByKuoYfo4t/PxqLWc0rUykH4F/DedPVsc5AFi+6XGtbzZob16u8C5BUtWC0IKrqyihzUzGVtHmdy/oiiKAHuDmQUqMOtwtYR8ICnsrN7bRtztHsZR3IfaXUiytbopoERkLUQoKvNJ7B7mc6TKCNVKsMZmSotwNpPNLYHdOKpG/Ly0YTiKm1PO6OO3tMHm7YEqgwq00vOFGFPUslzD8TTQqIqBUmZkcSVRfbRcOw1H0DVbusM3qluW73Ul99ALNr+25io28Hi13jPCnpTOrCSurRq9V0JIu057TLjtDkeiN2hJdy3thIvxV9h8Nww39aYw46/eVNh7ylN3axR05UgfM+yZu416t453xxgVAJe77XDsaPOdsYTn28ZGmt46JhAYcROU+wwoenXOCqOD8oO4O38X/FVDrjQv/RSIFRv78ar/dhzLq/FJstmsFsNe3kGGHhSCXH9kQmRBlfjaJ+QSAZkhSNvLFFpmXgBV+3lS2ppuAVlEVmIgckWMRme9yxW3oQhdkGZtWh0Tzw+Q0J1ET6/vS8AMc9QrpznA6l9k5RC3LSoW05j9OCsvIAMeCffyus3HUCZYupzogzTsMZd2WFoJij5ri6QRSU7nsJQbKQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2025 17:41:02.6653 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35577b6e-c763-4aa1-a15b-08dd720d89be X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR19MB5756 X-OriginatorOrg: ddn.com X-BESS-ID: 1743617584-111141-8647-9262-1 X-BESS-VER: 2019.1_20250401.1649 X-BESS-Apparent-Source-IP: 104.47.58.176 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkbGxmZAVgZQ0CDZyMLE2MDUwC TR1DIxNc0gLTHVJNkyzcQ8ydQiycxSqTYWAKVqchFBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.263603 [from cloudscan14-58.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 fuse_uring_send_next_to_ring() can just call into fuse_uring_send and avoid code dup. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 5a05b76249d6fe6214e948955f23eed1e40bb751..c5cb2aea75af523e22f539c8e18cfd0d6e771ffc 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -667,6 +667,20 @@ static int fuse_uring_prepare_send(struct fuse_ring_ent *ent, return err; } +static void fuse_uring_send(struct fuse_ring_ent *ent, struct io_uring_cmd *cmd, + ssize_t ret, unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ent->queue; + + spin_lock(&queue->lock); + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + ent->cmd = NULL; + spin_unlock(&queue->lock); + + io_uring_cmd_done(cmd, ret, 0, issue_flags); +} + /* * Write data to the ring buffer and send the request to userspace, * userspace will read it @@ -676,22 +690,13 @@ static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ent, struct fuse_req *req, unsigned int issue_flags) { - struct fuse_ring_queue *queue = ent->queue; int err; - struct io_uring_cmd *cmd; err = fuse_uring_prepare_send(ent, req); if (err) return err; - spin_lock(&queue->lock); - cmd = ent->cmd; - ent->cmd = NULL; - ent->state = FRRS_USERSPACE; - list_move(&ent->list, &queue->ent_in_userspace); - spin_unlock(&queue->lock); - - io_uring_cmd_done(cmd, 0, 0, issue_flags); + fuse_uring_send(ent, ent->cmd, 0, issue_flags); return 0; } @@ -1151,20 +1156,6 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) return -EIOCBQUEUED; } -static void fuse_uring_send(struct fuse_ring_ent *ent, struct io_uring_cmd *cmd, - ssize_t ret, unsigned int issue_flags) -{ - struct fuse_ring_queue *queue = ent->queue; - - spin_lock(&queue->lock); - ent->state = FRRS_USERSPACE; - list_move(&ent->list, &queue->ent_in_userspace); - ent->cmd = NULL; - spin_unlock(&queue->lock); - - io_uring_cmd_done(cmd, ret, 0, issue_flags); -} - /* * This prepares and sends the ring request in fuse-uring task context. * User buffers are not mapped yet - the application does not have permission From patchwork Wed Apr 2 17:40:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 14036348 Received: from outbound-ip191a.ess.barracuda.com (outbound-ip191a.ess.barracuda.com [209.222.82.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EFBC198E7B for ; Wed, 2 Apr 2025 18:16:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617778; cv=fail; b=k0L45ygVhInd6PfZ39l0Vo0TuMu5ED2ne3Kvjyb6wbYKh7ClUWqgTSyjio94jcZH1Ac1weHwoW2Ic14acbnH1pdV0Tf50Z8VQA1n/eJZpZyXDmJnVrl9+/zAKsPCwrDXgFgLZ6Jzpwy6i+833HKBKkjhuhbSmLjWKB6H0H6zRLc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743617778; c=relaxed/simple; bh=Dua8+hES0iXumoTTq1YQ89zt7sXm6RE3yEjmy3Dxfg8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HN70v4t67CzjyI87gD6MIuYwMer4v6LcyHOkqgE8oE70vO6vJsMpv7WyKzUIjfi5kIKK9o6q5AjrnEc9WtNvN9pkDpJfHjHEMOuqtoFDGs5l8wdkTBGzgnBdIYWEQ8GNnlzCDfXXTahMBJZpheKJ63adrMZ8OInGV/nOiirrn+s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=n1HAIPBt; arc=fail smtp.client-ip=209.222.82.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="n1HAIPBt" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by mx-outbound15-245.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 02 Apr 2025 18:16:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AeRgNYALLKxzaEdVZ8uaPUB2+L/AMdGRzxRUSdiKsp626Zd0BVdIxYpr/UnE2J4Pso8hgIrnzwa/7Kbp2StQynSbdJwnUgI7e3sSbfKP5CiugjaRB+7wste9KfdZsTTYN/+IxbvcHisU+Knh4W53RoZR2G83/y5HZ8fu5XnmOkQqu+HIQaZiQLaw0i026vtB7UMTAcv5W2XehoOQjYPIrUhhk+/6fZQii+cgn1cR15XUTwLgI0sGeZzcodsHtJz9xZtigClacQx6SLf78tayTHRZ/gDJ1pcLnzaTO7/qxDym0D4C9FwxCbvMzIl5gAPspLXHMhQQpsTVXY4yBYLPLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=906l0uz2nUjyJTIeUeXoSrOz5nvaEGy28z0fUxDyJ0M=; b=TDS4TQtl5nJ/RSDffkcz+pn+v+Q4OmwXTu6U7JjsEP3xxYgmEzTPdwsk/pC5YeCuJ8JJsxXvwBEvBygQEp2Yy2fRu4oqyEeztb7rk/wyvStl0ZyWEt36OU8FoGI5BlKAELOp+KtaJQz9LJbI7THDqPI2iFVBcTJ/yJLYOfQHgoVsaLRS+ZMybhaL/wXvr5UydvB/6qyOf+sIkHTdX6YBl5uuFxYXBDDqu3+yyOWMZgLcKtPAFgWOvDCSbpFZqqRhyO0q7o8Lqv2GI/3WoAC0+e3QuWN1upfhzLYxalYjjthVzUeKbMZ9rq/J3eF4eN4sZ0BkVDcLW5AD8ng+zCLAjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=906l0uz2nUjyJTIeUeXoSrOz5nvaEGy28z0fUxDyJ0M=; b=n1HAIPBtP5vpcHknj99HMFNDv87hh9ZvGfTwIZmE/esH6uyJiUOJ0KyBX6I5bkEI+lPxQVSovU90r+N+XE2BRN1hmXnQYfGheB6m3SuOFvel2zgDScxdi9tyTte1TvvBLlMxrZJCzfBjsI2DZe5o1G8xFcnJo6/roXsm/4etTo8= Received: from CH0PR03CA0450.namprd03.prod.outlook.com (2603:10b6:610:10e::28) by DM4PR19MB6320.namprd19.prod.outlook.com (2603:10b6:8:a5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.44; Wed, 2 Apr 2025 17:41:06 +0000 Received: from CH2PEPF0000013D.namprd02.prod.outlook.com (2603:10b6:610:10e:cafe::8) by CH0PR03CA0450.outlook.office365.com (2603:10b6:610:10e::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8583.41 via Frontend Transport; Wed, 2 Apr 2025 17:41:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH2PEPF0000013D.mail.protection.outlook.com (10.167.244.69) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Wed, 2 Apr 2025 17:41:03 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id C84254A; Wed, 2 Apr 2025 17:41:02 +0000 (UTC) From: Bernd Schubert Date: Wed, 02 Apr 2025 19:40:54 +0200 Subject: [PATCH 4/4] fuse: fine-grained request ftraces Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250402-fuse-io-uring-trace-points-v1-4-11b0211fa658@ddn.com> References: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> In-Reply-To: <20250402-fuse-io-uring-trace-points-v1-0-11b0211fa658@ddn.com> To: Miklos Szeredi , Vivek Goyal , Stefan Hajnoczi , =?utf-8?q?Eugenio_P=C3=A9rez?= Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Josef Bacik , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1743615658; l=4634; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Dua8+hES0iXumoTTq1YQ89zt7sXm6RE3yEjmy3Dxfg8=; b=K0FIP+dKqnrXK5Xv+mSHwcqdRc/iUuB8CwhzFDKFFcZDrl76EzTXRH+aUjQMXql79neqwmcTg abfDpfc8y5RCFBRt9+0iwzFr0XJ0a330Um9XdR8p8OtHeWYi19Y3KPV X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000013D:EE_|DM4PR19MB6320:EE_ X-MS-Office365-Filtering-Correlation-Id: 80bf673e-023f-4b9f-fcad-08dd720d8a67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?zQuSxgX7N8peC73hZPwSaL01+4GfLMr?= =?utf-8?q?0NAJo5Z7TfBd/kI7hj1LGecmLocIfu1Mf9zSg/FJCjs07iufJy25QVM4JAcQ7Safr?= =?utf-8?q?35dDbn+S5hdmk15XBUBBb9bFHVG++v6tUrVF2CP0K1w+uVCM652dZj/gZ5MMMb4hC?= =?utf-8?q?dnpPRGgJxqNARScqSpfef3Y2/sRF0xZtVA6tXg5aqZBHw1Iad+5H36uH0jwGdticT?= =?utf-8?q?txPzsunbLnDF7vESjAChdNIxf6xvGn1JL9WnCABtTJpu05pBg8bRGT32UqPRyYi03?= =?utf-8?q?qLi6HN3iU1nybdNr315Dc3fOTonyZFU+y81mgtxzzqPgQB5EI/+5mCuvu7v2iQIEI?= =?utf-8?q?mGo5/1dWsow46miPH8GB80IOm5TYqQlgMRHRZPedSh4YkILQPVdmhaGA4bSSJJjAg?= =?utf-8?q?MhECumJuVS2aV8jgz7uZy1ehXoyJ9uhwujVS/u3lGiy+tORWfRQ41mwGU/eKOctuR?= =?utf-8?q?NJJHJUGg0QOYJbSz6d4RCNVOmU1aiUFXdcsYnGiQKE9E7l63dNvP/PSqi2TZ+SOnd?= =?utf-8?q?ktkQyZflEsljXh40bOr/uDR3Fh7gGz+7rkELIPnYOzbrY9PRBG5G6WaHijDS9IKJ9?= =?utf-8?q?gCnPC0fiMsD3H+4fiiahSu6yezOwinmKGjwY8PzDXoTbvjBI4ZgycZmUELhT1kF+G?= =?utf-8?q?lka7v491TYX4JgXC07IZkrAbo3JH78p6eghoNOMaU/8U/9cLiliotnXJOzCZwAwYJ?= =?utf-8?q?NEcjuT8iULTcUXwJxbTCmEqvcWmwc0JBSehPD4P75CQbwwR+q4/SXcM4rjbo9/c0l?= =?utf-8?q?v/yLvsV/10ebmXmaJoWNFySrwT3om76KILk3U8TGkOJfxrM2DMe0jxaJ+KOoYD4HF?= =?utf-8?q?usNGc+KZpsZv1WV12HyNKhbuZgkj/huLdOCvJtXtVqEuCcmpGW2ojnFIlO0HNKFgj?= =?utf-8?q?OsNNsqX9yb+UqicZEGFRYCsGn+5JxV2ga85bXPT8DFXKlz4Q0aG47IrpAQxnDYOuy?= =?utf-8?q?3PJLHYTsXOjfKhgz/HW3IdqjT/XLT6n8mzE0g0UbEQraZst97YM536Q+WrePR2NLB?= =?utf-8?q?q86OPtsMhSfnLAG+2wsWnTLZEgeHLi7Tyz2UneJv6KqnS/5rh30T5WCT+B8VhpvO1?= =?utf-8?q?Bcv23zzuModbIWIFWKjBt8MS8SDVLdlS+m0WoFZhPPLmlw4a29qsvQix/bRgT0jJw?= =?utf-8?q?VtYCXRetEXf59dZy2znt92qxQMye59BPXJ0XmehYqDvRsBVsoMtutK05Bsa5md1sb?= =?utf-8?q?RrGuZi0ZHYFqzqvWH76Kjc68+FaV52ykwHKrvWiw1oan2v+9GT0DKNLbx+X5efLPB?= =?utf-8?q?9c/hZ55dCBC1QfqvOc7KMq6kol4TnGha7pBY2+YTaEcu0BWwrhdjnidb6rvWt+3o4?= =?utf-8?q?HuUERYXv8IgjU/pPSa3zGd2kw16y/2red+BjmKxqx0XVnooO8WArHX7C008CqyEpV?= =?utf-8?q?e7dkwGelND7NkC6ycVFhXdXOQXS6mkhlNZ0hYhsGr8cuSafMjoW7cU=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: B3w6+oS+vE2l/QrVTzSDUvnZGoHT+qsPeuX2xw+Ck8Xsynhc45O5bD3JqVv5NmJqDtA2p8MKJfQKbGyivkeVC7mx07QpXmztQrJs6Po/0fJEuEebkDZllvWhzvvBK3xdUin28/ng2XxiEpHO4e6d9CU4tqA4UQO+x434AcKrmXRDaClDZh3SVdY6VGSEa8zf6/3cz/kMxyybgdpK6tDnswzEEOrtX+kkA6qqlF9fGOqOe95o+zOnh6G2QtI0IlMQvnnMvvux1+YN+wk5+xlF9ydDDaRnLUNyMa9wSjFJrqiBM2scLzcRM+09tSnkof+MWAhHv09/hSzHbTCUojfUaA/Z9zad4p26mLb6XP8uSRf5nmG6OVVj0CGcEARdF8c/MI7ZfqU7GC8ZgwoviSJT/umtKs1mS4f1ZI4gHjGHUQc/3AfFjO/UKNN8FrD5pDb0XS1kW0K3JW+vOja5knHM6DN70l42uigDAihuKbnf582mMuBvu/lmEvTZJmEtl4uExUdwjXHOONGQg0fAkSxxTlBfkq9LLDH/dVcdxS6RV7jwTIQbAE6zpezZ5Fr4Iuh8j2gxFKT8WIG7FWNtxnWnRN+/Hc/JfkhdjfZy4tiiF0awlVjood0NvVgHdHavY/rWTtLUdnktT88IigeWwk1UwA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2025 17:41:03.7596 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80bf673e-023f-4b9f-fcad-08dd720d8a67 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF0000013D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR19MB6320 X-OriginatorOrg: ddn.com X-BESS-ID: 1743617771-104085-620-11849-1 X-BESS-VER: 2019.1_20250401.1649 X-BESS-Apparent-Source-IP: 104.47.55.171 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViYmFpZAVgZQMMUoLdnczDAxJd EiydDA0MjcNMUo0Tw52cDYOMnAOClZqTYWAAQQG+xBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.263603 [from cloudscan19-104.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Rename trace_fuse_request_send to trace_fuse_request_enqueue Add trace_fuse_request_send Add trace_fuse_request_bg_enqueue Add trace_fuse_request_enqueue This helps to track entire request time and time in different queues. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 7 ++++++- fs/fuse/dev_uring.c | 2 ++ fs/fuse/fuse_trace.h | 57 +++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 17 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 1ccf5a9c61ae2b11bc1d0b799c08e6da908a9782..8e1a95f80e5454d1351ecb90beacbb35779731bb 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -281,7 +281,9 @@ static void fuse_send_one(struct fuse_iqueue *fiq, struct fuse_req *req) req->in.h.len = sizeof(struct fuse_in_header) + fuse_len_args(req->args->in_numargs, (struct fuse_arg *) req->args->in_args); - trace_fuse_request_send(req); + + /* enqueue, as it is send to "fiq->ops queue" */ + trace_fuse_request_enqueue(req); fiq->ops->send_req(fiq, req); } @@ -580,6 +582,8 @@ static int fuse_request_queue_background(struct fuse_req *req) } __set_bit(FR_ISREPLY, &req->flags); + trace_fuse_request_bg_enqueue(req); + #ifdef CONFIG_FUSE_IO_URING if (fuse_uring_ready(fc)) return fuse_request_queue_background_uring(fc, req); @@ -1314,6 +1318,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, clear_bit(FR_PENDING, &req->flags); list_del_init(&req->list); spin_unlock(&fiq->lock); + trace_fuse_request_send(req); args = req->args; reqsize = req->in.h.len; diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index c5cb2aea75af523e22f539c8e18cfd0d6e771ffc..e5ed146b990e12c6cc2a18aaa9b527c276870aba 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -7,6 +7,7 @@ #include "fuse_i.h" #include "dev_uring_i.h" #include "fuse_dev_i.h" +#include "fuse_trace.h" #include #include @@ -678,6 +679,7 @@ static void fuse_uring_send(struct fuse_ring_ent *ent, struct io_uring_cmd *cmd, ent->cmd = NULL; spin_unlock(&queue->lock); + trace_fuse_request_send(ent->fuse_req); io_uring_cmd_done(cmd, ret, 0, issue_flags); } diff --git a/fs/fuse/fuse_trace.h b/fs/fuse/fuse_trace.h index bbe9ddd8c71696ddcbca055f6c4c451661bb4444..393c630e7726356da16add7da4b5913b9f725b25 100644 --- a/fs/fuse/fuse_trace.h +++ b/fs/fuse/fuse_trace.h @@ -77,30 +77,55 @@ OPCODES #define EM(a, b) {a, b}, #define EMe(a, b) {a, b} -TRACE_EVENT(fuse_request_send, +#define FUSE_REQ_TRACE_FIELDS \ + __field(dev_t, connection) \ + __field(uint64_t, unique) \ + __field(enum fuse_opcode, opcode) \ + __field(uint32_t, len) \ + +#define FUSE_REQ_TRACE_ASSIGN(req) \ + do { \ + __entry->connection = req->fm->fc->dev; \ + __entry->unique = req->in.h.unique; \ + __entry->opcode = req->in.h.opcode; \ + __entry->len = req->in.h.len; \ + } while (0) + + +TRACE_EVENT(fuse_request_enqueue, TP_PROTO(const struct fuse_req *req), - TP_ARGS(req), - - TP_STRUCT__entry( - __field(dev_t, connection) - __field(uint64_t, unique) - __field(enum fuse_opcode, opcode) - __field(uint32_t, len) - ), - - TP_fast_assign( - __entry->connection = req->fm->fc->dev; - __entry->unique = req->in.h.unique; - __entry->opcode = req->in.h.opcode; - __entry->len = req->in.h.len; - ), + TP_STRUCT__entry(FUSE_REQ_TRACE_FIELDS), + TP_fast_assign(FUSE_REQ_TRACE_ASSIGN(req)), TP_printk("connection %u req %llu opcode %u (%s) len %u ", __entry->connection, __entry->unique, __entry->opcode, __print_symbolic(__entry->opcode, OPCODES), __entry->len) ); +TRACE_EVENT(fuse_request_bg_enqueue, + TP_PROTO(const struct fuse_req *req), + TP_ARGS(req), + TP_STRUCT__entry(FUSE_REQ_TRACE_FIELDS), + TP_fast_assign(FUSE_REQ_TRACE_ASSIGN(req)), + + TP_printk("connection %u req %llu opcode %u (%s) len %u ", + __entry->connection, __entry->unique, __entry->opcode, + __print_symbolic(__entry->opcode, OPCODES), __entry->len) +); + +TRACE_EVENT(fuse_request_send, + TP_PROTO(const struct fuse_req *req), + TP_ARGS(req), + TP_STRUCT__entry(FUSE_REQ_TRACE_FIELDS), + TP_fast_assign(FUSE_REQ_TRACE_ASSIGN(req)), + + TP_printk("connection %u req %llu opcode %u (%s) len %u ", + __entry->connection, __entry->unique, __entry->opcode, + __print_symbolic(__entry->opcode, OPCODES), __entry->len) +); + + TRACE_EVENT(fuse_request_end, TP_PROTO(const struct fuse_req *req),