From patchwork Wed May 1 04:33:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10924505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E1FD92A for ; Wed, 1 May 2019 04:33:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BA9528ABE for ; Wed, 1 May 2019 04:33:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CC8D28B96; Wed, 1 May 2019 04:33:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E827728ABE for ; Wed, 1 May 2019 04:33:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725958AbfEAEdZ (ORCPT ); Wed, 1 May 2019 00:33:25 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:63464 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfEAEdZ (ORCPT ); Wed, 1 May 2019 00:33:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556685205; x=1588221205; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IDDSLBv6TR1FH1Ce2TESaIyNIg27l32mUNWK8SkXujk=; b=RJ45b2dzzxMhhOeTGw1B3lPkvM94Sbh/1DUYgB9MRfh3vGS3lfwTlSoL xN/GVrYPtnwNy5YyjDt+Nv7sYUd73KYe5ohQf0tKtLThufFzneut6mMkl jNwJtGffT4zzLnAPZTFnamORxv7kZi78tzPmjW12S0LhdKOjPI52uPjqo 208cZ9WuMLBOTHSbux04/TvR+lQA5K9rrWC5lO8UYxdVsSjcxR9aqULN1 lTjI4mbHPWBZJdHS8gJG4e3bPVKZ8F5GDqWauaV8pLbayY2EGzcKbF/NZ FcrC0qoBoqLXQ6p3we77zp97ovQwg9pDsT5DJTqybFo+5p/2NLqDyDC7R Q==; X-IronPort-AV: E=Sophos;i="5.60,416,1549900800"; d="scan'208";a="107229717" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 01 May 2019 12:33:25 +0800 IronPort-SDR: hx/z4hkXNqkETU3oAsnhqUPKjRo4nSbL9QWEc12s2UUit0toMQbgC85WZ1R7ushKFHaVD0Cjgx uHG4u3L9PFEKiY+I0IX6Lm+VvJ8ti/xb4mE1Jsn8D2fWUITHdY+FLYRPKPoYOms+SywOsbCYL7 utLXNz0Xtay9PY5cXdfcjHFRhvOgvDSeHqL6Z5DVprnNGqn08Nm7CoHFJJyquUT8E7DkiVLE1O 7J3Zxvd884Osl3F6DeYC4sTeH/6Iopn0fSih+lotQxFFbtvDjCaKm0rNxgkeHiGC26TK9qd8BZ TbgRQBpf5qVCkCZmL6qZFgL1 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 30 Apr 2019 21:11:53 -0700 IronPort-SDR: ilEDFoC/WxOrdrUmeB16rnZlfrydHyoG6GnjDk8rwH3OwLUKPbdQmMEp9+o4tJLglo78S2SQPK lJ2LcgEo9LhhBbqqRF2C4+893o/DQiLemhPmqaSMx1xhpdXcYJXt5jhufXBQ4ccIRIQk+gwe/N yUYs6IQZAZJhq+kxxDtwq/ciNkN3Y1wQkCNfvGQYeth/+4DPi4s7sNpcpcNKJYZPl0DXAxOM+R eetwlnZ3BP7P1AzH+LHJoQKUjzBkmBJpWDD1hmmyJcdzPWXdpC48Wp+VndXtQ0lAWbu8+5GpKj KCs= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Apr 2019 21:33:25 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: Chaitanya Kulkarni Subject: [RFC PATCH blktrace-tools 01/10] blktrace.h: add blktrace extension to the header Date: Tue, 30 Apr 2019 21:33:08 -0700 Message-Id: <20190501043317.5507-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> References: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds blktrace extension definitions to the central header file blktrace.h. Here we also add priority related constants which are used in the next few patches. Signed-off-by: Chaitanya Kulkarni --- blktrace.h | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/blktrace.h b/blktrace.h index 944fc08..17f9f8d 100644 --- a/blktrace.h +++ b/blktrace.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "blktrace_api.h" #include "rbtree.h" @@ -26,6 +27,38 @@ #define t_kb(t) ((t)->bytes >> 10) #define t_b(t) ((t)->bytes & 1023) +#ifdef CONFIG_BLKTRACE_EXT +/* + * Gives us 8 prio classes with 13-bits of data for each class + */ +#define IOPRIO_CLASS_SHIFT (13) +#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1) + +#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT) +#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK) +#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data) + +#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE) + +/* + * These are the io priority groups as implemented by CFQ. RT is the realtime + * class, it always gets premium service. BE is the best-effort scheduling + * class, the default for any process. IDLE is the idle scheduling class, it + * is only served when no one else is using the disk. + */ +enum { + IOPRIO_CLASS_NONE, + IOPRIO_CLASS_RT, + IOPRIO_CLASS_BE, + IOPRIO_CLASS_IDLE, + IOPRIO_CLASS_LAST, +}; + +#define TRACE_ALL_IOPRIO ((1 << IOPRIO_CLASS_NONE) | (1 << IOPRIO_CLASS_RT) | \ + (1 << IOPRIO_CLASS_BE) | (1 << IOPRIO_CLASS_IDLE)) + +#endif /* CONFIG_BLKTRACE_EXT */ + typedef __u32 u32; typedef __u8 u8; @@ -68,7 +101,11 @@ extern int data_is_native; extern struct timespec abs_start_time; #define CHECK_MAGIC(t) (((t)->magic & 0xffffff00) == BLK_IO_TRACE_MAGIC) +#ifdef CONFIG_BLKTRACE_EXT +#define SUPPORTED_VERSION (0x08) +#else #define SUPPORTED_VERSION (0x07) +#endif #if __BYTE_ORDER == __LITTLE_ENDIAN #define be16_to_cpu(x) __bswap_16(x) @@ -95,7 +132,7 @@ static inline int verify_trace(struct blk_io_trace *t) return 1; } if ((t->magic & 0xff) != SUPPORTED_VERSION) { - fprintf(stderr, "unsupported trace version %x\n", + fprintf(stderr, "unsupported trace version %x\n", t->magic & 0xff); return 1; } From patchwork Wed May 1 04:33:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10924507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CBD492A for ; Wed, 1 May 2019 04:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DFD328ABE for ; Wed, 1 May 2019 04:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 020B228B96; Wed, 1 May 2019 04:33:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84F8D28ABE for ; Wed, 1 May 2019 04:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725973AbfEAEd2 (ORCPT ); Wed, 1 May 2019 00:33:28 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:63464 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfEAEd1 (ORCPT ); Wed, 1 May 2019 00:33:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556685208; x=1588221208; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AGWx/uUxm0nQ3i8lTTtjIdMK7mOGIchfY+XfJ9kd0iA=; b=POlpbwT8Mvgak6GMp2PE1Fz46nwFxVXfGQkzXghgL+6DugkKOOiLcNyC YqU1sOmoD/Shq5shtTMH+Oo6LDMbNKuPbHvPsFJZxT8Wj6Ji8rwi/5SuC leX95bfsQTYgG+lTNStQhJxguP1+vPeS75yRila8K7zEnqpIJqCu/LcPc NBPyIxZc0xwR1E5WB1mbGyXfF1LjAPt2/awXUX2bnTx2UgOzrhXICrcNu cfVDsljBialCNIaRRmtUCu1KAHJABbS1venbboSnnwAsdgKlL8FBlkZKs hoChTa1+C8FiptTYOjHQpiy0L33oYvP224XpbEmQgD8JvpiFcZXzL8fsp Q==; X-IronPort-AV: E=Sophos;i="5.60,416,1549900800"; d="scan'208";a="107229721" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 01 May 2019 12:33:28 +0800 IronPort-SDR: xNX1zAKL2VrDhD5dpMP9pxQLGHknn6BtzogGScM8TElkuMCVRBA3o2QevSmbH3Z6uZ+O5gAWMI uDIKtMpzpLgGw6Pn0X8nWIhOCjxmEHQtkWzI/f687piVwRiAuPZEBRnWuSPpEkntLcFNQp+yWb WGwkrkEeVDrRR/zuFZfOOOePwZIy8ade8Oj5d/AdAF/kc1z7Pd8dp1Ow0pGLi4YdK8gPgyAXkm R9Uqo5bh7Huc6+JZNyC4BJTUhTwHQ6nbTVPLqY4CTJDSdomO52jqnSfmTd9uVBf3ZLqC7fe7+d 4Vp19W/JfP6C532F/YJusKj4 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 30 Apr 2019 21:11:56 -0700 IronPort-SDR: t6VNYlU/qQt0Nz/J0+tS5gj/aAFbbqSFgEFOhrDtiS1Za7CtRkflZlF+EJPgjbxyVy3BOTezfS 3fsjozzMRy2RyaJEOT3ePAI01iR/8IE4J46PWu8H2hJ+LUIQZUV8WK77cYFilQ/bAgYdc+6n8C ad72bv42bNci1hBJUMugNZQaZb/AkZYv1HX40Fgl1hO62Sdt4EHjdFxfSkjDR1+0GabuK7FKsw T7cRPAcDWXevJQAJHVj4LYuxi3AXO6poaLExE768f6KSD9tExoDizhtuBIv3P/FnCegUVwtEIH Shk= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Apr 2019 21:33:28 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: Chaitanya Kulkarni Subject: [RFC PATCH blktrace-tools 02/10] blktrace_api.h: update blktrace API header Date: Tue, 30 Apr 2019 21:33:09 -0700 Message-Id: <20190501043317.5507-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> References: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds blktrace extension definitions to the blktrace_api.h file. Here we add new block operations write-zeroes and zone reset. Also, we update the size of the block trace action and add a new field to mask the priorities. Mainly we change the size of the action in the blk_io_trace and size of action mask to keep it uniform across all the headers and the kernel which allows us to add new trace actions. Signed-off-by: Chaitanya Kulkarni --- blktrace_api.h | 66 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/blktrace_api.h b/blktrace_api.h index b222218..ac2ea43 100644 --- a/blktrace_api.h +++ b/blktrace_api.h @@ -2,34 +2,47 @@ #define BLKTRACEAPI_H #include +#include /* * Trace categories */ -enum { - BLK_TC_READ = 1 << 0, /* reads */ - BLK_TC_WRITE = 1 << 1, /* writes */ - BLK_TC_FLUSH = 1 << 2, /* flush */ - BLK_TC_SYNC = 1 << 3, /* 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 driver data */ - BLK_TC_FUA = 1 << 15, /* fua requests */ +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 */ + +#ifdef CONFIG_BLKTRACE_EXT + BLK_TC_WRITE_ZEROES = 1 << 16, /* write-zeores */ + BLK_TC_ZONE_RESET = 1 << 17, /* zone-reset */ - BLK_TC_END = 1 << 15, /* we've run out of bits! */ + BLK_TC_END = 1 << 31, /* we've run out of bits! */ +#else + BLK_TC_END = 1 << 15, /* we've run out of bits! */ +#endif /* CONFIG_BLKTRACE_EXT */ }; +#ifdef CONFIG_BLKTRACE_EXT +#define BLK_TC_SHIFT (32) +#define BLK_TC_ACT(act) (((uint64_t)act) << BLK_TC_SHIFT) +#else #define BLK_TC_SHIFT (16) #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) - +#endif /* CONFIG_BLKTRACE_EXT */ /* * Basic trace actions */ @@ -88,7 +101,12 @@ enum blktrace_notify { #define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY)) #define BLK_IO_TRACE_MAGIC 0x65617400 + +#ifdef CONFIG_BLKTRACE_EXT +#define BLK_IO_TRACE_VERSION 0x08 +#else #define BLK_IO_TRACE_VERSION 0x07 +#endif /* CONFIG_BLKTRACE_EXT */ /* * The trace itself @@ -99,7 +117,12 @@ struct blk_io_trace { __u64 time; /* in nanoseconds */ __u64 sector; /* disk offset */ __u32 bytes; /* transfer length */ +#ifdef CONFIG_BLKTRACE_EXT + __u64 action; /* what happened */ + __u32 ioprio; /* ioprio */ +#else __u32 action; /* what happened */ +#endif /* CONFIG_BLKTRACE_EXT */ __u32 pid; /* who did it */ __u32 device; /* device identifier (dev_t) */ __u32 cpu; /* on what cpu did it happen */ @@ -121,7 +144,12 @@ struct blk_io_trace_remap { */ struct blk_user_trace_setup { char name[32]; /* output */ +#ifdef CONFIG_BLKTRACE_EXT + __u64 act_mask; /* input */ + __u32 prio_mask; /* input */ +#else __u16 act_mask; /* input */ +#endif /* CONFIG_BLKTRACE_EXT */ __u32 buf_size; /* input */ __u32 buf_nr; /* input */ __u64 start_lba; From patchwork Wed May 1 04:33:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10924509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB0A592A for ; Wed, 1 May 2019 04:33:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C47728ABE for ; Wed, 1 May 2019 04:33:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90D9128B96; Wed, 1 May 2019 04:33:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 272D528ABE for ; Wed, 1 May 2019 04:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726005AbfEAEda (ORCPT ); Wed, 1 May 2019 00:33:30 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:63464 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfEAEda (ORCPT ); Wed, 1 May 2019 00:33:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556685211; x=1588221211; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZPie3xCE0DP4N8ZJOm6oXLeSI2TDSs0yR7ULxbyJoSE=; b=eNC26ITGO7MPb1K7Tv4gii3rxiHZUflyPCkfIsvXCFIi+gQkkR/aP4Oe ZH7TN7xX0kVui/SxzBIxOkgdoRyH+STCBLvRaYtAa/m9A+Xf87EsIZ4++ NuIqxR4zGF4z+XmSE0El/mt4TKSEnIC6XMlXPPynZ7dzsiLCza5p8QpqE P69mhdt4e2ovRTcCsosWD9Mxc9AsnIbmVVdmP4wpUbVRDO5OX9dZQhze4 qKGSkBwgjJVoZIFekgsGKocDNter0QkylO0JevMG/dvCxEEMV1JOAK23Q Pam1P92UPGpRK26qSTU6sQWIsoxMVUgIXlbxN6sdtvi+w1Hus1UmbMetN A==; X-IronPort-AV: E=Sophos;i="5.60,416,1549900800"; d="scan'208";a="107229725" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 01 May 2019 12:33:31 +0800 IronPort-SDR: QeO+g/BJceKeyrCfXUiUlUNlfSBZ/jqeXM8pY/e3hyPKdKy+16JURkQ2CXmiKhj7z4R0vbyRKC VvOnoL/FTWCgmZ0gth8ZwFyvrWGXiarlxQY58JnbkOOLgl4ZBI6/yXS3FTRxs3zvUUgqsrCa+l UcKtsr9Mw68Kh3XeOLSpzEbipbcK7owEZVbm1nAyRuFw48DIlQyaT2lv7iDZ9OJSlPpjJxo3vM XRnLLxdg8IZD53fovubJcHz2rdvdV84nLkhjVGF4Wvh/6p80+oZrmeCJOebw8iCJ9evUSw33Sq dL2Lny0sXRZ5h+UvUOjow9gd Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 30 Apr 2019 21:11:59 -0700 IronPort-SDR: nGC4DRzTMXI/X0KcVPHRiCIIq6mMI98KkX2HkemfQqiP7LDZ+8EkVJjt5b8UVsEP0IkfHB1MVg 75FCZijr62G6wSQc0qpmsTfQObd+IvFLLOylUXMUVgyx1oAAkKmM0oeV+DR0XTARAqKc0o/1ci GbwVq0gEMBY4y6sud6HGLAxXrIWnT/S2QDC4odC3pevAQutR7nDoo7hDYWhlOs9mD+FmabMPyy oBbePkIvxCXI6XSlZK7CqjR7AxPtrLFLuZANpkwilsPilTqmWFLNeKGOFHz5vMcuCw1hDuZUXa YqE= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Apr 2019 21:33:31 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: Chaitanya Kulkarni Subject: [RFC PATCH blktrace-tools 03/10] act-mask: add blktrace extension to act_mask Date: Tue, 30 Apr 2019 21:33:10 -0700 Message-Id: <20190501043317.5507-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> References: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the support for blktrace action mask to accommodate more operations like write-zeroes and zone reset etc. Also, we add support to use the priority mask in the existing infrastructure. We also update the existing helpers to manage action mask and add similar helpers for priority mask. Signed-off-by: Chaitanya Kulkarni --- act_mask.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++---- blktrace.h | 6 ++++++ 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/act_mask.c b/act_mask.c index 8f1b8d7..09bda08 100644 --- a/act_mask.c +++ b/act_mask.c @@ -1,7 +1,15 @@ #include + +#ifdef CONFIG_BLKTRACE_EXT +#include +#endif /* CONFIG_BLKTRACE_EXT */ #include "blktrace.h" #define DECLARE_MASK_MAP(mask) { BLK_TC_##mask, #mask, "BLK_TC_"#mask } +#ifdef CONFIG_BLKTRACE_EXT +#define DECLARE_PRIO_CLASS_MASK_MAP(mask) \ + { (1 << IOPRIO_CLASS_##mask), #mask, "IOPRIO_CLASS_"#mask } +#endif /* CONFIG_BLKTRACE_EXT */ #define COMPARE_MASK_MAP(mmp, str) \ (!strcasecmp((mmp)->short_form, (str)) || \ !strcasecmp((mmp)->long_form, (str))) @@ -29,20 +37,64 @@ static struct mask_map mask_maps[] = { DECLARE_MASK_MAP(DISCARD), DECLARE_MASK_MAP(DRV_DATA), DECLARE_MASK_MAP(FUA), +#ifdef CONFIG_BLKTRACE_EXT + DECLARE_MASK_MAP(WRITE_ZEROES), + DECLARE_MASK_MAP(ZONE_RESET), +#endif /* CONFIG_BLKTRACE_EXT */ }; -int find_mask_map(char *string) +#ifdef CONFIG_BLKTRACE_EXT + +/** + * I/O Priority Map mask based on ${KERNEL_SRC_DIR}/include/linux/ioprio.h. + */ +static struct mask_map prio_map[] = { + DECLARE_PRIO_CLASS_MASK_MAP(NONE), + DECLARE_PRIO_CLASS_MASK_MAP(RT), + DECLARE_PRIO_CLASS_MASK_MAP(BE), + DECLARE_PRIO_CLASS_MASK_MAP(IDLE), +}; + +/** + * I/O Priority Map mask search for valid ioprio string value. + */ +int find_prio_mask_map(char *string) { unsigned int i; - for (i = 0; i < sizeof(mask_maps)/sizeof(mask_maps[0]); i++) - if (COMPARE_MASK_MAP(&mask_maps[i], string)) - return mask_maps[i].mask; + for (i = 0; i < sizeof(prio_maps)/sizeof(prio_maps[0]); i++) + if (COMPARE_MASK_MAP(&prio_map[i], string)) + return prio_map[i].mask; return -1; } +/** + * I/O Priority Map mask search for valid ioprio mask. + */ +bool valid_prio_opt(uint32_t x) +{ + return (x & 0xFFFFFFF0) ? false : true; +} + +uint64_t valid_act_opt(uint64_t x) +{ + return (1 <= x) && (x < (1ULL << BLK_TC_SHIFT)); +} +#else int valid_act_opt(int x) { return (1 <= x) && (x < (1 << BLK_TC_SHIFT)); } +#endif /* CONFIG_BLKTRACE_EXT */ + +int find_mask_map(char *string) +{ + unsigned int i; + + for (i = 0; i < sizeof(mask_maps)/sizeof(mask_maps[0]); i++) + if (COMPARE_MASK_MAP(&mask_maps[i], string)) + return mask_maps[i].mask; + + return -1; +} diff --git a/blktrace.h b/blktrace.h index 17f9f8d..c860bf9 100644 --- a/blktrace.h +++ b/blktrace.h @@ -181,7 +181,13 @@ extern void set_all_format_specs(char *); extern int add_format_spec(char *); extern void process_fmt(char *, struct per_cpu_info *, struct blk_io_trace *, unsigned long long, int, unsigned char *); +#ifdef CONFIG_BLKTRACE_EXT +extern uint64_t valid_act_opt(uint64_t); /* adjusted act mask for extension */ +extern bool valid_prio_opt(uint32_t x); /* validate priority mask */ +int find_prio_mask_map(char *string); /* find prio mask from user input */ +#else extern int valid_act_opt(int); +#endif /* CONFIG_BLKTRACE_EXT */ extern int find_mask_map(char *); extern char *find_process_name(pid_t); From patchwork Wed May 1 04:33:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10924511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12DEE92A for ; Wed, 1 May 2019 04:33:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 036C928ABE for ; Wed, 1 May 2019 04:33:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC2A528B96; Wed, 1 May 2019 04:33:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6644428ABE for ; Wed, 1 May 2019 04:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725776AbfEAEdd (ORCPT ); Wed, 1 May 2019 00:33:33 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:63464 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfEAEdd (ORCPT ); Wed, 1 May 2019 00:33:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556685214; x=1588221214; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HFiyCWDxmB3njrOTkqlK+KXLrC9HqciLiQ062ymPrDY=; b=SIKNhdIu1DaGl3qq3q8HLGMkrqgTvS0mZxnRRRKVW6RkqjmyX0rI/fzD eoVxe1d26Ab0g37+fQ2NgvM+kdTJacvvBE8BpdONcLMnT4uQlfNmRdfdg LudLP+P0JE/Yln0iy1kJ3zPBUz+34KdSVD217pleEIzYSQIOMNw49OZyL ARsff7lc/Rl+iYLwJwDb/PiQy06rAWrZNIzxwyLPjILFbEaN3XXDmIDWW 08yvNakWXyFSebiZghvZ6nL986PqkzJliQqxOYZAYth/FT90G4o8aVP7d SgL18El+fJ2TeVNF4HJn3/AJvCHBlVVQAwY3EhmOVAK11VVM86Dtqa4Xp Q==; X-IronPort-AV: E=Sophos;i="5.60,416,1549900800"; d="scan'208";a="107229727" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 01 May 2019 12:33:33 +0800 IronPort-SDR: vZ7F3Jns2o7zRZWuQ+NnvOfaYD0tMyReqkNPrGvMjPNywjqfKb/OioUNIgGwSF5L9gkwcGbbHF sAfX+U6vxdlxK5+A4toxdEGd13IKzmeYLZwUurpPyHa5DsCLcUj/rxzu6z6ZU73QRo+u61r4ys kFdDSDQdAX4kEPMmCXuFja/DdgtGtSZxT8lOcgg2VAuUOfwjpL4nABZA8VBq4jH6FR8aSWx/iQ 2MXxCgX27iUDOctE6PkZSVWfrFi4RMguAgFi8JygLBjM4AV4R8vY7EHigkbIltre4Bqfrht369 JVFQNQrBdc3C4TGJ3PJInqa3 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 30 Apr 2019 21:12:02 -0700 IronPort-SDR: L1qEvqDKZAM7EOX/dI3s+FoPP044ZSthlSq3dMc4buFXsqGFK+JM+OmW3n4sOpDqdjfWgxEjll aHumtCVHx+zLdlMaYT4JLXDcPQ3GBpMfkZE0lF2nu3hK7MCGtVGx+A1XzImBas5kJmKuTov3d1 6OicO9X/thjkmSiUBHjyDxNBrgoDHEsO0cx5eNpB0R99KXY71fxEKRitlvgqCQuhbqPB5Wk3Ft NGEk3CvhdkBw7z9ENsI+LX0rXo7+WfN9XtC2aUYs9817Y66328pP+EDQpoWM/JYhdvca3gANEe e50= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Apr 2019 21:33:33 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: Chaitanya Kulkarni Subject: [RFC PATCH blktrace-tools 04/10] blktrace.c: add support for extensions Date: Tue, 30 Apr 2019 21:33:11 -0700 Message-Id: <20190501043317.5507-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> References: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for blktrace tool to use the blktrace extension. Here we also add the support for priority tracking and using priority mask from the command line just like action mask. Here we also increase the size of the various bufferes. We add three new command line options so that user can specify whethere to track priority and priority mask just like actiom mask. In order to keep the backward compaibility we by default we turn off the priority tracking. Signed-off-by: Chaitanya Kulkarni --- blktrace.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/blktrace.c b/blktrace.c index d0d271f..e5105f5 100644 --- a/blktrace.c +++ b/blktrace.c @@ -57,10 +57,17 @@ * You may want to increase this even more, if you are logging at a high * rate and see skipped/missed events */ +#ifdef CONFIG_BLKTRACE_EXT +#define BUF_SIZE (1024 * 1024) +#define BUF_NR (4) + +#define FILE_VBUF_SIZE (256 * 1024) +#else #define BUF_SIZE (512 * 1024) #define BUF_NR (4) #define FILE_VBUF_SIZE (128 * 1024) +#endif /* CONFIG_BLKTRACE_EXT */ #define DEBUGFS_TYPE (0x64626720) #define TRACE_NET_PORT (8462) @@ -279,7 +286,15 @@ static int max_cpus; static int ncpus; static cpu_set_t *online_cpus; static int pagesize; + +#ifdef CONFIG_BLKTRACE_EXT +static uint64_t act_mask = -1ULL; +/* by default don't trace priority */ +static uint32_t blktrace_prio_mask = 0; +int btrace_track_prio; +#else static int act_mask = ~0U; +#endif /* CONFIG_BLKTRACE_EXT */ static int kill_running_trace; static int stop_watch; static int piped_output; @@ -329,7 +344,11 @@ static int *cl_fds; static int (*handle_pfds)(struct tracer *, int, int); static int (*handle_list)(struct tracer_devpath_head *, struct list_head *); +#ifdef CONFIG_BLKTRACE_EXT +#define S_OPTS "d:a:A:r:o:kw:vVb:n:D:lh:p:sI:Px:X:" +#else #define S_OPTS "d:a:A:r:o:kw:vVb:n:D:lh:p:sI:" +#endif /* CONFIG_BLKTRACE_EXT */ static struct option l_opts[] = { { .name = "dev", @@ -427,6 +446,24 @@ static struct option l_opts[] = { .flag = NULL, .val = 'p' }, + { + .name = "track-priority", + .has_arg = no_argument, + .flag = NULL, + .val = 'P' + }, + { + .name = "prio-mask", + .has_arg = required_argument, + .flag = NULL, + .val = 'x' + }, + { + .name = "prio-set-mask", + .has_arg = required_argument, + .flag = NULL, + .val = 'X' + }, { .name = "no-sendfile", .has_arg = no_argument, @@ -453,6 +490,9 @@ static char usage_str[] = "\n\n" \ "[ -p | --port=]\n" \ "[ -s | --no-sendfile]\n" \ "[ -I | --input-devs=]\n" \ + "[ -P | --track-priority ]\n" \ + "[ -x | --prio-mask= ]\n" \ + "[ -X | --set-mask= ]\n" \ "[ -v | --version]\n" \ "[ -V | --version]\n" \ @@ -468,6 +508,9 @@ static char usage_str[] = "\n\n" \ "\t-l Run in network listen mode (blktrace server)\n" \ "\t-h Run in network client mode, connecting to the given host\n" \ "\t-p Network port to use (default 8462)\n" \ + "\t-P Enable tracking priorites.\n" \ + "\t-a Only priority specified actions.\n" \ + "\t-A Give priority mask as a single value.\n" \ "\t-s Make the network client NOT use sendfile() to transfer data\n" \ "\t-I Add devices found in \n" \ "\t-v Print program version info\n" \ @@ -633,11 +676,11 @@ static int lock_on_cpu(int cpu) CPU_ZERO_S(size, cpu_mask); CPU_SET_S(cpu, size, cpu_mask); if (sched_setaffinity(0, size, cpu_mask) < 0) { - CPU_FREE(cpu_mask); + CPU_FREE(cpu_mask); return errno; } - CPU_FREE(cpu_mask); + CPU_FREE(cpu_mask); return 0; } @@ -1080,7 +1123,9 @@ static int setup_buts(void) buts.buf_size = buf_size; buts.buf_nr = buf_nr; buts.act_mask = act_mask; - +#ifdef CONFIG_BLKTRACE_EXT + buts.prio_mask = btrace_track_prio ? blktrace_prio_mask : 0; +#endif /* CONFIG_BLKTRACE_EXT */ if (ioctl(dpp->fd, BLKTRACESETUP, &buts) >= 0) { dpp->ncpus = max_cpus; dpp->buts_name = strdup(buts.name); @@ -2104,7 +2149,7 @@ static int handle_args(int argc, char *argv[]) { int c, i; struct statfs st; - int act_mask_tmp = 0; + unsigned int act_mask_tmp = 0; while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) >= 0) { switch (c) { @@ -2211,6 +2256,29 @@ static int handle_args(int argc, char *argv[]) case 'p': net_port = atoi(optarg); break; +#ifdef CONFIG_BLKTRACE_EXT + case 'P': /* enable priority tracking */ + btrace_track_prio = 1; + break; + case 'x': /* priority mask values in string */ + i = find_prio_mask_map(optarg); + if (i < 0) { + fprintf(stderr,"Invalid prio mask %s\n", + optarg); + return 1; + } + blktrace_prio_mask |= i; + break; + case 'X': /* priority mask values in hex */ + if ((sscanf(optarg, "%x", &i) != 1) || + !valid_prio_opt(i)) { + fprintf(stderr, "Invalid prio mask %s/0x%x\n", + optarg, i); + return 1; + } + blktrace_prio_mask = i; + break; +#endif /* CONFIG_BLKTRACE_EXT */ case 's': net_use_sendfile = 0; break; @@ -2243,7 +2311,14 @@ static int handle_args(int argc, char *argv[]) if (act_mask_tmp != 0) act_mask = act_mask_tmp; - +#ifdef CONFIG_BLKTRACE_EXT + /* + * When track-priority is on and user didn't specify prio_mask then + * trace all the classes. + */ + if (btrace_track_prio && !blktrace_prio_mask) + blktrace_prio_mask = TRACE_ALL_IOPRIO; +#endif /* CONFIG_BLKTRACE_EXT */ if (net_mode == Net_client && net_setup_addr()) return 1; From patchwork Wed May 1 04:33:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10924513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E354114B6 for ; Wed, 1 May 2019 04:33:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D277228ABE for ; Wed, 1 May 2019 04:33:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C708F28B96; Wed, 1 May 2019 04:33:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B00C228ABE for ; Wed, 1 May 2019 04:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726022AbfEAEdg (ORCPT ); Wed, 1 May 2019 00:33:36 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:63464 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726019AbfEAEdg (ORCPT ); Wed, 1 May 2019 00:33:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556685216; x=1588221216; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WpReDyaaRaxg+6XhstJs3f/exDS12ahEFhY2353rdRY=; b=VCegtAsg2+RHVx4rJCcavAIqmQQRApSpbxZz65/XznAICqEIBa1+oK0Y IeaMNPULf7OnFnGG921UaqovqoaJMVQC2WM5s+WzImSUvqm+BfNHzpiWg N+B5X8U0/uFov9R+RfPHVjL5MYRrYNAdgVt3S+JX4X0mR5fNH66gga3Wz cgMYCgx930ijQ+BwCsrI5wxDtAc4d/OlN6HiGeZJ3VLkiHLkHfUWTN45t XkTrwPZ+xahPrY7P02mSVS98VWj1pdjgtCWE9AFky4balvKyffXIrBqq8 N9V/gLcsIy6mjBzanj8q6lSjCiI0NIk9RLE2kYmsutu9s9cWoq/he06Ur g==; X-IronPort-AV: E=Sophos;i="5.60,416,1549900800"; d="scan'208";a="107229729" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 01 May 2019 12:33:36 +0800 IronPort-SDR: PWtzPwUMTYaQp+ufdRpusMgjcuLrWcpqO/iuqYMzCZWeT1zv3t9KROgdYIB0CpdZteqMvVIr2I dm9/7XHKnKCJt8T7cVaO2QO08ByFCcQdiRicMEIoqVFTuf5kfUHh49DLX4Baassi224BmmG9An dDsuDsawz2fR4jTHkESnmX2JicnfXc9IqpMZRSBkaS/ny/rb7ZlyFUnGN5iO4bl0DUz7SvKqRC idxKamFCOCQyFE8utxIIsQkUhalw4CHl3Eb3tHi6RwIrYm0/mNSuOpz51Sdmr+1xCgz5/Jc/LE eXXs6kLczmaQ3xS2AaRteiQK Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 30 Apr 2019 21:12:04 -0700 IronPort-SDR: gfErVIHnNVtuTvKPs3ITsw0yIR73LJvIhYhVtAYvKPWk7Dj7mYqi6t3h0qyZ18OhWAajbnJg0f 76r1NI2KPiPg1QGaABfdy2sNcczLR0XZXYBxqsJvBM2tWlFhTseKTbpWK8LuKb+U8ed8xHX3LA s9AsoFDw0NR3e5gGs9PZLgOYkyjfz8IJLroJdRinbQUc651xFBQmxwmcOQ0pY9Hk4EtlRKYiTH ea124oDseuvwfQ7Z7zZBkHYEOTksmuaCfIZnreMEAgEIRT3dAL9i9GaWSWXitiO2ok+JZ+xGVo 0vQ= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Apr 2019 21:33:36 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: Chaitanya Kulkarni Subject: [RFC PATCH blktrace-tools 05/10] blkparse.c: add support for extensions Date: Tue, 30 Apr 2019 21:33:12 -0700 Message-Id: <20190501043317.5507-6-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> References: <20190501043317.5507-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for blkparse tool to use the blktrace extension. Here we also add the support for priority tracking and using priority mask from the command line just like action mask. Signed-off-by: Chaitanya Kulkarni --- blkparse.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- blktrace.h | 1 + 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/blkparse.c b/blkparse.c index 227cc44..228c8d6 100644 --- a/blkparse.c +++ b/blkparse.c @@ -105,7 +105,7 @@ static struct per_process_info *ppi_list; static int ppi_list_entries; static struct option l_opts[] = { - { + { .name = "act-mask", .has_arg = required_argument, .flag = NULL, @@ -177,6 +177,26 @@ static struct option l_opts[] = { .flag = NULL, .val = 'O' }, +#ifdef CONFIG_BLKTRACE_EXT + { + .name = "track-priority", + .has_arg = no_argument, + .flag = NULL, + .val = 'p' + }, + { + .name = "prio-mask", + .has_arg = required_argument, + .flag = NULL, + .val = 'x' + }, + { + .name = "prio-set-mask", + .has_arg = required_argument, + .flag = NULL, + .val = 'X' + }, +#endif /* CONFIG_BLKTRACE_EXT */ { .name = "quiet", .has_arg = no_argument, @@ -273,9 +293,21 @@ static int per_device_and_cpu_stats = 1; static int track_ios; static int ppi_hash_by_pid = 1; static int verbose; + +#ifdef CONFIG_BLKTRACE_EXT +static uint64_t act_mask = -1ULL; +/* by default don't trace priority */ +uint32_t blkparse_prio_mask; +#else static unsigned int act_mask = -1U; +#endif /* CONFIG_BLKTRACE_EXT */ + static int stats_printed; static int bin_output_msgs = 1; + +#ifdef CONFIG_BLKTRACE_EXT +int bparse_track_prio; +#endif /* CONFIG_BLKTRACE_EXT */ int data_is_native = -1; static FILE *dump_fp; @@ -1614,7 +1646,11 @@ static void dump_trace_fs(struct blk_io_trace *t, struct per_dev_info *pdi, /* dump to binary file only */ break; default: +#ifdef CONFIG_BLKTRACE_EXT + fprintf(stderr, "Bad fs action %llx\n", t->action); +#else fprintf(stderr, "Bad fs action %x\n", t->action); +#endif /* CONFIG_BLKTRACE_EXT */ break; } } @@ -2730,7 +2766,11 @@ static int is_pipe(const char *str) return 0; } +#ifdef CONFIG_BLKTRACE_EXT +#define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vVMpx:X:" +#else #define S_OPTS "a:A:b:D:d:f:F:hi:o:Oqstw:vVM" +#endif /* CONFIG_BLKTRACE_EXT */ static char usage_str[] = "\n\n" \ "-i | --input=\n" \ "[ -a | --act-mask= ]\n" \ @@ -2746,6 +2786,9 @@ static char usage_str[] = "\n\n" \ "[ -q | --quiet ]\n" \ "[ -s | --per-program-stats ]\n" \ "[ -t | --track-ios ]\n" \ + "[ -p | --track-prio ]\n" \ + "[ -x | --act-mask= ]\n" \ + "[ -X | --set-mask= ]\n" \ "[ -w