From patchwork Thu Feb 25 07:01:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9FD0C433E0 for ; Thu, 25 Feb 2021 07:04:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C02364E4D for ; Thu, 25 Feb 2021 07:04:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230174AbhBYHE4 (ORCPT ); Thu, 25 Feb 2021 02:04:56 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13049 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232471AbhBYHE1 (ORCPT ); Thu, 25 Feb 2021 02:04:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237151; x=1645773151; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EiTEA8rJ+zvTS8aqZsBQxKesJgcmxfVC6VzIj84hvAg=; b=FOynYpEZFv5VH73EX8VthfMXWxbbLVmHHdRzZ86Q4b4IKvQVGceAUOgJ CI9VWDbC+/hKry154PbPi7vEodn7u200WdKdJndbw8bhG8emCLcTiuB9O FKbJa0XI2DtGjhq2AnX5LdtIXR9hIpLCJ1bi4nGU8Yfgl+MWmYe2ue5kT PgAeiMmR0hzpCOJ19iwIcdRz1ryddsn7o16tRyXFSA7PLam99y1MItPD5 tdhHoumsCFldMtQLyg4Dddp12DHe8Hwhxfx6f9UzeP4tft/eUGj1P54cT 3K17bde+8YrXhPWExBxwYS/4gxzkUH+Pc0n/G1qZd7xaQR+gFGN2N8a2y w==; IronPort-SDR: gZ25v9M7mI62mr5idEYVUi5V7S4lBlxia8YN3PX/Dw7JWqjPwm6ckiqo4sOUJBRJ5i5YuvHVLg ZPiPM4xCk7J7HwL8FpkMRexnvaFx/zqiCqtSoDdtaiCyyS+hOId57K07qd6X/ImHVugtwRLuJX CAvy+y/gNlb1moTKLJP6CStYKNi0qpmbTonR7BQpLVmzYmf6jFnDaOGIyhC+m6MLkfHB3eZypB FnpdbjvYxsr7eskApzuCrzOUZeQPMkJlXv9ETvcPh6rGjeKW20rGFRI3bQ5cXHE7ml8OavS57f NF8= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978745" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:10:11 +0800 IronPort-SDR: 8CaMf0F2w5QaKLxAa8Il9wVovreEuAwf/YFhNObbETqHgmkNK7dfr+hJpWLSXkbq6eB7smKw+J mdrrQDGilv08PPz+F6cyMb0mqLfXiDCVULYVxVRzNu25cm90jOJXrUiMB+8SYXapH0xW8c2NkO ulSxMrH5G/BEVqA7O+AR6zDzK6ifyY25naZ68u/e9PiS30tUULSfQIXpw9NVLJFBWZPrsZVVE2 MwKJXDjVKgRc7XGzSVessK2tD6HOg3ekzsji/0HswTo9ITyAk4YYdnYOuzy/eOr2955ABhYKx5 Qn2AG+Qqzp7Gg54O/L1LAbHs Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:44:15 -0800 IronPort-SDR: 3XQYXge+QisbPCejLdBFccnJRWKymYEXC/6SYM+GtSuop1vUOQyDChD+eIqYWQOUXFnz24g3tT Kxc65b/1w7Px+bKEBNVhhbEjXKXcWzVfxejEtyIS+CHIq+6U4ykF8ZE3PedQ+/B8zG4fYjKaEh jfJerGeuCGZY4X14c77d6qsTnADp2DPkJf5UQiGqRADEOQGyh6vLFQfTfGvuZEEd0OGmTGenb+ BSfklIiP8EW4dEfBdK94hgTePEqtjhIUoxVEfsQEl+WWZYfrsPneGhXcJ34fZIId6RD/Pj1Zil 43I= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:02:53 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 01/39] blktrace_api: add new trace definitions Date: Wed, 24 Feb 2021 23:01:53 -0800 Message-Id: <20210225070231.21136-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch adds a new trace categories, trace actions adds a new version number for the trace extentions, adds new trace extension structure to hold actual trace along with structure nedded to execute various IOCTLs to configure trace from user space. Signed-off-by: Chaitanya Kulkarni --- include/uapi/linux/blktrace_api.h | 110 ++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 21 deletions(-) diff --git a/include/uapi/linux/blktrace_api.h b/include/uapi/linux/blktrace_api.h index 690621b610e5..fdb3a5cdfa22 100644 --- a/include/uapi/linux/blktrace_api.h +++ b/include/uapi/linux/blktrace_api.h @@ -8,30 +8,41 @@ * Trace categories */ enum blktrace_cat { - BLK_TC_READ = 1 << 0, /* reads */ - BLK_TC_WRITE = 1 << 1, /* writes */ - BLK_TC_FLUSH = 1 << 2, /* flush */ - BLK_TC_SYNC = 1 << 3, /* sync IO */ - BLK_TC_SYNCIO = BLK_TC_SYNC, - BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ - BLK_TC_REQUEUE = 1 << 5, /* requeueing */ - BLK_TC_ISSUE = 1 << 6, /* issue */ - BLK_TC_COMPLETE = 1 << 7, /* completions */ - BLK_TC_FS = 1 << 8, /* fs requests */ - BLK_TC_PC = 1 << 9, /* pc requests */ - BLK_TC_NOTIFY = 1 << 10, /* special message */ - BLK_TC_AHEAD = 1 << 11, /* readahead */ - BLK_TC_META = 1 << 12, /* metadata */ - BLK_TC_DISCARD = 1 << 13, /* discard requests */ - BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ - BLK_TC_FUA = 1 << 15, /* fua requests */ - - BLK_TC_END = 1 << 15, /* we've run out of bits! */ + BLK_TC_READ = 1 << 0, /* reads */ + BLK_TC_WRITE = 1 << 1, /* writes */ + BLK_TC_FLUSH = 1 << 2, /* flush */ + BLK_TC_SYNC = 1 << 3, /* sync IO */ + BLK_TC_SYNCIO = BLK_TC_SYNC, + BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ + BLK_TC_REQUEUE = 1 << 5, /* requeueing */ + BLK_TC_ISSUE = 1 << 6, /* issue */ + BLK_TC_COMPLETE = 1 << 7, /* completions */ + BLK_TC_FS = 1 << 8, /* fs requests */ + BLK_TC_PC = 1 << 9, /* pc requests */ + BLK_TC_NOTIFY = 1 << 10, /* special message */ + BLK_TC_AHEAD = 1 << 11, /* readahead */ + BLK_TC_META = 1 << 12, /* metadata */ + BLK_TC_DISCARD = 1 << 13, /* discard requests */ + BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ + BLK_TC_FUA = 1 << 15, /* fua requests */ + BLK_TC_WRITE_ZEROES = 1 << 16, /* write-zeores */ + BLK_TC_ZONE_RESET = 1 << 17, /* zone-reset */ + BLK_TC_ZONE_RESET_ALL = 1 << 18, /* zone-reset-all */ + BLK_TC_ZONE_APPEND = 1 << 19, /* zone-append */ + BLK_TC_ZONE_OPEN = 1 << 20, /* zone-open */ + BLK_TC_ZONE_CLOSE = 1 << 21, /* zone-close */ + BLK_TC_ZONE_FINISH = 1 << 22, /* zone-finish */ + + BLK_TC_END = 1 << 15, /* we've run out of bits! */ + BLK_TC_END_EXT = 1 << 31, /* we've run out of bits! */ }; #define BLK_TC_SHIFT (16) #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) +#define BLK_TC_SHIFT_EXT (32) +#define BLK_TC_ACT_EXT(act) (((u64)act) << BLK_TC_SHIFT_EXT) + /* * Basic trace actions */ @@ -88,12 +99,38 @@ enum blktrace_notify { #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA)) +#define BLK_TA_QUEUE_EXT (__BLK_TA_QUEUE | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_BACKMERGE_EXT (__BLK_TA_BACKMERGE | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_FRONTMERGE_EXT (__BLK_TA_FRONTMERGE | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_GETRQ_EXT (__BLK_TA_GETRQ | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_SLEEPRQ_EXT (__BLK_TA_SLEEPRQ | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_REQUEUE_EXT (__BLK_TA_REQUEUE | BLK_TC_ACT_EXT(BLK_TC_REQUEUE)) +#define BLK_TA_ISSUE_EXT (__BLK_TA_ISSUE | BLK_TC_ACT_EXT(BLK_TC_ISSUE)) +#define BLK_TA_COMPLETE_EXT (__BLK_TA_COMPLETE | BLK_TC_ACT_EXT(BLK_TC_COMPLETE)) +#define BLK_TA_PLUG_EXT (__BLK_TA_PLUG | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_UNPLUG_IO_EXT (__BLK_TA_UNPLUG_IO | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_UNPLUG_TIMER_EXT \ + (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_INSERT_EXT (__BLK_TA_INSERT | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_SPLIT_EXT (__BLK_TA_SPLIT) +#define BLK_TA_BOUNCE_EXT (__BLK_TA_BOUNCE) +#define BLK_TA_REMAP_EXT (__BLK_TA_REMAP | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_ABORT_EXT (__BLK_TA_ABORT | BLK_TC_ACT_EXT(BLK_TC_QUEUE)) +#define BLK_TA_DRV_DATA_EXT \ + (__BLK_TA_DRV_DATA | BLK_TC_ACT_EXT(BLK_TC_DRV_DATA)) + #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY)) -#define BLK_IO_TRACE_MAGIC 0x65617400 -#define BLK_IO_TRACE_VERSION 0x07 +#define BLK_TN_PROCESS_EXT (__BLK_TN_PROCESS | BLK_TC_ACT_EXT(BLK_TC_NOTIFY)) +#define BLK_TN_TIMESTAMP_EXT (__BLK_TN_TIMESTAMP | BLK_TC_ACT_EXT(BLK_TC_NOTIFY)) +#define BLK_TN_MESSAGE_EXT (__BLK_TN_MESSAGE | BLK_TC_ACT_EXT(BLK_TC_NOTIFY)) + +#define BLK_IO_TRACE_MAGIC 0x65617400 +#define BLK_IO_TRACE_VERSION 0x07 +#define BLK_IO_TRACE_VERSION_EXT 0x08 + /* * The trace itself @@ -113,6 +150,23 @@ struct blk_io_trace { /* cgroup id will be stored here if exists */ }; +struct blk_io_trace_ext { + __u32 magic; /* MAGIC << 8 | version */ + __u32 sequence; /* event number */ + __u64 time; /* in nanoseconds */ + __u64 sector; /* disk offset */ + __u32 bytes; /* transfer length */ + __u64 action; /* what happened */ + __u32 ioprio; /* I/O priority */ + __u32 pid; /* who did it */ + __u32 device; /* device number */ + __u32 cpu; /* on what cpu did it happen */ + __u16 error; /* completion error */ + __u16 pdu_len; /* length of data after this trace */ + /* cgroup id will be stored here if exists */ +}; + + /* * The remap event */ @@ -143,4 +197,18 @@ struct blk_user_trace_setup { __u32 pid; }; +/* + * User setup structure passed with BLKTRACESETUP_EXT + */ +struct blk_user_trace_setup_ext { + char name[BLKTRACE_BDEV_SIZE]; /* output */ + __u64 act_mask; /* input */ + __u32 prio_mask; /* input */ + __u32 buf_size; /* input */ + __u32 buf_nr; /* input */ + __u64 start_lba; + __u64 end_lba; + __u32 pid; +}; + #endif /* _UAPIBLKTRACE_H */ From patchwork Thu Feb 25 07:01:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCCF4C433E0 for ; Thu, 25 Feb 2021 07:05:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95FF764EDD for ; Thu, 25 Feb 2021 07:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231604AbhBYHFA (ORCPT ); Thu, 25 Feb 2021 02:05:00 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13098 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhBYHEf (ORCPT ); Thu, 25 Feb 2021 02:04:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237164; x=1645773164; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YHFpfpeQSYIOW2oaDbitZ5qqGXHdZ7t0JGdaE7Ribi4=; b=lNEOabQtbKUQDK+Xkg0gO7Nth3FjBAhjK6fy9Z3DXm7+MBts32yZos/g xdyUnF6chRoMiEifF4JdE6cEWja3+yjHPinXtcl7+sOrLHWhvSuvOGSTa W0+CgfCvhAJu8gntdSQBgrIqcsOKmqB9EBdCXkCa67XYH3bWmCI2uglkl L+PgfqM/fiOVz9RcpgHykwqZ3bdCPIL3tMd/y1Pn9TpThC9dOYy0dX5gZ JDn9yunfhBithVkTgAykyajFaTuN4OaRt0svCCS8Vu1XfhMzRLL9yxBpk ZNlkwAQBk8Lt7zXc1W02aTSItfBO9JlpeDCSs3Z/spvcUrhjociPIB1PJ Q==; IronPort-SDR: 2GCn4lzTdaxE9rUkuzQwMx+RlMjKD0Rf+lIoXnNd17t29hABDB1qV7HjIU3uuJ504VMd9zyDaF WjsSkzJ7ZgryyZRdp2AAjhfzDE0imCNRxPhbRHtIfUaARJDxfhKVXTCG0qJCniPjKoPO4byizl dMglyaGS2J7vKVDxlgvlM3L3nNlzMj0ZO3ELCpgFaBBAk3p2EThwZYIIwEODi+sg30eXJ+53So sNS7CJ/KYS4Gj9JaoWnwz88vNlZmMhAqYWxOqq8PapnJMI6RZr08T6GpJcH+0YkRCBGC5GhP23 /zg= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978751" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:10:25 +0800 IronPort-SDR: MdmwdJTo//4u0g1TOkbgmjfHEmROYK8Rg4lQ5B+G6xpMSYlNybHVZNuRXuIRH6DGLJbMlqXIeF EQvmVUw0V25ECKTrhvjxp3HTk0ux8EqcmQylDwEx4BWc09Hiyaxtb3H7HeE/y9LlGCfjGYMxFu 5QYouYNdvXd1Cu9GwgQLs4+Xr3KSF0/2qgUhD4V9Go0uTqaLmtshCDeBbDsRiB/jfc+fVM6Pbt eqG4YuBKg9YlKKSyWiTSEFQL1qlO4oC+zKaTtkebcXXh9kwB1W7ahBANUR41cGq2wJiHtJ5V7M /HPVO1YSrHRs/AKkesrJxoKZ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:18 -0800 IronPort-SDR: wAMKbg1ieOidwvDUbTerEBZNf1ivBanSrkSpyh775lln15HTIx1A4URg3A/bN851aip0jXicPs tR+1jF+//r9upLjJKL78GfLSa3irUPYFVl3Oa+owaXW5c5vABXG2pqz2Uupg/dcG5pEw1sQ2D7 B22asBF1klNr91EyaJ20lLbgkSqvA51c4GUGcRzP48c8ZlYOJv4CgGcQ1ujSVcXOT+bWnxGXey 9nRhFZ4yepAALIQT3NfAW/IG7yQA6Gq2/6NOZQki66FHLPipFKeMIkYx60a25wor6IJaoAHx4m urI= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:03:02 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 02/39] blktrace_api: add new trace definition Date: Wed, 24 Feb 2021 23:01:54 -0800 Message-Id: <20210225070231.21136-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch adds new structure similar to struct blk_trace to support block trace extensions. Signed-off-by: Chaitanya Kulkarni --- include/linux/blktrace_api.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index a083e15df608..6c2654f45ad2 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h @@ -27,6 +27,24 @@ struct blk_trace { atomic_t dropped; }; +struct blk_trace_ext { + int trace_state; + struct rchan *rchan; + unsigned long __percpu *sequence; + unsigned char __percpu *msg_data; + u64 act_mask; + u32 prio_mask; + u64 start_lba; + u64 end_lba; + u32 pid; + u32 dev; + struct dentry *dir; + struct dentry *dropped_file; + struct dentry *msg_file; + struct list_head running_ext_list; + atomic_t dropped; +}; + struct blkcg; extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); From patchwork Thu Feb 25 07:01:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA6DCC433E0 for ; Thu, 25 Feb 2021 07:04:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61DFD64EDC for ; Thu, 25 Feb 2021 07:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229722AbhBYHEy (ORCPT ); Thu, 25 Feb 2021 02:04:54 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:61594 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbhBYHE0 (ORCPT ); Thu, 25 Feb 2021 02:04:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236667; x=1645772667; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d651v85zCDRiBFcpLwJk/4ElAAp+r9REzayoZ1T+uy8=; b=S9ZrQrSe/0YdgP5VVm4QV/zYpsco+cWXJwQEslte3kJhxOPq/QhVibGC AK8UdFfbP4gLWw/Olv/0D28Zj+EhuvO+uwo4gZbkGY25EHSmAaXRxxLg+ r+lSNVVpc0rIJgpdCOR2NJ+pHijKDIGzAa1LgnJIwMXPza72QyH49434o 2LQrXX83G7ljetVSOc58bHa4DzzW0qCCCQ5A0DJRN0FD7Iqfu8KMDuEXY Jio3R2QoU9+fJ8CIubd10l4xryDKTHVrGbRj71fNpOIYhR7ynnTrYYw39 DPhKPqOfkBt1b8BisFTgqzc5X7JPDMSDAJZKeLlLChoDuGxSnNiDqEFU+ Q==; IronPort-SDR: Fh/jv3+oTnM1C1PGV6JsYQ1TI/v1a9vY6fW2v6FHc0i7mIXrMFaqbT6J2DIYG4TlCqjKJjpsDJ 4CewgS7EnaEDZ+zIoYy7Y9csPItnoo8RnreTG9p2pWCBOpppx/6caCZpvnWIhzB6isPhqKJgSx lwRjLFSdOHzpQ5kmvhnH56pKwQCH4LymaCxSNMdpDdaC4r2gVwWn/mUXtSBPfQYSlFNfdRCHls zMu2NPNzonOc4mhmXtZx7kmQW3V/fMcrLsI/grRNLbOKmQH5dY31SwwxIxMhE9SAtPKg095HG5 Eho= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="161931329" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:03:12 +0800 IronPort-SDR: 09yDS0cB5LCtQmX/ZybKorEU7GvQnGqxdFAb6qA2AxABInOExbD/xKRSl/mKEZPZUjMn+nkMjp bOsQl+7JlEG4uq7EvNmFy8bAPu7fn1jYeNwCDL4wCUWvyJJ3QP+aVTLkYBjZ7PslYK1rUuCbl9 2lxZg4leiWht117q+XutvXjWDIAEkMxplVHX9ffPwEg7ytINJWEmJfgsoNzmFJgz/0zUk7b25a 1EFrMT+FGDvldk38yz9n9qID5P6CLqkUfxv4QSDs47wQ8kuIP+GsyB4M4upTmrBNiVNBfe0ifM rCQb43/N9k7YxCx5zGQNEFuW Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:26 -0800 IronPort-SDR: 9iMZnrTBci9VBgi7qsOF6VGkQpmaHLHmW4QDyTlgIRxHhfj0xFHTkrxqZ9A4lnEsRqL1UwmCrR lK5sDvsne+COA3w8XYPFoZ7tQUVYgBDYBK/bEIMv2V66DRwIw1BHkzuzznYX7DYqXRpUR9NMTL 5JvNmkqY0n4U03edOc/1VVYKiQ7hNg1Qxsy8XxusK4qNEQheFOea95/0XPHi2PiBbfHcmIl/ro MsLIe8WLtJ/4k5Ks2lPJFXDICD5x/w1lpkuZn9Rk48yIfT6LnlmjKidHiKR/j2TpDwSkN5X7zW Yr0= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:03:11 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 03/39] blkdev.h: add new trace ext as a queue member Date: Wed, 24 Feb 2021 23:01:55 -0800 Message-Id: <20210225070231.21136-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Update a struct queue with block trace extension. Signed-off-by: Chaitanya Kulkarni --- include/linux/blkdev.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c032cfe133c7..7c21f22f2077 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -533,6 +533,7 @@ struct request_queue { struct mutex debugfs_mutex; #ifdef CONFIG_BLK_DEV_IO_TRACE struct blk_trace __rcu *blk_trace; + struct blk_trace_ext __rcu *blk_trace_ext; #endif /* * for flush operations From patchwork Thu Feb 25 07:01:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7051C433E6 for ; Thu, 25 Feb 2021 07:05:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FDCD64ED9 for ; Thu, 25 Feb 2021 07:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231160AbhBYHE6 (ORCPT ); Thu, 25 Feb 2021 02:04:58 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:40841 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbhBYHE3 (ORCPT ); Thu, 25 Feb 2021 02:04:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236668; x=1645772668; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YqyjlzPNQjTMRjOk6Mtz4VEUf84S5Nuxb+VjgSMGlAw=; b=UaW74+j7pQoSpS/9ZXr8d6w1v/HAU6NP/MjOe2QBVb1gcwN3KsrCy5vl Qj5oauJsrKV/PMs/0CaWknZ118X2yyUI7fCdSbAeLCFu6TchQKoNUzptn JpxFn0YnsG5gCD6fGuhd70RwENr22RgKXO6bNcDbvHmm5MYxTAsIgCZhV jZ9a+L3pNhVQ4ztOaz1EMccu38MuMnWbABByrot3qZclhow4ut8gDZb2P FlyQswkdmaq9byyN/AA7MuIpS9WPtL2yUdd1yhfGbDVq9ir07vjUnMiXG gN8Cvz53Vm6HbjYpk01rc4x6+AR5GPOanf7Yq5qd7NVHj+Ac3Qw4SLcWX g==; IronPort-SDR: vug1FgfP955B5CgApzZts6lfg3uSpKmH1ZpKE0jCyG+0atOc4P3lagz4LCM3+amho/wmhFnj/z TVlTYxWR/yQWAInDOyK3dl5SysX8BIJ4AG0Wx1zl5327PatURRKBKciZTiK7XBmB67spJXJuCm 7YEFliVsraMMgqF07T62tIz+M/wBulXC6SZP1+AJcglyuWbk4XGkeV/BHtVDwtLf+F+o/oTbXT tJDiX6eLrR0DUNamm+evd8chNZU9p5wPAOUeZH0QzpxPknT1SVMy7fthl0g1d3eL/JItdWLwUl lH4= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="271318941" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:03:20 +0800 IronPort-SDR: XHoA/padyu3eAVe0wow4xq6KZprJeYXDVXB4pj95VJutdAhbIuubARBKCu01iQJ96f/gJmiKOr 0YRA4B0L0J/SSWjZNJ3ttdKDEUWiQNlMN9xq0NdvnCumxNDYk8fNzx2xkhA0a6zNzxdhIqL1ko lY5HNNnnOAo6HLH9pgg6fx3NiSTONtKr38Q/KlLCB8c4vCkQEpWqyj+642eILq1/Cjagy/MOzF 2j3qQvkYKBPrn4FYD8MvyABohLsxy7+3/T5HZuHLOdfHWg23f2eHQyFcgHReg9LTuBr6p1rXrO aCVRKdJcIWwG5XcP++/6hcWH Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:44:42 -0800 IronPort-SDR: /hjG3Gw3NpTQ7UoUXCey8Agu3ljuUiBGQbfO/EQmLCyI3xHTR+KfpB6Ii8FPxyUgbB9CzPKL5e jOjj/xsxrWHba2EZ5XZzyczE9szDplFR2ahNG1oBXxUF8WewA0ygQULv7KFgEbkVwrHK/4hviY rF2Qn1uxI7XfZg7jwODu5qkMedGLnhN3bDYrNMrUgRS9rsMCmOJ71HgIMuubzv4Bj1wC4P9OJN 83KMkdikvEDTK7AHfzBtbOiLI6VmAs6pgFusE3ewldgarFDhYJ8fXuDCh+ESsDuDQtFInhpeFV 9wI= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:03:20 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 04/39] blktrace: add a new global list Date: Wed, 24 Feb 2021 23:01:56 -0800 Message-Id: <20210225070231.21136-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add a separate list to hold running extension traces. Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index ca6f0ceba09b..e45bbfcb5daf 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -36,6 +36,9 @@ static bool blk_tracer_enabled __read_mostly; static LIST_HEAD(running_trace_list); static __cacheline_aligned_in_smp DEFINE_SPINLOCK(running_trace_lock); +static LIST_HEAD(running_trace_ext_list); +static __cacheline_aligned_in_smp DEFINE_SPINLOCK(running_trace_ext_lock); + /* Select an alternative, minimalistic output than the original one */ #define TRACE_BLK_OPT_CLASSIC 0x1 #define TRACE_BLK_OPT_CGROUP 0x2 From patchwork Thu Feb 25 07:01:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D743C433DB for ; Thu, 25 Feb 2021 07:06:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B01AF64ED3 for ; Thu, 25 Feb 2021 07:06:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbhBYHGO (ORCPT ); Thu, 25 Feb 2021 02:06:14 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:5434 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232263AbhBYHFU (ORCPT ); Thu, 25 Feb 2021 02:05:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237232; x=1645773232; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cTaFZeshtY/P5AdZC4uOQS6rwB7PeP2EPmugukbwT2M=; b=HflIpj/9VF/M6gCmTZ08fAby/adY3ygFvzYz2oVY/88h90p+U8yHoPmo uBxzzTWWmCyHjvK5MMkhPkLl5IINlh1Xi5eEzeWiOXZWR0E+YayNE0Pur PPAW+PjgFgvKzunU/oe/GU0mF9wNwG5Vh1iGqtSGTrH6DsVZC7vgaGKg9 58ix8QBHXEScUElRiGBcHmYqBux3PVaoK7OCWgizzODWYcNGh0hmD5B5f EF3loA7xL0/15EKgqPH16hMstFaLGoHkJL5U7gyT9YnoNnVk7hwQm6QE0 3+klABP/H0jQazD0f/K/lr2/cxwB4gWAVdBW/m763AOnu6Luf3vWQMbdb A==; IronPort-SDR: 0sxs0asfCtAMSA5NDBOiDUyJjZVt3LV0+VNL4r7Dmyh0eFIOHV4Y4h1oJyxT06gxEbMZDfZEBs bJDFzGa5v+DDMc8Rufro7vvPsuuND/i2kAoUoacGPkneI1F805niK0+LeMjaTpIRxh4e+YAFSL XCmnQEzWPWg9ZIHNz7pFX+1IEZooAycun6GFK0R3zoodx82nfLdJlJv6NO6F5Vzy/dV947MyKw XYrjMx/vKLkNBf3wBlF88xE/kXDVRR4DnXIbHxBvV/ktNXHr432qiuKcA61Ca35Kn+9JGItvaB xSE= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978784" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:11:06 +0800 IronPort-SDR: 3wLUVf1Qr3EVEWC6rQ9uudwdFY9rKI8Hc30siQpLYOEiF1aqxAkbfzI91EtOF60k942uFID5wu 7MWufMb+kyJNCItXl6/16Znks4mZG/ny1sa1nwMUcJVPc/zp1ZDOIQgf7IPF2LOXIAXuTPn5GS 3EevaD9iuuGxdIHIdeapFwuNCxUIdJbiaJQu9TNXFow5zNxk7mp39hrPSuNXm+n2zgrJRJ6FGH A8wTKCfx8nEAx1837DQDu4b3Akvyp6bftNqyjXIFPQLCp53I/YXdMlWP4l+NdJaZ60DoWZovCl Ziv4rJJKVF4nlCRF8P3bhNdU Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:45 -0800 IronPort-SDR: wB6TbvqlNZwKMapdr1mDfmhL3gVaQYcTN9mlB+HAE1E4Pd2OWdlMt6iRkM+jucRume3inI2xMU k0b3p1vjpwtmF5jDx3iCrtn3deq9ipwl0hxaEIak+1VfJ65IUdgdp7YzU3WKZIGHiM/L/EMflj 9hpz70+6wm+ERuCGLQeCmQphuwBqI7XMHvN1n84iLom4CegyYR2onX0qmu2L+ZvvuoAEG3zd2+ l5eumY9r87dN5BWm0bTWFYDDWi/aAAIsmk+lG7U3Rwcrx2ZANDhmx4+eH9k+0kCN0h+SjlosA4 jKo= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:03:29 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 05/39] blktrace: add trace note APIs Date: Wed, 24 Feb 2021 23:01:57 -0800 Message-Id: <20210225070231.21136-6-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 113 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index e45bbfcb5daf..4871934b9717 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -114,6 +114,52 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action, } } +static void trace_note_ext(struct blk_trace_ext *bt, pid_t pid, u64 action, + const void *data, size_t len, u64 cgid, u32 ioprio) +{ + struct blk_io_trace_ext *t; + struct ring_buffer_event *event = NULL; + struct trace_buffer *buffer = NULL; + int pc = 0; + int cpu = smp_processor_id(); + bool blk_tracer = blk_tracer_enabled; + ssize_t cgid_len = cgid ? sizeof(cgid) : 0; + + if (blk_tracer) { + buffer = blk_tr->array_buffer.buffer; + pc = preempt_count(); + event = trace_buffer_lock_reserve(buffer, TRACE_BLK, + sizeof(*t) + len + cgid_len, + 0, pc); + if (!event) + return; + t = ring_buffer_event_data(event); + goto record_it; + } + + if (!bt->rchan) + return; + + t = relay_reserve(bt->rchan, sizeof(*t) + len + cgid_len); + if (t) { + t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION_EXT; + t->time = ktime_to_ns(ktime_get()); +record_it: + t->device = bt->dev; + t->action = action | (cgid ? __BLK_TN_CGROUP : 0); + t->ioprio = ioprio; + t->pid = pid; + t->cpu = cpu; + t->pdu_len = len + cgid_len; + if (cgid_len) + memcpy((void *)t + sizeof(*t), &cgid, cgid_len); + memcpy((void *) t + sizeof(*t) + cgid_len, data, len); + + if (blk_tracer) + trace_buffer_unlock_commit(blk_tr, buffer, event, 0, pc); + } +} + /* * Send out a notify for this process, if we haven't done so since a trace * started @@ -132,6 +178,20 @@ static void trace_note_tsk(struct task_struct *tsk) spin_unlock_irqrestore(&running_trace_lock, flags); } +static void trace_note_tsk_ext(struct task_struct *tsk, u32 ioprio) +{ + unsigned long flags; + struct blk_trace_ext *bt; + + tsk->btrace_seq = blktrace_seq; + spin_lock_irqsave(&running_trace_ext_lock, flags); + list_for_each_entry(bt, &running_trace_ext_list, running_ext_list) { + trace_note_ext(bt, tsk->pid, BLK_TN_PROCESS_EXT, tsk->comm, + sizeof(tsk->comm), 0, ioprio); + } + spin_unlock_irqrestore(&running_trace_ext_lock, flags); +} + static void trace_note_time(struct blk_trace *bt) { struct timespec64 now; @@ -148,6 +208,22 @@ static void trace_note_time(struct blk_trace *bt) local_irq_restore(flags); } +static void trace_note_time_ext(struct blk_trace_ext *bt) +{ + struct timespec64 now; + unsigned long flags; + u32 words[2]; + + /* need to check user space to see if this breaks in y2038 or y2106 */ + ktime_get_real_ts64(&now); + words[0] = (u32)now.tv_sec; + words[1] = now.tv_nsec; + + local_irq_save(flags); + trace_note_ext(bt, 0, BLK_TN_TIMESTAMP, words, sizeof(words), 0, 0); + local_irq_restore(flags); +} + void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg, const char *fmt, ...) { @@ -185,6 +261,43 @@ void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg, } EXPORT_SYMBOL_GPL(__trace_note_message); +void __trace_note_message_ext(struct blk_trace_ext *bt, struct blkcg *blkcg, + const char *fmt, ...) +{ + int n; + va_list args; + unsigned long flags; + char *buf; + + if (unlikely(bt->trace_state != Blktrace_running && + !blk_tracer_enabled)) + return; + + /* + * If the BLK_TC_NOTIFY action mask isn't set, don't send any note + * message to the trace. + */ + if (!(bt->act_mask & BLK_TC_NOTIFY)) + return; + + local_irq_save(flags); + buf = this_cpu_ptr(bt->msg_data); + va_start(args, fmt); + n = vscnprintf(buf, BLK_TN_MAX_MSG, fmt, args); + va_end(args); + + if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CGROUP)) + blkcg = NULL; +#ifdef CONFIG_BLK_CGROUP + trace_note_ext(bt, 0, BLK_TN_MESSAGE_EXT, buf, n, + blkcg ? cgroup_id(blkcg->css.cgroup) : 1, 0); +#else + trace_note_ext(bt, 0, BLK_TN_MESSAGE_EXT, buf, n, 0, 0); +#endif + local_irq_restore(flags); +} +EXPORT_SYMBOL_GPL(__trace_note_message_ext); + static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector, pid_t pid) { From patchwork Thu Feb 25 07:01:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AFCBC433E0 for ; Thu, 25 Feb 2021 07:05:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EF0764ED3 for ; Thu, 25 Feb 2021 07:05:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbhBYHFL (ORCPT ); Thu, 25 Feb 2021 02:05:11 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:54863 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbhBYHEu (ORCPT ); Thu, 25 Feb 2021 02:04:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236689; x=1645772689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qdyagKJPcWErAA46tCNY0K0NdqzdODTcXuAuyhapQbU=; b=TXZVyBQ8ml0SEGs/GcbgamKQkBnaTxOKu4+wZ3BloVx+0uf7gi7oi4HN L4GEFw3tJD3pxZ3LUfvlr9OKvwQZO5tYS71nLTmVwZTmWLYDep30sQU8u wiePmgcqVEYyBuuhfmxHAybRmgY4o9iRpgIde5rcqfCAi9tdslyd9UKjF DVivdIxlYvFDhe+znjaaGWnel+iDpuQXf5EqlboSnlIXotGj3XwrPcT+J 9aXnUXCVw/so/jOqo5S16WG47UynPOFTWp+mGrrHvqyuUek4doKAiPXeL 1DxU9JcccMcOZqcQ0YrgseyNm6f50FEKrful0hbHpSqZEQs8pY6amM3EW w==; IronPort-SDR: c7nmWf4y87SmIsiYb/qc9ic1Yeva/zczDkR2v0hQLRJ1rAEFR548thTfj1tZBj1Iuh0skH/i4Q 2B6BfVZl/CrsRLJUnF5ZR2tRqKb1L2kdn3v/vlBQYAHAJlUCRT+s6Y4odeRVcqTrQePhH5bgSQ PWDUL1ioGFREWeC0AMOajffTE2gQClcoZgKmbjLwIB8mFh+OsRDc++150zvculCS8DNShtyhgN CfR3tURH/sv885nNqGDCKm3q0QICHl/WyDDoSuD42pUa6gLyjgunxvwlB6d50cdFZt3+OoK+T9 BuI= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160777860" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:03:38 +0800 IronPort-SDR: mN8GuriArjqQAZmozLuZwNQ3rNZnscbLSV1px7W/6G6r4HptqCjoiihtp/TIuoyelbuWgrH1Ia PQ2KEXITW82L3P1AmiX6B5z5FSxxOOms5WlBCPszncfJ4YMk8nvw1FLO+tp2CKfqyA+GV6dZLw vqst9XJ45ZmrclXNEMa+z3T4N/h3zH8qx8Kzg8KKlSnFAQg7GQjRgig5lSjtdMyTA+LJ5vhciX vaqF5gATQsXL60/BWnnld1U+73BIZ2yZWMpPhNpaBQtA7IsLBOWYndAX7yegy14qtrGtfDBgF7 NI05nIbQ7lity5Ysh1rdtZwR Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:53 -0800 IronPort-SDR: WnRuBgoyCtMo+vxu/gIkc0+9FWzQELFP7nsalmCAAODcVpugmiOW8wIWd/PIBLW2IdfWDfKK3a f+pqiiil1IcvKexTHHfZnk7C2Dyna4Z4zdNerJVaUYHTFHjtb/YWbZheMHSpx3Pv7Tfg/SN7iJ lhl/IMGzAxvQ9Ssba+FjiynX3819Vt+Mzn/aKE40FW4SG+v4Wy9/QZm6u+/5QdbKMXYioiJrAl 1ATkJwVyEYu2npTQCi9UFPaAu5+PTEprOXaF0VAHrFNC4FFQFiOMtGjE/CwUMJ5JPyL5e8jjuT ScU= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:03:38 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 06/39] blktrace: add act and prio check helpers Date: Wed, 24 Feb 2021 23:01:58 -0800 Message-Id: <20210225070231.21136-7-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 4871934b9717..feb823b917ec 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -311,6 +311,43 @@ static int act_log_check(struct blk_trace *bt, u32 what, sector_t sector, return 0; } +static inline bool prio_log_check(struct blk_trace_ext *bt, u32 ioprio) +{ + bool ret; + + switch (IOPRIO_PRIO_CLASS(ioprio)) { + case IOPRIO_CLASS_NONE: + ret = (bt->prio_mask & 0x01) ? true : false; + break; + case IOPRIO_CLASS_RT: + ret = (bt->prio_mask & 0x02) ? true : false; + break; + case IOPRIO_CLASS_BE: + ret = (bt->prio_mask & 0x04) ? true : false; + break; + case IOPRIO_CLASS_IDLE: + ret = (bt->prio_mask & 0x08) ? true : false; + break; + default: + /*XXX: print rate limit warn here */ + ret = false; + } + return ret; +} + +static inline int act_log_check_ext(struct blk_trace_ext *bt, u64 what, + sector_t sector, pid_t pid) +{ + if (((bt->act_mask << BLK_TC_SHIFT_EXT) & what) == 0) + return 1; + if (sector && (sector < bt->start_lba || sector > bt->end_lba)) + return 1; + if (bt->pid && pid != bt->pid) + return 1; + + return 0; +} + /* * Data direction bit lookup */ From patchwork Thu Feb 25 07:01:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75205C433E0 for ; Thu, 25 Feb 2021 07:05:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E7FA64ED3 for ; Thu, 25 Feb 2021 07:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232033AbhBYHF1 (ORCPT ); Thu, 25 Feb 2021 02:05:27 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:13993 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbhBYHEy (ORCPT ); Thu, 25 Feb 2021 02:04:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236694; x=1645772694; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=prMu5VWVvyH6quJgJm9/+dMQtJ1jV2ZlJRv9h09QmW8=; b=JbfEFrZCDD1dPKqdFCjirh/JRNhTqzojV5QWsfEcbMvc2fZbjQP2w+eD DN87AW47faFovH8GgOXSW/pea6o+QyK9pdg92p2imf8tKUs8vI9VCQDDR Vlp1LQtQI/OedSQ5xmO3gCsmnvUIb3NndZHcEiC22U4YmtmrMrmB92uPp osh3SCKZ6lELX6EDLgayzryOR+ol8V3TMgpSyvAZSLxL9gYxZnj3+CXHo s9GYkuq4VooEawzTpt+FWlTTaqY7JzPpJ0g9ydoD8PPbJm9xB90Qjds1t t3kqYpwq4sY8rHx2dqquDLlZwcoIGOUd+dU5fstUsQVPi4BjI0D06SM5h w==; IronPort-SDR: yXNNbuaEpqNx5wIPJFCBcONoTPBVI7JrQ6arrUbj7MyoryMLDTkqDbdEw3wn2dBReIlOwg+zZ6 3JkQ4UF+TKimeLeMIRr7s3AgWQUWxP236mukidnkR7yVruJQVtVzyAEihdmq8w6b0qqL31R/dT YdVUgCKp/nuXlR0tdQo4DHNkzIAdP/s4VOQ6a1diiKMms80vRhTHiBc32PU1Dh+IcayuWX0V7P HnCjI0wfpK4EEaeEXI0GnF/ONcWymi6JH6qTsRQjnCpTUFQBOAsLYR+/KM0J9fL5VJL6BUr037 SZk= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751667" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:03:47 +0800 IronPort-SDR: VVZManM2tYw3yRwKoRxVVLjBXgFbGRcSRMCq1J7EVgzn+Vx1NkbO22QbVl1Qlb7XnHerb3B5XW TDUnmbmZuJOv2cYXXO31VuqoCe/RpWaq6M21RQXY7HXQJlwnbYoTX68YiRR16U7q9T1GvHd8e7 ClqNjOwWmfmIIRFcTnCdloMFh+G3O723cmv0OabBq+Q/i7WdGoHls3d5OaHkWBKQgjH3/ZKAoN qPu4aaz0ESwg7q0kcnQzu6GB1iHiod23cLb34TFCGHgVKb40BHMD0aDLh/J035FlBXwzTQHScn wQwzA31EaqSCb+JZjsVArbDs Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:02 -0800 IronPort-SDR: TVONRZDXjB9/ityTS4FG+vryTqDrcEn/RclLb7OnqTPjX2WsFUC3jHGsRxTbAf+OkCdYk+IpPQ ptOKSzCTlBTyL+ah2P9C7fFc0K3Tyk2Z3N1jLcLKzN4HRSc3y8k7oYdUeb52IBGxkz9YSmsmPO Zhogoib04S5BOtWHtzS9blIGAn6vG+o+F+YMC5Zy2jE59e1vTTJORXDC50nTwti6+U5Q/MS79O K9fy+pdEEDiXKcNoBKrqAi6Tk/LAVBV4UH4ODmPMr4CcjUoBCDJm4uo6+bNCgy9BW5f8OLxNHI 2Qc= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:03:47 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 07/39] blktrace: add core trace API Date: Wed, 24 Feb 2021 23:01:59 -0800 Message-Id: <20210225070231.21136-8-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 130 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index feb823b917ec..1aef55fdefa9 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -462,6 +462,136 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, local_irq_restore(flags); } +/* + * Data direction bit lookup + */ +static const u64 ddir_act_ext[2] = { BLK_TC_ACT_EXT(BLK_TC_READ), + BLK_TC_ACT_EXT(BLK_TC_WRITE) }; + +/* The ilog2() calls fall out because they're constant */ +#define MASK_TC_BIT_EXT(rw, __name) ((rw & REQ_ ## __name) << \ + (ilog2(BLK_TC_ ## __name) + BLK_TC_SHIFT_EXT - __REQ_ ## __name)) + +/* + * The worker for the various blk_add_trace*() types. Fills out a + * blk_io_trace structure and places it in a per-cpu subbuffer. + */ +static void __blk_add_trace_ext(struct blk_trace_ext *bt, sector_t sector, int bytes, + int op, int op_flags, u64 what, int error, int pdu_len, + void *pdu_data, u64 cgid, u32 ioprio) +{ + struct task_struct *tsk = current; + struct ring_buffer_event *event = NULL; + struct trace_buffer *buffer = NULL; + struct blk_io_trace_ext *t; + unsigned long flags = 0; + unsigned long *sequence; + pid_t pid; + int cpu, pc = 0; + bool blk_tracer = blk_tracer_enabled; + ssize_t cgid_len = cgid ? sizeof(cgid) : 0; + + if (unlikely(bt->trace_state != Blktrace_running && !blk_tracer)) + return; + + what |= ddir_act_ext[op_is_write(op) ? WRITE : READ]; + what |= MASK_TC_BIT_EXT(op_flags, SYNC); + what |= MASK_TC_BIT_EXT(op_flags, RAHEAD); + what |= MASK_TC_BIT_EXT(op_flags, META); + what |= MASK_TC_BIT_EXT(op_flags, PREFLUSH); + what |= MASK_TC_BIT_EXT(op_flags, FUA); + if (op == REQ_OP_ZONE_APPEND) + what |= BLK_TC_ACT_EXT(BLK_TC_ZONE_APPEND); + if (op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE) + what |= BLK_TC_ACT_EXT(BLK_TC_DISCARD); + if (op == REQ_OP_FLUSH) + what |= BLK_TC_ACT_EXT(BLK_TC_FLUSH); + if (unlikely(op == REQ_OP_WRITE_ZEROES)) + what |= BLK_TC_ACT_EXT(BLK_TC_WRITE_ZEROES); + if (unlikely(op == REQ_OP_ZONE_RESET)) + what |= BLK_TC_ACT_EXT(BLK_TC_ZONE_RESET); + if (unlikely(op == REQ_OP_ZONE_RESET_ALL)) + what |= BLK_TC_ACT_EXT(BLK_TC_ZONE_RESET_ALL); + if (unlikely(op == REQ_OP_ZONE_OPEN)) + what |= BLK_TC_ACT_EXT(BLK_TC_ZONE_OPEN); + if (unlikely(op == REQ_OP_ZONE_CLOSE)) + what |= BLK_TC_ACT_EXT(BLK_TC_ZONE_CLOSE); + if (unlikely(op == REQ_OP_ZONE_FINISH)) + what |= BLK_TC_ACT_EXT(BLK_TC_ZONE_FINISH); + + if (cgid) + what |= __BLK_TA_CGROUP; + + pid = tsk->pid; + if (act_log_check_ext(bt, what, sector, pid)) + return; + if (bt->prio_mask && !prio_log_check(bt, ioprio)) + return; + + cpu = raw_smp_processor_id(); + + if (blk_tracer) { + tracing_record_cmdline(current); + + buffer = blk_tr->array_buffer.buffer; + pc = preempt_count(); + event = trace_buffer_lock_reserve(buffer, TRACE_BLK, + sizeof(*t) + pdu_len + cgid_len, + 0, pc); + if (!event) + return; + t = ring_buffer_event_data(event); + goto record_it; + } + + if (unlikely(tsk->btrace_seq != blktrace_seq)) + trace_note_tsk_ext(tsk, ioprio); + + /* + * A word about the locking here - we disable interrupts to reserve + * some space in the relay per-cpu buffer, to prevent an irq + * from coming in and stepping on our toes. + */ + local_irq_save(flags); + t = relay_reserve(bt->rchan, sizeof(*t) + pdu_len + cgid_len); + if (t) { + sequence = per_cpu_ptr(bt->sequence, cpu); + + t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION_EXT; + t->sequence = ++(*sequence); + t->time = ktime_to_ns(ktime_get()); +record_it: + /* + * These two are not needed in ftrace as they are in the + * generic trace_entry, filled by tracing_generic_entry_update, + * but for the trace_event->bin() synthesizer benefit we do it + * here too. + */ + t->cpu = cpu; + t->pid = pid; + + t->sector = sector; + t->bytes = bytes; + t->action = what; + t->ioprio = ioprio; + t->device = bt->dev; + t->error = error; + t->pdu_len = pdu_len + cgid_len; + + if (cgid_len) + memcpy((void *)t + sizeof(*t), &cgid, cgid_len); + if (pdu_len) + memcpy((void *)t + sizeof(*t) + cgid_len, pdu_data, pdu_len); + + if (blk_tracer) { + trace_buffer_unlock_commit(blk_tr, buffer, event, 0, pc); + return; + } + } + + local_irq_restore(flags); +} + static void blk_trace_free(struct blk_trace *bt) { relay_close(bt->rchan); From patchwork Thu Feb 25 07:02:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FBFCC433E0 for ; Thu, 25 Feb 2021 07:05:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF1C464ED9 for ; Thu, 25 Feb 2021 07:05:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231974AbhBYHFB (ORCPT ); Thu, 25 Feb 2021 02:05:01 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:20154 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbhBYHEg (ORCPT ); Thu, 25 Feb 2021 02:04:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236676; x=1645772676; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i2LSH/OjKGCrKXEu0AkHm8m/B3zNNzAdY2JIHZBpPOw=; b=MGeU+vPA4ueLuT9sLlEBlh+7OQQWJbSzgi5OSqomagqR7Md89I276f6I USI//DQ2vkuJ4qfvsiE+DanB1Y5DVIHQeS0Nw+NlLMVJQWIevGdLwsvZ9 w83EqZL4oxe0GPBc/ELSGKo3LdGrijqjZecgA/8JC1ZXmusRmg7DgNoYQ bMWmJCdzzxndEYLOldoCPcjUS46fR2/JRjT/Ro42wAvRQ0rOIbUFf9uDw G38+PizwEvyli9Ok2VVudbuOvm3kBwH1F6+j6EhUzDhVlAvZCFxQDWCnl 9tqUXRMk+Vb3bHBiAaYn8kYht3VvIq8YkWUoSCh4rpOqN8RpuEeezUI1/ w==; IronPort-SDR: 5jY9UCehsWuM01xC71tEcZuJXoajlzkFNv6ymTHWAJKJi9cc8TRqPHOaHOg+XIHYn2T952lz4W Gz9qIpCaUp6wNB74KM+4hU211Kzp4i16+bYQDiSW8jGHIfPJgR62GBxHGQKe2FjyqB3HsWiyHE 6JM1ckZAqxO1enomXbGJF7FoGIKugmgFZuwcr+/yIASxMU5RItbvg6bHVghsF8P2Q67TONs0XR kKNTuTtMXCAiVOYUr2x00/XPU2FT/2txVLVImPSYHis0qZCYrn4P72yg9IEpe6JFY07ijXta/j 7SQ= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="165245657" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:03:56 +0800 IronPort-SDR: 62TsDyzlWVRfJ1kFy8jjqv/Zimj/o959HEp65qiXUztLyPIBijXaugl5mPS1R/4LzPEAUHsXfB aN8GmMNPnkhQmJ1klCerIfQ7Wkjn9vUmQysN3oH4YVT7EAPDMhrYZup+dTmj300g2PW6XXAiKc uOLxzDYIRKS3rqAk8/uyh5kps3sWhJ9Jx5ynOiionDQYIuSzdE8NQ5kokbrZRW1HJBr9Ag3hsF 85CzA4oAFbC5AktAlylx6SPvxX1Nap/trKJOl0q6hyMh5AMt5XhGUwxQrusL0N7+6TTCTsaF6I m9nVbX8vAoDHxE7WMvnXv3QH Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:45:17 -0800 IronPort-SDR: uT1Gbcjh/y/RdWSoB4lyWWBt0RseD4xGuhuvQ+IIsqtAkCaYpfkTyK14dVq1TRLNy0CsyAGosz U32AWIJ+L/5mzaGRxpy21ocDv4T+R/EMYLb+GHoerpo6T+JZ2O0VJr9MBNWwAWgQMA5jGvtn3b ltJvN757ajKXKudOczOhYSWmIpFMSpx9KBimUZKx8U18Stey2/jqJPZi4dI5I+w+r4SAxkQrZJ IkUqtC+PMU6RKra919zmX/za7es4/VdPhzW6Q8X72FZrRzYEIheqYdBC+la9AZNOemtmFmze/P c9w= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:03:55 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 08/39] blktrace: update blk_add_trace_rq() Date: Wed, 24 Feb 2021 23:02:00 -0800 Message-Id: <20210225070231.21136-9-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 1aef55fdefa9..280ad94f99b6 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1099,24 +1099,36 @@ blk_trace_request_get_cgid(struct request *rq) * **/ static void blk_add_trace_rq(struct request *rq, int error, - unsigned int nr_bytes, u32 what, u64 cgid) + unsigned int nr_bytes, u64 what, u64 cgid) { struct blk_trace *bt; + struct blk_trace_ext *bte; rcu_read_lock(); bt = rcu_dereference(rq->q->blk_trace); - if (likely(!bt)) { + bte = rcu_dereference(rq->q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { rcu_read_unlock(); return; } - if (blk_rq_is_passthrough(rq)) - what |= BLK_TC_ACT(BLK_TC_PC); - else - what |= BLK_TC_ACT(BLK_TC_FS); - - __blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes, req_op(rq), - rq->cmd_flags, what, error, 0, NULL, cgid); + if (bt) { + if (blk_rq_is_passthrough(rq)) + what |= BLK_TC_ACT(BLK_TC_PC); + else + what |= BLK_TC_ACT(BLK_TC_FS); + __blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes, + req_op(rq), rq->cmd_flags, (u32)what, error, 0, + NULL, cgid); + } else if (bte) { + if (blk_rq_is_passthrough(rq)) + what |= BLK_TC_ACT_EXT(BLK_TC_PC); + else + what |= BLK_TC_ACT_EXT(BLK_TC_FS); + __blk_add_trace_ext(bte, blk_rq_trace_sector(rq), nr_bytes, + req_op(rq), rq->cmd_flags, what, error, 0, + NULL, cgid, req_get_ioprio(rq)); + } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08127C433DB for ; Thu, 25 Feb 2021 07:06:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A466764ED3 for ; Thu, 25 Feb 2021 07:06:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232164AbhBYHGU (ORCPT ); Thu, 25 Feb 2021 02:06:20 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:14053 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232196AbhBYHFe (ORCPT ); Thu, 25 Feb 2021 02:05:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236733; x=1645772733; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Eg2fGoq9LGHNhr856Wi8sTcdeuBXuyQcrnLuJl0Hsuw=; b=aByuaKw0XAPRKMbZ/8Wtvuq4EznNFcW1HCTWXe1uosi6OTm2gB76ZERM QDnLuvLEGXlDorRVCgSuwyUhrqjDPS8haPQjASm7lIOzIzO9VXs6jy72u wBrD5xaPOSgmC/6Wfkm0PrUve06SPTJeu0+FHS2svQn02M3EyOFNk8333 m/iOXcYUeXyrPDcZFIRZ1HLGuAG9j/MxargJ/V7A7eM0nIXeba4gHQ3u8 /tiiG+vOGghEoWaek4cRaZR0liprAR/+oIBeFyNhhRoWSAFP/37ZAB2H7 xC9jTNt/cY5NeCwnfzAfVPe4gPnfMCyG9GjbxvO/leaNiCh+dxHtC8Ffp Q==; IronPort-SDR: OfTcfNGgK8bgJvQl6FjSl6/aZhKGeNllMPvF4NUDO478l+E/NiFlq/G1VjUY/t/6UupCCMObRo RVUCA0Ptb0jIR7ywljOEezSHfY8hy1itu3m6MRVoyLAvhwyuJt21lxDRR9pRR8OWxyU28sH57J 4GzeAQMbT70hPV2C9Aiqk9efEJGVq1HXhiGtuNpXLC3zlUtnA0NCMSVqxKmdeNMQ8Ef4CTQyWP tly/Vznu7VeN+iVQ63T/iZnWVi66B3GBINF9OXbpat8m3I6sbdEs2abHhwTTIGcyh/CzAL/8xb iDo= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751685" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:04:04 +0800 IronPort-SDR: Y4xQ6bMoIXmw8tIhb3BqsKrywbE/mzNfI0T+H5y+nKcGZjoFa1FdTIdM9KnqNOPMxljk2Y6mVI O2rE0Jj0nW7WQb1/SxyzZCkjRyLrd/bPyein0K907Zdv/gXDwWWKhB9Wp/yoT+10ZmPYDG13jd TCcEbJgb7KcONhDTCL93gDMbMGFzXs41a1R8g6Ee4OjkgvZgm8BskCaIjr3YzLkw4DoW/ZryVK KMES+vvvQmXNRK9dFjg34os+chmz1Jl2cRES9Wew3qVzLm4oUFM/YFyHB5bbFbDtdPrClFkHb8 KnzJa55t4Z5eZR1jZriMT5xV Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:20 -0800 IronPort-SDR: oFAB9j2Iw25emAnehabNGsmkCSyWETo8/m45CNp6X8Lse0u4pJh4os7tWT5Oph4QDkKlYYYNDS 39g+agCKH2+H36ZhjWnkN7BPSJ2AND31f205r/40ps5BiZlJzrNPtN+qTF1jF5cQRpEKUEhv2x DNxV9+74lrnlc8V+61CaxbcXcTqp0HJZHbvhFvJd74ls/k0Pm/9lL3xCO00p4jGTrx/k7LEsJK WNxVh7DKcrfuKKQuw68lGpyoH5WJy8CCRGwj89gSp4hE77EhVpzpVuk1zRe+cgMl9BTqxZxRfN BpA= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:04:04 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 09/39] blktrace: update blk_add_trace_rq_insert() Date: Wed, 24 Feb 2021 23:02:01 -0800 Message-Id: <20210225070231.21136-10-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 280ad94f99b6..906afa0982c2 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1134,7 +1134,25 @@ static void blk_add_trace_rq(struct request *rq, int error, static void blk_add_trace_rq_insert(void *ignore, struct request *rq) { - blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_INSERT, + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(rq->q->blk_trace); + bte = rcu_dereference(rq->q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_INSERT; + } else if (bte) { + ta = BLK_TA_INSERT_EXT; + } + rcu_read_unlock(); + blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), ta, blk_trace_request_get_cgid(rq)); } From patchwork Thu Feb 25 07:02:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2169C433DB for ; Thu, 25 Feb 2021 07:06:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A27164E85 for ; Thu, 25 Feb 2021 07:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232196AbhBYHGY (ORCPT ); Thu, 25 Feb 2021 02:06:24 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13049 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232417AbhBYHFf (ORCPT ); Thu, 25 Feb 2021 02:05:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237255; x=1645773255; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UrkLJRrs1lnD9LqgYlpTtfqj+52EYKJ9/MSNX1BWZfM=; b=lTEuqchBHA7fdPDiumW/1pEMai09Rr6OvTxpbQwhIjUzQ3YcY3IhCYvr YKrqJa/XyUizZ04K79qzaZCunxKYciIwdp16vlK46AAqQZebWibEti3x8 3Ezpbet9B/cEuBVIY8LRaZLm5bWux8YLsYS7Ru0jOHdj9l5EiFrRU8+1f sHRXaOGcliWmxfFDDj74RdvqsSuxSehnO0ljVJyiIPX7keXdR8XK1s2G1 mJWXY1SR495iEJ4erhySvMmDNgll+KooYHBbYGF9IkOP+86lWBkRYG3R/ xtpUdNDg617RgfVLmMBpBTnYVlIEJPS7FwSirgVg126Dq/xAsSNMPHYOk w==; IronPort-SDR: +SJxXmBxfPRfPpQ7RHbYnEYxZvvSin4IHj7qnS12tOFw343+TwOm3IpiARg7jgMrT4tGc3cqKY jTqGJR29nnPsKdeDQFyJTasNcK8U2HAahOa9zGtToO5YX6v+hQswx7cx4fBRBkDf+uCQumWaGL Xd2Naw/jMAIebOncclrPJtqxkYlTPVUr8kMo6OlFJ3P86tpwkcVdfFL6Wh2qoL+jm0zs9ZxciU dXYXBPxXtfEkhQrWpAQ2iYnLQOWq5SkpVgJzvTFGrRPHeg7AGDSdiq2QwbwyjL7qoIqpalcI8V 3SY= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978837" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:12:12 +0800 IronPort-SDR: 4CUeEASSTR4Uss64K5Fq+0Bt+W1LeMpYusHF45L0HJsW7nM7qTnClrVxDrrqKmJ523Sz9eLr4W 0suqbkX0bDqfTKT6nRwwPwrX5MvvI1CH3QlNDxlAaVS3UgQf6vlo5e5R5Lc433SncazDD5PFCJ AzlHGEGU/EEAL3aTOFJfCziQr5xHMGjizjUMvcmIE7wQKVPwo/u/8dWS2fnyxEE3r6zGfSADGi MpJyBUBHgHLTKQUIxwPPfhAGP68F1UDb0is+MJ/uCSCVvsI3YT7O7xvIADoyIqFD76xmv7qWkZ QVifGWVlF8wGWWCY53M6jrPx Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:29 -0800 IronPort-SDR: Zl81cQDbLFnJjbZTlvLnrD6Ew73F5BR/Ye1TJvXMPlaipyAYtm4aYrO7i3KDhn40nvbpbhpocp bEiw1n8emCshrkLq2tBK+lO+J1cCsou+EoLL9awDw3ZS+x/lV96F/IiV19lViFY6omqr4+imOE R7MAbg2lEHyBSwszt8sG9VVidC3RcL3ZGsCA+Joco2cXzvjryqZJilDb82kR+s7lsTGjkw0f5E Iw/IyxPiPeP3OUucRrzdFojQlG7eQv8Ep359GvznxFd/kERMsEnOe8qOULwKiCsv566YgD6Nmf pkM= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:04:13 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 10/39] blktrace: update blk_add_trace_rq_issue() Date: Wed, 24 Feb 2021 23:02:02 -0800 Message-Id: <20210225070231.21136-11-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 906afa0982c2..e1646d74ac9a 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1158,7 +1158,25 @@ static void blk_add_trace_rq_insert(void *ignore, struct request *rq) static void blk_add_trace_rq_issue(void *ignore, struct request *rq) { - blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_ISSUE, + u64 ta; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(rq->q->blk_trace); + bte = rcu_dereference(rq->q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_ISSUE; + } else if (bte) { + ta = BLK_TA_ISSUE_EXT; + } + rcu_read_unlock(); + blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), ta, blk_trace_request_get_cgid(rq)); } From patchwork Thu Feb 25 07:02:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103471 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACDADC433E0 for ; Thu, 25 Feb 2021 07:07:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63E4C64ED3 for ; Thu, 25 Feb 2021 07:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233067AbhBYHHD (ORCPT ); Thu, 25 Feb 2021 02:07:03 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:13993 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbhBYHFy (ORCPT ); Thu, 25 Feb 2021 02:05:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236752; x=1645772752; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zX5u0LGVFFUDJJ8B1co7L0h1Qj5Ehc3inMJ8ZLgIl1c=; b=jKrwKdzo/7mZ3WtBBYLc2uFJdf+nLFWVASj/yTWpcIboBwad1sDpKalU ta6gHZF9b5VKGUxQjKSpojhZ6uBSmFSVbXPXfUZVRHxbZ7IMnQIA0+c5W lbi343Ne9ahI9mELky7EZ8M+89BQn5Wjt4v9nWkZxIAyz0OWv15fDe9Y7 W9YEeKyu0e8UIiJdEOcamY2JrHnufE7Bcv3Jyw75dMBH6TFTDkqxM1Ond +dn/zTmwigeoM4QAyXRCI2o67hTaV4Sl6dmZjQZ37ROZqxHXtBQITP+1Y iye3IJY2GJKlLbR7uQcTZNNgo4Vlsr2DAihqAkBRo+CTQscxeV8DBfQZb Q==; IronPort-SDR: PrhtrCCNo8yg0EJ610XmTrxf2GB4eDTb/4nS7s9OdyMe+jvPEy/YNkCsWkb0UaU27lpzrKHFw4 4cR17VgSidUvUrka56IAgxcxNepA7vHQiJdWWVBi7aeQQvNyz6DiGhmnm5Ki28Si3mO2I04Ks7 YYllqG1mX4C1DhO3NjO9NaKZ8joNT81YJs8LbdDpM9DzEQzokK8x9yK3/lGJvj7wOJZ5wPTsOr In3Qt7pntMjWCCHM4aFNv1M6HhoDGX39hygy4M84TZkoTZiGBhlSCfTCfS7TDBDXur7/YFnw09 p+4= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751717" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:04:23 +0800 IronPort-SDR: VnFEYYatB/sNso+/0b+MIAtsHbDRFdUwrIDLcWArwtMrNZ3mnu6LdHtfxUftd/WVWW50VjRtxQ YHsrRE6hPiB233nLMIb9L+WGPKPI8agG4i1Bw754IK/VTTOd3AVOJ+u01t+xgy/99l0cIhViwS UbmeOuToEC55r4DSA2c6WEX8Qq5J11b0iwQQzcATGakUAgixacBfMTXDgQLLBF7ZetWgkyK0wo 9m3TAFZjBFw6qh091u/ugF72uPH6enLdPWvm6bY7uOWubFvDusUzn8iVBVovJHhLhWOKK8lJoD IFQ82npZLI0m4IND4jKLSRn4 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:38 -0800 IronPort-SDR: b6D3DJ2Y/kk6gNN5eORP+52pxYzmVI5Ds+/VMwpHylQgt3DiU8fh2pQp0DOzzSqO+dceFu6tUX aoiAMzk45FSmXILPfpz5jtHZar/G5oTO+GC3MjzgzM9Z16Met/XeFyGmq8SS0sSu1BCy95YgEo 4kgHSefPuyxvh21KwXoZWwvACWcl2/WTUeSzMslqQF9h8mUjMBjvhWy/f3ZdeAoWMlKNDSiGiY w5SwvI4Ma/1icgaGtxLd0sruHWwbainJwlQR4MSDl4wPdVXH2hycAixWsLtQ+m3BjJl+31smQd kP8= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:04:22 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 11/39] blktrace: update blk_add_trace_rq_requeue() Date: Wed, 24 Feb 2021 23:02:03 -0800 Message-Id: <20210225070231.21136-12-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index e1646d74ac9a..8a7fedfac6b3 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1188,7 +1188,25 @@ static void blk_add_trace_rq_merge(void *ignore, struct request *rq) static void blk_add_trace_rq_requeue(void *ignore, struct request *rq) { - blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_REQUEUE, + u64 ta; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(rq->q->blk_trace); + bte = rcu_dereference(rq->q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_REQUEUE; + } else if (bte) { + ta = BLK_TA_REQUEUE_EXT; + } + rcu_read_unlock(); + blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), ta, blk_trace_request_get_cgid(rq)); } From patchwork Thu Feb 25 07:02:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA168C433DB for ; Thu, 25 Feb 2021 07:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD8F464E4D for ; Thu, 25 Feb 2021 07:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232403AbhBYHG1 (ORCPT ); Thu, 25 Feb 2021 02:06:27 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:54936 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbhBYHFj (ORCPT ); Thu, 25 Feb 2021 02:05:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236738; x=1645772738; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bRSf7aRHFZjwKCFxu48NbjjHqZ6tr+RDQGJuYmhf/1w=; b=oJ7QiiCn0IwezQVjse7j8NTXId7/nIwwBbGElirTVeYwuDPBjd8WYxMZ XunyyV60HLnmdbfNknKN/WjLdHx+VNk1D7wKx9kpGCzRVBpRb4RDPq4AV iNbb0XNnhkqTBd55lFVQiNqrDw7+vPvWU4qDkMUWT+hg+x/GoGPokMg4m xOEgNZ/v/pkiShhzAExXdm4Hm5U9gIEhhPMkEJ/iM23526kDDe2Zf/yto KHG3cib9LpgQixeiATI9hUlnmngpVFvrSNhJhL/2P5hEPzfZnCIlV79gM rsRbhOG/aZ7o0SlKb+5gNVDRsVYVgn7z9rM2qQ2Jmkp5HgkVrokt/D8fj Q==; IronPort-SDR: 10RcSK9zhObgF9dGyXzF1QncTT/iFEW/WgghG5A7f0ZQ3tNL2KdKAhipEtB4F7Pb0bJcPpT2lP +mI+fw6CbW6kzAAdUFLQFXNjn9keyZ9YVeLrsgqpRt3SxdX2YaEZYcUWokCmfjfSa9osr2Imvz kIqMd0mmDz+mGQTO/1onaD83vtVbt1OQEblJDB3XS6maWYpINHH+EtsTehDXDaqxNZ4GXqQ8H9 Nm57h+8lVQHj4sMwBX1gGxZ4vzx1TcoRfKFlLZ9hzShWI+qcwjpeJ9ar6iJAMJyfGomBRnzhKf wCE= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160777912" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:04:32 +0800 IronPort-SDR: 5garp/d4Zg/wHtV8BeW4ZCOg1EBwI+/sLaL8eJXrUc/uBj8kXw84TBjFGNh/FByCwyLE30noXE 6Yacb0rfI9uu1qORkDMSPWx9GGOdsLa8e8e8EERdTcvlXFvTFcuifVEvQFBrvPzTADZPCPvS77 8abLuRYvmx7BL0AeuufdCGUfMLCP5higUSfqaEAWy/05uvvdjpJybrYGh5CX5WGrOOMeYpCaw8 vGdfJzADZUQ+7KzsZ3psRN72K/d/cipeK9dT5pa/9VFAOoX46d64EEixuqdwDxlIUz/cjubSEi 6t5Srilw7z1UbZE7zWtJmdvv Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:47 -0800 IronPort-SDR: vKKlsoTwwQ8w99awhN2gezM3J9FdT3hxy1J3T4UVldZCiEolV/GH4GCxrpEuTLS7C9eQzBNrk2 viZ3D/UHE3RIfltfADz2ukcEdfaegZTSb2XEyWTLY7ASiqBCp+zFJRJJl+T3QpZ7lRuKqNsS5X 11fcMEOjCk9mahgtW1R2WF8ncOujuLh2GwBR66JEQ0M/hfCy1CG6u7X/hVPbqqmbuwzT+eTWcq JC9KfT0o4Qle+pdlslSl+0Un+F2gBVz9vNhxyMZQuOqW3Fig3TJThQB6Xw61DX6Pf3+0m7dUrD iDs= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:04:31 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 12/39] blktrace: update blk_add_trace_rq_complete() Date: Wed, 24 Feb 2021 23:02:04 -0800 Message-Id: <20210225070231.21136-13-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 8a7fedfac6b3..07f71a052a0d 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1213,7 +1213,25 @@ static void blk_add_trace_rq_requeue(void *ignore, struct request *rq) static void blk_add_trace_rq_complete(void *ignore, struct request *rq, int error, unsigned int nr_bytes) { - blk_add_trace_rq(rq, error, nr_bytes, BLK_TA_COMPLETE, + u64 ta; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(rq->q->blk_trace); + bte = rcu_dereference(rq->q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_COMPLETE; + } else if (bte) { + ta = BLK_TA_COMPLETE_EXT; + } + rcu_read_unlock(); + blk_add_trace_rq(rq, error, nr_bytes, ta, blk_trace_request_get_cgid(rq)); } From patchwork Thu Feb 25 07:02:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E863DC433E6 for ; Thu, 25 Feb 2021 07:06:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7D2564E4D for ; Thu, 25 Feb 2021 07:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232290AbhBYHGV (ORCPT ); Thu, 25 Feb 2021 02:06:21 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:61594 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbhBYHFe (ORCPT ); Thu, 25 Feb 2021 02:05:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236735; x=1645772735; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jJS33jTeS4XOBYxJhHFf4LP5tOs+0XruCJUSjMPRWFQ=; b=VBquBQsLeNhwCzvHAGchjVn5OhOmxonchIor33W9BnOOpeTPUYUmkr7H 8FQrX8BngwpSrBeX7XS1YXV+saPG5sQQy/MPlrE7ukRI6Zp1C4o80NqzO cmGYJPqkxZx3SQIEu0Ry6wYxToUfPNU38pb2JJOutTy9yVswgqBut0/oe 5fhD2VA0Ed0P1NEeb0mwYWbKe9qpUuZANFbzDjHOacl7pHLPb8Nrmu0rW nRZNQiqyrFdVwwL89pX7jBJqYT6P4id/hH7GjJQvByrVUWdytzcjFivcg O85qXHALe8NH91R3eQtSdHdl9QxSmEEESrbxd4U6zCkjAOeixgOYqy8lb g==; IronPort-SDR: W+1+t3b5Dml6Vz/GRuNdBsgYUEIxpiWYy28A9fy8+elhhIgRET4laNiVRapcVw/SXIu7sQ0mHf rTEYAG/xg3xInr7Z4t7QIDhoYWjMYy8q65WsC/bk7sa52pGS9w6GHRAZA1shgClOAJQ6nMdjfL 7moUdVV1if+RvPM7LMokANKZc0s1GPsULgV6qVj3Y4+iMCRaVpR8jenE6lIk7uHZNBdHUl3glS GaCWnDkKoK1qAU8x6C0EXbDy/t8/OzAKzPC0vTwcgUoe3ZcFaNRQRq1PhHkRBQDnsqea354fif Ab8= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="161931415" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:04:41 +0800 IronPort-SDR: 5ecHJDcH030FWYLkstVEL2M6nZYHDgLO1y47JVVgsWu0B39a4PsHVm92JbAncjwkGUf6v/NCg7 qn3D8c0O1kZqqZpK5euNs20yssg3VTEZ4Yd3SP+Ur1BKpq4XFcDJMedZy4o8/YleQDQVPDDWrB bgo15juSh8NqB7qbCB8lgEU2xwGapoSLHTANqm7Z9Y6hKoQtr4n0lWAiosczOXUQadhFYPl98k 3q86NT+dRTPf+H/LSNp07ag4JkAgnCGg6wR1BdM4Z+yeLdLrhbsNzKn7avAmc2PoNrtZN5LBGm 4CZprC9AvMG38iVt1Gryh2cU Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:02 -0800 IronPort-SDR: 88N634aVstBuqVOxPofvX7qZC4KLKjL5g9B29uWfgYJRqBpZOUUdcWNVsdaqbYfeOIvnZHzUDS U25Ij7rei2zcHXrWF1SsqzUnBD2fOi00T4FyplhfecBoxZamE6CkRCKWomrjCBPZfyc2XnMTWW Yqi22ei+izyD+nBM2YzymQ+MW1rQoOxKkFwecELtf5t9AWYYYFWhoYGF6NxpaH88/0qPy4R+G9 URwILbAyFv3GDsO4uHFtuSiktTwc5j4fxIocSjhnQ4Li/JnasWMXgOv/RIn5JSAdKLUaxqg/DC JJA= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:04:40 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 13/39] blktrace: update blk_add_trace_bio() Date: Wed, 24 Feb 2021 23:02:05 -0800 Message-Id: <20210225070231.21136-14-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 07f71a052a0d..14658b2a3fc8 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1247,20 +1247,31 @@ static void blk_add_trace_rq_complete(void *ignore, struct request *rq, * **/ static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, - u32 what, int error) + u64 what, int error) { struct blk_trace *bt; + struct blk_trace_ext *bte; rcu_read_lock(); bt = rcu_dereference(q->blk_trace); - if (likely(!bt)) { + bte = rcu_dereference(q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { rcu_read_unlock(); return; } - __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, - bio_op(bio), bio->bi_opf, what, error, 0, NULL, - blk_trace_bio_get_cgid(q, bio)); + if (bt) { + __blk_add_trace(bt, bio->bi_iter.bi_sector, + bio->bi_iter.bi_size, bio_op(bio), + bio->bi_opf, (u32)what, error, 0, NULL, + blk_trace_bio_get_cgid(q, bio)); + } else if (bte) { + __blk_add_trace_ext(bte, bio->bi_iter.bi_sector, + bio->bi_iter.bi_size, bio_op(bio), + bio->bi_opf, what, error, 0, NULL, + blk_trace_bio_get_cgid(q, bio), + bio_prio(bio)); + } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FDAFC433E0 for ; Thu, 25 Feb 2021 07:06:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D77EB64EDC for ; Thu, 25 Feb 2021 07:06:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232746AbhBYHGf (ORCPT ); Thu, 25 Feb 2021 02:06:35 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13098 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232486AbhBYHFj (ORCPT ); Thu, 25 Feb 2021 02:05:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237261; x=1645773261; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oCu3+kNWbsW2ZNvShwFNhd9xthlLzpeD0o9Ug702zLA=; b=aUYfqxm5ElNMRX9VonJ/8ZJEe0VpHiUw2Ujop9DrX2VlXvJyNuvPQhxP UWaseu3wn/i8IdBWLIh/fMnW+2Lo21V+IEVAlWUxM4o+hHqxyK1oU09d9 RbuIPXp/ABwCTV58qryxg6QkAD4lSPjboinI21sqmiI+lI1c7ydybEZfC iTzPksTYArcJ+u/g+PjwsIGGMlzRU+/ckrWpBVIQ2ZdLVNAdJT/qwBvKf LBvFFs+gz7SN+PY5B+sEZ1Dh8LjtxQI+EUjVQSoR8xltdGu2hScz7mcfC 07CCkpVm1EAQIiyz3G+57ab1eE4pbBhoofBQx/SvzpCX5l9x5GzPb7JAd A==; IronPort-SDR: Q+dkk34Zc4w2OV2u3FNywpJsNBcSQ/REtYCu+/negt6RD9DFhsXUxJRJLdV125q+d6FGYHq5nF DC0uSjBTuNZfZgEIrfDEBm83zWqSvbS+rVwqPtAl35HUbWbYTS4D0YJLFgF/UWjFYXVXMqLZLo zw031ukqsGMPPf5FS1Caot5cSm3CFKqqF+kl0JnPPQKr9nkr+MUD9b1UO/2BYjvcBQuica6I/g eXb/SDqqUZLCAR5msVs2pw7M5c5hMPhh+CitstFeN469Ls+z6DhkjgV5lDUeXwePnjT5DrwJnl SGg= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978876" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:13:06 +0800 IronPort-SDR: MFLFIMLo8QsX1IknvU+4uu7t9LH84ls9VuefsK/yL9m6pfTM0KQlYVoaYsIeetmVsz97B0mrM9 DekNCogVXv6QKo23A/2M7sXaGmaK8ygAiGzbAdV8eZ1hYq+NaxJ2UOpP1iLRcvyqWZRxch1reQ Eub7QZDQzhzwYfNVBBfBpyUa2zo3bjMApNny91pv5q83AtwTZRGh11on4KFBI8mux9MNM9dzwZ oUhjiejTK0Tq8SenPidcfz/nQNaKVQDZVj8xjV8GYzY79ieDTdio47+HCrkK3m78YxinvCxGY2 ANZxYsnbyk8VtS3Goq52WkRu Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:48:05 -0800 IronPort-SDR: WcQGSHilogCONek1dvPeaTZ+NSX6ZsQpzH7zXtz4o78vPCAIOvdh9BGJpfmYDZCj3I/HuvZv5l j2afCI6Pgo+cysftS/CEWeNDd3kZ4aE3j7wBDRQ/k5RWFp4J/lU41LjcjX2Y8ZLi6d2Fs+4k/u Mun8vCjNBzgXaRbugeggqBNZ62Z8Ta4by3ZR3Xkl7hFRjQ6nvcsj2wfjXYBWRii5tIDZR4nHTV 40PriSHdrHwH08V/GGoOm3cg2t9+ZQObMMeGpO9OLzu1V7SPRNYTNu0xcAJhharAvCiOwSCLnA vNI= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:04:49 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 14/39] blktrace: update blk_add_trace_bio_bounce() Date: Wed, 24 Feb 2021 23:02:06 -0800 Message-Id: <20210225070231.21136-15-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 14658b2a3fc8..d4c3ae0f419e 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1277,7 +1277,25 @@ static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, static void blk_add_trace_bio_bounce(void *ignore, struct bio *bio) { - blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, BLK_TA_BOUNCE, 0); + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace); + bte = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_BOUNCE; + } else if (bte) { + ta = BLK_TA_BOUNCE_EXT; + } + rcu_read_unlock(); + blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, ta, 0); } static void blk_add_trace_bio_complete(void *ignore, From patchwork Thu Feb 25 07:02:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E701C433E0 for ; Thu, 25 Feb 2021 07:08:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E97E964ED9 for ; Thu, 25 Feb 2021 07:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231326AbhBYHH7 (ORCPT ); Thu, 25 Feb 2021 02:07:59 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:5434 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232861AbhBYHGy (ORCPT ); Thu, 25 Feb 2021 02:06:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237374; x=1645773374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=42OzqGRcgX68urDOm4p/VfIlMMm4jPAS9tAy3doIZLk=; b=GRUW/ivF6+72zNk90C0Notzju5+2SCKl4sH2aUG5TUZyIWdWRF5TONyd 9ZVGMH9GBK8EGzhKegqfRkrhkCrRwhHrDddAEQfvysd9cjHb0ebhxoClP sjrWI8+YDZR/3mjpSEd3FP1ps035EkC6/UW4rBzb+VJqkTFY7Zu4TuqqE 7/UR4s07LnAiYZnt4OsDUPQ7HDyEU51o5FlJh85dVJcruTm92Tfns3kwa iB43DJ3uZWQej8dCUxL7BwXvyhGi9spokl+YvjuHmW9OmssxdDSDCrjxk KRP4chzii4DwFHLpS1ZBtGuuqV2PosJuu2gXrrIairCc8E5zQkA9ZquOa w==; IronPort-SDR: nC3+SwKP75iaTCw+daEK17psah9StxSd4I9ZnglzHMThd7ZcjMnPCP3TrmZeNCua14Wwn3dBeT sLRD6Fd2rM7q/oASLfNXzZzbKLTWMJ3p5RKnfKJaRGAGaPVzK8YeNkKm8Lj+ES7a7AicEbcyuI lsKPiPyKc5cgeYymISoxbnWTTyYFSw34sUo3/xO5xf4x46IQgDeMOQ7zAfWgTXmFNxl96fBw8R J+JaJLoCnwwCaYnbDuth2IoidxSvORQJq0JEsW9hGhldTgYGXmRWCA6s+6ls4Xv6qzR4hG0fZj TgA= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978883" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:13:19 +0800 IronPort-SDR: O7TDRm2u5yp/kTgILM8hvwXqnKI2e2Tkw7ILwyFfcJVU+r0ZYG2EKkvxv8XHNrJ53LK0+OTeGZ F0yDRDtn5Hl2Fs4oqTRFaS1MJ9mwn9mYjW6VR+BsIkEZLcabbsT/9grIElqaOsR7IA7ikJ4XL2 AWSlZeCTBFpvUxkrDR4lMhDpQnQvWWXuo0o8Uyupem6rzt1qpoowH7J4yxG/dXmSemJq05MPBD uHRl2lnxPkIsy/QS/x5MaAJ+IknXHgb/xtizf5GsshE6xWwsKnfdbCIhJaIoRIOAkvChqCmAmm mSiBhczlSi5vKjb6MjNUVdlz Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:19 -0800 IronPort-SDR: Btwi8E0VZfow8w0HxK2UhZRQiL2RCgR1JsOmX9bXMWXQUq3otnRGBLOSKzRAbAW5wn8aOD7ySE x10VhtpFJjg6hzVRrKutYdIUvnlIy4SCR+r8cCHugDlLo2q+NU+YhH/Sca5mRwGV19ESBn5f31 7UqAkT9skiKuHfizTjBRqPgD+xexZSe5oHeAITT8d3BJsIfwZ/lGjOrNattvrWqFplitzFuxxi FXVqvNGA6JL2et+bGuKqze/lMEik3odMYrEA9wzN1r61tTYul8wCe0Ah6N/VT+etpRwWNWRGYK dWM= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:04:57 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 15/39] blktrace: update blk_add_trace_bio_complete() Date: Wed, 24 Feb 2021 23:02:07 -0800 Message-Id: <20210225070231.21136-16-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d4c3ae0f419e..e3210951f1f0 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1301,7 +1301,25 @@ static void blk_add_trace_bio_bounce(void *ignore, struct bio *bio) static void blk_add_trace_bio_complete(void *ignore, struct request_queue *q, struct bio *bio) { - blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace); + bte = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_COMPLETE; + } else if (bte) { + ta = BLK_TA_COMPLETE_EXT; + } + rcu_read_unlock(); + blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, ta, blk_status_to_errno(bio->bi_status)); } From patchwork Thu Feb 25 07:02:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71D40C433E0 for ; Thu, 25 Feb 2021 07:07:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 17E5364ED3 for ; Thu, 25 Feb 2021 07:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229561AbhBYHHN (ORCPT ); Thu, 25 Feb 2021 02:07:13 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:14102 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbhBYHGM (ORCPT ); Thu, 25 Feb 2021 02:06:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236771; x=1645772771; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RliDRw3pUoQbW2z4uvyiA/GGoWrKbwqiRnsu1squGWo=; b=ao7vUco5Gl3ndUpJkj1gCo5QkQfcl8kmaPmiZ8kgZvWQ0S3Z4Tlc27aM 1yif54EUnd8hwQG1DdcuQv9cZ2NjTYkDBqONoqQDjFdonmuroth/hY6Ax R0BEmCZ51isfRdpSSsHK8e2LT9DfYwQYCNk+ZlFpdEDSYkZHRNOZUh3jv oWtkfFaow/I0kJqSZarFkKt49cTc7k16joYilEOAGlk+jOtcKppqWYcRH 9z0jCjEhQY7RXrjAJ5XxkBWuPe6C06AV+prf0hQpeMqxPPFkWiTr4P9ZJ uRx6Nd3U4KD0271sN2ZZ3s/SFwD1xUEnk2DAqygU+DzFrV/e8xXPmIMpp A==; IronPort-SDR: 8e4DVI3ZsuMKr54iqo7UUBmnD3gRF097IisgvZNtInCrK7Cyw0075tcVm7AkX3jfPKFvf44EyV 1v8A7kd3HbnDUa9NvKU+CSWR9rogKh7/aV2eP5yk2xoSUNJQMtcrfWGqhVq/FQIDUa8aQGj/+q siFP18Ukh2g1rfp4airud27x18MZzzYYuZWvTT/QzyT0ttnIhBi2zp8dTkGO8f5c5yyCDFrn7C qKLGyFIEihaKTDo76Xz4KZPjexF7xmk23Of58Dy7fpgPOfxis0CxFCRljPnBceQ5v0XuoNWizk oPE= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751776" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:05:05 +0800 IronPort-SDR: NgENxV4QowIg8d59Ww5ApWv1fQ/EYPjrSbSvIZVhsrc/02LzkM5bx9HMlrT6pw9bOTXiDHfSVz sK/t+bHj1TCwqqbojC+H0B1NcIqPJQMqNqLdMyJChm6W7EK+kINKOG/o+oFiPqgbmRpE5YWS75 7LAlW6F9Efj9tbLXfOx74LPbdHNLpxBhMXWb0bJcZMQWLkJDUTrHE9dPxZ6RCpOvvsmhcvwebv etClPYCHuwAu4PHMbZX7j8eyDg2S+/gVrioRocJxmwLF1eTZAVP65x+5SDXT/L0aWh73PJO2U5 9xtt+LHYG30njdbYoj3pP0ow Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:27 -0800 IronPort-SDR: MPBBpIG4htHj0h1ebF0opNZPzbHbBmMU/F1pFTs8FhH/WsMq0lF0wrmgacv/z+lksrtIAmGndL lazja2d55S1LQY7D+QzVpbIOxpwh8Ngkricnkj3BCjYGyPCWXtTHENXr0n2yKwmeD4p8H3sTBI sGElFuFmmJmnMCcgcaPHgqDrfls807syUHhLyDRriGfXWWrYRaV/zxXvFLiUlBfuq208TpZU/Z 6jxI7JvoRKeiEDVSC7NQNboG0q60qtdDSA+0t5q4WuBf/FxDPj7sGxKfFJmDssqJ4er5NIFoEY duw= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:05:05 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 16/39] blktrace: update blk_add_trace_bio_backmerge() Date: Wed, 24 Feb 2021 23:02:08 -0800 Message-Id: <20210225070231.21136-17-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index e3210951f1f0..1ebaffb6a3d2 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1325,8 +1325,25 @@ static void blk_add_trace_bio_complete(void *ignore, static void blk_add_trace_bio_backmerge(void *ignore, struct bio *bio) { - blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, BLK_TA_BACKMERGE, - 0); + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace); + bte = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_BACKMERGE; + } else if (bte) { + ta = BLK_TA_BACKMERGE_EXT; + } + rcu_read_unlock(); + blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, ta, 0); } static void blk_add_trace_bio_frontmerge(void *ignore, struct bio *bio) From patchwork Thu Feb 25 07:02:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 670E7C433DB for ; Thu, 25 Feb 2021 07:07:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1467264ED3 for ; Thu, 25 Feb 2021 07:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233121AbhBYHHR (ORCPT ); Thu, 25 Feb 2021 02:07:17 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:53171 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232139AbhBYHGT (ORCPT ); Thu, 25 Feb 2021 02:06:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236778; x=1645772778; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7d7MNmuGjm/4LXsD5U+vaIc0UhTaJT40eTogubgAbUE=; b=S+GBp6bp/rmMlXZU5pnSL59RoNrx6GO5IHRCl9QM6UAopg22O16dqr90 HEAQIcY0c9mCeVBJTVx8ftT/LReF8YgJFwxnP0DPkPCE4JgwXw4A82UOL V0il0c5hObWGfk9pQgabX+bT8zmSOQAJzkIVcGvHZnpW7NaigFTfEkMu1 Xz9+imCpeuY7hAch7lCWUu4ymHIW+avhDxwNDDi86NHfTictWUCWUGOwi nh3CzxdHGXP49rudsUrjYnuBofZXn5G++s011NKzZOG6Wz5Qa1kaj6Ft8 GXJNwubzJ6/LBQkORwjBQMA3kolcYJJUOYan3rc1Iyvs2TlRSHNntNVV3 A==; IronPort-SDR: WZSCtJwueZNz3mHcfB4VC6VZSvtF6sL5WUfFIVfBmFOJXONP7U8eBknWIME/Cjg14qIzRG0s77 9aTvYv08laMJOBBPh7Nqxzp5xLLcXY32Am3NsJ+9xt1d4BUuUNRdvk1Wie7qPhr1vtGobRbInP mBePc3xWBk9PRUAcrYUHlLPeeCBxToYvA/2LhflK+f79wFVt4ThvtmFNoz8Klqio5ngJifeMTl UYM/SNCaiB88seRsIDK2sCNluYlpGtVfX6CI1Nkgs6Fz7Aa6Iru11P45rYJiURU8avvdpnZvoO UKY= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160777950" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:05:13 +0800 IronPort-SDR: WpXYFcFAlnfHBIUTlase7U7mGiJQtXrhIascKu+Nh0lOp9z9r2h0Xan57g3lr3sg55kJijqkdt ev9fh7O80AJS+vT5aXRL+1wPOwMHI0rfzML+PpiaXtBPxqXjqpqD7T2mUmj9543WQA2pmtPabR +agaKtMgV3W4fxtvn6m76FfgEAN4/TXtgSX1wcCUutuI4/0WOZCFgo9KjtBacNO4gz5vQbrYU3 OfkPavwyS3R/xv7WMAda8w1z0O00k0syOG5lzL3Jp4y02tqDJER49eF/krCcBdL5L/wXz9drTL RSYPC+zodCeMZ2swSbzZ1Ppo Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:35 -0800 IronPort-SDR: 13R85S7gLYrIwH7dB4ykXoA9U9qCoqkbh89xBWodtb8/IH9TUCdTqB/6BLn7pPIR3h6okSyquF cWosQxhXEvXz3eAEipBeR6Kf+ncZR+j0QHmshscC01QAuNQ1a45eka5MzyeuEQPtzKIGwT+8Ar y33QJmpFz0YFvhwoYjSBrY0z1Fx1loEunt/o0rwklUBZeCpTpTgnNEaZip3xZSrHiPwOixCvoq x2yPjSPRashiOyzHtTr5OQw0z//+1oo0xztTWLr894lYf64h8l6pOPZOOTX3zE8+BsraFu9TO0 puk= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:05:13 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 17/39] blktrace: update blk_add_trace_bio_frontmerge() Date: Wed, 24 Feb 2021 23:02:09 -0800 Message-Id: <20210225070231.21136-18-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 1ebaffb6a3d2..92c4e5eb8948 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1348,8 +1348,25 @@ static void blk_add_trace_bio_backmerge(void *ignore, struct bio *bio) static void blk_add_trace_bio_frontmerge(void *ignore, struct bio *bio) { - blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, BLK_TA_FRONTMERGE, - 0); + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace); + bte = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_FRONTMERGE; + } else if (bte) { + ta = BLK_TA_FRONTMERGE_EXT; + } + rcu_read_unlock(); + blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, ta, 0); } static void blk_add_trace_bio_queue(void *ignore, struct bio *bio) From patchwork Thu Feb 25 07:02:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DD62C433E0 for ; Thu, 25 Feb 2021 07:08:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E4CF64E85 for ; Thu, 25 Feb 2021 07:08:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233311AbhBYHIN (ORCPT ); Thu, 25 Feb 2021 02:08:13 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13049 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232486AbhBYHHB (ORCPT ); Thu, 25 Feb 2021 02:07:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237384; x=1645773384; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rOGHu10pEh6J1YM+7k5+Aia6scmIzlsX4emCrLh9cE4=; b=m1w15HANV/mBcDKJsq9E51NWNlZ6Azn/n5zO2xfHELSvAn19Zqvyiac0 WBmMZvTajTMMpPPaPMIOCJRHEdLoNA5gzUMzy2SyVyp/9NtZEkrr/3JzT 4Ud+t45EuXAlWPeBNfuvCbsq5uYzpAf/l3MIcuHcVGoAsntk+T6zN5QvN r5jz3Nq4C7q9CSL2QFceXeK02/QxxyZ08YgHHK0QWzduan9/CFFnvE8Yg T1HvBkotpe0n+YTiiCu6/Lll5dP+5IwsFzZbz2ewFMbBBi2tI5FOaYZC7 eZjrc6flKwCFwmy2sHUQM1eratWwClaj4MsqIBFRK8/l3pVp3MIac59rk w==; IronPort-SDR: gca+nFfErfewQLRr4qANXrhyHR9lDRo3njQ+pFze0aC2VBfBFhmdaBBLQzoYDmYLGpXQxfhKyl zp1NCMi2l0seFfID4xXBBcqlxCNHOSFYM0CFCeCK4eWeKpGJ45EKwJaMIe5VjVLzTMMsXgHYzq FCKPugF9vlmuYLkszEuHIkY48EfvgaLmGkfpGEIqC+dkZ9KcrPvPfeIe6B4Q432oIBpm8woyHy 5FoyqsyAq6qYNFh1jpQgqzFP+ELzDRjFml6r0vAWxRSihl0lCayuHoseznDgVlDY3FKO/2N8kv kxw= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978904" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:13:54 +0800 IronPort-SDR: 1wap3JaV1i6RZIw9qBSRt6Rv2imlgzOCbQ0Qvt93crihFZPFFG8gKr8mT2o3ddt83Fpw9BLzmz kmxwg558nCiBW5gACUj/7oGSsR5kBR5DPRk752HWgFGSeRk5aN4EzLkTi9k8Vv5MTLn9xshiSs LCVnsZUvJhIesMdUZ7lHVzL7oSPSlqTlqJ6qjzJAa64Wyg0+WF/MVwel2tfG8E58HDe+rg86bR sZRJRhMhZ0QCrXe2MoGAXQAYfvnEEAx2KUkdXd6Nao6IQVjorLUZAd4t+HUCLIPrHwqBlT0z49 szsOH7xQV56IKHnPrHu2bBOz Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:48:36 -0800 IronPort-SDR: r56t6IHNG9si8K91SdegoAe1Goq1+NHNTq3tq+mvGcRfOPMjmM/L44/Spc+ZZ2iv6FhhHlzlQ1 aTn1A7ebQCeptw7pGTJz+pqmy4LAeVJk/n4zGV+SIYrxDOswzSOLiAjQCOjkpQ1OUL0P9TV/AM l1bYyzk6QzaUpzgz+S4OYWwW0/73eU1BYCc9SzBUDTnc7nS1kcObFu6fJ9nBTKDJCnEpaZXg53 t9GTKzmA4vtk72g8gZRPRyNk6exhgtQMzJwWM503uRd62nsUy4VBYTmwpZJbdk5a55SYWygIpE DQ0= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:05:21 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 18/39] blktrace: update blk_add_trace_bio_queue() Date: Wed, 24 Feb 2021 23:02:10 -0800 Message-Id: <20210225070231.21136-19-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 92c4e5eb8948..45327201ebf6 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1371,7 +1371,25 @@ static void blk_add_trace_bio_frontmerge(void *ignore, struct bio *bio) static void blk_add_trace_bio_queue(void *ignore, struct bio *bio) { - blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, BLK_TA_QUEUE, 0); + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace); + bte = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + + if (bt) { + ta = BLK_TA_QUEUE; + } else if (bte) { + ta = BLK_TA_QUEUE_EXT; + } + rcu_read_unlock(); + blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, ta, 0); } static void blk_add_trace_getrq(void *ignore, struct bio *bio) From patchwork Thu Feb 25 07:02:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0604C433E6 for ; Thu, 25 Feb 2021 07:08:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B9A764E85 for ; Thu, 25 Feb 2021 07:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233243AbhBYHIH (ORCPT ); Thu, 25 Feb 2021 02:08:07 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:14053 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233002AbhBYHG6 (ORCPT ); Thu, 25 Feb 2021 02:06:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236818; x=1645772818; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jQtuXx/YWUBZ2KrGbVMjGytKIm6+oeZ85JzwEpRZQ6s=; b=RMcC11J4QGiUJjlcSsZWziJiG6br5rc9LFPX1r3HLCdalidwwSjSP0qp 1FDjDdDuP3fAhTQpRxD8O5x6PXhPGUS73nbzdA3u0T3rAGhuTIIjGX6KV 0oWqQGYKlRn4Lb0fR3WQKHFkzb3GHCNimiW7hW5B3aUA85iL7gAP1EpHS nq/cavgC+Mg7qXMHyl4BQ1Iukt7jWgyPPBL+nIaypijtpQcKtZglnu1gr 5AWD2lHCYDVN2917l7YTAAcTLmfSpMdymrEZB3BE9xgRn6ZJioZ6DGtxV Q6W/MDdovwUSE9XL2KuWDSfndCne5THADPCkWOyObgXe9qvbBG4/YNC2l A==; IronPort-SDR: yGMHvftYHSAzi3aAZrpaFr/jUz5QM/7Xkybeusk8mk6Aw0wV0TaJ8amKvQysOq1s54RIX27nib sHYvbDnlowkQnGjuYEeSauvCUyxZfOw8vMcNGW78heOtrjXZt1Ab8nM3ulDXSbN/dnj7pHISoV YBsqbe2EOeYJT+smfD99qIm/0wfWxYJ+dof77+/4KgZkozvk0EBnQf1NR/K/bKLsd9xZXK7oot 0XOI3WRK4x8iWWdrhyDqJC5Q5KZ5byddA9bP/DC6h4nwb67a7V9HbnzlnZNuQYDpMvTYQLZrcS 13o= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751810" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:05:28 +0800 IronPort-SDR: Bq2Jvkks4Sj/33ulqaF0JgVNav71DmhsrM+EGw3uTjhFW56diYBv8avafFc606lNQ6vtlnkkgL jWTEcXzVGXIZx24UM6Mv4mUHe5iPOLsHXhf7Tx7GpXXpcUz5SaoEe8B+6e/QXSE64Pq+82eGZf kuAqdJ9uQp1S7pararmMhyqHZ3djNbv1XiaWgnmZ+Pd038/MIIDqxIjlmAz1OEY49LuwHizUJD zmsUzR3aUBJcHe7TA1OEkA7Dsq+ATFb5rg6zEQnu7oIQuQQmSBR+9El7rWymL/Ia03pA9IygPm DPGKkK9fjWpZ+eNG0U2C59MJ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:50 -0800 IronPort-SDR: u9ljBbQJbMqX/PM1h2Z5iB4zff1WM2NCh77DrvDv5b4cZ6VN35ztajy0/LB+pY7zeBEVxYFUZV fT0Mi0wBo8y5nd9g2K2L/XVJUE6K/ScSYqvJq05iAdzzPaeYxyhOIPbcSNxOsWoAoqCqmDnWZd xTsjMcBV+xK6Hi0jZXzaqboxPkWWYW80kSMBlOE8giILGcL9b5YjNxjDpDKEU0NxP1uVDBVPs0 riX90YlDLwjGaQf5hdZEcNhDIjc+x5P2eYMLdwfmLq5SwyK7CH8HGmv/xFHq/2NGdKvAllqtBN LEM= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:05:28 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 19/39] blktrace: update blk_add_trace_getrq() Date: Wed, 24 Feb 2021 23:02:11 -0800 Message-Id: <20210225070231.21136-20-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 45327201ebf6..51c10d86aa92 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1394,7 +1394,24 @@ static void blk_add_trace_bio_queue(void *ignore, struct bio *bio) static void blk_add_trace_getrq(void *ignore, struct bio *bio) { - blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, BLK_TA_GETRQ, 0); + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace); + bte = rcu_dereference(bio->bi_bdev->bd_disk->queue->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + if (bt) { + ta = BLK_TA_GETRQ; + } else if (bte) { + ta = BLK_TA_GETRQ_EXT; + } + rcu_read_unlock(); + blk_add_trace_bio(bio->bi_bdev->bd_disk->queue, bio, ta, 0); } static void blk_add_trace_plug(void *ignore, struct request_queue *q) From patchwork Thu Feb 25 07:02:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82E40C433DB for ; Thu, 25 Feb 2021 07:07:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A11164ED3 for ; Thu, 25 Feb 2021 07:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232588AbhBYHHh (ORCPT ); Thu, 25 Feb 2021 02:07:37 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:26799 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232816AbhBYHGn (ORCPT ); Thu, 25 Feb 2021 02:06:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236802; x=1645772802; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Py6IWxRz+VdBlW3n5qrf5au53uQwXwAWNr3415byY5c=; b=Ntgb5V3SLBPgCR3pYeSZwI+RPCV0V4mXhRs53VJdCSwvsIGIc3HYa2CL Ti0HUigFHOUvXIMczrzydsWgcOBozjz8/HbtK7UFFJX2LauE6oYE9/iKs lYmf/rcPWW6cPCV0thQjvnB+NMiDNBAEBnQmMdaVxv+/NHgat4IboChPT xEHaGtyIvRF5PaL0DKAKF7iVBDM1aPSQkI5kZAj0Eg51VPgCGj2kXDaRT AIsXQ+lMmGZz6HaBaseI0acE9BGPZs6ZQ5RylfWyMYV0BZiNzQ+YT6LAr DE/zaEodAnE810wYlO74cmhoPZSxaExzpFEerEWzcOIv0PQ614cYGCXVe g==; IronPort-SDR: z+kFKqxokK3HqEo5roDPFrdHfmiyq2CS1H5gRLwypjXaIaPk5BkGLj/1FdDr1aX1TWlV+P2P0P umUmkpS+9FpS9E0C3AjOcM9cETx/u1PhROMAKtJ9fwXchBP2z2DJh9+5zxVejXJn/AiJFN0IJO dMaAYv9CQVg5M3rZGdYxe6IOiiB7WrVAjpvbsHNrk50vCvhQ0j/Lh6e5EWr4+2GV3xR9ENYrij Ov830Jz4elkxp1AAIqYhp0EnxCSK+6uHN7EhNs9VjzkAh2OdKfs8ms7OtOfZZ/HeDKFYEQvy87 Tfs= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160777971" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:05:37 +0800 IronPort-SDR: W3owdHiFxr1VqaV32kEu2xJ2S4Us2B9aP05qSSdZ8CYw5bH7dsuKGfvyayCHbneLwWNn6cTgNQ 4eayzsAgIFWpMykhfVHX87iwdQMrxNm4bSP12ThF50jVyyb5hGvh/bGlajYO8CzdgtBj1n3ljh chqZ0MW9sldP0Os7m6d6xbVzY5mAP7hixizzP9VOwlT9GAYwuw31TQpZG/dQfsSP1RlIzPUxvZ 54WXybMvleSaRbOTGciDFRM3cDeH1t75v/UTuZJbnGvWdE5LDRgeSn2ne82HjbY6s66VCHfcr/ K11rIf+/WbIFxjH5sVWizAYH Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:46:58 -0800 IronPort-SDR: ZDf+1Y9VPXY0FIeg4WlyCgPeErXIR2Tk9XrDLppSrAO882b5425LqV1cYPmfU8pKEJ1lG+2xnZ LzaidmD3HMdSwuaNVRUOaAR/a50IcbPJukyGeS1YV5W3ENp5d3doDs9dS/B3hP2i5MYBJ6Hql7 8o4Y63fwqpKaZsQbc+SdYy5PG40pUapFWym3Yf4frIQW4xVYP2CQzevVlUqdELiuP5MTWYDySe bJbejXGZB++u57fo0Uo/ErYjtfsLC1bVTHwqds5snazHncIofDYbNVQHJ0rCvVYNybUDu1ad3L 3U0= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:05:36 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 20/39] blktrace: update blk_add_trace_plug() Date: Wed, 24 Feb 2021 23:02:12 -0800 Message-Id: <20210225070231.21136-21-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 51c10d86aa92..0a9b491bac9e 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1417,11 +1417,20 @@ static void blk_add_trace_getrq(void *ignore, struct bio *bio) static void blk_add_trace_plug(void *ignore, struct request_queue *q) { struct blk_trace *bt; + struct blk_trace_ext *bte; rcu_read_lock(); bt = rcu_dereference(q->blk_trace); + bte = rcu_dereference(q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } if (bt) __blk_add_trace(bt, 0, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL, 0); + else if (bte) + __blk_add_trace_ext(bte, 0, 0, 0, 0, BLK_TA_PLUG_EXT, 0, 0, + NULL, 0, 0); rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F2A0C433DB for ; Thu, 25 Feb 2021 07:08:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 230D564ED3 for ; Thu, 25 Feb 2021 07:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229566AbhBYHI2 (ORCPT ); Thu, 25 Feb 2021 02:08:28 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:13993 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232634AbhBYHHm (ORCPT ); Thu, 25 Feb 2021 02:07:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236861; x=1645772861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y3T+OzM9qlMoPq5UMX3em21f6JJsyAqATFoHOy5IpcM=; b=d5KVFdMcHUtz5tkAmI01Y5k+LCxtMBMqqI9pDySME1IySu6H99Aa6kH1 baLUAcvbp9lfIjZe4qH7P0s+Aq0cBqOeOKOnY78d7xa0/s2br3tkBjzIY ADkpZqC/+9E1l8McTWxIuhGrTvuTq35ISNyE8PS50TqV1mBPwcni38sSl Uk0GomUvGxZqtiBM3BHnIlzD399qr37uuPPr9tlbPZvqlKvpW+AurmGxk IM6qbfVx4tIcXig1unjBgaH0EdTc2cgSQB9/vfCF1hriDBapHn9OxHMk/ vwqwQo9OWSqHsDZAq8p0LMJOsEKaWZbBsq82YUneAUBcGdceHX9H6Fh4C A==; IronPort-SDR: 7p9rKASop30Unnk9iE541ygQBDQFzUv1k73VJBHmKcQqJm+WKpB0TIyPOVBS4DVQUSYeGlSokr YFPVyo/FiQLXy21+qOpKtzSDZoN+ybVH3BFTVPBiYKqtO/ChgMles3jBXScockiLlzESjFXjFa 2CowA1+dQ9/1E9E3HLWApJ8Cm8N37v0F5GJClSAZkF+vHeHLOkCJBCy5P4j6Ja6yFAx7ivpoMt RkhMC4gWL+88uVWZIPcKSXdg9AQAcAJ8xRhpmWvYEuHeULdbvHbCMcmqmgwJB4j3YRG1wSc652 45Q= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751826" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:05:45 +0800 IronPort-SDR: tX5JBq6ano0TMyyOK7dJVj0Hznn1H1AnFhTZWJqLxkVjvMKArzWbN0u+7lsy4MQ0qjNoXIvv++ cU2MEKDpnytI9KSKRu3uQ7rdJcrsLa7JDyi18e+m2BjhJfKQX7d2JP40YxhQhhVfS9eXXoQt2J x+KE/tqleNBAldZs/+2JreF5a/pIX6EMQMytdPonpXhiwCOijJXpcpmzLAgct1jnTEfvRUpGoW dwxCSKy1YSeS8sE5NEUlnUSVwdzfzwe90HeS1cueIMZtH4YRUTFpmEsqY7FM6hYDnKyPSjFLeh F1ehTpdrD2KcJBua02eX+2/Y Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:06 -0800 IronPort-SDR: b7dbboI8h38zwknCrW7l2BOsoIP1NNhTuV/rfLiqRK0NprYGMTn7E3saI1X9ZlHHu+o4w8IZ31 GBxC5c4Nvd6PRgu0D6anHCo+fGoH49KOzjQsSDHSC2p/SCBKOnRgLD1uo1GnXZSewKvnHt6Uy8 QNeVt3UzfKahoBq7o+ckdAkUPC0I7G/KLifTklS3JJMWpefuCyc8fgX/ds4ZBxQu2Ius0s/+nP oqu3ErG0uHrQMf/dHCLLla+1zKYdt6moVMeT3n6HJpiPAH4+NfLoqS/ORLLrfCuiv7eKQzZW4h b9k= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:05:44 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 21/39] blktrace: update blk_add_trace_unplug() Date: Wed, 24 Feb 2021 23:02:13 -0800 Message-Id: <20210225070231.21136-22-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 0a9b491bac9e..1f2857cdbcee 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1438,9 +1438,11 @@ static void blk_add_trace_unplug(void *ignore, struct request_queue *q, unsigned int depth, bool explicit) { struct blk_trace *bt; + struct blk_trace_ext *bte; rcu_read_lock(); bt = rcu_dereference(q->blk_trace); + bte = rcu_dereference(q->blk_trace_ext); if (bt) { __be64 rpdu = cpu_to_be64(depth); u32 what; @@ -1451,6 +1453,16 @@ static void blk_add_trace_unplug(void *ignore, struct request_queue *q, what = BLK_TA_UNPLUG_TIMER; __blk_add_trace(bt, 0, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu, 0); + } else if (bte) { + __be64 rpdu = cpu_to_be64(depth); + u64 what; + + if (explicit) + what = BLK_TA_UNPLUG_IO_EXT; + else + what = BLK_TA_UNPLUG_TIMER_EXT; + __blk_add_trace_ext(bte, 0, 0, 0, 0, what, 0, sizeof(rpdu), + &rpdu, 0, 0); } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E945C433E9 for ; Thu, 25 Feb 2021 07:08:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1132264EDC for ; Thu, 25 Feb 2021 07:08:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233266AbhBYHIL (ORCPT ); Thu, 25 Feb 2021 02:08:11 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:54936 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231375AbhBYHHE (ORCPT ); Thu, 25 Feb 2021 02:07:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236823; x=1645772823; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6ZNSnX34O/Mc5WZvA9o9dHyoDcTUtK8C4J4M5hfGiEo=; b=lgBlGxlCVnrxS9aVNxiwUzd2eZZuKXJh7uIJWB8o3TCPQVT6LYWm8P4i CNqnvRzgOJRXh10wM7YgLoh+Oq7PUJCqbWjkpDmZ+68+OZ10xuvCrjqzf SLdRwM7LcQj395Zp3QBIyNJGvgUZ8+lAFS6uTUG1lEzLEiThGKvg2CA7s WlHwWWjO9FL8hevEUV3VtctOkLRdI68lm4hLzyfm4/o/tPyfin+IbtQVo BmJMNsGfy5OpjWRt4uwudyLFga/dB3nQQkqXoDlY8BxS4Pv3rIVPGkcbO PIc9n9FDGizsdaEpOrFzPgV1M99NZssDseqL72+VP/6m10M1nBiVovhL8 A==; IronPort-SDR: tJ+vw+SMKhYLzCAj6bY2OCbXgTjoJF+jPGeOSQ0uNJbU7NbkFAXGBuYPJtJN09ifKkSVNoANvy twHc/Ry+/n5dnjaNJxIs/K+gEnxYk5wrB2dXlDhm0RzoxMXGqSH6v0Jjqye/ZWpBEC/l9i7SIK 5zDS31yqzop/ru4GXUyxB24LzwVqQABT8XboBJG93txioce4bpNHwbwNk0b+6olccFqFpwmf6X iqtG9dPujboxgje9H5Iz5o1tgekaxedm0bD83GmM+DAisrehCCntOwJnGdVrb7BsaGh0mUD6rK D7I= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160777982" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:05:52 +0800 IronPort-SDR: NoGXjhA85w+FFkBTK+coLSZft+Itvdq/ehOBd6lrv+gWo21XMYEfW3sqZ+TjsB0POArL1L1ULY xQ7r7h/mrOos9Mst6ypBH8f6SoFh+wBqYhOAOoBXSjySMgyUMwH0fj0+d0ovz4s1wWvDQY7Ww5 do85GQP+ZUY8FM3VA+Ew1Wa33s9xG2iCmm8eC3whO/Sb9nbF+AL4Y9EIzyHo4lTYGqpqZz+W4G 0FOUvPDG9QsFg+d/C5GstOb9gthpPznXoeXrNelqaowHcA5KS647H0QT8GVd1yxD4H/GslWBuM 8aj6NTIdCtrJxO1t2rrIBFzH Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:14 -0800 IronPort-SDR: rVpBaMxkvVtFW9lcfZ8I2Jiw21pOxBS4P9vCTczYyypcIkG5CSaYzgDyWtQZymKiYhrgmAabUd wYMsQaiL8JtoOgEx4siiaWIfyXB/2JJM5IC8+ZrM38t//eqMYmrOQbHsOrUBRdcOrK79811xxE DrJLb1u2lIRapYRvTAGW4C4LbJtmwsHzQ8hmm55U+aQco8wNyYJ1lxD6Mg1yVTyAO2zMDUpXOL JfGBP1RVM0ZhbxF8lgLoVOxXxaGz0Wub1lwDT5rd0Ft7J7b5IDrp4e/I+RgiA90LDOvJpkWEF5 Xu0= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:05:52 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 22/39] blktrace: update blk_add_trace_split() Date: Wed, 24 Feb 2021 23:02:14 -0800 Message-Id: <20210225070231.21136-23-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 1f2857cdbcee..35a01cf956a5 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1471,18 +1471,29 @@ static void blk_add_trace_split(void *ignore, struct bio *bio, unsigned int pdu) { struct request_queue *q = bio->bi_bdev->bd_disk->queue; struct blk_trace *bt; + struct blk_trace_ext *bte; + __be64 rpdu = cpu_to_be64(pdu); rcu_read_lock(); bt = rcu_dereference(q->blk_trace); + bte = rcu_dereference(q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } if (bt) { - __be64 rpdu = cpu_to_be64(pdu); - __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, BLK_TA_SPLIT, blk_status_to_errno(bio->bi_status), sizeof(rpdu), &rpdu, blk_trace_bio_get_cgid(q, bio)); + } else if (bte) { + __blk_add_trace_ext(bte, bio->bi_iter.bi_sector, + bio->bi_iter.bi_size, bio_op(bio), + bio->bi_opf, BLK_TA_SPLIT_EXT, + bio->bi_status, sizeof(rpdu), &rpdu, + blk_trace_bio_get_cgid(q, bio), 0); } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D5FAC433DB for ; Thu, 25 Feb 2021 07:08:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5587364E85 for ; Thu, 25 Feb 2021 07:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232538AbhBYHIV (ORCPT ); Thu, 25 Feb 2021 02:08:21 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13098 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233068AbhBYHHG (ORCPT ); Thu, 25 Feb 2021 02:07:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237392; x=1645773392; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qml1l8JUcbImsAtiKdYsTQYk5qDMEZ+xBH4KgzU1AVc=; b=Qexq6d6KItg+OsB4XhEDxrtapD5JjCkUugfK/ur+reIs0terETHFTMm5 3p83Z6Vwiw1bDGKAeO2QXhZ848kca5iDK0vdVexkhsQosh2mCLJJQlDzI 0Q/O5WJvBMRCpdjWXzpuUfjzVzepYZMeJv7xvsep53Ea6yGO+iFJEmDCc 9uKNPJw/P3jYheuXTBcJaMDj4kmVIVXvcs7B9l6UOjXgcfBgPrSuurI3B eD770RCYewnNi+TJcLF2dV36/pRNhx6lgFCwygtUOglSXL+VxdcIOhSU3 teUNOz7dnGxTwgdGGIeI11U0mg9EOaqtCdViT2mm8WJBb9qqefHsooy5L w==; IronPort-SDR: KVbemPO4I6gQ551sgKz5/LMB19ePbfO5Jg0pCOdzdnMZjrPY6SLj5SKYhWM1xnE9t/z5EpvN1f IdsJZWNU5Yh4dJtP+15/Xo5JvoHX2yHf/mC9w6+O7PGLU5tEGe89pOOdJVs9AadQnOz6H5fOPY 7eXWAT+6dkw5aiEuIRajHBk+5cSjgC/VrOUdLLDcOqQWc4UNda8af3kcfS9/AL5adv5B7ToKOZ hZeiixl74Vi0fgC+sOttidjO/NevUEYLyEYldWwle2lGy158nH5Q6ASdp9y1h7mLBuVLkhWRKK FFo= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978957" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:14:54 +0800 IronPort-SDR: aFQldnvsCanRdBYcb05TwFOmZnOhBGerNziXMisxUnzNsN803YIFg0hSYAm9Uk6E5Pn1hmgZbh EWf/eOXQ0ulojQr4jR3ZBmmuq8XPEFsaIq6pA5W0rxedd4DDp/gATxaz467wqdG0Pz+cQtW6EE wyqqH4iQbFKN6yB/4P9NJgzAbFgjqwZO4NDjkXRCsil5qKxk8/+pn4iU8Yh7WYWQ89eQnADx97 tvsVJ94uB1TzDndAQEQA+73oFlrQ4B60CEnTRTr+aSJmIWwR0ObeJRAwNckWV3YzzN5Ybgrs1Y 8tPoE7qRc8ueCELWHDrL7o0t Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:49:15 -0800 IronPort-SDR: sPzIe7Ww++prZTg0HIhk/S/Rh9lTYpxV9Br8zmffDd2JxpJIhBkLxWAgEXjGbSnDc3Cqv1gQKR BSXpcap1nBYL9pnf/Z9e1dNVmjUVGT/s25SIyTMEaUUd4nIPQKOEbGxFGWsj5ZQ+n302kbMNin rG8bDwuo3oLn4IPhU8yLrqTODM8Vxu7qnm2DJxiOR7f2/4io9cAlXsT6pWWifOjfK8aDWrUaMu r1Ps8VxcVD7mk2CL2VwOS2HQ7FZYSyy8etnqLUpL3zO32EH1B090eaaAqPLW8Miz/AkD3mEM2L KUY= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:00 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 23/39] blktrace: update blk_add_trace_bio_remap() Date: Wed, 24 Feb 2021 23:02:15 -0800 Message-Id: <20210225070231.21136-24-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 35a01cf956a5..e12317f48795 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1512,11 +1512,13 @@ static void blk_add_trace_bio_remap(void *ignore, struct bio *bio, dev_t dev, { struct request_queue *q = bio->bi_bdev->bd_disk->queue; struct blk_trace *bt; + struct blk_trace_ext *bte; struct blk_io_trace_remap r; rcu_read_lock(); bt = rcu_dereference(q->blk_trace); - if (likely(!bt)) { + bte = rcu_dereference(q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { rcu_read_unlock(); return; } @@ -1525,10 +1527,18 @@ static void blk_add_trace_bio_remap(void *ignore, struct bio *bio, dev_t dev, r.device_to = cpu_to_be32(bio_dev(bio)); r.sector_from = cpu_to_be64(from); - __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, - bio_op(bio), bio->bi_opf, BLK_TA_REMAP, - blk_status_to_errno(bio->bi_status), - sizeof(r), &r, blk_trace_bio_get_cgid(q, bio)); + if (bt) { + __blk_add_trace(bt, bio->bi_iter.bi_sector, + bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, + BLK_TA_REMAP, bio->bi_status, sizeof(r), &r, + blk_trace_bio_get_cgid(q, bio)); + } else if (bte) { + __blk_add_trace_ext(bte, bio->bi_iter.bi_sector, + bio->bi_iter.bi_size, bio_op(bio), + bio->bi_opf, BLK_TA_REMAP_EXT, bio->bi_status, + sizeof(r), &r, + blk_trace_bio_get_cgid(q, bio), 0); + } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86B35C433DB for ; Thu, 25 Feb 2021 07:09:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35A9364ED3 for ; Thu, 25 Feb 2021 07:09:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233158AbhBYHIx (ORCPT ); Thu, 25 Feb 2021 02:08:53 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:14102 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233159AbhBYHHu (ORCPT ); Thu, 25 Feb 2021 02:07:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236870; x=1645772870; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XwcksvYyDSM2HFUMYUU5AAfRMxXp+zPCmZ2/iCbPVy0=; b=RiWj6wu+LXnbp6bd8ZZaPGuH68XB4rH4x1w8EtEJI3siQVjc5st3xNFa rSegQFTC42ZE15co8gzuchuP9Z4eAC2hTAqtWpNp6SnZin3/6JelgO6Fn HRNtusmIKX+K6zV4RcAnRt2rMaUYNEFZGoCxvJcl4Y4AzlO9Za28//m4N W5ZFgc8riOl6cvl7Ng6dWSydDS/S755RJbJqGQCAmA75A/j1QzktkDh4f Jn3pr/P5w+lPz3XCMFv47RKtYB1DHoQVE/BfiEmPqyf2Dv8rPgmUUeIdi IN9BaqvFmPQ+cChuHAN0u+Wf9FoXRp2wjJldgkU5mS2+WBU6tluQZqhnC Q==; IronPort-SDR: zQXp0kYFIWzmerNxrPtGXnp/JiOyNV0GJTeDvQcrZ9s23WNlgPucXJeDrtmjN9b2AXMaBgGg76 c3pEUKCotv6aQr41DbTEv0DM+X2Q9VjYys3YEiNUQ+LquAP7Amn1CX0de/GjB3Yrn/LRfbRK+6 3Sp2zbpm6c3S8G9LX5l6mSBLVtsKJnvkd/5C2n4Zj8DsDHYazaoxbk9mN6bExJzeGY6AxmH795 VnJZxuMgguIEFKKg2+d0n32OZAmFrllWrBnODyCoOJN6cEjh3Heya3Y3ZPPsxM6RPzjy5zzqOT UBM= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751855" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:06:08 +0800 IronPort-SDR: gXY1GiuANDo6CbQUXXWteNO7aLvQ7B7UvL8EOr47OaaRcSBYye7dMZJ21zhrNiWEYPQkjPp2mk NRJdjV4ANq2nbNYnkZTw/y0UJSunS6sS+dCy3+ytFa2GVG7LPyJAkS95xuu0862lspjsuL94hT k5fCP/fKUVokdeY0uQKZslNWP68q7JLwPTIAD3FFXtV599mqkcUnlcnclkqSczX+K+3zK7ZTcP Li01OIENy6Ti21EaNU6WZSwFYU8FfrAt3PSNMXc6ZGoeDu0D55Nq/ZrZ9Xx1p8SAYl0RmH25rA aI4+Mlg+u2ZYMd6Tx+obaoko Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:29 -0800 IronPort-SDR: r8e2lsnKbLswHVUs16e/podGbXxIsxMCDGTYux+2KdLg4Kn31NTYKPT01lgdPkZA+D7QPnPk9U Uf4u5P/efxNDuu1fa+482qdE7FmX3TFhftinzzsA8IO7FKg+PGBrEzxXGwCNFiMDmhlGBV3j7t q21tVgoq1py4YBccW8JmlsCDbjpg6JQJ0UY1moEXwkOdFc/8lCorryizKMJunAJeBNY03h45bB KJ1WWwAGnkIzaLu08/ltKlvi0fFa8xCS5dF2pcsuWJ4Xy/lPkHipVhFYSNHjA6LXqZDHMNbvwa /qw= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:08 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 24/39] blktrace: update blk_add_trace_rq_remap() Date: Wed, 24 Feb 2021 23:02:16 -0800 Message-Id: <20210225070231.21136-25-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index e12317f48795..0710f2e40404 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1557,12 +1557,14 @@ static void blk_add_trace_bio_remap(void *ignore, struct bio *bio, dev_t dev, static void blk_add_trace_rq_remap(void *ignore, struct request *rq, dev_t dev, sector_t from) { + struct blk_trace_ext *bte; struct blk_trace *bt; struct blk_io_trace_remap r; rcu_read_lock(); bt = rcu_dereference(rq->q->blk_trace); - if (likely(!bt)) { + bte = rcu_dereference(rq->q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { rcu_read_unlock(); return; } @@ -1571,9 +1573,17 @@ static void blk_add_trace_rq_remap(void *ignore, struct request *rq, dev_t dev, r.device_to = cpu_to_be32(disk_devt(rq->rq_disk)); r.sector_from = cpu_to_be64(from); - __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), - rq_data_dir(rq), 0, BLK_TA_REMAP, 0, - sizeof(r), &r, blk_trace_request_get_cgid(rq)); + if (bt) { + __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), + rq_data_dir(rq), 0, BLK_TA_REMAP, 0, + sizeof(r), &r, + blk_trace_request_get_cgid(rq)); + } else if (bte) { + __blk_add_trace_ext(bte, blk_rq_pos(rq), blk_rq_bytes(rq), + rq_data_dir(rq), 0, BLK_TA_REMAP_EXT, 0, + sizeof(r), &r, + blk_trace_request_get_cgid(rq), 0); + } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30055C433E0 for ; Thu, 25 Feb 2021 07:08:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D998D64ED3 for ; Thu, 25 Feb 2021 07:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232861AbhBYHIX (ORCPT ); Thu, 25 Feb 2021 02:08:23 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:20454 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232086AbhBYHHW (ORCPT ); Thu, 25 Feb 2021 02:07:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236842; x=1645772842; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QJljxv9ZKdV4OMHqPsrhlbSrsGdfHzklEixZScRDCEY=; b=SbryPVumkNPvgC52ql0YiHwmKw9O07GKiX5ysEGNF4cOSnOItGv8tckM ksFz+QXlqCKoCXG5m3QQk5NGutjxBvrzC2X5iKpj0BWzHid82SEIcsKtp /8eZ6r88JMurk7NP9RdRZGdfVd8FZGd0jWHjr+494yS3s9w9SEXKqQEGA Pgvwfj9WR4nRHsg8daV/EIKdGIS0xuwpiJMOjb9M6xMVIRDFr7i00711S XV1MbB11G63jh+YFJCqPxj0y5gSde9QOk0bLuVz/6goAVFWrf3xpGSH80 ehnZKQOHFmlOJJnSOzmfQIeuuAvDt1SgcM+bHx4LUlKbQnqguDR3VhK1c g==; IronPort-SDR: BVb2RfEZETTh9RwgCupj7nbSjxEFjOydpLw7FNZMXBaZsYyxE0JSa3Cla1XXdQHHswM3vmxWoR 3wnOOWLp9vTKOJf+s487WopgizIEew/INo7Py2zQ1IBeFyVrbd/rc+AzS78r9N8aaf3uPb/JD/ Rnri9tcmQskVPJAdaJ9t73VFA4/pi48dj4rxPx0ostPcap+qUqVgOGPeZfTfdwl8oi1/jeWSeY jYLQ3dzXS3A+y8xxLGDWp1JhDqOh/sDuaTxToJ77vYW5C/I+1GBjXywqwlKqmgj6zmx2DoQMgW Ghk= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="165245790" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:06:16 +0800 IronPort-SDR: /1KK94gHlDTn14q7Wubc/qLwqbEk2Iu2cjcBgrYM6HilYQ406MQTBiYsaB1TERElnNGb57+IBZ NPtWIMdr5EuLU5t2xz1ADO+fA8brPcSHynVwSTd58pdSNk2h0IuW8kJc4zcSVFaePWGs2MDdCm 9KCuYnumFiIrlQGvG4AAQXG8sj1eo7I+QJycujAHS/p+7yx/cNdu1mUX4PwUbAQ6x+3p9P0Jr9 AzfpP0Gj42EQf/DkBC4NSAKSALyjKZ48xK/YtNidqTlZ23b8sseb6P72p+D0R1UTe2WaXAUPr7 Eke1+EpQuaK3CG8V4tJdEDgZ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:49:31 -0800 IronPort-SDR: urCze7X10jjqtJ+So4HJu3Ac0VQ9NXjnCvbxWxuUADvTBJRYcztZ3bfeaN0hZoMOaf2FyKJmAd xKa0WyfE29Rhi2ELfSNUIFYlxoAxGdWD2KWCb4dTyYJIUWbS523itgVrDxzErVlPmhPZohTA4n ls0zZA9YNGJatHf0jALJyhatxMJxRCVVdiW0BPfZOneXchxRl5TerrZtVp9Q3nIEietp/LYPQE U6zSVsoJPH66vhAoa5mzn2lktP0BVwmjz2yTmt2hMsYpTVq4Yozu8hS7m3bzzpe3Y3euivbdXT mnk= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:15 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 25/39] blktrace: update blk_add_driver_data() Date: Wed, 24 Feb 2021 23:02:17 -0800 Message-Id: <20210225070231.21136-26-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 0710f2e40404..1f9bc2eb31da 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1600,17 +1600,26 @@ static void blk_add_trace_rq_remap(void *ignore, struct request *rq, dev_t dev, void blk_add_driver_data(struct request *rq, void *data, size_t len) { struct blk_trace *bt; + struct blk_trace_ext *bte; rcu_read_lock(); bt = rcu_dereference(rq->q->blk_trace); - if (likely(!bt)) { + bte = rcu_dereference(rq->q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { rcu_read_unlock(); return; } - __blk_add_trace(bt, blk_rq_trace_sector(rq), blk_rq_bytes(rq), 0, 0, - BLK_TA_DRV_DATA, 0, len, data, + if (bt) { + __blk_add_trace(bt, blk_rq_trace_sector(rq), blk_rq_bytes(rq), 0, + 0, BLK_TA_DRV_DATA, 0, len, data, blk_trace_request_get_cgid(rq)); + } else if (bte) { + __blk_add_trace_ext(bte, blk_rq_trace_sector(rq), + blk_rq_bytes(rq), 0, 0, BLK_TA_DRV_DATA_EXT, 0, + len, data, blk_trace_request_get_cgid(rq), + req_get_ioprio(rq)); + } rcu_read_unlock(); } EXPORT_SYMBOL_GPL(blk_add_driver_data); From patchwork Thu Feb 25 07:02:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A74AC433E0 for ; Thu, 25 Feb 2021 07:10:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFE6564E4D for ; Thu, 25 Feb 2021 07:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233615AbhBYHJz (ORCPT ); Thu, 25 Feb 2021 02:09:55 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:5434 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233329AbhBYHIQ (ORCPT ); Thu, 25 Feb 2021 02:08:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237498; x=1645773498; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YIrjN8J8y0s9FmEZoq8v2vDrrP7j1iwQGvx1511RvM8=; b=MiQjW7HrPlWMsC2TtRmm7Kk52bybTugl9IdVDCWlWBOimCfWog81btCS bwNHELFUG0PybaRyWgR1ME1MTPeLlto5yajyBVg37FLBBeVXb89ZkN2H/ 0vju4/3qIQZINvA71DfxhSNUxKhV41IVcvGNJoN66cPTaVq362CJMwH19 +o11TPz6mkjGfLbOx3dgM2QslhIHsaOS+CJdw7SS7YJVer9WfC879BPJB GKrDwyt3n5NaJXQm4RMlzudgoSMQAgcPToVhWatkeOPNXCLW7AkNKFnaY bGPEo7B9A/9jTugMBPlx6TYgqGvOK135gkaHZo4eDi8IBbfAWVDpAFZ9W w==; IronPort-SDR: +1h4R6smeg+45su5EgT+5LpN/tx8RcACASjTK+7uTN3Eq/WCEiS1e+AEPKTmhoJ2AfP/Izx7i5 ZRXNr0wro/EGtnClTz99I9TtXg+4ErO92mshNqRGLdl4aovYi+ahlQNTxeYp2voQMtDg78J1gK XpGappSvzU5HF3QkPFuK7U74a3C5OJ/BYQizr2iqjQUtk4sbHi/Ov1ekVcgHgU9nkkyQf+jidZ clCge735Igtza8PsUQ/blapcxnHmXOfSuafujOn8iy5IrmusC5rSnKdJmOPRKsLl5yKyRfnwSh mNU= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978989" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:15:28 +0800 IronPort-SDR: VrXXPoZ0VK1+WM50WzFRfyWMp2fT1hrjepAOm2JxRphdwh8LW+C5uTm5ijPRKv+tmm9dqDQ4yj ICTHTW05Ago1uYemcPrv0T785EIxJTiIFMRTnQBUi3zdpy4X6Oo2E2HbfLzZlggBAB2cMH9S3Y G0BF5LcWbAr4jNS9XcG/fejoa+IsQ7itBEmXUw8RUa7xrIKQuu/H7bEV5BnvfkwbPlDZl47FsA IHgM8fN9Hl93wg4PiwIupdKqGsbETvnRLOyvWZi1wUccmI2zbVNh86HppUNvh8Noq3357sZYt1 /i8Rf8wK+MJ+bz0COlGFvD4A Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:47:44 -0800 IronPort-SDR: Snxudnct31WEUyWcEiTZX+P6QojNkpwGT+jQAojQqESUryUG5GpUnkVB9ppN/nGdzexmeRFF2m cGymp1c/Pijje14xIa4B6T5W89XjAfpk0KKPe3zY4/iAsWwdcIyYnnL3ESfOUMJRXDniuPA37R W74KpFbSiE4/s6fCcTJ+UNdNZ6A/AHxodIpRG2KekabU1hWc9qCACB10Y+lxrDP6eN+znsZBs/ eKkXyhyl7u6KTmIh/TXpHsgPQXJ8DcIyTU/ct67pU0UmoAJLnym/jcI+XwIayYlrT3ZIuK0tBz Cuk= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:23 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 26/39] blktrace: add trace entry & pdu helpers Date: Wed, 24 Feb 2021 23:02:18 -0800 Message-Id: <20210225070231.21136-27-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 1f9bc2eb31da..84bee8677162 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1728,52 +1728,107 @@ const struct blk_io_trace *te_blk_io_trace(const struct trace_entry *ent) return (const struct blk_io_trace *)ent; } +static inline +const struct blk_io_trace_ext *te_blk_io_trace_ext(const struct trace_entry *ent) +{ + return (const struct blk_io_trace_ext *)ent; +} + static inline const void *pdu_start(const struct trace_entry *ent, bool has_cg) { return (void *)(te_blk_io_trace(ent) + 1) + (has_cg ? sizeof(u64) : 0); } +static inline const void *pdu_start_ext(const struct trace_entry *ent, bool has_cg) +{ + return (void *)(te_blk_io_trace_ext(ent) + 1) + + (has_cg ? sizeof(u64) : 0); + +} + static inline u64 t_cgid(const struct trace_entry *ent) { return *(u64 *)(te_blk_io_trace(ent) + 1); } +static inline const void *cgid_start_ext(const struct trace_entry *ent) +{ + return (void *)(te_blk_io_trace_ext(ent) + 1); +} + static inline int pdu_real_len(const struct trace_entry *ent, bool has_cg) { return te_blk_io_trace(ent)->pdu_len - (has_cg ? sizeof(u64) : 0); } +static inline int pdu_real_len_ext(const struct trace_entry *ent, bool has_cg) +{ + return te_blk_io_trace_ext(ent)->pdu_len - + (has_cg ? sizeof(u64) : 0); +} + static inline u32 t_action(const struct trace_entry *ent) { return te_blk_io_trace(ent)->action; } +static inline u64 t_action_ext(const struct trace_entry *ent) +{ + return te_blk_io_trace_ext(ent)->action; +} + static inline u32 t_bytes(const struct trace_entry *ent) { return te_blk_io_trace(ent)->bytes; } +static inline u32 t_bytes_ext(const struct trace_entry *ent) +{ + return te_blk_io_trace_ext(ent)->bytes; +} + static inline u32 t_sec(const struct trace_entry *ent) { return te_blk_io_trace(ent)->bytes >> 9; } +static inline u32 t_sec_ext(const struct trace_entry *ent) +{ + return te_blk_io_trace_ext(ent)->bytes >> 9; +} + static inline unsigned long long t_sector(const struct trace_entry *ent) { return te_blk_io_trace(ent)->sector; } +static inline unsigned long long t_sector_ext(const struct trace_entry *ent) +{ + return te_blk_io_trace_ext(ent)->sector; +} + static inline __u16 t_error(const struct trace_entry *ent) { return te_blk_io_trace(ent)->error; } +static inline __u16 t_error_ext(const struct trace_entry *ent) +{ + return te_blk_io_trace_ext(ent)->error; +} + static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg) { const __be64 *val = pdu_start(ent, has_cg); return be64_to_cpu(*val); } +static __u64 get_pdu_int_ext(const struct trace_entry *ent, bool has_cg) +{ + const __u64 *val = pdu_start_ext(ent, has_cg); + return be64_to_cpu(*val); +} + typedef void (blk_log_action_t) (struct trace_iterator *iter, const char *act, bool has_cg); From patchwork Thu Feb 25 07:02:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56CAFC433E0 for ; Thu, 25 Feb 2021 07:09:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E18964ED3 for ; Thu, 25 Feb 2021 07:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbhBYHJO (ORCPT ); Thu, 25 Feb 2021 02:09:14 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:53171 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233169AbhBYHHx (ORCPT ); Thu, 25 Feb 2021 02:07:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236873; x=1645772873; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SC0pXVUCDuaPbg+F0lWxh72IEBX9ZhX5hajRxPIkVPU=; b=pAhZPr0Arm7V5sKxUnWamD5hWEWw4DuckhDm2ALM0LeXH2sX3ladTrDR UT6R4q3kf5BefyvKCYNpvTrjoxtCkQfeA7az7iGzZzrQJ2BpUBaM+C2y0 Q7rZ2gBgKF70ZcXtETOvB9WScshgTHCWxb0nPCIhY44K1lhgPhwC32tGf JpP+Zrt+L72wloBahBmXSoDSL1iLh52BvrvhlDA8q9ZBZSgbtzELp6oy/ O2YauWXEWeaSkjlEg/HIWm2Ji7YtXtTXROEsmrLPmCZbG7QPK38H9FF9v KPxW/87v0BxECPeDNb0tqqIOO0UNZ77jLz5s3SbigPGU/9Dc7SZD5BPjQ g==; IronPort-SDR: 4K/2Qj4LqJKPs+drCu7XeWEux3OU1EysjFUzX/bIiMjIODfdNLBMjE/9UoMmgoW7X1kHyqVclH jagyonPEnAU7fKe/06JhuZCThZSbCwFG6Jp8VKFi65zaG0ktHU8kyky4zCsQztnjfauO1zAZTF ydaGjYh2/6vBeRADfu+1CN+lFX1h7FhhM5DBL05OKFE34SlgfSShZ0gL5vzFpqCc6dWSaBD43b sp50W+dhWV+rvFItsLa4dJzmEuPwdSu+AAU4ejAN+xAcqMJRPwlIOUOO2KTj4/oHNtIqUm833q qYU= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160778025" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:06:31 +0800 IronPort-SDR: O2EYhLQUJDq6JMLiMDc3GXjzcxEvV8vQn5QAFER9XsLRQgoUkkWth52FKcRaJNfGWGHYSb5UaN SHj8gSb02B6I5qLx0ZMO7sm2jedqI94wYYQrlXAnffUY86yV1FEOtcuwmHbw7GXFH3396Hw+mT D2+YGX1qupZcNe8Y9YnyAdd5yYiYKMhuVEF1Y0tOSko1zgDV6d8uwnEXSQRDe4moJ0tepZvT19 gbdE2al46mtw3y6eWtBrOyMZPTCMBiIA+LdAF+L0lR75TZ/QzR9B9UL/aE/Y865Ys8weUyegcg 6mRXiYQ46nNqUnijvr6bJMMg Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:49:46 -0800 IronPort-SDR: 5UjRW13wELQaoILvjTuJW1uTQ2Reo7QcTwFg2ymZEjUdyxbflF4kqglXRB7TbrN679yLIo/9eh LtbOIm1qTpRdn4iXSBx9rNuewZfhwkWo3tWtVc/amVN45ND5g5qeuuS36hANy2pefoezaHLEQT ox9ILkFA+vIKM1c0jmUBZgnXs2Dp/DvZRqxGqydoWJhyxwQI06CUJMCm2u8AlI47ihwtGu3RqP 8qwPUdC+DYY8DXJhe1GbM6F++EZP7fspwojPhxAdwa3OtOLVFsi841xwGQb8ii21s4Fq4W/aVp 5A0= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:30 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 27/39] blktrace: add a new formatting routine Date: Wed, 24 Feb 2021 23:02:19 -0800 Message-Id: <20210225070231.21136-28-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 84bee8677162..2241c7304749 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1722,6 +1722,62 @@ static void fill_rwbs(char *rwbs, const struct blk_io_trace *t) rwbs[i] = '\0'; } +static void fill_rwbs_ext(char *rwbs, const struct blk_io_trace_ext *t) +{ + int i = 0; + int tc = t->action >> BLK_TC_SHIFT_EXT; + + if ((t->action & ~__BLK_TN_CGROUP) == BLK_TN_MESSAGE_EXT) { + rwbs[i++] = 'N'; + goto out; + } + + if (tc & BLK_TC_FLUSH) + rwbs[i++] = 'F'; + + if (tc & BLK_TC_DISCARD) + rwbs[i++] = 'D'; + else if ((tc & BLK_TC_WRITE_ZEROES)) { + rwbs[i++] = 'W'; + rwbs[i++] = 'Z'; + } else if ((tc & BLK_TC_ZONE_RESET)) { + rwbs[i++] = 'Z'; + rwbs[i++] = 'R'; + } else if ((tc & BLK_TC_ZONE_RESET_ALL)) { + rwbs[i++] = 'Z'; + rwbs[i++] = 'R'; + rwbs[i++] = 'A'; + } else if ((tc & BLK_TC_ZONE_APPEND)) { + rwbs[i++] = 'Z'; + rwbs[i++] = 'A'; + } else if ((tc & BLK_TC_ZONE_OPEN)) { + rwbs[i++] = 'Z'; + rwbs[i++] = 'O'; + } else if ((tc & BLK_TC_ZONE_CLOSE)) { + rwbs[i++] = 'Z'; + rwbs[i++] = 'C'; + } else if ((tc & BLK_TC_ZONE_FINISH)) { + rwbs[i++] = 'Z'; + rwbs[i++] = 'F'; + } else if (tc & BLK_TC_WRITE) + rwbs[i++] = 'W'; + else if (t->bytes) + rwbs[i++] = 'R'; + else + rwbs[i++] = 'N'; + + if (tc & BLK_TC_FUA) + rwbs[i++] = 'F'; + if (tc & BLK_TC_AHEAD) + rwbs[i++] = 'A'; + if (tc & BLK_TC_SYNC) + rwbs[i++] = 'S'; + if (tc & BLK_TC_META) + rwbs[i++] = 'M'; +out: + rwbs[i] = '\0'; +} + static inline const struct blk_io_trace *te_blk_io_trace(const struct trace_entry *ent) { @@ -2514,5 +2570,6 @@ void blk_fill_rwbs(char *rwbs, unsigned int op) } EXPORT_SYMBOL_GPL(blk_fill_rwbs); + #endif /* CONFIG_EVENT_TRACING */ From patchwork Thu Feb 25 07:02:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1318EC433DB for ; Thu, 25 Feb 2021 07:10:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8DE564ED3 for ; Thu, 25 Feb 2021 07:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233817AbhBYHKY (ORCPT ); Thu, 25 Feb 2021 02:10:24 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13049 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232596AbhBYHIh (ORCPT ); Thu, 25 Feb 2021 02:08:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237528; x=1645773528; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nW/cmAEGEcgZbRtFTdFsCAsbqIyXkGA21B4Ruo36fus=; b=Gi3HpZ6mXi9915ZLw8kmJgStq6icuEc3qdP+wovMKmTff41OSrTvdMJw 0zLSAVueX6m4e+LYE+mc/PFHx+3Y3SNVi/AMJ1n5PB/hK3hgbnlGXqAyW x6JWOGFgve4FKab1bvVEe5VjaczZsngnqe1k7PWS+Ln8luWH6PzXLmdS3 WMQM47bt+sh4er5xiCsy5ZKr1qD0FHHeBnPZ1ijCfGhahmEqCJApRpWdj dfRZBmuYkPg0HN9qcmLjgTGA8nGq5wkYJ5V47zMvDXr4CDS1hDKcG0Q/P WdrNa1PgN0vgNZL1DG5gAejyR7CNS9V5fJr64DB3PxyXLCtczsGHYXZA5 A==; IronPort-SDR: Ps7tSymEFWZXg/dsOF3ActnBlDiYZ7bKeWt+LQcTCg3NJNGuuWwq8ktDg1UsoFiYf5ygIVb0+X Xmg+3jsvePIm4J5zivAb7i9vWD0J6DyeP0I8o6o1uFjbpNNPl/4sv0MSSTz8ftNLAhBtTgZ6az pjhWZAUimxILCeTRs+Tu+VB801ujehehLCZfTKgbg5ZTSCmsvYpxZd0BligcNUj+poCPSv6j1q 8OtaNPuxBu46hv7P04pblg7ayke41eaa2ANpZ1YN3uFxnhKKJmbMyEiUdXp3ffiBhmZt4VFhPA AoY= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264978997" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:15:51 +0800 IronPort-SDR: zSQb9hDUteibx8kGfmRUCA+Uh6GurbINI6LD4OP/b0rOKJHH1ewn7fCk7NlgDGaf953LmibmbV Wp8dx3EUUt3xY64PqUo3q9vkHBSrEjN2fTI+LJWtSy13MfdTFIt0O+Fhv2IuRYP29IPTT6U9k9 sfK7yAw2cZuKFR4BZqeyIrIasW8Qm/CSMO14xcAr2ShkbbN6y5TRl/ti9nc9tb6xdeR0xHoEE+ Gu2ARb0LRp4Xai40p7t1PzG6RcUL39YjGHWHS3Zf3TgWgZRfezgeCgFYjz5VXpiwtOCNcq2YYT 8VV31c+TlNIEDTsifj5Wy4hZ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:48:00 -0800 IronPort-SDR: p54ivtLl1cUh8l/ibC2RBUdDuD+07LGlub+OkBDVVPqkg4UvXDGJ5dPlQflaC7lm6SYs+12QPk neKJpiZbmcBzEoFnaVfq9jr8hbcV8wD9JVlKXxoK28kcq/3+PvtytA+RSAxlhND1zNaSfD5QWY wGp/fZ8qqiFIIShgxWuxddqGwwMTJS6WPr3YtDvmc9tOcvc06OIu+AgnjPIfERxsCAK1AxaVPX So9RQb40cXTqprfWeByBqaeWsc/kzhhucyEoV8yFpeQHOqunrE7qsSCbRsnw6kTtC3An4pNSjH fSA= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:38 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 28/39] blktrace: add blk_log_xxx helpers() Date: Wed, 24 Feb 2021 23:02:20 -0800 Message-Id: <20210225070231.21136-29-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 175 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 2241c7304749..425756a62457 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1905,6 +1905,23 @@ static void blk_log_action_classic(struct trace_iterator *iter, const char *act, secs, nsec_rem, iter->ent->pid, act, rwbs); } +static void blk_log_action_classic_ext(struct trace_iterator *iter, const char *act, + bool has_cg) +{ + char rwbs[RWBS_LEN]; + unsigned long long ts = iter->ts; + unsigned long nsec_rem = do_div(ts, NSEC_PER_SEC); + unsigned secs = (unsigned long)ts; + const struct blk_io_trace_ext *t = te_blk_io_trace_ext(iter->ent); + + fill_rwbs_ext(rwbs, t); + + trace_seq_printf(&iter->seq, + "%3d,%-3d %2d %5d.%09lu %5u %2s %3s ", + MAJOR(t->device), MINOR(t->device), iter->cpu, + secs, nsec_rem, iter->ent->pid, act, rwbs); +} + static void blk_log_action(struct trace_iterator *iter, const char *act, bool has_cg) { @@ -1947,6 +1964,35 @@ static void blk_log_action(struct trace_iterator *iter, const char *act, MAJOR(t->device), MINOR(t->device), act, rwbs); } +static void blk_log_action_ext(struct trace_iterator *iter, const char *act, + bool has_cg) +{ + char rwbs[RWBS_LEN]; + const struct blk_io_trace_ext *t = te_blk_io_trace_ext(iter->ent); + + fill_rwbs_ext(rwbs, t); + if (has_cg) { + u64 id = t_cgid(iter->ent); + + if (blk_tracer_flags.val & TRACE_BLK_OPT_CGNAME) { + char blkcg_name_buf[NAME_MAX + 1] = "<...>"; + + cgroup_path_from_kernfs_id(id, blkcg_name_buf, + sizeof(blkcg_name_buf)); + trace_seq_printf(&iter->seq, "%3d,%-3d %s %2s %3s ", + MAJOR(t->device), MINOR(t->device), + blkcg_name_buf, act, rwbs); + } else + trace_seq_printf(&iter->seq, + "%3d,%-3d %llx,%-llx %2s %3s ", + MAJOR(t->device), MINOR(t->device), + id & U32_MAX, id >> 32, act, rwbs); + } else + trace_seq_printf(&iter->seq, "%3d,%-3d %2s %3s ", + MAJOR(t->device), MINOR(t->device), act, rwbs); +} + + static void blk_log_dump_pdu(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { @@ -1986,6 +2032,45 @@ static void blk_log_dump_pdu(struct trace_seq *s, trace_seq_puts(s, ") "); } +static void blk_log_dump_pdu_ext(struct trace_seq *s, + const struct trace_entry *ent, bool has_cg) +{ + const unsigned char *pdu_buf; + int pdu_len; + int i, end; + + pdu_buf = pdu_start_ext(ent, has_cg); + pdu_len = pdu_real_len_ext(ent, has_cg); + + if (!pdu_len) + return; + + /* find the last zero that needs to be printed */ + for (end = pdu_len - 1; end >= 0; end--) + if (pdu_buf[end]) + break; + end++; + + trace_seq_putc(s, '('); + + for (i = 0; i < pdu_len; i++) { + + trace_seq_printf(s, "%s%02x", + i == 0 ? "" : " ", pdu_buf[i]); + + /* + * stop when the rest is just zeroes and indicate so + * with a ".." appended + */ + if (i == end && end != pdu_len - 1) { + trace_seq_puts(s, " ..) "); + return; + } + } + + trace_seq_puts(s, ") "); +} + static void blk_log_generic(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { char cmd[TASK_COMM_LEN]; @@ -2005,6 +2090,28 @@ static void blk_log_generic(struct trace_seq *s, const struct trace_entry *ent, } } +static void blk_log_generic_ext(struct trace_seq *s, + const struct trace_entry *ent, + bool has_cg) +{ + char cmd[TASK_COMM_LEN]; + + trace_find_cmdline(ent->pid, cmd); + + if (t_action(ent) & BLK_TC_ACT_EXT(BLK_TC_PC)) { + trace_seq_printf(s, "%u ", t_bytes_ext(ent)); + blk_log_dump_pdu_ext(s, ent, has_cg); + trace_seq_printf(s, "[%s]\n", cmd); + } else { + if (t_sec_ext(ent)) + trace_seq_printf(s, "%llu + %u [%s]\n", + t_sector_ext(ent), + t_sec_ext(ent), cmd); + else + trace_seq_printf(s, "[%s]\n", cmd); + } +} + static void blk_log_with_error(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { @@ -2022,6 +2129,23 @@ static void blk_log_with_error(struct trace_seq *s, } } +static void blk_log_with_error_ext(struct trace_seq *s, + const struct trace_entry *ent, bool has_cg) +{ + if (t_action_ext(ent) & BLK_TC_ACT_EXT(BLK_TC_PC)) { + blk_log_dump_pdu_ext(s, ent, has_cg); + trace_seq_printf(s, "[%d]\n", t_error_ext(ent)); + } else { + if (t_sec_ext(ent)) + trace_seq_printf(s, "%llu + %u [%d]\n", + t_sector_ext(ent), + t_sec_ext(ent), t_error_ext(ent)); + else + trace_seq_printf(s, "%llu [%d]\n", + t_sector_ext(ent), t_error_ext(ent)); + } +} + static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); @@ -2033,6 +2157,18 @@ static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bo be64_to_cpu(__r->sector_from)); } +static void blk_log_remap_ext(struct trace_seq *s, const struct trace_entry *ent, + bool has_cg) +{ + const struct blk_io_trace_remap *__r = pdu_start_ext(ent, has_cg); + + trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n", + t_sector_ext(ent), t_sec_ext(ent), + MAJOR(be32_to_cpu(__r->device_from)), + MINOR(be32_to_cpu(__r->device_from)), + be64_to_cpu(__r->sector_from)); +} + static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { char cmd[TASK_COMM_LEN]; @@ -2042,6 +2178,16 @@ static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, boo trace_seq_printf(s, "[%s]\n", cmd); } +static void blk_log_plug_ext(struct trace_seq *s, const struct trace_entry *ent, + bool has_cg) +{ + char cmd[TASK_COMM_LEN]; + + trace_find_cmdline(ent->pid, cmd); + + trace_seq_printf(s, "[%s] %llu\n", cmd, get_pdu_int_ext(ent, has_cg)); +} + static void blk_log_unplug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { char cmd[TASK_COMM_LEN]; @@ -2051,6 +2197,16 @@ static void blk_log_unplug(struct trace_seq *s, const struct trace_entry *ent, b trace_seq_printf(s, "[%s] %llu\n", cmd, get_pdu_int(ent, has_cg)); } +static void blk_log_unplug_ext(struct trace_seq *s, const struct trace_entry *ent, + bool has_cg) +{ + char cmd[TASK_COMM_LEN]; + + trace_find_cmdline(ent->pid, cmd); + + trace_seq_printf(s, "[%s] %llu\n", cmd, get_pdu_int_ext(ent, has_cg)); +} + static void blk_log_split(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { char cmd[TASK_COMM_LEN]; @@ -2061,6 +2217,16 @@ static void blk_log_split(struct trace_seq *s, const struct trace_entry *ent, bo get_pdu_int(ent, has_cg), cmd); } +static void blk_log_split_ext(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) +{ + char cmd[TASK_COMM_LEN]; + + trace_find_cmdline(ent->pid, cmd); + + trace_seq_printf(s, "%llu / %llu [%s]\n", t_sector_ext(ent), + get_pdu_int_ext(ent, has_cg), cmd); +} + static void blk_log_msg(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { @@ -2070,6 +2236,15 @@ static void blk_log_msg(struct trace_seq *s, const struct trace_entry *ent, trace_seq_putc(s, '\n'); } +static void blk_log_msg_ext(struct trace_seq *s, const struct trace_entry *ent, + bool has_cg) +{ + + trace_seq_putmem(s, pdu_start_ext(ent, has_cg), + pdu_real_len_ext(ent, has_cg)); + trace_seq_putc(s, '\n'); +} + /* * struct tracer operations */ From patchwork Thu Feb 25 07:02:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40FD1C433E6 for ; Thu, 25 Feb 2021 07:11:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F112264ED3 for ; Thu, 25 Feb 2021 07:11:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231974AbhBYHLK (ORCPT ); Thu, 25 Feb 2021 02:11:10 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13098 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233443AbhBYHI6 (ORCPT ); Thu, 25 Feb 2021 02:08:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237562; x=1645773562; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=noVlfdAKnU4/DGq6YcXktGnI8djjvUkkGf2lKgCrAX4=; b=cSPIYwhGSIUejV88S5mKlwioyBu6zbWW1mtPo90H8faTR7QILTFRpGxp ELianDUDr28tdOFE9idOto/0qzezhYC9GZC0qxg8aggG8nFwKdoSdA1Er 6qCGNi9rzgRknoxfjV2w6oRZiGcE4L0jZ7yAACPL5w9P4ifxmHSfBZY9D X9VB/VBOVk9BklHu8183u5TqK/aMoGZJ2Xq/oQzYtL4jS1btWqWAoMmBe yVaQqyBVFExEr4x+vH7ccRSdJ7GpYbfLFCqInXKHdiDgjC5j1g8NqkTTW 82WVWTlXV+qaRNFCoKkf8UKibKksdhJfRQVx9vSV1qa2VB6b6cYQnyxn9 w==; IronPort-SDR: 8gqxMM8ZWzHpKGx+n1PWvpekDx8AWvcPgAghsllp6V2uXMXIqtg0tZM7od/aiiwOwnMxx3RCli nuymznVq0U5V2UGzndHgM6Ley2QL4cgV/Je/DtolfzPVegyYzZ/Ru4awaudSn48WfwLZDhaWa+ /GSExXVYpMYBsv0syx55tgEeXH6H38mPTt+HD56QfCSaEc9L7soRqSUiQr1/7+B/FEWNYxRfiP 5Bz0meudCACB8sXg+eiOhWmhFja8HEgy71hh6wV8gF3qeH6ShZEfmGmMAltEnKCd4pE6Typ05q Z4s= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264979007" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:16:03 +0800 IronPort-SDR: rsNQwtKUayRvaSkli0NLoqm1GObehnsms0PPysiLq+d4vDtTvq2LPc+/hfDISMpUUSY9tFlquy CtdKDEnHlEvi8iyw4C3KXJvcBVmMUyE4f4uw7VVxDOznhEuOd+16+GWthpVPTCtXnooS5bFDng UzIcB+99MkRr/S5sf1fkgpnAyxff89q1XLhTbkJNQ2qqO6w6nCVL190mjPyWRRei8nZDUDb+yx JJXDFr6n0T1neVd3sdBR9VFggAGvItS3LbD9zSoVsdMxOzfQPY9y/wMaC1cN3cWbvhrXJ/Xoun dLnujhaFKkR0ZDW0/liTV2jS Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:50:01 -0800 IronPort-SDR: vmgi6cHID6K41DB+8KrCq4QjXdT70xFkXHUOdUmSgXrJwU9B2QMv7y/3Si5TgBo85fwjIblUhc WoYO3YwnUJXGat67wjhTWCk5EV6WZKdLYnXsnoyshNnoAbrlC6XvUtOq8xuXf5y0vnGxsMSZD9 TjPusohN+UnSYA/ElQwAZU7Mh3Vy9smvxumz6fjlAIm3/Q+MfmfX6dXmSW3ibXK9QIsbcGzgcR 3QlhcEnH1GvHyiI0J1BPhWmp+XZR6TocQ4qSzTejWkkZcATBZj2WxmVdzhfcVK6hEv28w2j6a7 30Q= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:46 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 29/39] blktrace: link blk_log_xxx() to trace action Date: Wed, 24 Feb 2021 23:02:21 -0800 Message-Id: <20210225070231.21136-30-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 425756a62457..4a4ba1d45cb9 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -2301,6 +2301,28 @@ static const struct { [__BLK_TA_REMAP] = {{ "A", "remap" }, blk_log_remap }, }; +static const struct { + const char *act[2]; + void (*print)(struct trace_seq *s, const struct trace_entry *ent, + bool has_cg); +} what2act_ext[] = { + [__BLK_TA_QUEUE] = {{ "Q", "queue" }, blk_log_generic_ext }, + [__BLK_TA_BACKMERGE] = {{ "M", "backmerge" }, blk_log_generic_ext }, + [__BLK_TA_FRONTMERGE] = {{ "F", "frontmerge" }, blk_log_generic_ext }, + [__BLK_TA_GETRQ] = {{ "G", "getrq" }, blk_log_generic_ext }, + [__BLK_TA_SLEEPRQ] = {{ "S", "sleeprq" }, blk_log_generic_ext }, + [__BLK_TA_REQUEUE] = {{ "R", "requeue" }, blk_log_with_error_ext }, + [__BLK_TA_ISSUE] = {{ "D", "issue" }, blk_log_generic_ext }, + [__BLK_TA_COMPLETE] = {{ "C", "complete" }, blk_log_with_error_ext }, + [__BLK_TA_PLUG] = {{ "P", "plug" }, blk_log_plug }, + [__BLK_TA_UNPLUG_IO] = {{ "U", "unplug_io" }, blk_log_unplug_ext }, + [__BLK_TA_UNPLUG_TIMER] = {{ "UT", "unplug_timer" }, blk_log_unplug_ext}, + [__BLK_TA_INSERT] = {{ "I", "insert" }, blk_log_generic_ext}, + [__BLK_TA_SPLIT] = {{ "X", "split" }, blk_log_split_ext }, + [__BLK_TA_BOUNCE] = {{ "B", "bounce" }, blk_log_generic_ext }, + [__BLK_TA_REMAP] = {{ "A", "remap" }, blk_log_remap_ext }, +}; + static enum print_line_t print_one_line(struct trace_iterator *iter, bool classic) { From patchwork Thu Feb 25 07:02:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C69AC433E6 for ; Thu, 25 Feb 2021 07:13:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 218F864EF5 for ; Thu, 25 Feb 2021 07:13:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233869AbhBYHMi (ORCPT ); Thu, 25 Feb 2021 02:12:38 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:5434 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233938AbhBYHKc (ORCPT ); Thu, 25 Feb 2021 02:10:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237703; x=1645773703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qELsFddYf/fZidR2F4nWrGgbbzisn0TnUODqE1wzd5c=; b=KK3+F1DVazhWSCN8fEN4KeAc2nNxhw4NaCh+AA7qxdfDOVFxdwVptBr2 o1A3Vi9gBIdPtMp6hb7D9qu38Wg7t1+S+MhBLoz0l3GECzldpcGlAinu5 wBWVBWvhtIh7GuGnTSQhFucvtvKwJ6X85hAV9CdfgtQmD0Mw+tICC5lhY 0FPncYhXL0vyJ+R8/YKPoOcckSdc/tIjPyS1QBl/EEXGAF4Kl4+a/oJuA gxwC2vR6W7U/cg1910idH2masHAHiZjRoe6VNjT5IeKWxp7Lk6Ne0uG1N INxdkNVQU7Gippn+Gf3BNIlTet6RiusJquj2MYxIpi/MIz3vHNJAhNraz w==; IronPort-SDR: +jLz/R4w7Sq0TKfJTcjsqN5sLuk4VjYt79Y1Qxifn/oaIYUMIT4mE7PVwYEtFGy/4XMRrQvooi ylo58BrhhgYeayFaq1TKbwcfSNDUprmK9BmhUwGbODdSg8Rp4sJsVtLQZFnqj+dj5d/oR3lRmB hlghH6OJ4HJuTCGRFmRCSpF4LXykvc7Z1Pj/cSUINzZ5/MYTCaXJPmxu6gOJ/0meYHrzkIbtVD zAz8pvFLAR/7oGX8GBOqCNhy8FgJ2wgpqa0tPCNuiVRihZYqU9aQNFA8CDcuqidHg8nqNALwFI 9iw= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="264979019" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:16:14 +0800 IronPort-SDR: AFsHqhGAozGpbCPqpMs6v1fKIwznRauQ7wfZa1lg3CJvQ5nsWqSW1gLG+qWvnmy/I7ozs+Wnge +8A1ZArxZYl3tMX7BwFnykEiiAsoRx1/4DxcpIu6ow0nCGQr+TrVgaSnGip35Oe+C/g/+eS4p1 tcYO1lDzNqqnWKVL+kAoQbwxFrcRe7YMYGe8JoC1vuEHpdwB3SuGTS396fTjxvZQwojJKvNXk5 nRQv3vUtzAZ+F0iwINm8M91AJsit4TK56sZa+ZVEtN3oB0lu2h/MfLRj3Q4IqrCN6TErAI6UqX cT4mM/afnoIBmLxQ+qCTmGnW Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:50:09 -0800 IronPort-SDR: PQVvuUl0urV+AuHXoztIv2ko4ec5dnFXGMemj8nj98xLSxNSzY+fPjPQsEHPXi+DWIf/mEpthf lxggagRReXwz2a3qn1VtF0ulgngisTFgDc8GARpNPqvFCmSjwrqNPYJBYWQmXJuwJW1I+jcOfi mBefp/964dE3h3HgCffZkJDMNQ+Y2CTcG3X9wPYJRI/aNXIxvpkFSZCvBPjh/0AQZ9CcjAywMA VsiZcNWe2+YTYB+oTNZV9z4YznZH7rcm2BK8z8DwmhzxhVgCmg+FR6smll6MEDUYZv4HormmV6 /k8= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:06:53 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 30/39] blktrace: add trace event print helper Date: Wed, 24 Feb 2021 23:02:22 -0800 Message-Id: <20210225070231.21136-31-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 4a4ba1d45cb9..75b2ec88d8c4 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -2356,12 +2356,51 @@ static enum print_line_t print_one_line(struct trace_iterator *iter, return trace_handle_return(s); } +static enum print_line_t print_one_line_ext(struct trace_iterator *iter, + bool classic) +{ + struct trace_array *tr = iter->tr; + struct trace_seq *s = &iter->seq; + const struct blk_io_trace_ext *t; + u32 what; + bool long_act; + blk_log_action_t *log_action; + bool has_cg; + + t = te_blk_io_trace_ext(iter->ent); + what = (t->action & ((1ULL << BLK_TC_SHIFT_EXT) - 1)) & ~__BLK_TA_CGROUP; + long_act = !!(tr->trace_flags & TRACE_ITER_VERBOSE); + log_action = classic ? &blk_log_action_classic_ext : &blk_log_action_ext; + has_cg = t->action & __BLK_TA_CGROUP; + + if ((t->action & ~__BLK_TN_CGROUP) == BLK_TN_MESSAGE_EXT) { + log_action(iter, long_act ? "message" : "m", has_cg); + blk_log_msg_ext(s, iter->ent, has_cg); + return trace_handle_return(s); + } + + if (unlikely(what == 0 || what >= ARRAY_SIZE(what2act_ext))) + trace_seq_printf(s, "Unknown action %x\n", what); + else { + log_action(iter, what2act_ext[what].act[long_act], has_cg); + what2act_ext[what].print(s, iter->ent, has_cg); + } + + return trace_handle_return(s); +} + static enum print_line_t blk_trace_event_print(struct trace_iterator *iter, int flags, struct trace_event *event) { return print_one_line(iter, false); } +static enum print_line_t blk_trace_event_print_ext(struct trace_iterator *iter, + int flags, struct trace_event *event) +{ + return print_one_line_ext(iter, false); +} + static void blk_trace_synthesize_old_trace(struct trace_iterator *iter) { struct trace_seq *s = &iter->seq; From patchwork Thu Feb 25 07:02:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B15FC433DB for ; Thu, 25 Feb 2021 07:09:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDD8A64E4D for ; Thu, 25 Feb 2021 07:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232984AbhBYHJ0 (ORCPT ); Thu, 25 Feb 2021 02:09:26 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:26799 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232447AbhBYHIK (ORCPT ); Thu, 25 Feb 2021 02:08:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236890; x=1645772890; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hDmja61HZFUIv20A9Mnm2VsUFWdVGWs+qU/9EVKHfqA=; b=QDeCCdPXUPuPvJ77QaD2ZkHRoAEabeEvsaxrJoaUO+mUoUG1GofexfQp ZEvuSWmzqkyejR96a4L0yP86k654mvtB/7GHZnZDzVpDFKz92PhIQE7zW gKu112is2bgxHEzPJGexjidP+qNWnm3mp679uuYU+kBGsePKobuJT3aKM y/BFuJu8i7jO3cRbz+Od656gHiasbxjln2JfSPNgZJSmaBgU1FFFEwCJv 7VEvwOTX9kI3Sa0NTNV38DhsWIc3eBSI9DTlDYDcdJSI9aApbfvWaEFki fMyChU7cBynmmmGop+FVtFDQKEtUuQkD9O2Vtwsmf2UPTG/YwzePpQz06 g==; IronPort-SDR: vk0v9O38q2fCgEM4LUfG5FuETWJ24ybM/LOOwXdm9ygG+eDdfeHzj3cbADbZVZjH/9myQBdoUr +hq5tB7DvrIzsbRj92jvldrHvRSsL3QoDW/yCt9zaVyvTGQ2vqHzev0Uy0h/vCfww0oRgf7JbS Vs/TI7qvXeTcOL0gDrmU6TM+ki5/k3h3CXNlIBsmKbBCvSu7O0WnqQGyac3eefhGHGCep7rYhb yKM2cf+Op+4+xzVcmXOvYu0Fxa6XLcQQE2ldPCZD7P8yd70+UvwoJHH8dDYloVGcNw/ayinkpt Pdk= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160778067" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:01 +0800 IronPort-SDR: gVBEH77x5Zo8nXUTQnGsFO15VfXM/m8LQOSVOvqObHbHqB7Hkrbe3zAVTLx4SGJ1sylkU93H8G Q7d+caTiuIqUZg6mWK9DRIe6rBRvKyONxkT/SK+ar4OmILEDm0poFenba82oj118slFde/jFmW ZXA8rh9wvkA1DoJRw771Nu9/Md99WTb7SIQ5zB0iqMKBp0vwQZ3mFYRH23J38h9rOmH+6y+1jI 90j1QNlV+/2u10eqq19QeEjNQ0JrpaSFQyzFCEe48LcjQQX6zAsij8elV+qSd4LuEApgXu+X+Z CETy2c3t1QADLS8FMiEuaRFJ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:50:16 -0800 IronPort-SDR: CHhvpJieFcZHaxcsqGdeS2DaoT2/z9LZL4ieb8JtJY5UqwOOs1MxpTh2UONdE++l88e7chonHA +bGxbkH/OqttlCEBYQvHk20ZVuimEZdFmRqgu3VDXoYAOkKsEAwN77JK88Tw8ttED4/02pL1zd JYrY3L9FbE8Ya1KGKr5VjmWDpM0rA98wo0jHnITnFZM788s2o+gQwajMZacPxLJNGbn0Rr0kTc vp4H+a3kzfp6c8NNnJCbYZwsMqOLxLuaW2wzPFycCLvpxgVSISmSFw5DReqAeu9K5Bokt/f9FH 3wE= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:01 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 31/39] blktrace: add trace_synthesize helper Date: Wed, 24 Feb 2021 23:02:23 -0800 Message-Id: <20210225070231.21136-32-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 75b2ec88d8c4..a904a800b696 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -2416,6 +2416,21 @@ static void blk_trace_synthesize_old_trace(struct trace_iterator *iter) sizeof(old) - offset + t->pdu_len); } +static void blk_trace_synthesize_old_trace_ext(struct trace_iterator *iter) +{ + struct trace_seq *s = &iter->seq; + struct blk_io_trace_ext *t = (struct blk_io_trace_ext *)iter->ent; + const int offset = offsetof(struct blk_io_trace_ext, sector); + struct blk_io_trace_ext old = { + .magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION_EXT, + .time = iter->ts, + }; + + trace_seq_putmem(s, &old, offset); + trace_seq_putmem(s, &t->sector, + sizeof(old) - offset + t->pdu_len); +} + static enum print_line_t blk_trace_event_print_binary(struct trace_iterator *iter, int flags, struct trace_event *event) From patchwork Thu Feb 25 07:02:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 425E5C433E9 for ; Thu, 25 Feb 2021 07:10:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5FAE64ED9 for ; Thu, 25 Feb 2021 07:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233545AbhBYHJw (ORCPT ); Thu, 25 Feb 2021 02:09:52 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:4505 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbhBYHIP (ORCPT ); Thu, 25 Feb 2021 02:08:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236894; x=1645772894; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y4ZxvW+ayhHo+JhxLWhJUQIwkempqxmtM6LSOEmI9U0=; b=fVNgFb6ozWWJTy0yKoGb0uZSfKbnWL0f7I4uDRP0HzhBa4n2/pNcACMV C9wkYJs27QGXf/MBIa/Lsuo+XgEiHAUipivhMElc356BdkwMlw4bno9CJ LJHDJN/6t5+DYlnr4gG1Bl2CEjD5ARnfHgSfxA+yCfggnr4HFJvnocqck AoW3H7y3XG5i8AWWyCdq3i/dWKJybL4l+rhoornAoJA/2ktQFgBjNzhES hzfByd5DWlI0QwauAKcuA+yz60g0+8g6CULwjnoDfLmJpp4J3LIfUyfvO ffkG+aVWlTShpIppcCmUPv25qRWp7uAPrS78kRI4DDMcP9cqtzC7YQn0F w==; IronPort-SDR: cKwTNKHJdtYesXwxvdp9PJ8iFBkMpATR/ERmgsbLfgMRnFbXb7cMbUiBIO1SF2IpTjcDdcM9Zj B6KT6ynpsCc5RyzJz+RgW8e/YJbT4nmI0LTs8AYgAl4zZepg/+2UROnH4QiO7nFMYfP1Va5Bmp E5RtrmU7CsfC6cKX08yZcF6VXAvkKJcl/+S+l4NhCKvmoEXYMVzA3PBX1YxYCrzq7LLfBUiCiT WXnlPK190JHjzk6UjdVoQPEGqSGbKEGEdDibtFv3OfFAZn2jqvPreUhqxFWkgETfpDxeBJB9sF WFE= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="271319235" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:09 +0800 IronPort-SDR: 6BnNq8mRGyniPz3Z59aufhkAqmuqxse+AVTYkAz7xkQg5YUjFFxp1gES2D2DdWLP712qOxv5xo wkmh9q62nRVHfuFRNJi8ajxO3agjKiudauFhY9CLhKspZZofhoULc2o59xGsc77LknvRYvaFPW L7Ypo52FEtvdvKP4Z61aK4lWO/0QhJ2bHCbLHNMELlHDOd6r/AAvU/YoiD/09mIPPE6uMnBCtm GIshfP2rys2W9wdG/yctlrPBj7g8d3HBhvg7zROEEcrrEnvpytr5cvmwDwAMoI2JJvQyEJtjN8 PmzAVd90Zl8J8qC+YnPO0pgB Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:50:24 -0800 IronPort-SDR: 7NUV+Cljl9oT4cLlsofGNqrp91SRWL5KA8y94YS21VX5HfaeRc0Q+3IMfMw9+DVNuEar5q/nlh 7uTK2K0YrC357grRwbRvwnyXiubonoHUz3TBBEBvCeYSjQsPf7X0uZtCo0vAwIKkM4aH4uRFTD v42ww5buVuYpM99na2F3dZkv8bCVNZ9WTpf+ixT8YDXk7nrIXIOWvfWcQKYR1AJ/GdjI+8epEk 7s8DuNwWmt+scDCfXP0Hg/PyFvLKDrwz57XTh5LVOVGdwVM/oqZa3JSth1SvQ3q7NyIAmiDsaF VSc= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:09 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 32/39] blktrace: add trace print helpers Date: Wed, 24 Feb 2021 23:02:24 -0800 Message-Id: <20210225070231.21136-33-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index a904a800b696..53bba8537294 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -2440,6 +2440,15 @@ blk_trace_event_print_binary(struct trace_iterator *iter, int flags, return trace_handle_return(&iter->seq); } +static enum print_line_t +blk_trace_event_print_binary_ext(struct trace_iterator *iter, int flags, + struct trace_event *event) +{ + blk_trace_synthesize_old_trace_ext(iter); + + return trace_handle_return(&iter->seq); +} + static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter) { if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC)) @@ -2448,6 +2457,14 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter) return print_one_line(iter, true); } +static enum print_line_t blk_tracer_print_line_ext(struct trace_iterator *iter) +{ + if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC)) + return TRACE_TYPE_UNHANDLED; + + return print_one_line_ext(iter, true); +} + static int blk_tracer_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) { From patchwork Thu Feb 25 07:02:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADE0CC433DB for ; Thu, 25 Feb 2021 07:10:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CB5D64ED3 for ; Thu, 25 Feb 2021 07:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233688AbhBYHJ7 (ORCPT ); Thu, 25 Feb 2021 02:09:59 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:4515 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232923AbhBYHIZ (ORCPT ); Thu, 25 Feb 2021 02:08:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236904; x=1645772904; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1hBv8Gu4qfS+3fsLLBjregm8reryLOBw/ybrB5vLfFM=; b=hh5BCxDhIdlQRkZEY1Z9QFxD1q9NNgXT8qPgJrWO/6BvpW9bmgNlFhiB MrIo9CiQBLCDHfZ/sD9/pwM5Fr7VKvBc0XNw2XBcq31+Iuv4uoD0TF44i 9/NlCgjEmN5XD7ugd63gLcNPEeCiguPE4glemmPS7CMBRuv8KtngY+f6h GSdaxTfT37Ms3yKHVpnsS8JTH8HEv0/EkXaG6IN0pqtau2wvtxROszRp/ Of/XsnrdO9lQ5PnwTFq1iBDJK02NRD5+F83U5opVfOj24634+0IUysv55 59/RjIlVBGB9CgDpHyqa7/GbBIZDYOouJecCKStuX19a9IsAsWrGbDJ3o Q==; IronPort-SDR: zGxBJxxQrDDdC0ucph/RfmrlfTaJvE+vEAn7evILrLtpVlg7CLKRZz/edzmU0NvDAUEb6tNgza E+WHAPtGfA2RjAZm6kJrmb1ylw75scoJs52w2Q8UsRiIqfrCSOKBcilpJW7MHg/a+cfY1gpQMH 3T3kOJ1uv3hsjVnFBnTm9QiO+9qcUEVzKfIGpP5f55Wno3gTeEdPfhYSv/3fWyMQ5ytgIfa0Me ImfBWYUzGaCRYRTjfdrTD6aWz44gXJylxAriv3jcc/E0xsvClaF2eAADlnVKpmFBJiVF31eIKT +oA= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="271319252" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:16 +0800 IronPort-SDR: 0uoramwMAK5nO91+krnq9wy/JMpUFv2o1OEjLhYsBd5x7eVLqwrULfT9e17H8RSvM8uVXIpzjR YOVMek6wUTsV1o8bP4ADpc1X8Jliocjjqf7V33QUWHVGME77lW2jXX6zap6le14+b68SuvyfuC 7gvCorzsUIxhBRB7XSh/3GSoJhlIDFCNQbzjl0Vhn9q0m8yLB5qOjmM1sYcjFm8fpHns+mNQ7U Yhvq8/1d0CCZNVyhYHL4EuoEPeTmguALgfKQBYBDmUOqu+F662Lz0ymVvmBdlFog0qYMBapGSh jWTuzAZMax5D+/q+jLRVy9TY Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:48:38 -0800 IronPort-SDR: tTkqodW0+y/1iCCApd6wfSVWRetFjKjxI+gnXFyP8IMFdCZjLziwK1eUJixyaalCKBKexVMApX LtQx1fqtoA7r9H96areCy7K00hwXk1fvRlf2QB6iNDw8vM+1a+UfN4Gnp2EPhcmr+MILCQgeNq +G/bBLGGkQdlkz7o92uszxZY1V+h/BJXGshCY8ykmt6h0+ob0lVROC//GO7OSxzyg+L47/fUS1 cmHfxubD+Sxz831jFiWZjQgyibvUF9kyZXBG1uBascPLcwKdTN74/jcSo/GQdLYMRfFdiAXtP3 ZOQ= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:16 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 33/39] blktrace: add blkext tracer Date: Wed, 24 Feb 2021 23:02:25 -0800 Message-Id: <20210225070231.21136-34-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 47 ++++++++++++++++++++++++++++++++++++++--- kernel/trace/trace.h | 1 + 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 53bba8537294..f707ebde0062 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -2490,18 +2490,42 @@ static struct tracer blk_tracer __read_mostly = { .set_flag = blk_tracer_set_flag, }; +static struct tracer blk_tracer_ext __read_mostly = { + .name = "blkext", + .init = blk_tracer_init, + .reset = blk_tracer_reset, + .start = blk_tracer_start, + .stop = blk_tracer_stop, + .print_header = blk_tracer_print_header, + .print_line = blk_tracer_print_line_ext, + .flags = &blk_tracer_flags, + .set_flag = blk_tracer_set_flag, +}; + static struct trace_event_functions trace_blk_event_funcs = { .trace = blk_trace_event_print, .binary = blk_trace_event_print_binary, }; +static struct trace_event_functions trace_blk_event_funcs_ext = { + .trace = blk_trace_event_print_ext, + .binary = blk_trace_event_print_binary_ext, +}; + static struct trace_event trace_blk_event = { .type = TRACE_BLK, .funcs = &trace_blk_event_funcs, }; +static struct trace_event trace_blk_event_ext = { + .type = TRACE_BLK_EXT, + .funcs = &trace_blk_event_funcs_ext, +}; + static int __init init_blk_tracer(void) { + int ret = 0; + if (!register_trace_event(&trace_blk_event)) { pr_warn("Warning: could not register block events\n"); return 1; @@ -2509,11 +2533,28 @@ static int __init init_blk_tracer(void) if (register_tracer(&blk_tracer) != 0) { pr_warn("Warning: could not register the block tracer\n"); - unregister_trace_event(&trace_blk_event); - return 1; + goto unregister_trace_event; } - return 0; + if (!register_trace_event(&trace_blk_event_ext)) { + pr_warn("Warning: could not register block events\n"); + /* unregister blk_tracer */ + goto unregister_trace_event; + } + + if (register_tracer(&blk_tracer_ext) != 0) { + pr_warn("Warning: could not register the block tracer\n"); + goto unregister_trace_event_ext; + } +out: + return ret; + +unregister_trace_event_ext: + unregister_trace_event(&trace_blk_event_ext); +unregister_trace_event: + unregister_trace_event(&trace_blk_event); + ret = 1; + goto out; } device_initcall(init_blk_tracer); diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index e448d2da0b99..8bb010753a17 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -42,6 +42,7 @@ enum trace_type { TRACE_GRAPH_ENT, TRACE_USER_STACK, TRACE_BLK, + TRACE_BLK_EXT, TRACE_BPUTS, TRACE_HWLAT, TRACE_RAW_DATA, From patchwork Thu Feb 25 07:02:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24174C433DB for ; Thu, 25 Feb 2021 07:10:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE54164F06 for ; Thu, 25 Feb 2021 07:10:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233942AbhBYHKj (ORCPT ); Thu, 25 Feb 2021 02:10:39 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:54936 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbhBYHIi (ORCPT ); Thu, 25 Feb 2021 02:08:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236917; x=1645772917; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LeAvg38TfE+J/qYTQXG9nwkLSb8PcQeHGw+zvx/IKEM=; b=RBQEZWDcjWvz4saCMaLXAoq2v9lwVzMuvMA2CeC4RY07EBYbVeQj7zzH zOh2Hko0+sWigyhkRO7e0fgJfhWKxxkdT6syASdZ4dXFiqKczBk5mMMkR fO64cMT9WWrSc9KEmDOowaRJG9SC66NOuYGJpP2y949ygfeajtyur6NBK z6y+SAkI64klcmgWzFwXn1sH1CaHW8vgqaUns0rnD6m2+j0mHvIK6ifqM y6yPC2hcCCG3+7TnnEaz48kGpUahlKjAlF81nloacMtLHfdMFBAuhcSJA 4RyOgP1o4NnJK1Esa68W9wF0JQzmY7sHc9mdXt1aVZw10+NnmD3OxGBSc g==; IronPort-SDR: z7v+OOqEKcTpEYQACtrrzTGP+NaQ8j0vEp0kDhMTrzXgETeKdpoitkZXfFxFDyQRooBUYl7V7E JCzOcOrcP/3GJbLE94fBB5/0TwmO3W9h6IYM94EWK9xbonulE9zUWKct7muJm5QEMLGOVfPtMt E+OA4DNS1GTSynXBDZToU/y84PGABVYvBKeaQz4mNYH1cQprPU9z0mQMmg/F23OOMQ24oDJrQe 10t34y1R4k4BhI/EnfjzrP6HQrCshOB7PVGcRYYyrlkasukIJ29FkZ4aZGCLQYgWTTUC7/FHKd FuA= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160778088" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:23 +0800 IronPort-SDR: Es2PK+QhwFwz2l5ZxBzlGr3niCVYebFkuxpvXDXLI/FznVX1VFht5AF205yJjiWw+WCIa1k8hM e3Fn0czgKytl/gxIqpbyaWU2VoyPL6rU4GV80o9d5Nbdpl2BVpvB4IaD15YIXcu3HwOSxyzxA9 QbfuWMyLMfin/Cs6d9F49rspYuTiXbs+oivXuFNdNjn9jO8xRwWNhLWLGXA8PCw/4Zkq6qgyUt wNm0+cqcaxFRzoP/EXypWmybagttEob28BM3shJC1s8SEPfoexsphso24ofbMhPRxj9vY/PmB1 5HvCK0yaFS1QVhx6UZPXxHWU Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:50:39 -0800 IronPort-SDR: fHcv2t4JbP2TvYb/jPZgpXkNjncpqR00V00dzCRYR1rhlm/bxdnQPjzjdlx0hYobBOrqdDr0Q5 n3vrPHcthtoDB8LeD6H/kMWE+GEbGzeqzrsH3o14bX/hYvNgx5IlToGPTPG082U0pOGuydD127 DLm0kKEzxf47aWg4pdsnF3RFqVKMhK59aWeOoHmXnWI3sNwO8tCt8uJKQPPfWlFu2dxkeF0OtO wKr0ItK/ZZA2AFkKl14kIU5AzjR8R9pX8KuX8UkX16UMoZY1hI1tLUP+P1zTIR3zYumFcp5N65 du8= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:23 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 34/39] blktrace: implement setup-start-stop ioclts Date: Wed, 24 Feb 2021 23:02:26 -0800 Message-Id: <20210225070231.21136-35-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Implement newly introduced IOCTLs for setup/start/stop/teardown. Signed-off-by: Chaitanya Kulkarni --- include/uapi/linux/fs.h | 5 + kernel/trace/blktrace.c | 294 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 299 insertions(+) diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index f44eb0a04afd..ca722ecbd3de 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -184,6 +184,11 @@ struct fsxattr { #define BLKSECDISCARD _IO(0x12,125) #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) +#define BLKTRACESETUP_EXT _IOWR(0x12,128,struct blk_user_trace_setup_ext) +#define BLKTRACESTART_EXT _IO(0x12,129) +#define BLKTRACESTOP_EXT _IO(0x12,130) +#define BLKTRACETEARDOWN_EXT _IO(0x12,131) + /* * A jump here: 130-131 are reserved for zoned block devices * (see uapi/linux/blkzoned.h) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index f707ebde0062..3bd56b741379 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -609,6 +609,17 @@ static void get_probe_ref(void) mutex_unlock(&blk_probe_mutex); } +static void blk_trace_free_ext(struct blk_trace_ext *bt) +{ + debugfs_remove(bt->msg_file); + debugfs_remove(bt->dropped_file); + relay_close(bt->rchan); + debugfs_remove(bt->dir); + free_percpu(bt->sequence); + free_percpu(bt->msg_data); + kfree(bt); +} + static void put_probe_ref(void) { mutex_lock(&blk_probe_mutex); @@ -624,6 +635,13 @@ static void blk_trace_cleanup(struct blk_trace *bt) put_probe_ref(); } +static void blk_trace_cleanup_ext(struct blk_trace_ext *bt) +{ + synchronize_rcu(); + blk_trace_free_ext(bt); + put_probe_ref(); +} + static int __blk_trace_remove(struct request_queue *q) { struct blk_trace *bt; @@ -639,12 +657,28 @@ static int __blk_trace_remove(struct request_queue *q) return 0; } +static int __blk_trace_remove_ext(struct request_queue *q) +{ + struct blk_trace_ext *bt; + + bt = xchg(&q->blk_trace_ext, NULL); + if (!bt) + return -EINVAL; + + if (bt->trace_state != Blktrace_running) + blk_trace_cleanup_ext(bt); + + return 0; +} + int blk_trace_remove(struct request_queue *q) { int ret; mutex_lock(&q->debugfs_mutex); ret = __blk_trace_remove(q); + if (ret) + __blk_trace_remove_ext(q); mutex_unlock(&q->debugfs_mutex); return ret; @@ -662,6 +696,17 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf)); } +static ssize_t blk_dropped_read_ext(struct file *filp, char __user *buffer, + size_t count, loff_t *ppos) +{ + struct blk_trace_ext *bt = filp->private_data; + char buf[16]; + + snprintf(buf, sizeof(buf), "%u\n", atomic_read(&bt->dropped)); + + return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf)); +} + static const struct file_operations blk_dropped_fops = { .owner = THIS_MODULE, .open = simple_open, @@ -669,6 +714,13 @@ static const struct file_operations blk_dropped_fops = { .llseek = default_llseek, }; +static const struct file_operations blk_dropped_fops_ext = { + .owner = THIS_MODULE, + .open = simple_open, + .read = blk_dropped_read_ext, + .llseek = default_llseek, +}; + static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, size_t count, loff_t *ppos) { @@ -689,6 +741,26 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, return count; } +static ssize_t blk_msg_write_ext(struct file *filp, const char __user *buffer, + size_t count, loff_t *ppos) +{ + char *msg; + struct blk_trace_ext *bt; + + if (count >= BLK_TN_MAX_MSG) + return -EINVAL; + + msg = memdup_user_nul(buffer, count); + if (IS_ERR(msg)) + return PTR_ERR(msg); + + bt = filp->private_data; + __trace_note_message_ext(bt, NULL, "%s", msg); + kfree(msg); + + return count; +} + static const struct file_operations blk_msg_fops = { .owner = THIS_MODULE, .open = simple_open, @@ -696,6 +768,13 @@ static const struct file_operations blk_msg_fops = { .llseek = noop_llseek, }; +static const struct file_operations blk_msg_fops_ext = { + .owner = THIS_MODULE, + .open = simple_open, + .write = blk_msg_write_ext, + .llseek = noop_llseek, +}; + /* * Keep track of how many times we encountered a full subbuffer, to aid * the user space app in telling how many lost events there were. @@ -730,12 +809,31 @@ static struct dentry *blk_create_buf_file_callback(const char *filename, &relay_file_operations); } +static int blk_subbuf_start_callback_ext(struct rchan_buf *buf, void *subbuf, + void *prev_subbuf, size_t prev_padding) +{ + struct blk_trace_ext *bt; + + if (!relay_buf_full(buf)) + return 1; + + bt = buf->chan->private_data; + atomic_inc(&bt->dropped); + return 0; +} + static const struct rchan_callbacks blk_relay_callbacks = { .subbuf_start = blk_subbuf_start_callback, .create_buf_file = blk_create_buf_file_callback, .remove_buf_file = blk_remove_buf_file_callback, }; +static struct rchan_callbacks blk_relay_callbacks_ext = { + .subbuf_start = blk_subbuf_start_callback_ext, + .create_buf_file = blk_create_buf_file_callback, + .remove_buf_file = blk_remove_buf_file_callback, +}; + static void blk_trace_setup_lba(struct blk_trace *bt, struct block_device *bdev) { @@ -748,6 +846,18 @@ static void blk_trace_setup_lba(struct blk_trace *bt, } } +static void blk_trace_setup_lba_ext(struct blk_trace_ext *bt, + struct block_device *bdev) +{ + if (bdev) { + bt->start_lba = bdev->bd_start_sect; + bt->end_lba = bdev->bd_start_sect + bdev_nr_sectors(bdev); + } else { + bt->start_lba = 0; + bt->end_lba = -1ULL; + } +} + /* * Setup everything required to start tracing */ @@ -858,6 +968,106 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, return ret; } +static int do_blk_trace_setup_ext(struct request_queue *q, char *name, dev_t dev, + struct block_device *bdev, + struct blk_user_trace_setup_ext *buts) +{ + struct blk_trace_ext *bt = NULL; + struct dentry *dir = NULL; + int ret; + + if (q->blk_trace) { + pr_err("queue is already associated with legecy trace\n"); + return -EINVAL; + } + if (!buts->buf_size || !buts->buf_nr) + return -EINVAL; + + if (!blk_debugfs_root) + return -ENOENT; + + strncpy(buts->name, name, BLKTRACE_BDEV_SIZE); + buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0'; + + /* + * some device names have larger paths - convert the slashes + * to underscores for this to work as expected + */ + strreplace(buts->name, '/', '_'); + + bt = kzalloc(sizeof(*bt), GFP_KERNEL); + if (!bt) + return -ENOMEM; + + ret = -ENOMEM; + bt->sequence = alloc_percpu(unsigned long); + if (!bt->sequence) + goto err; + + bt->msg_data = __alloc_percpu(BLK_TN_MAX_MSG, __alignof__(char)); + if (!bt->msg_data) + goto err; + + ret = -ENOENT; + + dir = debugfs_lookup(buts->name, blk_debugfs_root); + if (!dir) + bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); + if (!dir) + goto err; + + bt->dev = dev; + atomic_set(&bt->dropped, 0); + INIT_LIST_HEAD(&bt->running_ext_list); + + ret = -EIO; + bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt, + &blk_dropped_fops_ext); + if (!bt->dropped_file) + goto err; + + bt->msg_file = debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops_ext); + if (!bt->msg_file) + goto err; + + bt->rchan = relay_open("trace", dir, buts->buf_size, + buts->buf_nr, &blk_relay_callbacks_ext, bt); + if (!bt->rchan) + goto err; + + bt->act_mask = buts->act_mask; + if (!bt->act_mask) + bt->act_mask = (u64) -1ULL; + + bt->prio_mask = buts->prio_mask; + + blk_trace_setup_lba_ext(bt, bdev); + + /* overwrite with user settings */ + if (buts->start_lba) + bt->start_lba = buts->start_lba; + if (buts->end_lba) + bt->end_lba = buts->end_lba; + + bt->pid = buts->pid; + bt->trace_state = Blktrace_setup; + + ret = -EBUSY; + if (cmpxchg(&q->blk_trace_ext, NULL, bt)) + goto err; + + get_probe_ref(); + + ret = 0; +err: + if (dir && !bt->dir) + dput(dir); + if (ret) + blk_trace_free_ext(bt); + return ret; +} + + static int __blk_trace_setup(struct request_queue *q, char *name, dev_t dev, struct block_device *bdev, char __user *arg) { @@ -879,6 +1089,27 @@ static int __blk_trace_setup(struct request_queue *q, char *name, dev_t dev, return 0; } +static int __blk_trace_setup_ext(struct request_queue *q, char *name, dev_t dev, + struct block_device *bdev, char __user *arg) +{ + struct blk_user_trace_setup_ext buts; + int ret; + + ret = copy_from_user(&buts, arg, sizeof(buts)); + if (ret) + return -EFAULT; + + ret = do_blk_trace_setup_ext(q, name, dev, bdev, &buts); + if (ret) + return ret; + + if (copy_to_user(arg, &buts, sizeof(buts))) { + __blk_trace_remove_ext(q); + return -EFAULT; + } + return 0; +} + int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, struct block_device *bdev, char __user *arg) @@ -969,12 +1200,57 @@ static int __blk_trace_startstop(struct request_queue *q, int start) return ret; } +static int __blk_trace_startstop_ext(struct request_queue *q, int start) +{ + int ret; + struct blk_trace_ext *bt; + + bt = rcu_dereference_protected(q->blk_trace_ext, + lockdep_is_held(&q->debugfs_mutex)); + if (bt == NULL) + return -EINVAL; + + /* + * For starting a trace, we can transition from a setup or stopped + * trace. For stopping a trace, the state must be running + */ + ret = -EINVAL; + if (start) { + if (bt->trace_state == Blktrace_setup || + bt->trace_state == Blktrace_stopped) { + blktrace_seq++; + smp_mb(); + bt->trace_state = Blktrace_running; + spin_lock_irq(&running_trace_ext_lock); + list_add(&bt->running_ext_list, + &running_trace_ext_list); + spin_unlock_irq(&running_trace_ext_lock); + + trace_note_time_ext(bt); + ret = 0; + } + } else { + if (bt->trace_state == Blktrace_running) { + bt->trace_state = Blktrace_stopped; + spin_lock_irq(&running_trace_ext_lock); + list_del_init(&bt->running_ext_list); + spin_unlock_irq(&running_trace_ext_lock); + relay_flush(bt->rchan); + ret = 0; + } + } + + return ret; +} + int blk_trace_startstop(struct request_queue *q, int start) { int ret; mutex_lock(&q->debugfs_mutex); ret = __blk_trace_startstop(q, start); + if (ret) + ret = __blk_trace_startstop_ext(q, start); mutex_unlock(&q->debugfs_mutex); return ret; @@ -1011,6 +1287,10 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) bdevname(bdev, b); ret = __blk_trace_setup(q, b, bdev->bd_dev, bdev, arg); break; + case BLKTRACESETUP_EXT: + bdevname(bdev, b); + ret = __blk_trace_setup_ext(q, b, bdev->bd_dev, bdev, arg); + break; #if defined(CONFIG_COMPAT) && defined(CONFIG_X86_64) case BLKTRACESETUP32: bdevname(bdev, b); @@ -1023,9 +1303,18 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) case BLKTRACESTOP: ret = __blk_trace_startstop(q, start); break; + case BLKTRACESTART_EXT: + start = 1; + /* fallthrough */ + case BLKTRACESTOP_EXT: + ret = __blk_trace_startstop_ext(q, start); + break; case BLKTRACETEARDOWN: ret = __blk_trace_remove(q); break; + case BLKTRACETEARDOWN_EXT: + ret = __blk_trace_remove_ext(q); + break; default: ret = -ENOTTY; break; @@ -1049,6 +1338,11 @@ void blk_trace_shutdown(struct request_queue *q) __blk_trace_remove(q); } + if (rcu_dereference_protected(q->blk_trace_ext, + lockdep_is_held(&q->debugfs_mutex))) { + __blk_trace_startstop_ext(q, 0); + __blk_trace_remove_ext(q); + } mutex_unlock(&q->debugfs_mutex); } From patchwork Thu Feb 25 07:02:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34453C433E0 for ; Thu, 25 Feb 2021 07:10:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1E9064EF5 for ; Thu, 25 Feb 2021 07:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233919AbhBYHK2 (ORCPT ); Thu, 25 Feb 2021 02:10:28 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:4544 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233383AbhBYHIh (ORCPT ); Thu, 25 Feb 2021 02:08:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236916; x=1645772916; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mMNdpWTlLEM3dM1FX5uUB+nf43YofWvX3hWgSz3vKQQ=; b=m4QL6RXSwpER+bs2UTWuEjjOzShmt4W1RjiJuKj1DukQ0ALyQVMS12r6 Oq1/jGXn2zaieTAq3vUvQBTqJLHLufAGDoJBbqmzKzofy1FClxfHP76K5 Ui5rM9gEglIUDXb87MRboa8mE2Tq4soirM6pEE4X0AnuCuq3ggFGqpEDq vkArKQiRmVrAvAJeHrF795sM54UvJVwO1S4KKpud+jI34qP4yVeKKNhPd Fw7Eh3jeAa8hhOUhP+gvTyp2KqIXbygCflqvtnWN8VpSM2CBLqDa8xegN WEpdqoKHebgm1znLWdEnvnjjRClEvLfKh+h5jOD4wArQ/jwnj5J3uCOxk Q==; IronPort-SDR: rVsQeEgz8ow6a8m+LaKiCdM0D5wK5Z4/GjkCn2N2VbTJeUzQ6rhZn7KQWm8Ia0TX6BEnrclG+z nrAsuox7E3VbqqKnlY62765wYM7sweg7hZpGgrBcrzCJLWk7+VUYRszMwcnhNhZYLeBtcEzgPN Oa1AYGSkBytWaSg+6TaXvqjpnzo2oIlDELxAlnh8tTaOfLp+ThA6rnYugj2DSwT2FVJB6DlNJ/ 3maFJU4r8KMcc0pYm0nt6tpnkAJz7isULRVzmBF7JakDaJMbxh7+w4tHrMbHwUrJlMoF59K/L5 ieU= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="271319267" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:31 +0800 IronPort-SDR: dDyziYqBNpAZh1uVVAYJTDRXKnGFiW+ZWVCoa48v9rPZ9RHQCVckbRTnR7JH2keSZvQ+n+UFYv Pmjquil+Mb4rs6Veq9cI1iKKWghe8Omu+fUBk/66sGZ5KPH+wID07HM07vFwT7dHfAqIDy0RKp F6pZ8hPb9z0HqtYpwc5W0mnEfrOtI/8ZDu7NLjBhpEWboBMyvr1aljR8+QLkErfcbArKgZASSy akRGQ4vpuwdX8yLXz/boY3cBYA1psZgR7Kryn6r0MLZPIXyGwYxg8kG8wxRWTQ9JZ97qpDPrGY ENKbeaPcSoeyk/XXxa4hx4RR Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:50:46 -0800 IronPort-SDR: Lg8JC040IaD4Bis3lI841Kfg7JXF+70Ehi6NqJwDicoXTGuOQCTtN6gBA5Ri/WEE9v3dCANpBA FG9UkQzlG0pkT+6LWRKzZEFi5wbICyRkSBUAXRMQ8z/Xo2I8ptl3L58ra5IjPGUjEAJ6VgDMl7 pKo6CQaS00ESCz9dcpp4NUPvgYPKMEcsDANqMW5gp4kXj+YzSQwvy+fikyU3opROXfDvZMcdAX Uq6hcXbHxk/erH+MNpclbvKri0dFOJPS1+nv1rUQsQ2W6xuVJjetFobHza83KNe/TjmwYNHPg/ cxA= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:31 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 35/39] block: update blkdev_ioctl with new trace ioctls Date: Wed, 24 Feb 2021 23:02:27 -0800 Message-Id: <20210225070231.21136-36-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add newly intoduce IOCTLs so that userspace tools can call them. Signed-off-by: Chaitanya Kulkarni --- block/ioctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/ioctl.c b/block/ioctl.c index ff241e663c01..9d5e742ce8be 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -509,6 +509,10 @@ static int blkdev_common_ioctl(struct block_device *bdev, fmode_t mode, case BLKTRACESTART: case BLKTRACESTOP: case BLKTRACETEARDOWN: + case BLKTRACESETUP_EXT: + case BLKTRACESTART_EXT: + case BLKTRACESTOP_EXT: + case BLKTRACETEARDOWN_EXT: return blk_trace_ioctl(bdev, cmd, argp); case IOC_PR_REGISTER: return blkdev_pr_register(bdev, argp); From patchwork Thu Feb 25 07:02:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76556C433DB for ; Thu, 25 Feb 2021 07:12:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25C1B64E6C for ; Thu, 25 Feb 2021 07:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233253AbhBYHLr (ORCPT ); Thu, 25 Feb 2021 02:11:47 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:53171 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233030AbhBYHJo (ORCPT ); Thu, 25 Feb 2021 02:09:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236983; x=1645772983; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qmVWl/riaxHF0ICKpnD1wtzPBpIFIgQ86tmQdnEqvsU=; b=Eh9SOixuIjb2ShKvhsZNlfPfH8RPehhgklKtcIfNDANx50YjNI8NN2J3 rm/clL4sz/Orjzmi5lix/QqVDZxMSfUGL+zF41ruzVDJiuJ3jTwdbyRmf Ie5MBc8gDimMnhl3Y/5U/vVoBYCU7sdlikmxvFXUc6/LGCKQwWrIeaQvc xe3RtDl/6ZufHGpgAS8T9J9HY65sPqxL3s6F3PAfWGxHzA02Y5ixQpf+x dtziuIFNa5ouan+RGW2njWRsC8EWBGBaDh2bO/Sea8HUm2cLv7n3XYIno wYXqzU76NxOHFtAEf/EX0d3yOElyP2nNZj9pcNMnW3bleBuhrJQHph0ZZ A==; IronPort-SDR: Hz/7lBWcrSh/O/IPMUY7MZ7CVsIUd0SskKckgbYbQOpV/7hpxlCiorJL1TTBxEBg5hvQGZED2J g+FhCwZu2N8XGZu886wh/IRgBvtgSaAA85k7gJvK6oKuqbhNzzB78WkLr6ROpK1S2+CETw6qaN 7/dSWIbtTACo7Z72eU80Vfv7jJ2kH8BG87msLk7dWIjMlIMmMKbz85pmC4TqqohOzu0qo1Og9Z 3bI9Csp+6GjBRKw+96/Unfmh2P8kWgxrhBx3SlyEuRvAjL5lBQMAR15nWgm+gth8uFBWA+yfQ/ wYs= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160778112" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:39 +0800 IronPort-SDR: ZDCsaWGF+XlFuK+RkQU/OIvjvmm++99RFL+Aa0iki5rikYrrN9u58NaYm+tZUQ0Wf1B4Wr25n4 Y4UrGapiRZiTVk9JaVwRN8SpZaGseFyPPMeQgkH5bgL8gPVh1PNzfSRb5jAYTB/KjdMDf50a20 5xWXTcx5J2tNA7SMWYFgvW9ldeEUrn1vw9yKjz3OOmcZ4uRYrUPCzMtF6tTMg+1IxWEaf3j47D co3IpTKGiq2zjY43I8PiXe1V+LNvQo8cQNFahN7kaNh75BQBHdNItNPWFYmNWDX4iB9zlOtokR IUzb+Rei7kq3GMb/rabteyc3 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:49:00 -0800 IronPort-SDR: 8ncxIOdAJ5I7FAzqO4m2G3XBPtBwH3hoZa4YW6kLoVPEaz6aZ0oPiKkgwStOsUhAzcorO8Jk6Q YXVH2s7DO44Fzh2tGbonkVgBXgA4lskbeduavKIoUjtfAb4SC5p9DJhzQpQBfpIovhNR34PY54 2Tuu2wUMyJ6G/XpLAPLCe+znRo7uZaMPdI7QxpHkBDE+9ghtbZQ7S5Rb/sjAZgxU6cCVH/0BS8 yib2lb5d/ZCv8dFYJTnJplFw75jEJTbu3rGiKtpGAS6TGehUDPnoZY7Wuj+uXvKR1zqJi9GQbQ 1jA= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:38 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 36/39] blktrace: add integrity tracking support Date: Wed, 24 Feb 2021 23:02:28 -0800 Message-Id: <20210225070231.21136-37-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch adds support to track the integrity related information. We update struct blk_io_trace_ext with two new members :- 1. seed :- to track the integrity seed. 2. integrity :- to store the integrity related flags and integrity size buffer. Signed-off-by: Chaitanya Kulkarni Suggested-by: Martin K. Petersen --- include/uapi/linux/blktrace_api.h | 2 ++ kernel/trace/blktrace.c | 60 ++++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/include/uapi/linux/blktrace_api.h b/include/uapi/linux/blktrace_api.h index fdb3a5cdfa22..ac533a0b0928 100644 --- a/include/uapi/linux/blktrace_api.h +++ b/include/uapi/linux/blktrace_api.h @@ -158,6 +158,8 @@ struct blk_io_trace_ext { __u32 bytes; /* transfer length */ __u64 action; /* what happened */ __u32 ioprio; /* I/O priority */ + __u64 seed; /* integrity seed */ + __u64 integrity; /* store integrity flags */ __u32 pid; /* who did it */ __u32 device; /* device number */ __u32 cpu; /* on what cpu did it happen */ diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 3bd56b741379..6759ac7bc6c7 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -66,6 +66,26 @@ static int blk_probes_ref; static void blk_register_tracepoints(void); static void blk_unregister_tracepoints(void); +#ifdef CONFIG_BLK_DEV_INTEGRITY +static void set_integrity(struct blk_io_trace_ext *t, + struct bio_integrity_payload *bip) +{ + t->seed = (u64)bip_get_seed(bip); + /* + * We store integrity buffer size and flags as :- + * + * 63 48 32 16 5 0 + * | reserved | buffer size | rsvd | bip flags | + */ + t->integrity = (bip->bip_iter.bi_size << 16) | bip->bip_flags; +} +#else +static void set_integrity(struct blk_io_trace_ext *t, void *bip) +{ + +} +#endif + /* * Send out a notify message. */ @@ -115,7 +135,8 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action, } static void trace_note_ext(struct blk_trace_ext *bt, pid_t pid, u64 action, - const void *data, size_t len, u64 cgid, u32 ioprio) + const void *data, size_t len, u64 cgid, u32 ioprio, + struct bio_integrity_payload *bip) { struct blk_io_trace_ext *t; struct ring_buffer_event *event = NULL; @@ -148,6 +169,8 @@ static void trace_note_ext(struct blk_trace_ext *bt, pid_t pid, u64 action, t->device = bt->dev; t->action = action | (cgid ? __BLK_TN_CGROUP : 0); t->ioprio = ioprio; + if (bip) + set_integrity(t, bip); t->pid = pid; t->cpu = cpu; t->pdu_len = len + cgid_len; @@ -178,7 +201,8 @@ static void trace_note_tsk(struct task_struct *tsk) spin_unlock_irqrestore(&running_trace_lock, flags); } -static void trace_note_tsk_ext(struct task_struct *tsk, u32 ioprio) +static void trace_note_tsk_ext(struct task_struct *tsk, u32 ioprio, + struct bio_integrity_payload *bip) { unsigned long flags; struct blk_trace_ext *bt; @@ -187,7 +211,7 @@ static void trace_note_tsk_ext(struct task_struct *tsk, u32 ioprio) spin_lock_irqsave(&running_trace_ext_lock, flags); list_for_each_entry(bt, &running_trace_ext_list, running_ext_list) { trace_note_ext(bt, tsk->pid, BLK_TN_PROCESS_EXT, tsk->comm, - sizeof(tsk->comm), 0, ioprio); + sizeof(tsk->comm), 0, ioprio, bip); } spin_unlock_irqrestore(&running_trace_ext_lock, flags); } @@ -220,7 +244,7 @@ static void trace_note_time_ext(struct blk_trace_ext *bt) words[1] = now.tv_nsec; local_irq_save(flags); - trace_note_ext(bt, 0, BLK_TN_TIMESTAMP, words, sizeof(words), 0, 0); + trace_note_ext(bt, 0, BLK_TN_TIMESTAMP, words, sizeof(words), 0, 0, NULL); local_irq_restore(flags); } @@ -290,9 +314,9 @@ void __trace_note_message_ext(struct blk_trace_ext *bt, struct blkcg *blkcg, blkcg = NULL; #ifdef CONFIG_BLK_CGROUP trace_note_ext(bt, 0, BLK_TN_MESSAGE_EXT, buf, n, - blkcg ? cgroup_id(blkcg->css.cgroup) : 1, 0); + blkcg ? cgroup_id(blkcg->css.cgroup) : 1, 0, NULL); #else - trace_note_ext(bt, 0, BLK_TN_MESSAGE_EXT, buf, n, 0, 0); + trace_note_ext(bt, 0, BLK_TN_MESSAGE_EXT, buf, n, 0, 0, NULL); #endif local_irq_restore(flags); } @@ -478,7 +502,7 @@ static const u64 ddir_act_ext[2] = { BLK_TC_ACT_EXT(BLK_TC_READ), */ static void __blk_add_trace_ext(struct blk_trace_ext *bt, sector_t sector, int bytes, int op, int op_flags, u64 what, int error, int pdu_len, - void *pdu_data, u64 cgid, u32 ioprio) + void *pdu_data, u64 cgid, u32 ioprio, void *bip) { struct task_struct *tsk = current; struct ring_buffer_event *event = NULL; @@ -545,7 +569,7 @@ static void __blk_add_trace_ext(struct blk_trace_ext *bt, sector_t sector, int b } if (unlikely(tsk->btrace_seq != blktrace_seq)) - trace_note_tsk_ext(tsk, ioprio); + trace_note_tsk_ext(tsk, ioprio, bip); /* * A word about the locking here - we disable interrupts to reserve @@ -1421,7 +1445,7 @@ static void blk_add_trace_rq(struct request *rq, int error, what |= BLK_TC_ACT_EXT(BLK_TC_FS); __blk_add_trace_ext(bte, blk_rq_trace_sector(rq), nr_bytes, req_op(rq), rq->cmd_flags, what, error, 0, - NULL, cgid, req_get_ioprio(rq)); + NULL, cgid, req_get_ioprio(rq), NULL); } rcu_read_unlock(); } @@ -1564,7 +1588,7 @@ static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, what, error, 0, NULL, blk_trace_bio_get_cgid(q, bio), - bio_prio(bio)); + bio_prio(bio), bio_integrity(bio)); } rcu_read_unlock(); } @@ -1724,7 +1748,7 @@ static void blk_add_trace_plug(void *ignore, struct request_queue *q) __blk_add_trace(bt, 0, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL, 0); else if (bte) __blk_add_trace_ext(bte, 0, 0, 0, 0, BLK_TA_PLUG_EXT, 0, 0, - NULL, 0, 0); + NULL, 0, 0, NULL); rcu_read_unlock(); } @@ -1756,7 +1780,7 @@ static void blk_add_trace_unplug(void *ignore, struct request_queue *q, else what = BLK_TA_UNPLUG_TIMER_EXT; __blk_add_trace_ext(bte, 0, 0, 0, 0, what, 0, sizeof(rpdu), - &rpdu, 0, 0); + &rpdu, 0, 0, NULL); } rcu_read_unlock(); } @@ -1787,7 +1811,9 @@ static void blk_add_trace_split(void *ignore, struct bio *bio, unsigned int pdu) bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, BLK_TA_SPLIT_EXT, bio->bi_status, sizeof(rpdu), &rpdu, - blk_trace_bio_get_cgid(q, bio), 0); + blk_trace_bio_get_cgid(q, bio), + bio_prio(bio), + bio_integrity(bio)); } rcu_read_unlock(); } @@ -1831,7 +1857,9 @@ static void blk_add_trace_bio_remap(void *ignore, struct bio *bio, dev_t dev, bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, BLK_TA_REMAP_EXT, bio->bi_status, sizeof(r), &r, - blk_trace_bio_get_cgid(q, bio), 0); + blk_trace_bio_get_cgid(q, bio), + bio_prio(bio), + bio_integrity(bio)); } rcu_read_unlock(); } @@ -1876,7 +1904,7 @@ static void blk_add_trace_rq_remap(void *ignore, struct request *rq, dev_t dev, __blk_add_trace_ext(bte, blk_rq_pos(rq), blk_rq_bytes(rq), rq_data_dir(rq), 0, BLK_TA_REMAP_EXT, 0, sizeof(r), &r, - blk_trace_request_get_cgid(rq), 0); + blk_trace_request_get_cgid(rq), 0, NULL); } rcu_read_unlock(); } @@ -1912,7 +1940,7 @@ void blk_add_driver_data(struct request *rq, void *data, size_t len) __blk_add_trace_ext(bte, blk_rq_trace_sector(rq), blk_rq_bytes(rq), 0, 0, BLK_TA_DRV_DATA_EXT, 0, len, data, blk_trace_request_get_cgid(rq), - req_get_ioprio(rq)); + req_get_ioprio(rq), NULL); } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9F48C433E0 for ; Thu, 25 Feb 2021 07:11:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A47B264ED3 for ; Thu, 25 Feb 2021 07:11:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233136AbhBYHKw (ORCPT ); Thu, 25 Feb 2021 02:10:52 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:50748 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233440AbhBYHIz (ORCPT ); Thu, 25 Feb 2021 02:08:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236936; x=1645772936; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cJQvU0rRFxDr7whJauE5NqjCq8pb+jrxymeltC/I/EM=; b=p0yvmUKB29zcJ8n8XK8opHBvEN+wAUjUAm1pwOfNPCR6ro1i5NKorR9u xjyO5Vkfjn9jpakvZeQxovmflb4i3/DompdLDJq8aVsu7+qlgsTdXTinl CEJ5Me5QTie2cwX3KR6iU9jBYrTjmhTtRGdnOKBiWXzKFzlpcQaF44a2x zWYgaAQevnuORtfDq2g9T7At1v1EHHAuQLKV2xAm4JtkEEqfO7iC63Ksw L2GYv8EvoGlYveM2mgxwwbnM/TYwKr+gU07zrpp4GzBrQLDYGAalMrKAH J78GaV34EV3EsL4OqMkBxdhekfbhdkGjYyYTh3fEkqXch/2nX5SGvWagq w==; IronPort-SDR: sWtl5nE+GbJJODQCE6oW3F8NQ2OmeWzffAusN6pMVSoSUYl9q6Wip5kGndsIMnji5jniup1g+7 cO61581qHu+AMctAuzfedol/5YODrdUWSP0hvL6YPrJar2J54ihXk2JtgAG3Cs9ttzN6zEHcOo g8Ldq6lfg1kq0JIo7l3ldoloJe1Zug95BKKxdJ7hFSO72v7JWSvWsq/E0pwpZ1L974h6DFG3BP aKbY8nM+niqfmrXfXg/245bfUFR/ZGAilD049/KmhAHQFoU+vzY956BbAQMpLfdvIxuYlP8E96 cKQ= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="161931681" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:47 +0800 IronPort-SDR: Uz9WINJxeRxXr1CSYmHMx+9pPkkikVTLcnyGqSlUcc4JAZZoZQ7zfBbTjz+0SVCrmKEL4109gc 345osgHqL9EEyDp7u5e8Aamrf6ttDR1VHQN26jfFgLSdu6O3VlKnra50IrQ/gFna2F0GTL0jmN /tDkOQR5WtL9EgzzRYqryvFMtPJp62BCTHcCPQMz/WmoZbYhp2orhCf9wsaUBG09cTeGiEcWwL 3MTYazelKkTjb2omZWJHXPq6DJry9RZst49NYvtY3RPaIs4chQFfcBK90U4CRtNd75YGLDLntd gtLinU5A6DPDl1XC42uU6sjF Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:49:08 -0800 IronPort-SDR: 1Ai/00Lm2cIyeyrSTjldjAq0K/s6INxGPiOcn+Ipc9i/4uq4e+yBU6GBdKWHv6+F7KSEF646yX NjFdYYumwkHZYhnsg3aqsZrX133zslPqldO6zMJCTyx8/JSod8KGZmpaZCDROA3TpXi+8JDDAZ rfxvV+W3/qoKQA7y59W9tjzMEpDWRJFnnLls3mM8wbbGo7Nfv1I9TNUFpAj37w/Dtf5PVuAExn sfmEZCoPMN3njd5YnCHgiHJ1g9F/mby4pJ9/67Tw1E6jBSF35lk5/J5/ajJCe8V7eJ5+zAuf1q rBI= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:46 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 37/39] blktrace: update blk_fill_rwbs() with new requests Date: Wed, 24 Feb 2021 23:02:29 -0800 Message-Id: <20210225070231.21136-38-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 6759ac7bc6c7..32100c5db7a6 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -3184,6 +3184,35 @@ void blk_fill_rwbs(char *rwbs, unsigned int op) case REQ_OP_READ: rwbs[i++] = 'R'; break; + case REQ_OP_WRITE_ZEROES: + rwbs[i++] = 'W'; + rwbs[i++] = 'Z'; + break; + case REQ_OP_ZONE_RESET: + rwbs[i++] = 'Z'; + rwbs[i++] = 'R'; + break; + case REQ_OP_ZONE_RESET_ALL: + rwbs[i++] = 'Z'; + rwbs[i++] = 'R'; + rwbs[i++] = 'A'; + break; + case REQ_OP_ZONE_APPEND: + rwbs[i++] = 'Z'; + rwbs[i++] = 'A'; + break; + case REQ_OP_ZONE_OPEN: + rwbs[i++] = 'Z'; + rwbs[i++] = 'O'; + break; + case REQ_OP_ZONE_CLOSE: + rwbs[i++] = 'Z'; + rwbs[i++] = 'C'; + break; + case REQ_OP_ZONE_FINISH: + rwbs[i++] = 'Z'; + rwbs[i++] = 'F'; + break; default: rwbs[i++] = 'N'; } From patchwork Thu Feb 25 07:02:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08012C433DB for ; Thu, 25 Feb 2021 07:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4BE964E6C for ; Thu, 25 Feb 2021 07:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232634AbhBYHMG (ORCPT ); Thu, 25 Feb 2021 02:12:06 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:26799 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbhBYHKA (ORCPT ); Thu, 25 Feb 2021 02:10:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614237000; x=1645773000; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zF7/doyKoEogbpCRXSeDJCnl1y9SdsmStX/bXUCeES0=; b=gz3+qrV5aoo6tX5TzvEO1Jb7dasqKV6nYigJoUEVP9+8Yc4BemhkUICL UEZQeFxFNtQMvh3g2FwADaGPOw/bXT47Gn6iFCYqB5H9aPU7bY0Agrtln 2pt0/ntO/v8FeoqgRI81uFqRceX05D2eeKRhRdnblHgAKvNP+KBjg0QQj PLaLhZk2sGlzk8YTEeZUVeAWtQO+nrgqdq8tgIVCikw5cER9zTy6uPh4y OGoJAa8+MoMD/EH1uYWut9vpd0nYQ/vgwuhoJ/8zaYSwGZemUjI5iH2xY vgd1C4atiVAHAm4PN28C4wtIGg7gM983aQ70w18Ib34A+0O1IhpeHoI0X g==; IronPort-SDR: hTwAjRhBAyD/iYPX+dBdAddXOS2C6wnnsz9YNZWr7Y3JDu9AJP2xEfrAr2LrpXIxXL7+Q7sJiG haX8OJ6Qn48sOQGVa9L1l1np8Q7e/HOKdihBlBdCUDJxQqg60EwygWG9mBpZ+orIn9ZWpunDqY UCVr2PQyWuZN10FhxT7/hm3KY5DR8w8a3gvRriwNzSUfiRtUcDPo8KDXtw5pUMI4v2RxD+eJR6 41PRp8+/eWpWyCq2QKVcIuUjZqy7mk8axJ/SBiev6nh9nWf7wQSrfJi/WX7k7WhA3Q4bHRP60n ZQg= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160778125" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:07:54 +0800 IronPort-SDR: AB5TIZt57zuC793FNzMHCokdEQuLFMA8wUOz77XSN45IestPNUolCrEQXGZKEk6NnEkRw9BNZW ADfwzwtxRhH+6kCrYztlxBGCvuNwrgEBdEiLJvW4a8MD3p3vFQDM17FbcSRXIakh53W8RdVZRS r/BtVN0mGEI9JrBERrebh7GZcDSTXO+dqcWP2WLh9gwwtGv+2avwNUE2U/K1Iqdm0jTHniuhbS CaO0gC1GO8mG8TISGJs2K4RZEuMqj/HYLgKnkXpoAklXiYnUoLqM+7uqQyHw45iAiZ24rIXp/g M/ZQc18XobLskU/N2l6MbF6K Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:49:16 -0800 IronPort-SDR: ryJ6gXargtDm0+QkHLSc5S5vTvL835ijcFWtYSf9MpFOuw/C+fmXqevnuJWRq5QddwxEL6EXFo KtCZZS00JTeUfDVPUO3nyiaMDOhk9TBGJ//aQaXviKDmuZpBhV+44WPckprZQWheCKX/Lom1gV pFgn41H4ryr2A55MmgY5NFrDCzSe6tOhWSx1xY3vwx9svTqZ6ZqLTsMjwnPiGmLTCkr46LAm5G VgzTMDJaj6Rwxx68vz6FnuXlHQX4/f3g1CYh8js4h8qzbiqquxOsu+Xllu4z3twJROEamjKox9 EY0= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:07:54 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 38/39] blktrace: track zone appaend completion sector Date: Wed, 24 Feb 2021 23:02:30 -0800 Message-Id: <20210225070231.21136-39-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The request type REQ_OP_ZONE_APPENDT needs zone start the when issued not the actual sector where this I/O lands and returns completion sector in for trace complete event 'C'. Right now we cannot track submission & completion sector for this special request with existing format. Add a new completion sector field in the blk_io_trace_ext structure, when generating the trace when req_op is REQ_OP_ZONE_APPEND update the completion sector from the I/O and store the zone start (where actual I/O was issued) in the secor field of the trace. With this new format we can track completion sector. (* is not a part real trace it is here as a place holder so that it is easy to read for reviewers) :- 252,0 15 1 92.785481956 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 2 92.785490381 6139 G ZAS N 262144 + 8 [dd] 252,0 15 3 92.785498517 6139 I ZAS N 262144 + 8 [dd] 252,0 15 4 92.785519065 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 5 92.785541527 86 C ZAS N 262144 + 8 [0] <262144> 252,0 15 6 92.785561936 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 7 92.785568368 6139 G ZAS N 262144 + 8 [dd] 252,0 15 8 92.785574820 6139 I ZAS N 262144 + 8 [dd] 252,0 15 9 92.785587754 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 10 92.785602802 86 C ZAS N 262144 + 8 [0] <262152> 252,0 15 11 92.785619704 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 12 92.785626076 6139 G ZAS N 262144 + 8 [dd] 252,0 15 13 92.785632438 6139 I ZAS N 262144 + 8 [dd] 252,0 15 14 92.785644801 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 15 92.785659939 86 C ZAS N 262144 + 8 [0] <262160> 252,0 15 16 92.785676460 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 17 92.785682872 6139 G ZAS N 262144 + 8 [dd] 252,0 15 18 92.785689294 6139 I ZAS N 262144 + 8 [dd] 252,0 15 19 92.785701487 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 20 92.785716024 86 C ZAS N 262144 + 8 [0] <262168> 252,0 15 21 92.785732335 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 22 92.785738687 6139 G ZAS N 262144 + 8 [dd] 252,0 15 23 92.785745019 6139 I ZAS N 262144 + 8 [dd] 252,0 15 24 92.785757843 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 25 92.785772020 86 C ZAS N 262144 + 8 [0] <262176> 252,0 15 26 92.785788180 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 27 92.785794492 6139 G ZAS N 262144 + 8 [dd] 252,0 15 28 92.785800763 6139 I ZAS N 262144 + 8 [dd] 252,0 15 29 92.785812696 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 30 92.785826762 86 C ZAS N 262144 + 8 [0] <262184> 252,0 15 31 92.785842852 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 32 92.785849104 6139 G ZAS N 262144 + 8 [dd] 252,0 15 33 92.785855346 6139 I ZAS N 262144 + 8 [dd] 252,0 15 34 92.785867599 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 35 92.785881835 86 C ZAS N 262144 + 8 [0] <262192> 252,0 15 36 92.785897845 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 37 92.785904107 6139 G ZAS N 262144 + 8 [dd] 252,0 15 38 92.785910329 6139 I ZAS N 262144 + 8 [dd] 252,0 15 39 92.785922181 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 40 92.785936237 86 C ZAS N 262144 + 8 [0] <262200> 252,0 15 41 92.785952037 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 42 92.785958289 6139 G ZAS N 262144 + 8 [dd] 252,0 15 43 92.785964651 6139 I ZAS N 262144 + 8 [dd] 252,0 15 44 92.785976373 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 45 92.785990419 86 C ZAS N 262144 + 8 [0] <262208> 252,0 15 46 92.786006339 6139 Q ZAS N 262144 + 8 [dd] 252,0 15 47 92.786025204 6139 G ZAS N 262144 + 8 [dd] 252,0 15 48 92.786031566 6139 I ZAS N 262144 + 8 [dd] 252,0 15 49 92.786043869 804 D ZAS N 262144 + 8 [kworker/15:1H] 252,0 15 50 92.786058216 86 C ZAS N 262144 + 8 [0] <262216> 252,0 10 1 92.783369654 6138 Q ZRS N 262144 + 0 [truncate] 252,0 10 2 92.783384813 6138 G ZRS N 262144 + 0 [truncate] 252,0 10 3 92.783395182 6138 I ZRS N 262144 + 0 [truncate] 252,0 10 4 92.783419628 782 D ZRS N 262144 + 0 [kworker/10:1H] 252,0 10 5 92.783460895 61 C ZRS N 262144 + 0 [0] 252,0 8 1 92.788546342 6140 Q ZRAS N 0 + 0 [blkzone] 252,0 8 2 92.788554628 6140 G ZRAS N 0 + 0 [blkzone] 252,0 8 3 92.788562232 6140 I ZRAS N 0 + 0 [blkzone] 252,0 8 4 92.788580977 934 D ZRAS N 0 + 0 [kworker/8:1H] 252,0 8 5 92.788597268 51 C ZRAS N 0 + 0 [0] Signed-off-by: Chaitanya Kulkarni --- include/uapi/linux/blktrace_api.h | 1 + kernel/trace/blktrace.c | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/include/uapi/linux/blktrace_api.h b/include/uapi/linux/blktrace_api.h index ac533a0b0928..ebfe3029cd10 100644 --- a/include/uapi/linux/blktrace_api.h +++ b/include/uapi/linux/blktrace_api.h @@ -155,6 +155,7 @@ struct blk_io_trace_ext { __u32 sequence; /* event number */ __u64 time; /* in nanoseconds */ __u64 sector; /* disk offset */ + __u64 completion_sector;/* zone append completion sector */ __u32 bytes; /* transfer length */ __u64 action; /* what happened */ __u32 ioprio; /* I/O priority */ diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 32100c5db7a6..59bf99b4106a 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -502,7 +502,8 @@ static const u64 ddir_act_ext[2] = { BLK_TC_ACT_EXT(BLK_TC_READ), */ static void __blk_add_trace_ext(struct blk_trace_ext *bt, sector_t sector, int bytes, int op, int op_flags, u64 what, int error, int pdu_len, - void *pdu_data, u64 cgid, u32 ioprio, void *bip) + void *pdu_data, u64 cgid, u32 ioprio, void *bip, + sector_t blk_queue_zone_sectors) { struct task_struct *tsk = current; struct ring_buffer_event *event = NULL; @@ -595,6 +596,16 @@ static void __blk_add_trace_ext(struct blk_trace_ext *bt, sector_t sector, int b t->pid = pid; t->sector = sector; + if (op == REQ_OP_ZONE_APPEND) { + sector_t zno = sector >> ilog2(blk_queue_zone_sectors); + + t->completion_sector = sector; + /* + * Start of the zone sector in which this completion + * sector belongs to. + */ + sector = zno * blk_queue_zone_sectors; + } t->bytes = bytes; t->action = what; t->ioprio = ioprio; @@ -1445,7 +1456,8 @@ static void blk_add_trace_rq(struct request *rq, int error, what |= BLK_TC_ACT_EXT(BLK_TC_FS); __blk_add_trace_ext(bte, blk_rq_trace_sector(rq), nr_bytes, req_op(rq), rq->cmd_flags, what, error, 0, - NULL, cgid, req_get_ioprio(rq), NULL); + NULL, cgid, req_get_ioprio(rq), NULL, + blk_queue_zone_sectors(rq->q)); } rcu_read_unlock(); } @@ -1588,7 +1600,8 @@ static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, what, error, 0, NULL, blk_trace_bio_get_cgid(q, bio), - bio_prio(bio), bio_integrity(bio)); + bio_prio(bio), bio_integrity(bio), + blk_queue_zone_sectors(q)); } rcu_read_unlock(); } @@ -1748,7 +1761,7 @@ static void blk_add_trace_plug(void *ignore, struct request_queue *q) __blk_add_trace(bt, 0, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL, 0); else if (bte) __blk_add_trace_ext(bte, 0, 0, 0, 0, BLK_TA_PLUG_EXT, 0, 0, - NULL, 0, 0, NULL); + NULL, 0, 0, NULL, 0); rcu_read_unlock(); } @@ -1780,7 +1793,7 @@ static void blk_add_trace_unplug(void *ignore, struct request_queue *q, else what = BLK_TA_UNPLUG_TIMER_EXT; __blk_add_trace_ext(bte, 0, 0, 0, 0, what, 0, sizeof(rpdu), - &rpdu, 0, 0, NULL); + &rpdu, 0, 0, NULL, 0); } rcu_read_unlock(); } @@ -1813,7 +1826,7 @@ static void blk_add_trace_split(void *ignore, struct bio *bio, unsigned int pdu) bio->bi_status, sizeof(rpdu), &rpdu, blk_trace_bio_get_cgid(q, bio), bio_prio(bio), - bio_integrity(bio)); + bio_integrity(bio), 0); } rcu_read_unlock(); } @@ -1859,7 +1872,7 @@ static void blk_add_trace_bio_remap(void *ignore, struct bio *bio, dev_t dev, sizeof(r), &r, blk_trace_bio_get_cgid(q, bio), bio_prio(bio), - bio_integrity(bio)); + bio_integrity(bio), 0); } rcu_read_unlock(); } @@ -1904,7 +1917,7 @@ static void blk_add_trace_rq_remap(void *ignore, struct request *rq, dev_t dev, __blk_add_trace_ext(bte, blk_rq_pos(rq), blk_rq_bytes(rq), rq_data_dir(rq), 0, BLK_TA_REMAP_EXT, 0, sizeof(r), &r, - blk_trace_request_get_cgid(rq), 0, NULL); + blk_trace_request_get_cgid(rq), 0, NULL, 0); } rcu_read_unlock(); } @@ -1940,7 +1953,7 @@ void blk_add_driver_data(struct request *rq, void *data, size_t len) __blk_add_trace_ext(bte, blk_rq_trace_sector(rq), blk_rq_bytes(rq), 0, 0, BLK_TA_DRV_DATA_EXT, 0, len, data, blk_trace_request_get_cgid(rq), - req_get_ioprio(rq), NULL); + req_get_ioprio(rq), NULL, 0); } rcu_read_unlock(); } From patchwork Thu Feb 25 07:02:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12103515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4C64C433DB for ; Thu, 25 Feb 2021 07:11:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DF8564E85 for ; Thu, 25 Feb 2021 07:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233996AbhBYHLR (ORCPT ); Thu, 25 Feb 2021 02:11:17 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:13993 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232600AbhBYHJF (ORCPT ); Thu, 25 Feb 2021 02:09:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1614236945; x=1645772945; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=meQL1JMpFqt94nC7NLV1ujzWJeKhbSQBgmyhyvdKdTk=; b=fNbkqUeuhdm3tjfty6BdKjuHQbUlPJ+GSPxgnkU8iAMZh9z4HNbmyxHF klYjtZYgexqivEjcp1rlIUBrO7nz43rOml8e0+Q16p4nl9Kfd+enzl3c1 CTjwaRCir3tDIEANeH4Ff1P+o18MSkZzU/h1gYiJYjiN3HmOlTwvAtUq6 X6XpMOOGzmHEWqTsoT0Sy0dBuKymHJkSverIzh894Qg+a49pFi/gjVHgD nc67xG1fq/F9Put/VmSboecUrvg+3cIxEB04XJCNIpNVEWG8F91kxh47b 3TXzmMtIytHkBcwGAQsnl+t4Qql7XUl9aat04Rcwdk5bwvhYpXgRlI6XC Q==; IronPort-SDR: Splu0NwJn2Lc/Eg6O7NTiyyppfPnEghCKG0iVrrVqmoTapokEMSGiFUuD6021FODroz3H3VIH9 Q4ce6/vG4P8IOq+9txz3X+oi84WbFjdpngFWcGAK4qlVJKzQlxzEyQvlxDeWiBiG9PVChr0nFC GwzY5FNDFpKThiFxE7QnA6NnXM9/9DAcqwF2VXkbz31Fhz1ZuEe6qahLLTMHlhGjXMHWbK3LVJ 7sSPGpbUxaYhRKtsFd5q390syFa8CqV1kXDCZdb7EDhYpV1GFbnJo+b/vkPp1Lw0vfnKt3u7UO XB0= X-IronPort-AV: E=Sophos;i="5.81,205,1610380800"; d="scan'208";a="160751973" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2021 15:08:02 +0800 IronPort-SDR: AuTrhQqJhu9M50V0N87awvkORBzl7EqE/Bsom5asYLrpmasLJPLwqOC9ukvOydUq8Y+C/Xab3i XjKczvRRrcF9SKLBKjBf85KPW51eN1FM37oLGqB251LfjKamLlGmWxdUsyKM1NYo0PZc+T8TGr RpAJOPWesfHxAoNyGJKBdVrKl75ZLQEqoB8IA7GQX7mYwe6D1gWZrIte+lhfIY+n9SxLrkaRCA D8SkmrDOFiYwEmIb+yofq8NasWXAh1nqZsm2ccSVLBNiixuyI+D/1J9wjrrliw66+pvh/1WpiU xV+gdcwm58GNyJCfpC8TVA2f Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 22:49:24 -0800 IronPort-SDR: RWgwNxvF+jMxkY5pmDIYl1N9kFSic+cuJLznej9ATn2Ra1ri8n257BI4KQMBtBYiBoVqX4PqA3 V3efPkeZ7//gvBqehB0pT4d0S0+O3oQPF9RqmXXbkkhh7CS8SHPXAhCU5jK358fIiKi0NA4Bti yVA6g1mGdoTrwtPxwgIsbPgjGyqUWLIFCt7iisO8IMgAB3Tfn5mjmYI3K/m8Ot1LJJHtB5G7pb Bji8m5Z4tj4sPzsUoVxpqw5mbH1626CSNdyjoVQvlVJ6Q/waivnRmiJOT3rdOCz+1tGMOIHlxg pnw= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip01.wdc.com with ESMTP; 24 Feb 2021 23:08:02 -0800 From: Chaitanya Kulkarni To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org, mingo@redhat.com, chaitanya.kulkarni@wdc.com, johannes.thumshirn@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org, dongli.zhang@oracle.com, aravind.ramesh@wdc.com, joshi.k@samsung.com, niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com, martin.petersen@oracle.com Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 39/39] blktrace: debug patch for the demo Date: Wed, 24 Feb 2021 23:02:31 -0800 Message-Id: <20210225070231.21136-40-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1.dirty In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> References: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Chaitanya Kulkarni --- block/blk-lib.c | 4 ++++ block/blk-zoned.c | 1 + drivers/block/null_blk/main.c | 32 ++++++++++++++++++++++++------- drivers/block/null_blk/null_blk.h | 1 + 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index 752f9c722062..dd8854341bf6 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -98,6 +98,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev); bio_set_op_attrs(bio, op, 0); + bio_set_prio(bio, get_current_ioprio()); bio->bi_iter.bi_size = req_sects << 9; sector += req_sects; @@ -191,6 +192,7 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector, bio = blk_next_bio(bio, 1, gfp_mask); bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev); + bio_set_prio(bio, get_current_ioprio()); bio->bi_vcnt = 1; bio->bi_io_vec->bv_page = page; bio->bi_io_vec->bv_offset = 0; @@ -267,6 +269,7 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev, bio = blk_next_bio(bio, 0, gfp_mask); bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev); + bio_set_prio(bio, get_current_ioprio()); bio->bi_opf = REQ_OP_WRITE_ZEROES; if (flags & BLKDEV_ZERO_NOUNMAP) bio->bi_opf |= REQ_NOUNMAP; @@ -319,6 +322,7 @@ static int __blkdev_issue_zero_pages(struct block_device *bdev, gfp_mask); bio->bi_iter.bi_sector = sector; bio_set_dev(bio, bdev); + bio_set_prio(bio, get_current_ioprio()); bio_set_op_attrs(bio, REQ_OP_WRITE, 0); while (nr_sects != 0) { diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 833978c02e60..3df0f22cbc54 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -233,6 +233,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, while (sector < end_sector) { bio = blk_next_bio(bio, 0, gfp_mask); bio_set_dev(bio, bdev); + bio_set_prio(bio, get_current_ioprio()); /* * Special case for the zone reset operation that reset all diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index d6c821d48090..0c2bc7188d27 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -84,6 +84,10 @@ enum { NULL_Q_MQ = 2, }; +static bool g_discard; +module_param_named(discard, g_discard, bool, 0444); +MODULE_PARM_DESC(discard, "Enable queue discard (default: false)"); + static int g_no_sched; module_param_named(no_sched, g_no_sched, int, 0444); MODULE_PARM_DESC(no_sched, "No io scheduler"); @@ -156,6 +160,10 @@ static int g_max_sectors; module_param_named(max_sectors, g_max_sectors, int, 0444); MODULE_PARM_DESC(max_sectors, "Maximum size of a command (in 512B sectors)"); +static unsigned int g_bounce_pfn; +module_param_named(bounce_pfn, g_bounce_pfn, int, 0444); +MODULE_PARM_DESC(bounce_pfn, "Queue Bounce limit (default: 0)"); + static unsigned int nr_devices = 1; module_param(nr_devices, uint, 0444); MODULE_PARM_DESC(nr_devices, "Number of devices to register"); @@ -350,6 +358,7 @@ NULLB_DEVICE_ATTR(submit_queues, uint, nullb_apply_submit_queues); NULLB_DEVICE_ATTR(home_node, uint, NULL); NULLB_DEVICE_ATTR(queue_mode, uint, NULL); NULLB_DEVICE_ATTR(blocksize, uint, NULL); +NULLB_DEVICE_ATTR(bounce_pfn, uint, NULL); NULLB_DEVICE_ATTR(max_sectors, uint, NULL); NULLB_DEVICE_ATTR(irqmode, uint, NULL); NULLB_DEVICE_ATTR(hw_queue_depth, uint, NULL); @@ -468,6 +477,7 @@ static struct configfs_attribute *nullb_device_attrs[] = { &nullb_device_attr_home_node, &nullb_device_attr_queue_mode, &nullb_device_attr_blocksize, + &nullb_device_attr_bounce_pfn, &nullb_device_attr_max_sectors, &nullb_device_attr_irqmode, &nullb_device_attr_hw_queue_depth, @@ -539,7 +549,7 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item) static ssize_t memb_group_features_show(struct config_item *item, char *page) { return snprintf(page, PAGE_SIZE, - "memory_backed,discard,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv,zone_max_open,zone_max_active,blocksize,max_sectors\n"); + "memory_backed,discard,bounce_pfn,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv\n"); } CONFIGFS_ATTR_RO(memb_group_, features); @@ -600,6 +610,7 @@ static struct nullb_device *null_alloc_dev(void) dev->blocking = g_blocking; dev->use_per_node_hctx = g_use_per_node_hctx; dev->zoned = g_zoned; + dev->discard = g_discard; dev->zone_size = g_zone_size; dev->zone_capacity = g_zone_capacity; dev->zone_nr_conv = g_zone_nr_conv; @@ -1588,15 +1599,10 @@ static void null_del_dev(struct nullb *nullb) static void null_config_discard(struct nullb *nullb) { + blk_queue_max_write_zeroes_sectors(nullb->q, UINT_MAX >> 9); if (nullb->dev->discard == false) return; - if (!nullb->dev->memory_backed) { - nullb->dev->discard = false; - pr_info("discard option is ignored without memory backing\n"); - return; - } - if (nullb->dev->zoned) { nullb->dev->discard = false; pr_info("discard option is ignored in zoned mode\n"); @@ -1609,6 +1615,17 @@ static void null_config_discard(struct nullb *nullb) blk_queue_flag_set(QUEUE_FLAG_DISCARD, nullb->q); } +static void null_config_bounce_pfn(struct nullb *nullb) +{ + if (nullb->dev->memory_backed && nullb->dev->bounce_pfn == false) + return; + + if (!nullb->dev->memory_backed && !g_bounce_pfn) + return; + + blk_queue_bounce_limit(nullb->q, nullb->dev->bounce_pfn); +} + static const struct block_device_operations null_bio_ops = { .owner = THIS_MODULE, .submit_bio = null_submit_bio, @@ -1881,6 +1898,7 @@ static int null_add_dev(struct nullb_device *dev) blk_queue_max_hw_sectors(nullb->q, dev->max_sectors); null_config_discard(nullb); + null_config_bounce_pfn(nullb); sprintf(nullb->disk_name, "nullb%d", nullb->index); diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h index 83504f3cc9d6..cd55f99118bf 100644 --- a/drivers/block/null_blk/null_blk.h +++ b/drivers/block/null_blk/null_blk.h @@ -86,6 +86,7 @@ struct nullb_device { unsigned int queue_mode; /* block interface */ unsigned int blocksize; /* block size */ unsigned int max_sectors; /* Max sectors per command */ + unsigned int bounce_pfn; /* bounce page frame number */ unsigned int irqmode; /* IRQ completion handler */ unsigned int hw_queue_depth; /* queue depth */ unsigned int index; /* index of the disk, only valid with a disk */