From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB74C32CF67; Tue, 9 Sep 2025 11:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416057; cv=none; b=pZB7D6foGpXZHOM+0sRkCAVi9uFQWfEj7GPmVcOE5f0R4w5Tb9IBfCdmZr9bqimY5QgYdoH+tFR3tmONz+BNhYf8fkx0Y91VatE6XgCfHDrT+kLax2SP1vSRShzxN2jiwBRdnYJ0Y/D+IGwERAPCwC12Yu3HKXDWtFfYwFTZbC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416057; c=relaxed/simple; bh=xuD/RysWcAGhVFKyhR6sNICgPdydUjswb4x8pX1x4WM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ME1dlrjWCHsc0tj5r7N7KnwgY2pOEhfaVgJdACRZnlgBcLmRrLJWqqGw/Z2zMzbtmDTkNnpHLHXJ/GFfXoYrTWhBSyJjGQ9kp7o6B2cOoK8JyTTF6db8tCTayMBwq5a+zaLuqLVg0INgCM/dJwCbvbaFVZkSGXB4WXXCBCXxDKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=d3fXcU64; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="d3fXcU64" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416056; x=1788952056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xuD/RysWcAGhVFKyhR6sNICgPdydUjswb4x8pX1x4WM=; b=d3fXcU64qLemb4GXlq5n4KuSPxaznf7ggLPTZVf6C5ENmPeni5lzd+Pq /eKUoGPXvWFRaD9X15g96ALtQLqSHy/HlHLDTvf09gGg+wwZGXWG2vuTw 5Ad6FCTA7HBq82eIJXt4W6iAxS+vNW0KtLZ+60PNSGt7Zzdhbi6sA6/c9 GMxuKbqeNrQn6uE1Il5LACHfjzcKiWl4PZ4RrAHlb1iD3mIR2weV2dkXZ EWFy+JZaI7xDfQSjaVOEuMPo0RQJkVVDNdZczePDy1+O9lwR8jK+xQw+1 SJyCNMzeI/KY4p/efCC5YOCxpcSgZYFTfrX106Sz3TRi8XfrzctTM0f4J g==; X-CSE-ConnectionGUID: 58OSBwTLQQWY3fStF0OWtQ== X-CSE-MsgGUID: gA+O/iY9QI6K7O1MO/cWeg== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810372" 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; 09 Sep 2025 19:07:35 +0800 IronPort-SDR: 68c00a77_N5n+m0Zmi7fLTy+WF0lpBZbjccv/mBfEd86tgEEv6Cz/gjW P5T28fH5cUGJ7bKRWzDcSeOYEufgGf21m3x75Pw== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:07:35 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:07:30 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 01/21] fix comment for struct blk_trace_setup: Date: Tue, 9 Sep 2025 13:07:03 +0200 Message-Id: <20250909110723.75676-2-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni --- blktrace_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blktrace_api.h b/blktrace_api.h index 8c760b8..172b4c2 100644 --- a/blktrace_api.h +++ b/blktrace_api.h @@ -127,7 +127,7 @@ struct blk_io_cgroup_payload { }; =20 /* - * User setup structure passed with BLKSTARTTRACE + * User setup structure passed with BLKTRACESETUP */ struct blk_user_trace_setup { char name[32]; /* output */ --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F1E132CF7B; Tue, 9 Sep 2025 11:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416061; cv=none; b=CiPZsBnZJaafdCm/rjKoMRpk+WtxBqt7K7WeZzzTZFOQ7AgXNVEZm3JRd39Pm3LL9fb0yJdOAJejD3CEZHhXZivQ73Tc1WCmDHpP0UiKgq5s76MONX6QY4QCwZtNa9X16ckqKVDxJUaVcp00CjiVbE+BfEDVTIFpDEbgyApfTaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416061; c=relaxed/simple; bh=A6y+pTXsNEjykg3IaiXa6pw7Li2TWLqIkGIrn9bRUy0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uygFkwe0UNRWd3nNgFb6Oc8XRBFfOF297HFDKEFSAymtNTZAyuRC5XM623287R4rNw6xg04eIzqSfAEmW7CxDP7h+hoEWSRRPMuGUwqVVwh3uEMHETeroKV3gOThhS40K7vHkKd8hwzZ7cyQL52cKTjvWVnALdQaNJ49hmPpeWE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=U81Xu+QY; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="U81Xu+QY" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416059; x=1788952059; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A6y+pTXsNEjykg3IaiXa6pw7Li2TWLqIkGIrn9bRUy0=; b=U81Xu+QY15PQPdZdSylkMUoMbAVrqWXFO1UkWX9TTQUiY40FTh7pj3Et pr/7p4a5mlVh9HQsyP0eJsBk4AwFlE3oqYwHKHrR5FF9Plr5/c68SpZBa J4L3J8fC5dWAEEFiJngZpEttmCdYcGSIeBr9ewCApaZsIuZgmzx2vK7bC daYEEnfzcS5eI02db0pL3UDdLgI0WfsV0u3W7lJm9FuAwO8m4WITiC7ns iy6KdNhoH8GXHSbV7mwPL8cvbu78/dLhPw2cDUbU4z68KdIBJXYH9rcbi M9S+xcAUWup364AKt0iVtYpiSjIx01p2iIux5BXMFFUGnBDDAboJtZEIi w==; X-CSE-ConnectionGUID: lNFzdYd5TXiOXxEcVzuw2Q== X-CSE-MsgGUID: I9Bo6BGFRUODWZzTR8px6w== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810448" 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; 09 Sep 2025 19:07:39 +0800 IronPort-SDR: 68c00a7b_/6r5pI0IXPGatTaNPAYQjpQkjbZnzpJQKkZf6vcVf8BDapH S7qLtBvGiF8oJKm8+wVTupJK7MwF0JYSHNYaFKA== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:07:39 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:07:35 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 02/21] add definitions for BLKTRACESETUP2 Date: Tue, 9 Sep 2025 13:07:04 +0200 Message-Id: <20250909110723.75676-3-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Johannes Thumshirn --- blktrace_api.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/blktrace_api.h b/blktrace_api.h index 172b4c2..9f435a5 100644 --- a/blktrace_api.h +++ b/blktrace_api.h @@ -139,9 +139,24 @@ struct blk_user_trace_setup { __u32 pid; }; =20 +/* + * User setup structure passed with BLKTRACESETUP2 + */ +struct blk_user_trace_setup2 { + char name[32]; /* output */ + __u64 act_mask; /* input */ + __u32 buf_size; /* input */ + __u32 buf_nr; /* input */ + __u64 start_lba; + __u64 end_lba; + __u32 pid; + __u32 reserved; /* for futute use */ +}; + #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) #define BLKTRACESTART _IO(0x12,116) #define BLKTRACESTOP _IO(0x12,117) #define BLKTRACETEARDOWN _IO(0x12,118) +#define BLKTRACESETUP2 _IOWR(0x12, 142, struct blk_user_trace_setup2) =20 #endif --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E683F32CF95; Tue, 9 Sep 2025 11:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416065; cv=none; b=P84GkmiMrzAxJPNpYSUkq7bUVWzsCDwDNWahWYsZH5JOG2grMjwk3JQHMum+PPEthLndl6gobu7CUkP+kKaE5pTaD5EGYHfRTYSy91/dFb/IrEDrzSTaEe9gVCivahf7B7AMm5SemQzB9CgVjYyALFfd00++BkF4hunc1YchO3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416065; c=relaxed/simple; bh=2H5LFMNPaYyglNMEHb+f7AgkaPYbc1RUaom07P26U+A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GLINH3BTJY5eDR40fqTqw8tLIZXZNV8Kyd4syCVlzU7tJXXbDlzktvyAogtHgmRfqJrumKa1rd6ngaG1aMssSlMIovzfFgl3PlAX2WXKQ91dBAzHFSibAHOwFR6dbtuzqJUff/YTDK3Aq7FOpOtMzl9r9t6BFYMD18zEmdjzlXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=l6IP5PTS; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="l6IP5PTS" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416064; x=1788952064; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2H5LFMNPaYyglNMEHb+f7AgkaPYbc1RUaom07P26U+A=; b=l6IP5PTSZSgkHlIAlwism547Fltn3tc9q6zDjiU7hB6sRbJMyRG/dIiN pIirlcb0V1nSYE4O+wkd28b7XQSpI3tgIwd8+kteYIbJyUlWj0i2Ma0Jq X2cb80T5xaT9yVlkgjiWLHThrxO3PsWaP97O6jpHFX9jnY/0T22LlaHNX JrLjpF543WyKG3ftl4xHMF1rixYmmBlHFJcXdrEkVlZWXdpObz8RgmS7u GEBfsTgpK6fCfgfS0Wk0wPY+DDo09tVXrIWMDTzgmyZNcqf//TzJGp9TE ivX79df2uVJwakNkGYCv2GS2tUE212zoomw/fMsEs17c5i+KaG2XnUamy g==; X-CSE-ConnectionGUID: YlhBCWg7SN6lLYKM5upt0w== X-CSE-MsgGUID: Mimb9AQCSFa92FBLyW9Ynw== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810532" 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; 09 Sep 2025 19:07:44 +0800 IronPort-SDR: 68c00a7f_b8CgpwimZL3PhbN7vW7Zv2RuBB863xS0bZA24wpBDivkIZK olBoYIoU+SGyImyVOANitipBI88LjLQlNOJKLmw== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:07:44 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:07:39 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 03/21] call BLKTRACESETUP2 ioctl per default to setup a trace Date: Tue, 9 Sep 2025 13:07:05 +0200 Message-Id: <20250909110723.75676-4-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Call BLKTRACESETUP2 ioctl per default and if the kernel does not support this ioctl because it is too old, fall back to calling BLKTRACESETUP. Signed-off-by: Johannes Thumshirn --- blktrace.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/blktrace.c b/blktrace.c index 038b2cb..72562fd 100644 --- a/blktrace.c +++ b/blktrace.c @@ -279,7 +279,7 @@ static int max_cpus; static int ncpus; static cpu_set_t *online_cpus; static int pagesize; -static int act_mask =3D ~0U; +static unsigned long long act_mask =3D ~0U; static int kill_running_trace; static int stop_watch; static int piped_output; @@ -1067,6 +1067,36 @@ static void close_client_connections(void) } } =20 +static int setup_buts2(void) +{ + struct list_head *p; + int ret =3D 0; + + __list_for_each(p, &devpaths) { + struct blk_user_trace_setup2 buts2; + struct devpath *dpp =3D list_entry(p, struct devpath, head); + + memset(&buts2, 0, sizeof(buts2)); + buts2.buf_size =3D buf_size; + buts2.buf_nr =3D buf_nr; + buts2.act_mask =3D act_mask; + + if (ioctl(dpp->fd, BLKTRACESETUP2, &buts2) >=3D 0) { + dpp->ncpus =3D max_cpus; + dpp->buts_name =3D strdup(buts2.name); + dpp->setup_done =3D 1; + if (dpp->stats) + free(dpp->stats); + dpp->stats =3D calloc(dpp->ncpus, sizeof(*dpp->stats)); + memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats)); + } else { + ret++; + } + } + + return ret; +} + static int setup_buts(void) { struct list_head *p; @@ -2684,9 +2714,11 @@ static int run_tracers(void) if (net_mode =3D=3D Net_client) printf("blktrace: connecting to %s\n", hostname); =20 - if (setup_buts()) { - done =3D 1; - return 1; + if (setup_buts2()) { + if (setup_buts()) { + done =3D 1; + return 1; + } } =20 if (use_tracer_devpaths()) { --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 936E23314AD; Tue, 9 Sep 2025 11:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416070; cv=none; b=fJV0T119gYE34+Vn1yOBd5zNGBlewdStPhSBKZGhpl2J3vP2zS8mifl4eFrXvnFhss+/tTwWgU1VpzmSWtFM+AAk+qgqjLzHlukrh4/XNM3NKSDDWEzbQ7OtXqIX2AMFVHiB+4UmjieMehA1Hwc90QTDGLRIt0BbZpypLyYXxNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416070; c=relaxed/simple; bh=OaOG6CBFbCFh/f58UIDgubm2vvZ/Pg+y292vRg7wo5M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o7YfO4e5wXfhUrE5/HoQzjteth1gKuU1eZa3YeP3rdoE8sMNa7bV5hxS6lX7Mg7Bb4sDeBYe5oW2PZnZ/9vER4+U2yUyaDTXDdmPz682fKHcXk7tgUhmK/W+W7OT4WHM0vvZ0TveDcgZbK/e1SM8QxCke5MTgeKo870h9FUMXcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=JQ1ew2Bz; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="JQ1ew2Bz" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416068; x=1788952068; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OaOG6CBFbCFh/f58UIDgubm2vvZ/Pg+y292vRg7wo5M=; b=JQ1ew2Bzv3eE3IZOE+U+hiMSGUUBxt1skz1gnmUU9CRPhqklvcqqFYrl wq6aGv1BT22Ec1JDEDH6j/86iFG6CIVPMU37GpdIa6NJa5Dyset506nt+ yhuuUG9XyWIzoS7SRMLbFBw3bb17HyAiH47SgkNXD1FFCzT+rc6IwA5Gx SRkUOyMO+nKQdoUi987zaMPA63pCMN3pwXhvnY8QQgWYR6C45pPWDv/6h fSvpyr0VcjOs4e73ZlHqVt+A4eQrzK+/gddVsBBZ5y0f/Xr5550hSUKwt ZtX4zTntaA4iuz2TPlZ/mhEqo8pBEZfFE/EsYRSoS2bNyONb5ITm6mHHb A==; X-CSE-ConnectionGUID: deJVU8bFQAiBG9ds8T07gg== X-CSE-MsgGUID: Blrt4vuXSridT8rhvwJYGg== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810605" 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; 09 Sep 2025 19:07:48 +0800 IronPort-SDR: 68c00a84_Zy2TWmxepq9cw6DKKKzdD8vQdzIC5GX5JzTAistQWX2auaU OkGlQ3zMWgRT5oFsV1A/K5qF471ss69Dqha+j6A== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:07:48 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:07:44 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 04/21] blktrace: change size of action to 64 bits Date: Tue, 9 Sep 2025 13:07:06 +0200 Message-Id: <20250909110723.75676-5-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In order to add the zoned commands to blktrace's actions, the storage size needs to be increased to 64bits. Signed-off-by: Johannes Thumshirn --- act_mask.c | 4 ++-- blkparse.c | 2 +- blkparse_fmt.c | 15 ++++++++------- blkrawverify.c | 10 +++++----- blktrace.h | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/act_mask.c b/act_mask.c index 8f1b8d7..510c7e0 100644 --- a/act_mask.c +++ b/act_mask.c @@ -42,7 +42,7 @@ int find_mask_map(char *string) return -1; } =20 -int valid_act_opt(int x) +unsigned long long valid_act_opt(unsigned long long x) { - return (1 <=3D x) && (x < (1 << BLK_TC_SHIFT)); + return (1ull <=3D x) && (x < (1ull << BLK_TC_SHIFT)); } diff --git a/blkparse.c b/blkparse.c index d6aaa8b..c720af6 100644 --- a/blkparse.c +++ b/blkparse.c @@ -299,7 +299,7 @@ static int per_device_and_cpu_stats =3D 1; static int track_ios; static int ppi_hash_by_pid =3D 1; static int verbose; -static unsigned int act_mask =3D -1U; +static unsigned long long act_mask =3D -1U; static int stats_printed; static int bin_output_msgs =3D 1; int data_is_native =3D -1; diff --git a/blkparse_fmt.c b/blkparse_fmt.c index 9b83d1d..02c5a3c 100644 --- a/blkparse_fmt.c +++ b/blkparse_fmt.c @@ -8,6 +8,7 @@ #include #include #include +#include =20 #include "blktrace.h" =20 @@ -52,13 +53,13 @@ int add_format_spec(char *option) =20 static inline void fill_rwbs(char *rwbs, struct blk_io_trace *t) { - int w =3D t->action & BLK_TC_ACT(BLK_TC_WRITE); - int a =3D t->action & BLK_TC_ACT(BLK_TC_AHEAD); - int s =3D t->action & BLK_TC_ACT(BLK_TC_SYNC); - int m =3D t->action & BLK_TC_ACT(BLK_TC_META); - int d =3D t->action & BLK_TC_ACT(BLK_TC_DISCARD); - int f =3D t->action & BLK_TC_ACT(BLK_TC_FLUSH); - int u =3D t->action & BLK_TC_ACT(BLK_TC_FUA); + bool w =3D !!(t->action & BLK_TC_ACT(BLK_TC_WRITE)); + bool a =3D !!(t->action & BLK_TC_ACT(BLK_TC_AHEAD)); + bool s =3D !!(t->action & BLK_TC_ACT(BLK_TC_SYNC)); + bool m =3D !!(t->action & BLK_TC_ACT(BLK_TC_META)); + bool d =3D !!(t->action & BLK_TC_ACT(BLK_TC_DISCARD)); + bool f =3D !!(t->action & BLK_TC_ACT(BLK_TC_FLUSH)); + bool u =3D !!(t->action & BLK_TC_ACT(BLK_TC_FUA)); int i =3D 0; =20 if (f) diff --git a/blkrawverify.c b/blkrawverify.c index ed5d258..9c5d595 100644 --- a/blkrawverify.c +++ b/blkrawverify.c @@ -55,7 +55,7 @@ static struct trace_info traces[] =3D { #define N_TRACES (sizeof(traces) / sizeof(struct trace_info)) =20 struct act_info { - __u32 val; + __u64 val; char *string; }; =20 @@ -80,12 +80,12 @@ static struct act_info acts[] =3D { }; #define N_ACTS (sizeof(acts) / sizeof(struct act_info)) =20 -static char *act_to_str(__u32 action) +static char *act_to_str(__u64 action) { static char buf[1024]; unsigned int i; - unsigned int act =3D action & 0xffff; - unsigned int trace =3D (action >> BLK_TC_SHIFT) & 0xffff; + unsigned long long act =3D action & 0xffffffff; + unsigned long long trace =3D (action >> BLK_TC_SHIFT) & 0xffffffff; =20 if (act < N_ACTS) { sprintf(buf, "%s ", acts[act].string); @@ -97,7 +97,7 @@ static char *act_to_str(__u32 action) } } else - sprintf(buf, "Invalid action=3D%08x", action); + sprintf(buf, "Invalid action=3D%016llx", action); =20 return buf; } diff --git a/blktrace.h b/blktrace.h index 944fc08..74dfb48 100644 --- a/blktrace.h +++ b/blktrace.h @@ -144,7 +144,7 @@ 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 *); -extern int valid_act_opt(int); +extern unsigned long long valid_act_opt(unsigned long long); extern int find_mask_map(char *); extern char *find_process_name(pid_t); =20 --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE5EF32255D; Tue, 9 Sep 2025 11:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416074; cv=none; b=iL+pj2eC3TDfrR5ew6jikV93JVWe3Qm6C6x5ctrY3Gr6vz/lVnw0w0vm9MWcqufdIp3CsLnhirc26dzx40a2RlmD9HqQGXCQRHdpt2JqMROm7Iqxd0WYf2SRRvHoWwp8rwZ5ndtp9vhy6h3+tBoJOaDXnnKYhz5CvY2GLWr+hEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416074; c=relaxed/simple; bh=2SBoig+2av9xZLZVm0aXbXBPvQ0ssmJIyDrkle9d9eA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bRwY1GJ/OQClJYx8nrig5yRfueQZcGMCCWvElja+MRFUj5OQD2wxp/ZoixPZEo3UB1SptVCD2dEGAovNaXAaa9svZju6QMisjxlBMO1/nZV4rw7psF8ctkj7lvPBBih9bzUzWg94DmSyYCalZQZU6eaRBIbuvB758OJpSioU+EM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=jy57nhm8; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="jy57nhm8" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416073; x=1788952073; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2SBoig+2av9xZLZVm0aXbXBPvQ0ssmJIyDrkle9d9eA=; b=jy57nhm8Ooy8saFgQGLqQ77jL1O5Mahaqr1cFpT7IyYBXRaq0Y14GtWt nARGCr2PqXOYz0FNHZ9oOCdrOUaHeMbit7gILxLHGcOXBqucItMTxU+l3 pUYBNg26fcp/LUIqyakwT0zzPHGD27ZSzgs3EZOGy0P/XcVM0oKLH78s3 Cjo0AHeeeKKmSDcFn/5lKH3VtaKABH3JgcDLUqbwdiuaBF81On60OZLvd a9ObGXaLK2T5u+RONAa/i24j01mgHVwqHPH6BkTXWiISII+3wCH+POnh9 IUEVJDj06U7yxuNnsbYKZAcwAPUbcEeue2v97GKOJgHZziiBzZJPAu5dd w==; X-CSE-ConnectionGUID: WWVSvsa2TsarXsK4ml2YqQ== X-CSE-MsgGUID: qF/yOp6qRsCWmU4NL4V0lg== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810609" 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; 09 Sep 2025 19:07:52 +0800 IronPort-SDR: 68c00a88_3yIQ/waE35wr5Lckq635YIfUTfh3BmtrfHh1AtqFxhcJddp Vw+VR6HREtKYaAkrGAeNDRs4hNV2h7CLZBlemWw== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:07:53 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:07:48 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 05/21] blktrace: add definitions for blk_io_trace2 Date: Tue, 9 Sep 2025 13:07:07 +0200 Message-Id: <20250909110723.75676-6-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add 'struct blk_io_trace2' which represents the extended version of the blktrace protocol. Signed-off-by: Johannes Thumshirn --- blktrace_api.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/blktrace_api.h b/blktrace_api.h index 9f435a5..bbf075f 100644 --- a/blktrace_api.h +++ b/blktrace_api.h @@ -27,8 +27,19 @@ enum { BLK_TC_END =3D 1 << 15, /* we've run out of bits! */ }; =20 +enum blktrace_cat2 { + BLK_TC_ZONE_APPEND =3D 1 << 1ull, /* zone append */ + BLK_TC_ZONE_RESET =3D 1 << 2ull, /* zone reset */ + BLK_TC_ZONE_RESET_ALL =3D 1 << 3ull, /* zone reset all */ + BLK_TC_ZONE_FINISH =3D 1 << 4ull, /* zone finish */ + BLK_TC_ZONE_OPEN =3D 1 << 5ull, /* zone open */ + BLK_TC_ZONE_CLOSE =3D 1 << 6ull, /* zone close */ +}; + #define BLK_TC_SHIFT (16) #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) +#define BLK_TC_SHIFT2 (32) +#define BLK_TC_ACT2(act) ((__u64)(act) << BLK_TC_SHIFT2) =20 /* * Basic trace actions @@ -51,6 +62,7 @@ enum { __BLK_TA_REMAP, /* bio was remapped */ __BLK_TA_ABORT, /* request aborted */ __BLK_TA_DRV_DATA, /* binary driver data */ + __BLK_TA_ZONE_MGMT, /* zone management command was issued */ __BLK_TA_CGROUP =3D 1 << 8, }; =20 @@ -85,12 +97,20 @@ 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)) =20 +#define BLK_TA_ZONE_APPEND (__BLK_TA_COMPLETE |\ + BLK_TC_ACT2(BLK_TC_ZONE_APPEND)) +#define BLK_TA_ZONE_MGMT __BLK_TA_ZONE_MGMT +#define BLK_TA_ZONE_PLUG (__BLK_TA_ZONE_PLUG | BLK_TC_ACT(BLK_TC_QU= EUE)) +#define BLK_TA_ZONE_UNPLUG (__BLK_TA_ZONE_UNPLUG |\ + BLK_TC_ACT(BLK_TC_QUEUE)) + #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)) =20 #define BLK_IO_TRACE_MAGIC 0x65617400 #define BLK_IO_TRACE_VERSION 0x07 +#define BLK_IO_TRACE2_VERSION 0x08 =20 /* * The trace itself @@ -118,6 +138,21 @@ struct blk_io_trace_remap { __u64 sector_from; }; =20 +struct blk_io_trace2 { + __u32 magic; /* MAGIC << 8 | BLK_IO_TRACE2_VERSION */ + __u32 sequence; /* event number */ + __u64 time; /* in nanoseconds */ + __u64 sector; /* disk offset */ + __u32 bytes; /* transfer length */ + __u32 pid; /* who did it */ + __u64 action; /* what happened */ + __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 */ +}; + /* * Payload with originating cgroup info */ --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43EE4322745; Tue, 9 Sep 2025 11:07:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416078; cv=none; b=Xh3elsLePiqzm0tjypqY11+1F+b904QDUsgcNnX+/MT14vYdY3lY2c/LUJqARJp/J/vvT/r8ht2iUAnPP/y5Z/8cdRoCGHGl7X5f3X7yZICWtQcJrwEYNKG8caz8x7NgyCyWL0hGXqnpyXvZ9zBY++uqcNHr/cevxOxPB2zFWfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416078; c=relaxed/simple; bh=mPQj5kqwyRWqC+fMnaW0oDN1trAQZBc40cPOBN7KYso=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=INdUCbN6cldh9WV7g8QZm3ht5ZJaWqNcxV4v0FmttkdPsuMlCKEs8wISn3jScPoNngvM0Sty/vTEhIr22OCqzICclRl0cggldO16LAn3mzvjIiXmxMv+YovimMrmmq8pT/63UWTwpLMIi940r3bU0JlEqPHstMsqHeJ/QzqUWJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=Af1s1WGT; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Af1s1WGT" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416077; x=1788952077; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mPQj5kqwyRWqC+fMnaW0oDN1trAQZBc40cPOBN7KYso=; b=Af1s1WGTVyAtkrya/9R3IdC2winmZWmk4fiRBDuPtdp3KeR+GDra+CmK VEXkfVZmp0PmUxKVoyymoBhpJQ+vH3r1Gorq+IamtJoILaQpCB1mcUXtW FyYPzzyN+9gIMXgCiw9whn1rbsn1JKtxhxbHWbTt24rH3FVTzhuD69Td+ LNOUWro0x+YzqUEV5u6cb9WW4SGlyZiJ+T7IT//c3xob25Ig4Z297bjvl U6MsdIRzPw0lo5KGGGz5KQ2giyJDcrAM96HpExm5M7GTj8QCPiCxEwgLq ib/3EkO6MtoaBw9d0CkTIiNrbQdkPxI8c7gF2igGtjRBVkdbWYXTyaJu6 g==; X-CSE-ConnectionGUID: M7LnDVyoQ7Wg/sNBX1UYxw== X-CSE-MsgGUID: F1ym+dmmSQa9X3nbGLvaHQ== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810650" 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; 09 Sep 2025 19:07:57 +0800 IronPort-SDR: 68c00a8d_9Pd8PBHzjIZxkO8HaHsRIXSbPEWgYMMDJB61U9twUNgk1Ya x2rA/bixeUidEYpmXMPtqEPUCSdZaondK60r7jA== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:07:57 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:07:53 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 06/21] blktrace: support protocol version 8 Date: Tue, 9 Sep 2025 13:07:08 +0200 Message-Id: <20250909110723.75676-7-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Also support protocol version 8 in conjunction with protocol version 7. Signed-off-by: Johannes Thumshirn --- blktrace.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/blktrace.h b/blktrace.h index 74dfb48..3305fa0 100644 --- a/blktrace.h +++ b/blktrace.h @@ -69,6 +69,7 @@ extern struct timespec abs_start_time; =20 #define CHECK_MAGIC(t) (((t)->magic & 0xffffff00) =3D=3D BLK_IO_TRACE_MAG= IC) #define SUPPORTED_VERSION (0x07) +#define SUPPORTED_VERSION2 (0x08) =20 #if __BYTE_ORDER =3D=3D __LITTLE_ENDIAN #define be16_to_cpu(x) __bswap_16(x) @@ -90,13 +91,17 @@ extern struct timespec abs_start_time; =20 static inline int verify_trace(struct blk_io_trace *t) { + u8 version; + if (!CHECK_MAGIC(t)) { fprintf(stderr, "bad trace magic %x\n", t->magic); return 1; } - if ((t->magic & 0xff) !=3D SUPPORTED_VERSION) { - fprintf(stderr, "unsupported trace version %x\n",=20 - t->magic & 0xff); + + version =3D t->magic & 0xff; + if (version !=3D SUPPORTED_VERSION && + version !=3D SUPPORTED_VERSION2) { + fprintf(stderr, "unsupported trace version %x\n", version); return 1; } =20 --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3704334710; Tue, 9 Sep 2025 11:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416083; cv=none; b=I+H89isOG5kbvcw1KDqctgbzM3mf+TQKqmugsGDD0xtlA4M3ryR/pd/6cJSzu4LAfDpqVzwM16/oZsXGRk8fqd5lPL6hv5J+SNeiaOftIiq+EJBZWFNuT8Ce2BMWeXy3951L+tkiyzuz3yVi03I96GNNUsN3tBc+r9orwlEOXlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416083; c=relaxed/simple; bh=RGAsutA2LvxTDqGe9NrO9ENxqQJN2cUV2soMGRzFjgc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VUtQquU6659Qq6FFdbzkcTuEUnlJRkLgO5y43fLTK1yNpdaejJ2p01/F8UEof9D6pYMNES4FwIxwvSvNnUjsLbkPVYYMvCzcM8GmZ28rqInoeA10tBNsM1MAWKpuXZuTOFScByLSov9+xZbKH1lRkzaC6Wm8H+fUZR1bFUySCTM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=NxQ1FG6T; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NxQ1FG6T" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416082; x=1788952082; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RGAsutA2LvxTDqGe9NrO9ENxqQJN2cUV2soMGRzFjgc=; b=NxQ1FG6TjAJOqM0KFeUBv9Fv9jd5p3LCY/XUQQqp0zWXAqaMSMrzDbzw vF91r+DHZia4aEuUiyckSz+auCbCj34rIiaXUL4SQMHhDszUNNBQYYN3A Q4eFtupFvLlGPZJkALkH2QfWU4sRVACdHAwdqJoLuUZ7LMdvog+ZriXBE OA7e9joLAKq0TbMHuvuVo1pFw6K/7NXHv8LkF1IshYsgj72QKxw06cVOk Sh0OHCjHW/6WoHlVTY8ip49mCOTCFwSYngVsDokRbEdbc7jW6jZxWQwiV jJ4+pjFQtS1RKcwHuFZlGYpE73On4jYHPNfNZPpWHvAV/MTyMb3AJkDhG A==; X-CSE-ConnectionGUID: ajZJFarURqST8sY75Fah4A== X-CSE-MsgGUID: DtMcEZIKRzavEBMr8AKf4A== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810686" 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; 09 Sep 2025 19:08:01 +0800 IronPort-SDR: 68c00a91_tQcjyT8ZJpwOok773ZhUYYYcP8f35W/rlFrhjkAhoY32dVs ZJHyHStnIicVwep9OBeWK6RDvchkACuvdFhAsTg== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:01 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:07:57 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 07/21] blkparse: pass magic to get_magic Date: Tue, 9 Sep 2025 13:07:09 +0200 Message-Id: <20250909110723.75676-8-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Pass the magic value to get_magic() instead of the whole 'struct blk_io_trace'. This is a preparation for distinguishing between two different types of blktrace protocol versions in blkparse. Signed-off-by: Johannes Thumshirn --- blkparse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blkparse.c b/blkparse.c index c720af6..03df2a7 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2420,12 +2420,12 @@ static inline __u16 get_pdulen(struct blk_io_trace = *bit) return __bswap_16(bit->pdu_len); } =20 -static inline __u32 get_magic(struct blk_io_trace *bit) +static inline __u32 get_magic(__u32 magic) { if (data_is_native) - return bit->magic; + return magic; =20 - return __bswap_32(bit->magic); + return __bswap_32(magic); } =20 static int read_events(int fd, int always_block, int *fdblock) @@ -2458,7 +2458,7 @@ static int read_events(int fd, int always_block, int = *fdblock) if (data_is_native =3D=3D -1 && check_data_endianness(bit->magic)) break; =20 - magic =3D get_magic(bit); + magic =3D get_magic(bit->magic); if ((magic & 0xffffff00) !=3D BLK_IO_TRACE_MAGIC) { fprintf(stderr, "Bad magic %x\n", magic); break; @@ -2604,7 +2604,7 @@ static int ms_prime(struct ms_stream *msp) if (data_is_native =3D=3D -1 && check_data_endianness(bit->magic)) goto err; =20 - magic =3D get_magic(bit); + magic =3D get_magic(bit->magic); if ((magic & 0xffffff00) !=3D BLK_IO_TRACE_MAGIC) { fprintf(stderr, "Bad magic %x\n", magic); goto err; --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58E4632275D; Tue, 9 Sep 2025 11:08:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416087; cv=none; b=m/Y6wjUXfq99Vbg0diiwmiTO1ut1pOxV1eoEMBZENUhKARGHZihJUTUUCZV/nibSZUp0Wt6zKxf90cqdZRQeb67bE4TpMiWMxHeLTF4FlkO8HrtGS9oV7/vYu1FBRYcBqKvwDjbX+BRj3Vmpp9hre7Nb7GasVGSGI1ip23OFvps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416087; c=relaxed/simple; bh=4WnA8o4L2DRIQ3v7RIn87dq0Gk45P9/F4DivHW3wybE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RXTuUI5bsTnoLUopOCDSAzmH+yvJyFj8L6TAAilfK4LixekT77xn4mI0ONnXZ86kEJ0WORE0ovxm4v/ei/ueukmzPUWUPk+9E1IQDnZz03L1tnFodjAWMlky3MErMkZZFGaeRb2UXZTH6/U1PYX+LmHMn5f91hyCuSJ3ghKQwa4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=maYIPVOY; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="maYIPVOY" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416086; x=1788952086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4WnA8o4L2DRIQ3v7RIn87dq0Gk45P9/F4DivHW3wybE=; b=maYIPVOYiXYNaVouehja8fWAC0UZDm1+MJc1VQ1zWLNyTqhfEbvbOqaq kt/YY37wR4/zpotdVJkma8He6rt7j8YRuLctHSr0nxlMfnZVIDWqLCu+g PKQ84hS1bLQB5gGBpLfli0Ft4HB5+EPUrnt3OvUzN0r3L655CGH5ln98R 69MaPIyhthOGe14aLM3Q4BEewMbX6d8mRNsBtDbZUcY7+xfPcQcNzXU8X 1vB9i6rCd0BoI4MZpXwO3hCSBONTFEVT9/BfMWA4pZ8GOuvReNs/7Sf18 7VadisDw2APNUssPmb8Z5swKo7r/zTJTNvCvFQGi//hdp5K/swNBVv9T9 Q==; X-CSE-ConnectionGUID: RBgdgXBURQG2prIgKqRG7A== X-CSE-MsgGUID: dLFC5gr7Ty2ZKRf2/FnxSA== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810702" 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; 09 Sep 2025 19:08:06 +0800 IronPort-SDR: 68c00a96_pa1F4SrLn+dHgm+ZVx1Ge1GBYQE2m1Te78xq0H+XSrpcrQe ub5dCE8QRkzCsI0cpZXyU1+OveC0f2OV71eumBw== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:06 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:01 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 08/21] blkparse: read 'magic' first Date: Tue, 9 Sep 2025 13:07:10 +0200 Message-Id: <20250909110723.75676-9-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Read the 'magic' portion of 'struct blk_io_trace' first when reading the tracefile and only if all magic checks succeed, read the rest of the trace. This is a preparation of supporting multiple trace protocol versions. Signed-off-by: Johannes Thumshirn --- blkparse.c | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/blkparse.c b/blkparse.c index 03df2a7..8381e20 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2438,14 +2438,13 @@ static int read_events(int fd, int always_block, in= t *fdblock) struct trace *t; int pdu_len, should_block, ret; __u32 magic; - - bit =3D bit_alloc(); + void *p; =20 should_block =3D !events || always_block; =20 - ret =3D read_data(fd, bit, sizeof(*bit), should_block, fdblock); + ret =3D read_data(fd, &magic, sizeof(magic), should_block, + fdblock); if (ret) { - bit_free(bit); if (!events && ret < 0) events =3D ret; break; @@ -2455,15 +2454,28 @@ static int read_events(int fd, int always_block, in= t *fdblock) * look at first trace to check whether we need to convert * data in the future */ - if (data_is_native =3D=3D -1 && check_data_endianness(bit->magic)) + if (data_is_native =3D=3D -1 && check_data_endianness(magic)) break; =20 - magic =3D get_magic(bit->magic); + magic =3D get_magic(magic); if ((magic & 0xffffff00) !=3D BLK_IO_TRACE_MAGIC) { fprintf(stderr, "Bad magic %x\n", magic); break; } =20 + bit =3D bit_alloc(); + bit->magic =3D magic; + p =3D (void *) ((u8 *)bit + sizeof(magic)); + + ret =3D read_data(fd, p, sizeof(*bit) - sizeof(magic), + should_block, fdblock); + if (ret) { + bit_free(bit); + if (!events && ret < 0) + events =3D ret; + break; + } + pdu_len =3D get_pdulen(bit); if (pdu_len) { void *ptr =3D realloc(bit, sizeof(*bit) + pdu_len); @@ -2596,20 +2608,30 @@ static int ms_prime(struct ms_stream *msp) int ret, pdu_len, ndone =3D 0; =20 for (i =3D 0; !is_done() && pci->fd >=3D 0 && i < rb_batch; i++) { - bit =3D bit_alloc(); - ret =3D read_data(pci->fd, bit, sizeof(*bit), 1, &pci->fdblock); + void *p; + + ret =3D read_data(pci->fd, &magic, sizeof(magic), 1, + &pci->fdblock); if (ret) goto err; =20 - if (data_is_native =3D=3D -1 && check_data_endianness(bit->magic)) + if (data_is_native =3D=3D -1 && check_data_endianness(magic)) goto err; =20 - magic =3D get_magic(bit->magic); + magic =3D get_magic(magic); if ((magic & 0xffffff00) !=3D BLK_IO_TRACE_MAGIC) { fprintf(stderr, "Bad magic %x\n", magic); goto err; =20 } + bit =3D bit_alloc(); + bit->magic =3D magic; + p =3D (void *) ((u8 *)bit + sizeof(magic)); + + ret =3D read_data(pci->fd, p, sizeof(*bit) - sizeof(magic), 1, + &pci->fdblock); + if (ret) + goto err; =20 pdu_len =3D get_pdulen(bit); if (pdu_len) { @@ -2639,6 +2661,7 @@ static int ms_prime(struct ms_stream *msp) handle_notify(bit); output_binary(bit, sizeof(*bit) + bit->pdu_len); bit_free(bit); + bit =3D NULL; =20 i -=3D 1; continue; @@ -2659,6 +2682,7 @@ static int ms_prime(struct ms_stream *msp) } =20 ndone++; + bit =3D NULL; } =20 return ndone; --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1FCC335BAC; Tue, 9 Sep 2025 11:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416092; cv=none; b=acXEosIPgMWX1cCpa9pc2Jlsbl7S2mU7XGRalEh+GhfuF/2WY+oWprUiB3ygGdEAFZvW4hbtyeNCeKJ6ITJzHk0o4LHqEgycOZoKjW1iA6w0jLLyg41wXpNJD6qEPghpMZRt3DIjAWWEsQ6NlSq8Getbu8aYL9HXavRCVZXyMEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416092; c=relaxed/simple; bh=Ez4oiGj5L11AjnSxcGg+DGNFghkL7QjvULDGdBfytNU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pDrTaOTmdNtwRmcXA8sFsWWXT1YUS5jM6dUDXuY6cEf2btGLa/otIyLvo7D3Edi2svgcouRf+syRefJ4Agkj0EktXKa2zQIx0W9fA++DDHuXfPotavA9XID1Y+YtUYEJfWoKLt9XUroXk0s+nHObisGRj2HjlF7nLm37Qag4iHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=FwZOKw2K; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="FwZOKw2K" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416091; x=1788952091; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ez4oiGj5L11AjnSxcGg+DGNFghkL7QjvULDGdBfytNU=; b=FwZOKw2KMVXBEH/YcUiGWXqUPOhVTgKl54/KkJ7hKlvs3rzr7olNViTp L6rJwaA9lnXwLP/1PnFYWY+ynJxfBw3u7n+WoLtiqGMeK76JTRgpjdEqW baHQW8JR6kptTujJEXsJOIhIUYxNDE2BWV62z1ItcznPczAvqJ2ZIFOHF Qzrs3oTbSwYNByQOpj2bS+ygVmaxPm5HKQRE0Nlgs3WseI4YWQBY4tCJD YA+/Osi+cmxHjXPZTiYEUPnQDkSvELCqZAbMEpbIvNhIIQEwcBVGvgbwN pqFfq3X89CZ9CKjvOAY0jJeBl5HaQ7aTwaKYgnEaenadKLA0hyzxVcrE6 w==; X-CSE-ConnectionGUID: WxGLJNA4SoiZLgs/nD1eIQ== X-CSE-MsgGUID: JPlwgus6R+KSAst0+vCI3A== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810718" 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; 09 Sep 2025 19:08:10 +0800 IronPort-SDR: 68c00a9a_AaB5/t57qGLhKPBNhwXWnjgaQwF3DuqelBIcewI1i5zv6no HFaDOl/zYOxZh666+CdnBVq+tfzIg79caRa0u3w== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:10 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:06 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 09/21] blkparse: factor out reading of a singe blk_io_trace event Date: Tue, 9 Sep 2025 13:07:11 +0200 Message-Id: <20250909110723.75676-10-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Factor out reading a single blk_io_trace event. This de-duplicates code and also prepares for expansion with new trace protocol versions. Signed-off-by: Johannes Thumshirn --- blkparse.c | 78 ++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 44 deletions(-) diff --git a/blkparse.c b/blkparse.c index 8381e20..5d5cd48 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2428,6 +2428,34 @@ static inline __u32 get_magic(__u32 magic) return __bswap_32(magic); } =20 +static int read_one_bit(int fd, struct blk_io_trace *bit, int block, + int *fdblock) +{ + int ret; + int pdu_len; + void *p =3D (void *) ((u8 *)bit + sizeof(__u32)); + + ret =3D read_data(fd, p, sizeof(*bit) - sizeof(__u32), block, fdblock); + if (ret) + return ret; + + pdu_len =3D get_pdulen(bit); + if (pdu_len) { + void *ptr =3D realloc(bit, sizeof(*bit) + pdu_len); + + ret =3D read_data(fd, ptr + sizeof(*bit), pdu_len, 1, fdblock); + if (ret) { + free(ptr); + return ret; + } + bit =3D ptr; + } + + trace_to_cpu(bit); + + return 0; +} + static int read_events(int fd, int always_block, int *fdblock) { struct per_dev_info *pdi =3D NULL; @@ -2436,9 +2464,8 @@ static int read_events(int fd, int always_block, int = *fdblock) while (!is_done() && events < rb_batch) { struct blk_io_trace *bit; struct trace *t; - int pdu_len, should_block, ret; + int should_block, ret; __u32 magic; - void *p; =20 should_block =3D !events || always_block; =20 @@ -2465,33 +2492,14 @@ static int read_events(int fd, int always_block, in= t *fdblock) =20 bit =3D bit_alloc(); bit->magic =3D magic; - p =3D (void *) ((u8 *)bit + sizeof(magic)); =20 - ret =3D read_data(fd, p, sizeof(*bit) - sizeof(magic), - should_block, fdblock); - if (ret) { - bit_free(bit); - if (!events && ret < 0) - events =3D ret; + ret =3D read_one_bit(fd, bit, 1, fdblock); + if (ret) break; - } - - pdu_len =3D get_pdulen(bit); - if (pdu_len) { - void *ptr =3D realloc(bit, sizeof(*bit) + pdu_len); - - if (read_data(fd, ptr + sizeof(*bit), pdu_len, 1, fdblock)) { - bit_free(ptr); - break; - } - - bit =3D ptr; - } - - trace_to_cpu(bit); =20 if (verify_trace(bit)) { bit_free(bit); + bit =3D NULL; continue; } =20 @@ -2605,10 +2613,9 @@ static int ms_prime(struct ms_stream *msp) struct per_dev_info *pdi =3D msp->pdi; struct per_cpu_info *pci =3D get_cpu_info(pdi, msp->cpu); struct blk_io_trace *bit =3D NULL; - int ret, pdu_len, ndone =3D 0; + int ret, ndone =3D 0; =20 for (i =3D 0; !is_done() && pci->fd >=3D 0 && i < rb_batch; i++) { - void *p; =20 ret =3D read_data(pci->fd, &magic, sizeof(magic), 1, &pci->fdblock); @@ -2626,28 +2633,11 @@ static int ms_prime(struct ms_stream *msp) } bit =3D bit_alloc(); bit->magic =3D magic; - p =3D (void *) ((u8 *)bit + sizeof(magic)); =20 - ret =3D read_data(pci->fd, p, sizeof(*bit) - sizeof(magic), 1, - &pci->fdblock); + ret =3D read_one_bit(pci->fd, bit, 1, &pci->fdblock); if (ret) goto err; =20 - pdu_len =3D get_pdulen(bit); - if (pdu_len) { - void *ptr =3D realloc(bit, sizeof(*bit) + pdu_len); - ret =3D read_data(pci->fd, ptr + sizeof(*bit), pdu_len, - 1, &pci->fdblock); - if (ret) { - free(ptr); - bit =3D NULL; - goto err; - } - - bit =3D ptr; - } - - trace_to_cpu(bit); if (verify_trace(bit)) goto err; =20 --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1226332277B; Tue, 9 Sep 2025 11:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416096; cv=none; b=VzeYxBTbK85oPgRI0ifHZXqHTN8LOovK1ugbH8r7Rv2dTZtR6o+4tCi6Tph6kR1GOdiztJTnf0Umrzr/eVbcMwCjCkey1xJhyzdaNYEvg/zLBB29M3kUzCDmL0RI7sUnvaHAbupGEffNb2hmj68ZaTKRuHAlcaC9Ydjq/PZAcRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416096; c=relaxed/simple; bh=WD43JFS2ah5FUpMh882JigJ3lZCVegi0OGYqc9+sTMk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ExXxOWmcBv8CV1Y8Q24oM8/RN3Fp6pc8IpcMbPH8ayqdHQujJex8mzPmOUHPDaX+pzHVrJI606ZN5ZQGjL5utHFIlIgo/KzbAvCv1v+biygjFl58qQmbBWf5Df+EzIHLKcs0boWYX6op2djNdxrWnb8zBzvhjCXu8I2iIAWsKvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=UWg4VIiq; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="UWg4VIiq" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416095; x=1788952095; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WD43JFS2ah5FUpMh882JigJ3lZCVegi0OGYqc9+sTMk=; b=UWg4VIiq+/DrxlUvLn0sLJzpRYUesb3lCRkpqpVwHtLcNU51jUGijMPX YptQzv8D2hPZ9B3sfys1uswIpiTIh7glBJzUnTY4ZR8/hTAZbPx1VHnsJ g7fYzJQzSwm/KOZ+CNcMZ/QZho0uBZFC5SvfZ2m00PZtUDbLMtcuHJjT7 7pleqlZ58Tw5eQ9aM1HbpFas7MI5uQj8dPI8rLiU/S41W7CNQ2BUDDxAa ZZMXZed39xvVFJXdcl5fJVgeV04jkV7gvcZeyKEnPOIJTim1fuVCO5xOM iorJjc72VlGtSzfzWvb6qljlnwwUed2H3eVwQLnI+rJKqlrPN1j1KVz2Z g==; X-CSE-ConnectionGUID: 5b3b7m0HTqGUaoWKz61ckA== X-CSE-MsgGUID: 0lMDT4oDQlScS57VYUPVrQ== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810723" 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; 09 Sep 2025 19:08:15 +0800 IronPort-SDR: 68c00a9e_qJypKtHc6qrLOft0Q58GttWUVa8fVxEhSHj6S6qpx88EdZT ASckAlFQhaa/xnkr7zNf3Q7HeFo2XzmUeZc2ftA== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:15 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:10 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 10/21] blkparse: skip unsupported protocol versions Date: Tue, 9 Sep 2025 13:07:12 +0200 Message-Id: <20250909110723.75676-11-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Skip unsupported protocol versions for now. Signed-off-by: Johannes Thumshirn --- blkparse.c | 136 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 60 deletions(-) diff --git a/blkparse.c b/blkparse.c index 5d5cd48..0873c13 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2462,10 +2462,10 @@ static int read_events(int fd, int always_block, in= t *fdblock) unsigned int events =3D 0; =20 while (!is_done() && events < rb_batch) { - struct blk_io_trace *bit; struct trace *t; int should_block, ret; __u32 magic; + u8 version; =20 should_block =3D !events || always_block; =20 @@ -2489,42 +2489,50 @@ static int read_events(int fd, int always_block, in= t *fdblock) fprintf(stderr, "Bad magic %x\n", magic); break; } + version =3D magic & 0xff; + if (version =3D=3D SUPPORTED_VERSION) { + struct blk_io_trace *bit; + bit =3D bit_alloc(); + bit->magic =3D magic; =20 - bit =3D bit_alloc(); - bit->magic =3D magic; + ret =3D read_one_bit(fd, bit, 1, fdblock); + if (ret) + break; =20 - ret =3D read_one_bit(fd, bit, 1, fdblock); - if (ret) - break; + /* + * not a real trace, so grab and handle it here + */ + if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && + (bit->action & ~__BLK_TN_CGROUP) !=3D BLK_TN_MESSAGE) { + handle_notify(bit); + output_binary(bit, sizeof(*bit) + bit->pdu_len); + continue; + } =20 - if (verify_trace(bit)) { - bit_free(bit); - bit =3D NULL; - continue; - } + if (verify_trace(bit)) { + bit_free(bit); + bit =3D NULL; + continue; + } =20 - /* - * not a real trace, so grab and handle it here - */ - if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && (bit->action & ~__BLK_TN_= CGROUP) !=3D BLK_TN_MESSAGE) { - handle_notify(bit); - output_binary(bit, sizeof(*bit) + bit->pdu_len); - continue; - } + t =3D t_alloc(); + memset(t, 0, sizeof(*t)); + t->bit =3D bit; + t->read_sequence =3D read_sequence; =20 - t =3D t_alloc(); - memset(t, 0, sizeof(*t)); - t->bit =3D bit; - t->read_sequence =3D read_sequence; + t->next =3D trace_list; + trace_list =3D t; =20 - t->next =3D trace_list; - trace_list =3D t; + if (!pdi || pdi->dev !=3D bit->device) + pdi =3D get_dev_info(bit->device); =20 - if (!pdi || pdi->dev !=3D bit->device) - pdi =3D get_dev_info(bit->device); + if (bit->time > pdi->last_read_time) + pdi->last_read_time =3D bit->time; + } else { + fprintf(stderr, "unsupported version %d\n", version); + continue; + } =20 - if (bit->time > pdi->last_read_time) - pdi->last_read_time =3D bit->time; =20 events++; } @@ -2616,6 +2624,7 @@ static int ms_prime(struct ms_stream *msp) int ret, ndone =3D 0; =20 for (i =3D 0; !is_done() && pci->fd >=3D 0 && i < rb_batch; i++) { + u8 version; =20 ret =3D read_data(pci->fd, &magic, sizeof(magic), 1, &pci->fdblock); @@ -2631,46 +2640,53 @@ static int ms_prime(struct ms_stream *msp) goto err; =20 } - bit =3D bit_alloc(); - bit->magic =3D magic; + version =3D magic & 0xff; + if (version =3D=3D SUPPORTED_VERSION) { + bit =3D bit_alloc(); + bit->magic =3D magic; =20 - ret =3D read_one_bit(pci->fd, bit, 1, &pci->fdblock); - if (ret) - goto err; + ret =3D read_one_bit(pci->fd, bit, 1, &pci->fdblock); + if (ret) + goto err; =20 - if (verify_trace(bit)) - goto err; + if (verify_trace(bit)) + goto err; =20 - if (bit->cpu !=3D pci->cpu) { - fprintf(stderr, "cpu %d trace info has error cpu %d\n", - pci->cpu, bit->cpu); - continue; - } + if (bit->cpu !=3D pci->cpu) { + fprintf(stderr, + "cpu %d trace info has error cpu %d\n", + pci->cpu, bit->cpu); + continue; + } =20 - if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && (bit->action & ~__BLK_TN_= CGROUP) !=3D BLK_TN_MESSAGE) { - handle_notify(bit); - output_binary(bit, sizeof(*bit) + bit->pdu_len); - bit_free(bit); - bit =3D NULL; + if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && + (bit->action & ~__BLK_TN_CGROUP) !=3D BLK_TN_MESSAGE) { + handle_notify(bit); + output_binary(bit, sizeof(*bit) + bit->pdu_len); + bit_free(bit); + bit =3D NULL; =20 - i -=3D 1; - continue; - } + i -=3D 1; + continue; + } =20 - if (bit->time > pdi->last_read_time) - pdi->last_read_time =3D bit->time; + if (bit->time > pdi->last_read_time) + pdi->last_read_time =3D bit->time; =20 - t =3D t_alloc(); - memset(t, 0, sizeof(*t)); - t->bit =3D bit; + t =3D t_alloc(); + memset(t, 0, sizeof(*t)); + t->bit =3D bit; =20 - if (msp->first =3D=3D NULL) - msp->first =3D msp->last =3D t; - else { - msp->last->next =3D t; - msp->last =3D t; + if (msp->first =3D=3D NULL) + msp->first =3D msp->last =3D t; + else { + msp->last->next =3D t; + msp->last =3D t; + } + } else { + fprintf(stderr, "unsupported version %d\n", version); + continue; } - ndone++; bit =3D NULL; } --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86D173375B7; Tue, 9 Sep 2025 11:08:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416101; cv=none; b=SIoYn4tcsnZC/RIhpDuc4M2fSBzfu0f0IQLigMwzYjHNXkiClG43E/9uoxN/C3jsyGdpdvKUPWor0Jb4yjkXmXEnlucVoPKUgoFx73F7j6yWuVQ90zzHU3ikUS4AGGPHMBD0akKIS0M3MsYrNZEUjUJzvzSyU6ecejcJSEX4jPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416101; c=relaxed/simple; bh=P9BXDgzGLXQwW3Va5jL6Zsgr+hSb3rFcWs06lTgG0no=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MfcIX+nzvy72NigN/1RMwYAadBM50C/0ALHy61nV6LLIIk3bq+66FTqnMHpwXRnSI2slE6PxFqlPHY9o3JYoUnLKwyDdD91urQlpMCEp+kzLMA8AySTt//N2e+zmpl2zcywoQHfSJOOWWc9ljL7cYWp3DaTZyQkdMMLXcGCPyHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=b+oR6+NE; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="b+oR6+NE" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416099; x=1788952099; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=P9BXDgzGLXQwW3Va5jL6Zsgr+hSb3rFcWs06lTgG0no=; b=b+oR6+NEGwJ0c9s3r1Oo/6LBDxUPS8Z9cHtcWwaLvtbW2EAswftzPh87 mTaPdOwOYtY5USkumb8YOZdeakdNK8DpPz08uym7IbU4GvgWnzdJCxCzh qvPpfzQsPhr3egi676Hc1YaDykwmWQZRfv393tSBe4qeQWWh9i6D7TKiJ JgDlXHX+CbKaasLKP7JwT1qcfpuVmrmLLC9x1BVfWgkqQBQF6zMDIybvk MrzpSu4hQH4BU+2tvSh0VyYsHBJ5MGEyk1baXLp/NHIKqifNbt6VIoGQe U+XqlIdHMWHvMqYm7yq7JvT0hcLfPH9mHGl7QRkfGMdt6QCIToN2RuHqF g==; X-CSE-ConnectionGUID: cDcXPQ0HQt+MCLXQnrm27w== X-CSE-MsgGUID: LP1/nkrtTI+IwadFerHfzQ== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810733" 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; 09 Sep 2025 19:08:19 +0800 IronPort-SDR: 68c00aa3_QRDyc6OgoIlRS7YeJvMG9DJzqCis0RXS4hW4XSsA7Tfsl+O aCK7FPqAiwtpEoHq+bY97TwRSwTPa/72d03OVqQ== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:19 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:15 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 11/21] blkparse: make get_pdulen() take the pdu_len Date: Tue, 9 Sep 2025 13:07:13 +0200 Message-Id: <20250909110723.75676-12-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Directly pass in the pdu_len into get_pdulen() and only care about the byte swapping in get_pdulen(). This enables us to use the function for different versions of the protocol. Signed-off-by: Johannes Thumshirn --- blkparse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blkparse.c b/blkparse.c index 0873c13..3609ca9 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2412,12 +2412,12 @@ static int read_data(int fd, void *buffer, int byte= s, int block, int *fdblock) return 0; } =20 -static inline __u16 get_pdulen(struct blk_io_trace *bit) +static inline __u16 get_pdulen(__u16 pdu_len) { if (data_is_native) - return bit->pdu_len; + return pdu_len; =20 - return __bswap_16(bit->pdu_len); + return __bswap_16(pdu_len); } =20 static inline __u32 get_magic(__u32 magic) @@ -2439,7 +2439,7 @@ static int read_one_bit(int fd, struct blk_io_trace *= bit, int block, if (ret) return ret; =20 - pdu_len =3D get_pdulen(bit); + pdu_len =3D get_pdulen(bit->pdu_len); if (pdu_len) { void *ptr =3D realloc(bit, sizeof(*bit) + pdu_len); =20 --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2CEB322A09; Tue, 9 Sep 2025 11:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416105; cv=none; b=MOMQlv2P5Z6EBeUGhMNal7Yn+soEjg0Jd9Vebm6Yc5J+eCeW0eVcl56QZ93aTsgiH9tkNn3Hoi9t9wRjnv0oeSsp2cNtV8iUeQw1t7KAVZum63RH9BhzPbo+7P348NV2bYgeCys2pu39KHF5PxOd0N+07IMuMwwzvFufgEH4GdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416105; c=relaxed/simple; bh=7x/8BV1VwYtiCopSTQrOJDK3TC6H2EX5xtil7lp16lM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mjK7LlZFXiMBqkYHYxb7jLZRKNMerQw4m/5zP95J8yhMbJipjrnsJUfziWInYUqbLijc3i9kWTu888QGH+KpKlB0zPL0OQxuhlypKe1TlZLM8hSmbFjgHzUgx996G66a1c95o4AUYIX4eF+UnMmMnbrXrIjRhKwTifqD5mTZcXM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=EEJ8kQi9; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="EEJ8kQi9" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416104; x=1788952104; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7x/8BV1VwYtiCopSTQrOJDK3TC6H2EX5xtil7lp16lM=; b=EEJ8kQi9wDYRnz+4lvNWqviHZQi+FZHqsj7F7vsM3XTssIs7wmT71YpF XyVwP4NhVNA/G5oZMB+yL/LzTjaxtcxcGEN19c/FQ6zrszvvhS4NS24RW 9/LF6CiRfBQof6SG/cf/EG5g1nGwkRgq1VOo63Do/K3TRxDVoT9Un/R0h 3AIAGhfFElHglp1ypl0ubgeUQ1xXbkNCDCgm4GOKuuPqG5vosdq+YhSHT LQeLxAC8ljul/0UZBv9zykYyFjfbIOhwoqP+vrgCkxfzdR8GoZeQCMfV2 bezvMjCGn0B5dfmgHYc+s9pYmJSXr2V+n+jzmCPLBpPPea9r1NGvyF1qJ w==; X-CSE-ConnectionGUID: oiYHrXUYTUujMcq1tmraaw== X-CSE-MsgGUID: RQVxc5hXQ4+PVMVro1PBgg== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810740" 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; 09 Sep 2025 19:08:23 +0800 IronPort-SDR: 68c00aa7_oJoHIW38v9jfTnRZD5eOKcOzHxDxgkn76XgdGBW7Ex2ajYC r2pUqfZ/EC69asZSxFHsvZXo+ck0n3oOBmiLZ2g== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:24 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:19 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 12/21] blkiomon: read 'magic' first Date: Tue, 9 Sep 2025 13:07:14 +0200 Message-Id: <20250909110723.75676-13-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Similar to blkparse, read the 'magic' portion of 'struct blk_io_trace' first when reading the trace. This is a preparation of supporting multiple trace protocol versions. Signed-off-by: Johannes Thumshirn --- blkiomon.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blkiomon.c b/blkiomon.c index f8b0c9d..05f2d00 100644 --- a/blkiomon.c +++ b/blkiomon.c @@ -460,19 +460,28 @@ static int blkiomon_do_fifo(void) bit =3D &t->bit; =20 while (up) { + __u32 magic; + + if (fread(&magic, sizeof(magic), 1, ifp) !=3D 1) { + if (!feof(ifp)) + fprintf(stderr, + "blkiomon: could not read trace"); + break; + } if (fread(bit, sizeof(*bit), 1, ifp) !=3D 1) { if (!feof(ifp)) fprintf(stderr, "blkiomon: could not read trace"); break; } + bit->magic =3D magic; if (ferror(ifp)) { clearerr(ifp); fprintf(stderr, "blkiomon: error while reading trace"); break; } =20 - if (data_is_native =3D=3D -1 && check_data_endianness(bit->magic)) { + if (data_is_native =3D=3D -1 && check_data_endianness(magic)) { fprintf(stderr, "blkiomon: endianess problem\n"); break; } --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 250C0320CDF; Tue, 9 Sep 2025 11:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416109; cv=none; b=cYbFna0v2xBXPKfvDYFhAC5UvnIaV9imONVrJ07QWUv5uYHURnZBXvSiSSbX+54IUyxAwHvsaJoe4+Ua6J0DaaEfWt6sEygvbagINqDNngc5ikZ/1MA2c/3hDuisyWhS0ZIwvUycgURIg01OgqkEJQgjI1CTkV3MKRuegkwD/0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416109; c=relaxed/simple; bh=3oS1kgcAgXjp0aHkhvXj8mPE9QIVrKKYTq1StaQgUmk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=P4gQMfnstXgrLNCWc/LU+wm5hKuh8oP4X/Bi0YfF/FlsoRnniM0GwlwhTZkBAOEl4IpIbcKiZMyJOoCg1vdJx7Qv3lv7KB7dKjrP4W7rOd94Jur+ptncqQ+Pq46vndywXfX3RbiMMGoqxA/XKu+0QKklbt526CPVpYMsBVtVzDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=roaUqzG3; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="roaUqzG3" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416108; x=1788952108; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3oS1kgcAgXjp0aHkhvXj8mPE9QIVrKKYTq1StaQgUmk=; b=roaUqzG3DKNuKFvwY9ZANIPuVhW1w/6Vyr47ap6goPkFBglfWp/m/mpM knjbkLbfs4sT1qJ+uvp+B0GoBReNJZJG/UFBzlxUng5UsQYVvXdlByM5+ XRH7bAc0vA/Rf6Se2sx7rKkmTVszLxh/50uZbbZH50Vw7CCc/zcJPhF2q u/prMbXFPyRZhym9HRc8AgWV9WewXf/7aKMZlCjB5drsXVP/A37vYGJNb 35jZoRIKu6iWur3sl2EwJFVP0k/mId6QjkVJ8b7wHV9ehFAibCOatb32A Oid2cZX5UKOi8aJ9w2YAbK//DrAmpInQiiHkeTeBo1NjPTaq9kHNkBEi2 A==; X-CSE-ConnectionGUID: /39Hfy8YQ1adk9uhUW8uTA== X-CSE-MsgGUID: aflApoD5TWeL72hVWjLdkA== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810744" 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; 09 Sep 2025 19:08:28 +0800 IronPort-SDR: 68c00aac_kMsR2DaramIEdoDIgi7N+rURCKvCMBU3hpVT34xqU+990YI VjG7RlOuAIXjqMbzGXh26z3+MePYIk1BzDV78zw== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:28 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:24 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 13/21] blktrace: pass magic to CHECK_MAGIC macro Date: Tue, 9 Sep 2025 13:07:15 +0200 Message-Id: <20250909110723.75676-14-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Pass only the magic number itself to the CHECK_MAGIC() macro. This enables support for multiple versions. Signed-off-by: Johannes Thumshirn --- blkrawverify.c | 2 +- blktrace.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blkrawverify.c b/blkrawverify.c index 9c5d595..cc5b06e 100644 --- a/blkrawverify.c +++ b/blkrawverify.c @@ -183,7 +183,7 @@ static int process(FILE **fp, char *devname, char *file= , unsigned int cpu) =20 trace_to_cpu(bit); =20 - if (!CHECK_MAGIC(bit)) { + if (!CHECK_MAGIC(bit->magic)) { INC_BAD("bad trace"); continue; } diff --git a/blktrace.h b/blktrace.h index 3305fa0..81a5b51 100644 --- a/blktrace.h +++ b/blktrace.h @@ -67,7 +67,7 @@ extern FILE *ofp; extern int data_is_native; extern struct timespec abs_start_time; =20 -#define CHECK_MAGIC(t) (((t)->magic & 0xffffff00) =3D=3D BLK_IO_TRACE_MAG= IC) +#define CHECK_MAGIC(magic) (((magic) & 0xffffff00) =3D=3D BLK_IO_TRACE_MA= GIC) #define SUPPORTED_VERSION (0x07) #define SUPPORTED_VERSION2 (0x08) =20 @@ -93,7 +93,7 @@ static inline int verify_trace(struct blk_io_trace *t) { u8 version; =20 - if (!CHECK_MAGIC(t)) { + if (!CHECK_MAGIC(t->magic)) { fprintf(stderr, "bad trace magic %x\n", t->magic); return 1; } --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7568F338F48; Tue, 9 Sep 2025 11:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416114; cv=none; b=PQ25JQISpQ3Z/TJEirnaoMvnnHvoH0VdkzSO7mIyGFfsPlW+hRP2POqLbFgG0F3BfwodY9INrusJ9flZfl962Dn+OJZkmL1BAZcS8GZl3IeZZgiETctWp4r2qvCAivMiMvb0zmz/rYxhBKylKhAim+P0MOxcaavXLenrsO9j8gU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416114; c=relaxed/simple; bh=nRZnhyBd/qziiI41VmsqQR87WLp9tku/9fGsw/Z/SJc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=krZHphDcBFwrNdx1h4zW4HhFr82mU9S25wOqQWF3nMaF8IJ4oA/ma3gCURS9mBR7vMZAEVVvetdlleUAUAI47pEaphoOxoA91U+TX5YpCZefo69eIVg3uLEwu4QZTtOw5hb058vHzjB/Qbi6xv6XuuKQpvUyv4yi6qBbWRqbrX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=K8LxRydm; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="K8LxRydm" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416112; x=1788952112; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nRZnhyBd/qziiI41VmsqQR87WLp9tku/9fGsw/Z/SJc=; b=K8LxRydmx3GhWvyDARdFmpvOHYg5a286KMaKteT7DtMjWVU/uUKmZrXM ppKVYXU9Naf/10/liGhPwfFzS78MQN9AImGd1P8gbseKcuj3vLpSfGnoh InfCXeON2DIlVE0Q2qbm/B5yyzGYKu3LP+3oh/r83MIdkwI7wN468djG4 OTVYrWbIQeY70mR0NqffsA/Lkrv0/5YqfxVq+Ii8qNkA/+G9K0vFdP772 dYWVy55qZOASuqwtZBO2ar/YZqlserDGVSSCW8nFOQmGLHv1bmFZItWqZ wr1ynLMYZ7ILZ+k3lEEhqE/Hw5rExVBRJ90iA2ins6rHS1i7ccMAZMFzd A==; X-CSE-ConnectionGUID: mvtZUHIRRiKlM7b5I5mA3w== X-CSE-MsgGUID: qatcUp6+S3u3J7WgHsT6bA== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810751" 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; 09 Sep 2025 19:08:32 +0800 IronPort-SDR: 68c00ab0_yFGfdWBLoT5xo8Zqj4hgIi+EUr3Qd+7uwshHVVZ7/BbMNEV 22+eNfTdVB5jNGV+rEXth5YGcPafk0l1bNTF+4A== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:32 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:28 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 14/21] blktrace: pass magic to verify_trace Date: Tue, 9 Sep 2025 13:07:16 +0200 Message-Id: <20250909110723.75676-15-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Pass magic to verify_trace(), this will enable verification of multiple supported versions. Singed-off-by: Johannes Thumshirn --- blkiomon.c | 2 +- blkparse.c | 4 ++-- blktrace.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blkiomon.c b/blkiomon.c index 05f2d00..373947e 100644 --- a/blkiomon.c +++ b/blkiomon.c @@ -488,7 +488,7 @@ static int blkiomon_do_fifo(void) =20 /* endianess */ trace_to_cpu(bit); - if (verify_trace(bit)) { + if (verify_trace(bit->magic)) { fprintf(stderr, "blkiomon: bad trace\n"); break; } diff --git a/blkparse.c b/blkparse.c index 3609ca9..cc62dcf 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2509,7 +2509,7 @@ static int read_events(int fd, int always_block, int = *fdblock) continue; } =20 - if (verify_trace(bit)) { + if (verify_trace(bit->magic)) { bit_free(bit); bit =3D NULL; continue; @@ -2649,7 +2649,7 @@ static int ms_prime(struct ms_stream *msp) if (ret) goto err; =20 - if (verify_trace(bit)) + if (verify_trace(bit->magic)) goto err; =20 if (bit->cpu !=3D pci->cpu) { diff --git a/blktrace.h b/blktrace.h index 81a5b51..68c67f2 100644 --- a/blktrace.h +++ b/blktrace.h @@ -89,16 +89,16 @@ extern struct timespec abs_start_time; #error "Bad arch" #endif =20 -static inline int verify_trace(struct blk_io_trace *t) +static inline int verify_trace(__u32 magic) { u8 version; =20 - if (!CHECK_MAGIC(t->magic)) { - fprintf(stderr, "bad trace magic %x\n", t->magic); + if (!CHECK_MAGIC(magic)) { + fprintf(stderr, "bad trace magic %x\n", magic); return 1; } =20 - version =3D t->magic & 0xff; + version =3D magic & 0xff; if (version !=3D SUPPORTED_VERSION && version !=3D SUPPORTED_VERSION2) { fprintf(stderr, "unsupported trace version %x\n", version); --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE2A833A021; Tue, 9 Sep 2025 11:08:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416118; cv=none; b=r7uVoyfM0OWiRDuvHlN5OiliFkp+oEphcCT7oI0CCVSP4vbSmib4vsv1SXbpNRXS0I6dRIMrOh33lA0nmvCAGWR7b9QILuBOy4rPDK4nAWJTbb8fNtk7NnBVWiAH+6M8IEdlkTAlEpcNmeWBZpfsBmCtBW4DE5xSJNE1/qQB+IA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416118; c=relaxed/simple; bh=LQEvU4huJwrt4jkfJqH99TrPqp77yysYykNycx4NgNo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jbGIPf7fwPfBiYNgbOAo72zzIoYNPR8i6mo/zaJYyrIHo5mPm9YADzrkmtDlM8+Isq+AdPV8shZwpKS2yRhY3qabk3fip+mejXi6jBZPJYDnKeqxojjjPoPm/g+ufBVKZhFRwwALoa313JwqasAwDUK2G+0Tf3sl+O8ehh5/btU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=KxV0NWKP; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="KxV0NWKP" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416117; x=1788952117; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LQEvU4huJwrt4jkfJqH99TrPqp77yysYykNycx4NgNo=; b=KxV0NWKP31EoVxF5SqL6nmvTlJPwloe1aCyfb7aGrbDu0reKRXY0MnZK +aEBUsVtikO8wazshdociATl23SwssENJ5mZWINIRs0aT1U4axsrzl2Rm ijS2bFTIhO+Futkg1ahgbtpRbgMzR4M05fB02QQfq5qnrEYPezBHH96TR m+2YtDdVGSRiYnjLPRGNLqKpgmOlOmKP+itRyToTnQNlGFah1u7jmVG8s 3lwxHL7JAA0xp9GwbOtPB1BCYB+Hxaw3vFxxltorJSyTWgQBMOISHVHW2 ZyO5anP6H0feyWooPToMW5bb8QAsVg8ghhofk9o/ZmGhkColW45MJ4PbO A==; X-CSE-ConnectionGUID: Wea1qmthQR22v7oyfU8hrw== X-CSE-MsgGUID: zZI9MMeeTHqsMy8nsQkG9Q== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810797" 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; 09 Sep 2025 19:08:36 +0800 IronPort-SDR: 68c00ab4_yzhNKyODBgLalqmm6Zjyg1zCaksyaBjSGw9b8634B0lDWmF 8f/p+hWmw6fNtynjqbr5JqbI9tjW+AkimQKGf1Q== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:37 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:32 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 15/21] blktrace: rename trace_to_cpu to bit_trace_to_cpu Date: Tue, 9 Sep 2025 13:07:17 +0200 Message-Id: <20250909110723.75676-16-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Johannes Thumshirn --- blkiomon.c | 2 +- blkparse.c | 2 +- blkrawverify.c | 2 +- blktrace.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/blkiomon.c b/blkiomon.c index 373947e..9defa2c 100644 --- a/blkiomon.c +++ b/blkiomon.c @@ -487,7 +487,7 @@ static int blkiomon_do_fifo(void) } =20 /* endianess */ - trace_to_cpu(bit); + bit_trace_to_cpu(bit); if (verify_trace(bit->magic)) { fprintf(stderr, "blkiomon: bad trace\n"); break; diff --git a/blkparse.c b/blkparse.c index cc62dcf..068c4b2 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2451,7 +2451,7 @@ static int read_one_bit(int fd, struct blk_io_trace *= bit, int block, bit =3D ptr; } =20 - trace_to_cpu(bit); + bit_trace_to_cpu(bit); =20 return 0; } diff --git a/blkrawverify.c b/blkrawverify.c index cc5b06e..8e863cb 100644 --- a/blkrawverify.c +++ b/blkrawverify.c @@ -181,7 +181,7 @@ static int process(FILE **fp, char *devname, char *file= , unsigned int cpu) if (data_is_native =3D=3D -1) check_data_endianness(bit->magic); =20 - trace_to_cpu(bit); + bit_trace_to_cpu(bit); =20 if (!CHECK_MAGIC(bit->magic)) { INC_BAD("bad trace"); diff --git a/blktrace.h b/blktrace.h index 68c67f2..08ac28b 100644 --- a/blktrace.h +++ b/blktrace.h @@ -108,7 +108,7 @@ static inline int verify_trace(__u32 magic) return 0; } =20 -static inline void trace_to_cpu(struct blk_io_trace *t) +static inline void bit_trace_to_cpu(struct blk_io_trace *t) { if (data_is_native) return; --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 477C433CE8C; Tue, 9 Sep 2025 11:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416123; cv=none; b=o3VBXE5XzIQQb3UdNQSt8axOA6BTuXHXQ4wiUFyjjNwnMKwo0IiZCPLqx6gyJtsRbcYNo6ST2/rBYCDsZTrddUxt7zg5JVwDhHD+w+S8t2hjFgTle7EuY+bt4cfRJxb9crtB4j1zL3zbyHF0p9tLv/d1mE9adVvOGhLHMWv2t+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416123; c=relaxed/simple; bh=3MwyTgxLH0GtWDusN38sfKI7G/O+aPFTqnKOt3Y/LRM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y0lg4bskfRX1KhV8K/VxkdapzxWlLBa6Br6yyjiEuoA6C6ka1NYi1//aHoxx5DeJBFvez5ZvA8TLfJE7e9MknMa2Qe+Xd1S2J8YSMfz34XJEXZg4NPxpuOByCPX821oxVlUNrMFYEMlWzmKH+/rI7+QnV9RuYxROijS3LpKntjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=f47QxzbH; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="f47QxzbH" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416121; x=1788952121; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3MwyTgxLH0GtWDusN38sfKI7G/O+aPFTqnKOt3Y/LRM=; b=f47QxzbHEksqwAE0zUThZW9fUjSf2gJpsRyqHf6G+JGy2is64DJIbepw yTbKFFWGSEJmzkY0vUNZn0L13KX4v/kjsd6uflWJSJ36M26fbQ49Mvthx Q27iYenXUN1O2+cyLHQd35A+FUSQC5GE2SHT3JuSHJ39zr7gx0Rew5xwu SYoDezxCZTMifT131C+2DxOOflJISk8t+j5YKFwATA9an0djlhEylK+05 IfP3xVmws2kppb4FpzBxNZF8kqnq1vxS4/sF2Ly3jIoIWTqosRKZF3bzP TAmCP0CInQz9Dtj/5/PjjMrPokGfM7ptG4dlEOhu+qLhhLEdqZ4lq5vfZ w==; X-CSE-ConnectionGUID: iuiejeRIQFuFGlRv5OIPEg== X-CSE-MsgGUID: NI9DkjUqSRGFuMjsePxsQA== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810837" 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; 09 Sep 2025 19:08:41 +0800 IronPort-SDR: 68c00ab9_zqAk96jqN0XDNoaXOefTmF1Fw04LsoMyafMYvyhfIDfumhC /pEw9V8imux4lXWpjJt5KWxNd0b8ej6pvaShcbQ== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:41 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:37 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 16/21] blkparse: use blk_io_trace2 internally Date: Tue, 9 Sep 2025 13:07:18 +0200 Message-Id: <20250909110723.75676-17-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use 'struct blk_io_trace2' as internal representation for a captured blktrace. This implies the conversion of 'struct blk_io_trace' into 'struct blk_io_trace2' when reading the trace from the binary file. Signed-off-by: Johannes Thumshirn --- blkparse.c | 131 +++++++++++++++++++++++++++---------------------- blkparse_fmt.c | 16 +++--- blktrace.h | 23 ++++++++- 3 files changed, 103 insertions(+), 67 deletions(-) diff --git a/blkparse.c b/blkparse.c index 068c4b2..1237c02 100644 --- a/blkparse.c +++ b/blkparse.c @@ -243,7 +243,7 @@ static struct option l_opts[] =3D { * for sorting the displayed output */ struct trace { - struct blk_io_trace *bit; + struct blk_io_trace2 *bit; struct rb_node rb_node; struct trace *next; unsigned long read_sequence; @@ -257,7 +257,7 @@ static struct trace *trace_list; /* * allocation cache */ -static struct blk_io_trace *bit_alloc_list; +static struct blk_io_trace2 *bit_alloc_list; static struct trace *t_alloc_list; =20 /* @@ -332,7 +332,7 @@ static int have_drv_data =3D 0; #define CPU_IDX(cpu) ((cpu) / CPUS_PER_LONG) #define CPU_BIT(cpu) ((cpu) & (CPUS_PER_LONG - 1)) =20 -static void io_warn_unless(struct blk_io_trace *t, int condition, +static void io_warn_unless(struct blk_io_trace2 *t, int condition, const char *fmt, ...) { va_list ap; @@ -613,7 +613,7 @@ static struct process_pid_map *add_ppm_hash(pid_t pid, = const char *name) return ppm; } =20 -static void handle_notify(struct blk_io_trace *bit) +static void handle_notify(struct blk_io_trace2 *bit) { void *payload =3D (caddr_t) bit + sizeof(*bit); __u32 two32[2]; @@ -802,25 +802,25 @@ static inline struct trace *t_alloc(void) return malloc(sizeof(*t)); } =20 -static inline void bit_free(struct blk_io_trace *bit) +static inline void bit_free(struct blk_io_trace2 *bit) { if (bit_alloc_cache < 1024 && !bit->pdu_len) { /* * abuse a 64-bit field for a next pointer for the free item */ bit->time =3D (__u64) (unsigned long) bit_alloc_list; - bit_alloc_list =3D (struct blk_io_trace *) bit; + bit_alloc_list =3D (struct blk_io_trace2 *) bit; bit_alloc_cache++; } else free(bit); } =20 -static inline struct blk_io_trace *bit_alloc(void) +static inline struct blk_io_trace2 *bit_alloc(void) { - struct blk_io_trace *bit =3D bit_alloc_list; + struct blk_io_trace2 *bit =3D bit_alloc_list; =20 if (bit) { - bit_alloc_list =3D (struct blk_io_trace *) (unsigned long) \ + bit_alloc_list =3D (struct blk_io_trace2 *) (unsigned long) \ bit->time; bit_alloc_cache--; return bit; @@ -1041,7 +1041,7 @@ static struct io_track *find_track(struct per_dev_inf= o *pdi, pid_t pid, } =20 static void log_track_frontmerge(struct per_dev_info *pdi, - struct blk_io_trace *t) + struct blk_io_trace2 *t) { struct io_track *iot; =20 @@ -1062,7 +1062,7 @@ static void log_track_frontmerge(struct per_dev_info = *pdi, track_rb_insert(pdi, iot); } =20 -static void log_track_getrq(struct per_dev_info *pdi, struct blk_io_trace = *t) +static void log_track_getrq(struct per_dev_info *pdi, struct blk_io_trace2= *t) { struct io_track *iot; struct io_track_req *req; @@ -1081,7 +1081,7 @@ static void log_track_getrq(struct per_dev_info *pdi,= struct blk_io_trace *t) * for md/dm setups, the interesting cycle is Q -> C. So track queueing * time here, as dispatch time */ -static void log_track_queue(struct per_dev_info *pdi, struct blk_io_trace = *t) +static void log_track_queue(struct per_dev_info *pdi, struct blk_io_trace2= *t) { struct io_track *iot; struct io_track_req *req; @@ -1096,7 +1096,7 @@ static void log_track_queue(struct per_dev_info *pdi,= struct blk_io_trace *t) req->dispatch_time =3D t->time; } =20 -static void log_track_split(struct per_dev_info *pdi, struct blk_io_trace = *t) +static void log_track_split(struct per_dev_info *pdi, struct blk_io_trace2= *t) { struct io_track *iot, *split; =20 @@ -1118,7 +1118,7 @@ static void log_track_split(struct per_dev_info *pdi,= struct blk_io_trace *t) * return time between rq allocation and insertion */ static unsigned long long log_track_insert(struct per_dev_info *pdi, - struct blk_io_trace *t) + struct blk_io_trace2 *t) { unsigned long long elapsed; struct io_track *iot; @@ -1153,7 +1153,7 @@ static unsigned long long log_track_insert(struct per= _dev_info *pdi, * return time between queue and issue */ static unsigned long long log_track_issue(struct per_dev_info *pdi, - struct blk_io_trace *t) + struct blk_io_trace2 *t) { unsigned long long elapsed =3D -1ULL; struct io_track *iot; @@ -1191,7 +1191,7 @@ static unsigned long long log_track_issue(struct per_= dev_info *pdi, return elapsed; } =20 -static void fixup_complete(struct per_dev_info *pdi, struct blk_io_trace *= t) +static void fixup_complete(struct per_dev_info *pdi, struct blk_io_trace2 = *t) { struct io_track *iot; __u64 start_sector; @@ -1214,7 +1214,7 @@ static void fixup_complete(struct per_dev_info *pdi, = struct blk_io_trace *t) * return time between dispatch and complete */ static unsigned long long log_track_complete(struct per_dev_info *pdi, - struct blk_io_trace *t) + struct blk_io_trace2 *t) { unsigned long long elapsed =3D -1ULL; struct io_track *iot, *next; @@ -1288,7 +1288,7 @@ static char *get_dev_name(struct per_dev_info *pdi, c= har *buffer, int size) return buffer; } =20 -static void check_time(struct per_dev_info *pdi, struct blk_io_trace *bit) +static void check_time(struct per_dev_info *pdi, struct blk_io_trace2 *bit) { unsigned long long this =3D bit->time; unsigned long long last =3D pdi->last_reported_time; @@ -1297,7 +1297,7 @@ static void check_time(struct per_dev_info *pdi, stru= ct blk_io_trace *bit) pdi->last_reported_time =3D this; } =20 -static inline void __account_m(struct io_stats *ios, struct blk_io_trace *= t, +static inline void __account_m(struct io_stats *ios, struct blk_io_trace2 = *t, int rw) { if (rw) { @@ -1311,7 +1311,7 @@ static inline void __account_m(struct io_stats *ios, = struct blk_io_trace *t, } } =20 -static inline void account_m(struct blk_io_trace *t, struct per_cpu_info *= pci, +static inline void account_m(struct blk_io_trace2 *t, struct per_cpu_info = *pci, int rw) { __account_m(&pci->io_stats, t, rw); @@ -1324,7 +1324,7 @@ static inline void account_m(struct blk_io_trace *t, = struct per_cpu_info *pci, } =20 static inline void __account_pc_queue(struct io_stats *ios, - struct blk_io_trace *t, int rw) + struct blk_io_trace2 *t, int rw) { if (rw) { ios->qwrites_pc++; @@ -1337,7 +1337,7 @@ static inline void __account_pc_queue(struct io_stats= *ios, } } =20 -static inline void account_pc_queue(struct blk_io_trace *t, +static inline void account_pc_queue(struct blk_io_trace2 *t, struct per_cpu_info *pci, int rw) { __account_pc_queue(&pci->io_stats, t, rw); @@ -1363,7 +1363,7 @@ static inline void __account_pc_issue(struct io_stats= *ios, int rw, } } =20 -static inline void account_pc_issue(struct blk_io_trace *t, +static inline void account_pc_issue(struct blk_io_trace2 *t, struct per_cpu_info *pci, int rw) { __account_pc_issue(&pci->io_stats, rw, t->bytes); @@ -1376,7 +1376,7 @@ static inline void account_pc_issue(struct blk_io_tra= ce *t, } =20 static inline void __account_pc_requeue(struct io_stats *ios, - struct blk_io_trace *t, int rw) + struct blk_io_trace2 *t, int rw) { if (rw) { ios->wrqueue_pc++; @@ -1389,7 +1389,7 @@ static inline void __account_pc_requeue(struct io_sta= ts *ios, } } =20 -static inline void account_pc_requeue(struct blk_io_trace *t, +static inline void account_pc_requeue(struct blk_io_trace2 *t, struct per_cpu_info *pci, int rw) { __account_pc_requeue(&pci->io_stats, t, rw); @@ -1409,7 +1409,7 @@ static inline void __account_pc_c(struct io_stats *io= s, int rw) ios->creads_pc++; } =20 -static inline void account_pc_c(struct blk_io_trace *t, +static inline void account_pc_c(struct blk_io_trace2 *t, struct per_cpu_info *pci, int rw) { __account_pc_c(&pci->io_stats, rw); @@ -1421,7 +1421,7 @@ static inline void account_pc_c(struct blk_io_trace *= t, } } =20 -static inline void __account_queue(struct io_stats *ios, struct blk_io_tra= ce *t, +static inline void __account_queue(struct io_stats *ios, struct blk_io_tra= ce2 *t, int rw) { if (rw) { @@ -1435,7 +1435,7 @@ static inline void __account_queue(struct io_stats *i= os, struct blk_io_trace *t, } } =20 -static inline void account_queue(struct blk_io_trace *t, +static inline void account_queue(struct blk_io_trace2 *t, struct per_cpu_info *pci, int rw) { __account_queue(&pci->io_stats, t, rw); @@ -1460,7 +1460,7 @@ static inline void __account_c(struct io_stats *ios, = int rw, int bytes) } } =20 -static inline void account_c(struct blk_io_trace *t, struct per_cpu_info *= pci, +static inline void account_c(struct blk_io_trace2 *t, struct per_cpu_info = *pci, int rw, int bytes) { __account_c(&pci->io_stats, rw, bytes); @@ -1486,7 +1486,7 @@ static inline void __account_issue(struct io_stats *i= os, int rw, } } =20 -static inline void account_issue(struct blk_io_trace *t, +static inline void account_issue(struct blk_io_trace2 *t, struct per_cpu_info *pci, int rw) { __account_issue(&pci->io_stats, rw, t->bytes); @@ -1506,7 +1506,7 @@ static inline void __account_unplug(struct io_stats *= ios, int timer) ios->io_unplugs++; } =20 -static inline void account_unplug(struct blk_io_trace *t, +static inline void account_unplug(struct blk_io_trace2 *t, struct per_cpu_info *pci, int timer) { __account_unplug(&pci->io_stats, timer); @@ -1519,7 +1519,7 @@ static inline void account_unplug(struct blk_io_trace= *t, } =20 static inline void __account_requeue(struct io_stats *ios, - struct blk_io_trace *t, int rw) + struct blk_io_trace2 *t, int rw) { if (rw) { ios->wrqueue++; @@ -1532,7 +1532,7 @@ static inline void __account_requeue(struct io_stats = *ios, } } =20 -static inline void account_requeue(struct blk_io_trace *t, +static inline void account_requeue(struct blk_io_trace2 *t, struct per_cpu_info *pci, int rw) { __account_requeue(&pci->io_stats, t, rw); @@ -1545,31 +1545,31 @@ static inline void account_requeue(struct blk_io_tr= ace *t, } =20 static void log_complete(struct per_dev_info *pdi, struct per_cpu_info *pc= i, - struct blk_io_trace *t, char *act) + struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, log_track_complete(pdi, t), 0, NULL); } =20 static void log_insert(struct per_dev_info *pdi, struct per_cpu_info *pci, - struct blk_io_trace *t, char *act) + struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, log_track_insert(pdi, t), 0, NULL); } =20 -static void log_queue(struct per_cpu_info *pci, struct blk_io_trace *t, +static void log_queue(struct per_cpu_info *pci, struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, -1, 0, NULL); } =20 static void log_issue(struct per_dev_info *pdi, struct per_cpu_info *pci, - struct blk_io_trace *t, char *act) + struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, log_track_issue(pdi, t), 0, NULL); } =20 static void log_merge(struct per_dev_info *pdi, struct per_cpu_info *pci, - struct blk_io_trace *t, char *act) + struct blk_io_trace2 *t, char *act) { if (act[0] =3D=3D 'F') log_track_frontmerge(pdi, t); @@ -1577,38 +1577,38 @@ static void log_merge(struct per_dev_info *pdi, str= uct per_cpu_info *pci, process_fmt(act, pci, t, -1ULL, 0, NULL); } =20 -static void log_action(struct per_cpu_info *pci, struct blk_io_trace *t, +static void log_action(struct per_cpu_info *pci, struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, -1ULL, 0, NULL); } =20 -static void log_generic(struct per_cpu_info *pci, struct blk_io_trace *t, +static void log_generic(struct per_cpu_info *pci, struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, -1ULL, 0, NULL); } =20 -static void log_unplug(struct per_cpu_info *pci, struct blk_io_trace *t, +static void log_unplug(struct per_cpu_info *pci, struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, -1ULL, 0, NULL); } =20 -static void log_split(struct per_cpu_info *pci, struct blk_io_trace *t, +static void log_split(struct per_cpu_info *pci, struct blk_io_trace2 *t, char *act) { process_fmt(act, pci, t, -1ULL, 0, NULL); } =20 -static void log_pc(struct per_cpu_info *pci, struct blk_io_trace *t, char = *act) +static void log_pc(struct per_cpu_info *pci, struct blk_io_trace2 *t, char= *act) { unsigned char *buf =3D (unsigned char *) t + sizeof(*t); =20 process_fmt(act, pci, t, -1ULL, t->pdu_len, buf); } =20 -static void dump_trace_pc(struct blk_io_trace *t, struct per_dev_info *pdi, +static void dump_trace_pc(struct blk_io_trace2 *t, struct per_dev_info *pd= i, struct per_cpu_info *pci) { int w =3D (t->action & BLK_TC_ACT(BLK_TC_WRITE)) !=3D 0; @@ -1657,7 +1657,7 @@ static void dump_trace_pc(struct blk_io_trace *t, str= uct per_dev_info *pdi, } } =20 -static void dump_trace_fs(struct blk_io_trace *t, struct per_dev_info *pdi, +static void dump_trace_fs(struct blk_io_trace2 *t, struct per_dev_info *pd= i, struct per_cpu_info *pci) { int w =3D (t->action & BLK_TC_ACT(BLK_TC_WRITE)) !=3D 0; @@ -1737,12 +1737,12 @@ static void dump_trace_fs(struct blk_io_trace *t, s= truct per_dev_info *pdi, /* dump to binary file only */ break; default: - fprintf(stderr, "Bad fs action %x\n", t->action); + fprintf(stderr, "Bad fs action %llx\n", t->action); break; } } =20 -static void dump_trace(struct blk_io_trace *t, struct per_cpu_info *pci, +static void dump_trace(struct blk_io_trace2 *t, struct per_cpu_info *pci, struct per_dev_info *pdi) { if (text_output) { @@ -2162,7 +2162,7 @@ static void find_genesis(void) } } =20 -static inline int check_stopwatch(struct blk_io_trace *bit) +static inline int check_stopwatch(struct blk_io_trace2 *bit) { if (bit->time < stopwatch_end && bit->time >=3D stopwatch_start) @@ -2185,7 +2185,7 @@ static int sort_entries(unsigned long long *youngest) =20 *youngest =3D 0; while ((t =3D trace_list) !=3D NULL) { - struct blk_io_trace *bit =3D t->bit; + struct blk_io_trace2 *bit =3D t->bit; =20 trace_list =3D t->next; =20 @@ -2264,7 +2264,7 @@ static int check_cpu_map(struct per_dev_info *pdi) =20 static int check_sequence(struct per_dev_info *pdi, struct trace *t, int f= orce) { - struct blk_io_trace *bit =3D t->bit; + struct blk_io_trace2 *bit =3D t->bit; unsigned long expected_sequence; struct per_cpu_info *pci; struct trace *__t; @@ -2315,7 +2315,7 @@ static void show_entries_rb(int force) { struct per_dev_info *pdi =3D NULL; struct per_cpu_info *pci =3D NULL; - struct blk_io_trace *bit; + struct blk_io_trace2 *bit; struct rb_node *n; struct trace *t; =20 @@ -2428,12 +2428,22 @@ static inline __u32 get_magic(__u32 magic) return __bswap_32(magic); } =20 -static int read_one_bit(int fd, struct blk_io_trace *bit, int block, +static int read_one_bit(int fd, struct blk_io_trace2 **bit2, int block, int *fdblock) { + struct blk_io_trace2 *new =3D *bit2; + struct blk_io_trace *bit; int ret; int pdu_len; - void *p =3D (void *) ((u8 *)bit + sizeof(__u32)); + void *p; + + bit =3D malloc(sizeof(*bit)); + if (!bit) + return -1; + + bit->magic =3D new->magic; + + p =3D (void *) ((u8 *)bit + sizeof(__u32)); =20 ret =3D read_data(fd, p, sizeof(*bit) - sizeof(__u32), block, fdblock); if (ret) @@ -2449,9 +2459,14 @@ static int read_one_bit(int fd, struct blk_io_trace = *bit, int block, return ret; } bit =3D ptr; + + new =3D realloc(*bit2, sizeof(struct blk_io_trace2) + pdu_len); } =20 bit_trace_to_cpu(bit); + bit_to_bit2(bit, new); + free(bit); + *bit2 =3D new; =20 return 0; } @@ -2491,11 +2506,11 @@ static int read_events(int fd, int always_block, in= t *fdblock) } version =3D magic & 0xff; if (version =3D=3D SUPPORTED_VERSION) { - struct blk_io_trace *bit; + struct blk_io_trace2 *bit; bit =3D bit_alloc(); bit->magic =3D magic; =20 - ret =3D read_one_bit(fd, bit, 1, fdblock); + ret =3D read_one_bit(fd, &bit, 1, fdblock); if (ret) break; =20 @@ -2620,7 +2635,7 @@ static int ms_prime(struct ms_stream *msp) struct trace *t; struct per_dev_info *pdi =3D msp->pdi; struct per_cpu_info *pci =3D get_cpu_info(pdi, msp->cpu); - struct blk_io_trace *bit =3D NULL; + struct blk_io_trace2 *bit =3D NULL; int ret, ndone =3D 0; =20 for (i =3D 0; !is_done() && pci->fd >=3D 0 && i < rb_batch; i++) { @@ -2645,7 +2660,7 @@ static int ms_prime(struct ms_stream *msp) bit =3D bit_alloc(); bit->magic =3D magic; =20 - ret =3D read_one_bit(pci->fd, bit, 1, &pci->fdblock); + ret =3D read_one_bit(pci->fd, &bit, 1, &pci->fdblock); if (ret) goto err; =20 @@ -2767,7 +2782,7 @@ static int handle(struct ms_stream *msp) struct trace *t; struct per_dev_info *pdi; struct per_cpu_info *pci; - struct blk_io_trace *bit; + struct blk_io_trace2 *bit; =20 t =3D ms_peek(msp); =20 diff --git a/blkparse_fmt.c b/blkparse_fmt.c index 02c5a3c..f93addb 100644 --- a/blkparse_fmt.c +++ b/blkparse_fmt.c @@ -51,7 +51,7 @@ int add_format_spec(char *option) return 0; } =20 -static inline void fill_rwbs(char *rwbs, struct blk_io_trace *t) +static inline void fill_rwbs(char *rwbs, struct blk_io_trace2 *t) { bool w =3D !!(t->action & BLK_TC_ACT(BLK_TC_WRITE)); bool a =3D !!(t->action & BLK_TC_ACT(BLK_TC_AHEAD)); @@ -146,16 +146,16 @@ static char *dump_pdu(unsigned char *pdu_buf, int pdu= _len) return p; } =20 -#define pdu_start(t) (((void *) (t) + sizeof(struct blk_io_trace))) +#define pdu_start(t) (((void *) (t) + sizeof(struct blk_io_trace2))) =20 -static unsigned int get_pdu_int(struct blk_io_trace *t) +static unsigned int get_pdu_int(struct blk_io_trace2 *t) { __u64 *val =3D pdu_start(t); =20 return be64_to_cpu(*val); } =20 -static void get_pdu_remap(struct blk_io_trace *t, struct blk_io_trace_rema= p *r) +static void get_pdu_remap(struct blk_io_trace2 *t, struct blk_io_trace_rem= ap *r) { struct blk_io_trace_remap *__r =3D pdu_start(t); __u64 sector_from =3D __r->sector_from; @@ -166,7 +166,7 @@ static void get_pdu_remap(struct blk_io_trace *t, struc= t blk_io_trace_remap *r) } =20 static void print_field(char *act, struct per_cpu_info *pci, - struct blk_io_trace *t, unsigned long long elapsed, + struct blk_io_trace2 *t, unsigned long long elapsed, int pdu_len, unsigned char *pdu_buf, char field, int minus, int has_w, int width) { @@ -275,7 +275,7 @@ static void print_field(char *act, struct per_cpu_info = *pci, } =20 static char *parse_field(char *act, struct per_cpu_info *pci, - struct blk_io_trace *t, unsigned long long elapsed, + struct blk_io_trace2 *t, unsigned long long elapsed, int pdu_len, unsigned char *pdu_buf, char *primary_format) { @@ -302,7 +302,7 @@ static char *parse_field(char *act, struct per_cpu_info= *pci, } =20 static void process_default(char *act, struct per_cpu_info *pci, - struct blk_io_trace *t, unsigned long long elapsed, + struct blk_io_trace2 *t, unsigned long long elapsed, int pdu_len, unsigned char *pdu_buf) { struct blk_io_trace_remap r =3D { .device_from =3D 0, }; @@ -436,7 +436,7 @@ static void process_default(char *act, struct per_cpu_i= nfo *pci, =20 } =20 -void process_fmt(char *act, struct per_cpu_info *pci, struct blk_io_trace = *t, +void process_fmt(char *act, struct per_cpu_info *pci, struct blk_io_trace2= *t, unsigned long long elapsed, int pdu_len, unsigned char *pdu_buf) { diff --git a/blktrace.h b/blktrace.h index 08ac28b..196b3c9 100644 --- a/blktrace.h +++ b/blktrace.h @@ -6,6 +6,7 @@ #include #include #include +#include =20 #include "blktrace_api.h" #include "rbtree.h" @@ -108,6 +109,26 @@ static inline int verify_trace(__u32 magic) return 0; } =20 +static inline void bit_to_bit2(struct blk_io_trace *old, + struct blk_io_trace2 *new) +{ + new->magic =3D old->magic; + new->sequence =3D old->sequence; + new->time =3D old->time; + new->sector =3D old->sector; + new->bytes =3D old->bytes; + new->action =3D 0 | old->action; + new->pid =3D old->pid; + new->device =3D old->device; + new->cpu =3D old->cpu; + new->error =3D old->error; + new->pdu_len =3D old->pdu_len; + + if (new->pdu_len) + memcpy(((u8 *) new + sizeof(*new)), ((u8 *)old + sizeof(*old)), + old->pdu_len); +} + static inline void bit_trace_to_cpu(struct blk_io_trace *t) { if (data_is_native) @@ -147,7 +168,7 @@ static inline int check_data_endianness(u32 magic) =20 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= *, +extern void process_fmt(char *, struct per_cpu_info *, struct blk_io_trace= 2 *, unsigned long long, int, unsigned char *); extern unsigned long long valid_act_opt(unsigned long long); extern int find_mask_map(char *); --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A328E3218C9; Tue, 9 Sep 2025 11:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416127; cv=none; b=mA7i6f+QGjkvUbVHeaIpFrSXZOOUIlotzCKxxh5Yjrh59BAgQSVLWXI79BqfrZx3MNbXHjRf0IvoZRCXBJmkRovwrbjVfUD5BH6RE7/S8BPsk8m7cqqIU2gIbQaRltcDrslz9xf35rMnE1B80qcrrmi5YhqNGstWjfMypvRz71k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416127; c=relaxed/simple; bh=CTdpI0pBE7O8HMENjl+aLW7GQmWBJpgwd+dHiIIQBNk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LHog6zeZH8Dx7J5R1ZsRPLaaJXU1VFBK0P8aZtKLgqFDlxeJrHhHghX/mudSA24EotSKf9n2IR1lg/wZ/a63OTRLv8IHC5SfI2It+/Rwdc0cLh4MA2w5jyGd/Y/MsbvDMrMT9WK+DztnmGC7ifPi25PatY8FK1/2col31f4/alo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=HhK9Gl7k; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="HhK9Gl7k" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416126; x=1788952126; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CTdpI0pBE7O8HMENjl+aLW7GQmWBJpgwd+dHiIIQBNk=; b=HhK9Gl7ktaqGkN1IWjy/2/VqW9Hs2a519yb3I7IZKNgz+OaVwjXHgm2k fff8V/hKv9uX2eDRwCGqCzz7SOxDL0sfRq4qLXFlEqpOhOnafZCbcnzs0 9DxrjB4EVTeJh1BhRTzhI/9Ou1P8SSmb6oejylMg5hSamPfTXeB3JCBCY 9r4J183I9O+TbujnK7nZ57DlItYDxqvlUyPaxnaJ7NGv4yO4FG4n1K1vH qCmJ4m/yNHdze35onaq5+XFWmXlinQln5cf1a8USe3fbjWOVPbBsWfL8V 4LZys4POgNJQrdQhR/VGXCsliZdu/hTZfHk0gC7PHWw+mHL8VGM0BNvp7 Q==; X-CSE-ConnectionGUID: yYMxx8zNRG2BoeJsxekFJg== X-CSE-MsgGUID: BDdxm5B/Rzq5I4u/8RaghA== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810895" 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; 09 Sep 2025 19:08:45 +0800 IronPort-SDR: 68c00abd_+gwkQk6589caPtP8sBbRTYB8THgkZPYogV2Zk/mcDht7Qme AlAXIWsshXwqqSnvBiPY8zlLoz8U7esQ+uH/G9w== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:45 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:41 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 17/21] blkparse: natively parse blk_io_trace2 Date: Tue, 9 Sep 2025 13:07:19 +0200 Message-Id: <20250909110723.75676-18-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Natively parse 'struct blk_io_trace2' from a blktrace binary. Signed-off-by: Johannes Thumshirn --- blkparse.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ blktrace.h | 18 +++++++++ 2 files changed, 130 insertions(+) diff --git a/blkparse.c b/blkparse.c index 1237c02..e702356 100644 --- a/blkparse.c +++ b/blkparse.c @@ -2471,6 +2471,37 @@ static int read_one_bit(int fd, struct blk_io_trace2= **bit2, int block, return 0; } =20 +static int read_one_bit2(int fd, struct blk_io_trace2 **bit2, int block, + int *fdblock) +{ + struct blk_io_trace2 *new =3D *bit2; + int ret; + int pdu_len; + void *p; + + p =3D (void *) ((u8 *)new + sizeof(__u32)); + + ret =3D read_data(fd, p, sizeof(*new) - sizeof(__u32), block, fdblock); + if (ret) + return ret; + + pdu_len =3D get_pdulen(new->pdu_len); + if (pdu_len) { + void *ptr =3D realloc(new, sizeof(*new) + pdu_len); + + ret =3D read_data(fd, ptr + sizeof(*new), pdu_len, 1, fdblock); + if (ret) { + free(ptr); + return ret; + } + new =3D ptr; + } + + bit2_trace_to_cpu(new); + *bit2 =3D new; + + return 0; +} static int read_events(int fd, int always_block, int *fdblock) { struct per_dev_info *pdi =3D NULL; @@ -2538,6 +2569,44 @@ static int read_events(int fd, int always_block, int= *fdblock) t->next =3D trace_list; trace_list =3D t; =20 + if (!pdi || pdi->dev !=3D bit->device) + pdi =3D get_dev_info(bit->device); + + if (bit->time > pdi->last_read_time) + pdi->last_read_time =3D bit->time; + } else if (version =3D=3D SUPPORTED_VERSION2) { + struct blk_io_trace2 *bit; + bit =3D bit_alloc(); + bit->magic =3D magic; + + ret =3D read_one_bit2(fd, &bit, 1, fdblock); + if (ret) + break; + + /* + * not a real trace, so grab and handle it here + */ + if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && + (bit->action & ~__BLK_TN_CGROUP) !=3D BLK_TN_MESSAGE) { + handle_notify(bit); + output_binary(bit, sizeof(*bit) + bit->pdu_len); + continue; + } + + if (verify_trace(bit->magic)) { + bit_free(bit); + bit =3D NULL; + continue; + } + + t =3D t_alloc(); + memset(t, 0, sizeof(*t)); + t->bit =3D bit; + t->read_sequence =3D read_sequence; + + t->next =3D trace_list; + trace_list =3D t; + if (!pdi || pdi->dev !=3D bit->device) pdi =3D get_dev_info(bit->device); =20 @@ -2698,6 +2767,49 @@ static int ms_prime(struct ms_stream *msp) msp->last->next =3D t; msp->last =3D t; } + } else if (version =3D=3D SUPPORTED_VERSION2) { + bit =3D bit_alloc(); + bit->magic =3D magic; + + ret =3D read_one_bit2(pci->fd, &bit, 1, &pci->fdblock); + if (ret) + goto err; + + if (verify_trace(bit->magic)) + goto err; + + if (bit->cpu !=3D pci->cpu) { + fprintf(stderr, + "cpu %d trace info has error cpu %d\n", + pci->cpu, bit->cpu); + continue; + } + + if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && + (bit->action & ~__BLK_TN_CGROUP) !=3D BLK_TN_MESSAGE) { + handle_notify(bit); + output_binary(bit, sizeof(*bit) + bit->pdu_len); + bit_free(bit); + bit =3D NULL; + + i -=3D 1; + continue; + } + + if (bit->time > pdi->last_read_time) + pdi->last_read_time =3D bit->time; + + t =3D t_alloc(); + memset(t, 0, sizeof(*t)); + t->bit =3D bit; + + if (msp->first =3D=3D NULL) + msp->first =3D msp->last =3D t; + else { + msp->last->next =3D t; + msp->last =3D t; + } + } else { fprintf(stderr, "unsupported version %d\n", version); continue; diff --git a/blktrace.h b/blktrace.h index 196b3c9..ba06237 100644 --- a/blktrace.h +++ b/blktrace.h @@ -129,6 +129,24 @@ static inline void bit_to_bit2(struct blk_io_trace *ol= d, old->pdu_len); } =20 +static inline void bit2_trace_to_cpu(struct blk_io_trace2 *t) +{ + if (data_is_native) + return; + + t->magic =3D be32_to_cpu(t->magic); + t->sequence =3D be32_to_cpu(t->sequence); + t->time =3D be64_to_cpu(t->time); + t->sector =3D be64_to_cpu(t->sector); + t->bytes =3D be32_to_cpu(t->bytes); + t->action =3D be64_to_cpu(t->action); + t->pid =3D be32_to_cpu(t->pid); + t->device =3D be32_to_cpu(t->device); + t->cpu =3D be32_to_cpu(t->cpu); + t->error =3D be16_to_cpu(t->error); + t->pdu_len =3D be16_to_cpu(t->pdu_len); +} + static inline void bit_trace_to_cpu(struct blk_io_trace *t) { if (data_is_native) --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8E8B33CEB5; Tue, 9 Sep 2025 11:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416131; cv=none; b=bA/H0F5MGjs3XV677L3TMqvIsFuifM2PGoi11WAx0D5RM5KvV5m0S+EctDa5VZrTXdK7KxxXPoAJmQP5E2JmVQcba24Fx+XQwGXWkWNwXHMIZOx1q2Fdr4db1eF21bsDLdm0ficXA8oNRMzO0/x8eegEsS7TBjHe2VHv/T8Nai8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416131; c=relaxed/simple; bh=Ta3Q1aiMxCrK6xGgJ9dr0qYg2RbzxnCFYqcNkItW+fU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bJ6LmKBNZjra+lWVBPlo1Rsk4hljUvOzWLtzJHDL3YXSLL7fywoGQfMwOx5N2uHaBscnZ0TD0z+NSM4IDRwXSPJt1ccA4ZpZCKw+kgllADD0JkTGwTzogftPymvut1ZzRC2FDZe3iVJt0zq9vuqmD24yvO28JM3dy8UXNERS4Rg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=JEJ24fzL; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="JEJ24fzL" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416130; x=1788952130; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ta3Q1aiMxCrK6xGgJ9dr0qYg2RbzxnCFYqcNkItW+fU=; b=JEJ24fzLb5VpGIGvPoqQ66JzeF6cLQA+bxmjA5qCWouHPgHnoXPpuk69 a8Kn14r4AjG/yQzY4nzgrGYfcTjDpBAAfy6pFAQouYqQu5htjbhr9TuhY je1LIJJ1qKBBil1dffzIPbzTBErtZ5rU28JjiltLz1HXufgTJIMpL8QQa Hn5uWoGaLPVv3aGSogo2aH20o0wZke/Ztyg5uyAhLSD3TKp02+jc9hhj9 rBsr8aodSWhKm9xlYv2cv4D3qJ5SrSLioIs7i2hxbdtk9ildckb5iT0lF eZpBQ2qfNVz3KWbJI88IpOFH8Es0NsoMX33+hXoYgm7U3YhUdxA5i+GkK g==; X-CSE-ConnectionGUID: SMskXhaPSCepwI5CdYl/vg== X-CSE-MsgGUID: /IjuY4d0RQykAIRIyNeiLw== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810937" 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; 09 Sep 2025 19:08:50 +0800 IronPort-SDR: 68c00ac1_9ldOyKYbMZ0Zu+nBemBISLCBh1BpQBFe4AWeU1GTVptwb3g YmfUScBaSpNcgbusa0BB4rdMakO8iNJDvLBi+Ew== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:50 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:45 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 18/21] blkparse: parse zone (un)plug actions Date: Tue, 9 Sep 2025 13:07:20 +0200 Message-Id: <20250909110723.75676-19-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Parse Zone Write Plugging plug and unplug actions in blkparse. Signed-off-by: Johannes Thumshirn --- blkparse.c | 7 +++++++ blkparse_fmt.c | 19 +++++++++++++++++++ blktrace_api.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/blkparse.c b/blkparse.c index e702356..1a372e5 100644 --- a/blkparse.c +++ b/blkparse.c @@ -1722,6 +1722,13 @@ static void dump_trace_fs(struct blk_io_trace2 *t, s= truct per_dev_info *pdi, account_unplug(t, pci, 1); log_unplug(pci, t, "UT"); break; + case __BLK_TA_ZONE_PLUG: + log_action(pci, t, "ZP"); + break; + case __BLK_TA_ZONE_UNPLUG: + account_unplug(t, pci, 0); + log_unplug(pci, t, "ZU"); + break; case __BLK_TA_SPLIT: log_track_split(pdi, t); log_split(pci, t, "X"); diff --git a/blkparse_fmt.c b/blkparse_fmt.c index f93addb..a5f721f 100644 --- a/blkparse_fmt.c +++ b/blkparse_fmt.c @@ -301,6 +301,22 @@ static char *parse_field(char *act, struct per_cpu_inf= o *pci, return p; } =20 +static void process_zoned(char *act, struct blk_io_trace2 *t, + unsigned long long elapsed, char *name) +{ + switch (act[1]) { + case 'P': /* Zone Plug */ + fprintf(ofp, "[%s]\n", name); + break; + case 'U': /* Zone Unplug */ + fprintf(ofp, "[%s] %u\n", name, get_pdu_int(t)); + break; + default: + fprintf(stderr, "Unknown zoned action %c\n", act[1]); + break; + } +} + static void process_default(char *act, struct per_cpu_info *pci, struct blk_io_trace2 *t, unsigned long long elapsed, int pdu_len, unsigned char *pdu_buf) @@ -429,6 +445,9 @@ static void process_default(char *act, struct per_cpu_i= nfo *pci, fprintf(ofp, "%*s\n", pdu_len, pdu_buf); break; =20 + case 'Z': /* Zoned command */ + process_zoned(act, t, elapsed, name); + break; default: fprintf(stderr, "Unknown action %c\n", act[0]); break; diff --git a/blktrace_api.h b/blktrace_api.h index bbf075f..3966e1a 100644 --- a/blktrace_api.h +++ b/blktrace_api.h @@ -62,6 +62,8 @@ enum { __BLK_TA_REMAP, /* bio was remapped */ __BLK_TA_ABORT, /* request aborted */ __BLK_TA_DRV_DATA, /* binary driver data */ + __BLK_TA_ZONE_PLUG, /* zone write plug was plugged */ + __BLK_TA_ZONE_UNPLUG, /* zone write plug was unplugged */ __BLK_TA_ZONE_MGMT, /* zone management command was issued */ __BLK_TA_CGROUP =3D 1 << 8, }; --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69CD933EB14; Tue, 9 Sep 2025 11:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416136; cv=none; b=HTQtlySq9pU7oM7qqKy3Crng/LmL5Gsb9tgskyoOWKJh74WiX+FZRnr0+zO2aMAA9MrPry0Q1SUK4o3ii3FR4o3WlVrItEk/dl/F8IJ04xHi9OPTY0Lg36x1dKWziTi2fwht303YwaYkOFgar8XrZqvEtt9SUjI9XLFlmU1H2Mg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416136; c=relaxed/simple; bh=bEHjRAgcAgUgIx12l2d9svhT+oC6b0Yi9goSkoKt2nA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gZegGebHkmlb/vZh9qB0FZaaEpJJyhzrflELgQ3B7SJLSL/s8m9g/BEak/Y+jrH5M5l7bJi4mSnAhZgKfjSJzxalHpt0wU9+xtB4svTuZ+Nth50UJtAkQ5Jn1UWmK7XW43oVlJuZestR4H6vt4Dvg094NtefRhZqBfnznfIar8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=rmlr3rzc; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="rmlr3rzc" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416134; x=1788952134; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bEHjRAgcAgUgIx12l2d9svhT+oC6b0Yi9goSkoKt2nA=; b=rmlr3rzcdMh0qoJ5Xky9lyUN+1N69ibqAuvfI8Qs/2QnBaoz8ELvif2l GKj/yKn09WJb+gbEU89y2Lg7HzPuJ7f91xcmLHxtz87dqoHCC9Au1t3RD uKBV/Bk/oae4Or7BvPUyoboPUnd2FsQlS351i+4eekPnNJbyziQ83tw2r PAWRYTaY4Lw0WQ5AhJfm4jFE+Qi2p81ZbvuQONz1Tez2ISD0nSxAM3OZ2 uUEk8woJI84WgZG593Nqc6jWOeGM6VAyUTlxY/ZDicNrEW2W9krhii/hb fxGLpjf1q3aka03VJPR0S5mLPODXpTyvHTw4YhSRBGADBSLSBbyL6FDq1 w==; X-CSE-ConnectionGUID: R5/D1noLS3elwHws2MKzlA== X-CSE-MsgGUID: caroMDrfRJmB42g/u0DjyA== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810944" 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; 09 Sep 2025 19:08:54 +0800 IronPort-SDR: 68c00ac6_6E6pRBzbFCQmgiAP+vamferFmsdGlDP2/6QcHmCzCIk+Xe2 w1GZPpb4eeopoC16y7Z4W8W6q9C9Koh8On2n9/g== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:54 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:50 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 19/21] blkparse: add zoned commands to fill_rwbs() Date: Tue, 9 Sep 2025 13:07:21 +0200 Message-Id: <20250909110723.75676-20-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Parse zoned commands in blkparse. Signed-off-by: Johannes Thumshirn --- blkparse_fmt.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/blkparse_fmt.c b/blkparse_fmt.c index a5f721f..467c8c5 100644 --- a/blkparse_fmt.c +++ b/blkparse_fmt.c @@ -60,19 +60,45 @@ static inline void fill_rwbs(char *rwbs, struct blk_io_= trace2 *t) bool d =3D !!(t->action & BLK_TC_ACT(BLK_TC_DISCARD)); bool f =3D !!(t->action & BLK_TC_ACT(BLK_TC_FLUSH)); bool u =3D !!(t->action & BLK_TC_ACT(BLK_TC_FUA)); + bool za =3D !!(t->action & BLK_TC_ACT2(BLK_TC_ZONE_APPEND)); + bool zr =3D !!(t->action & BLK_TC_ACT2(BLK_TC_ZONE_RESET)); + bool zra =3D !!(t->action & BLK_TC_ACT2(BLK_TC_ZONE_RESET_ALL)); + bool zf =3D !!(t->action & BLK_TC_ACT2(BLK_TC_ZONE_FINISH)); + bool zo =3D !!(t->action & BLK_TC_ACT2(BLK_TC_ZONE_OPEN)); + bool zc =3D !!(t->action & BLK_TC_ACT2(BLK_TC_ZONE_CLOSE)); int i =3D 0; =20 if (f) rwbs[i++] =3D 'F'; /* flush */ =20 - if (d) + if (d) { rwbs[i++] =3D 'D'; - else if (w) + } else if (za) { + rwbs[i++] =3D 'Z'; + rwbs[i++] =3D 'A'; + } else if (zr) { + rwbs[i++] =3D 'Z'; + rwbs[i++] =3D 'R'; + } else if (zra) { + rwbs[i++] =3D 'Z'; + rwbs[i++] =3D 'R'; + rwbs[i++] =3D 'A'; + } else if (zf) { + rwbs[i++] =3D 'Z'; + rwbs[i++] =3D 'F'; + } else if (zo) { + rwbs[i++] =3D 'Z'; + rwbs[i++] =3D 'O'; + } else if (zc) { + rwbs[i++] =3D 'Z'; + rwbs[i++] =3D 'C'; + } else if (w) { rwbs[i++] =3D 'W'; - else if (t->bytes) + } else if (t->bytes) { rwbs[i++] =3D 'R'; - else + } else { rwbs[i++] =3D 'N'; + } =20 if (u) rwbs[i++] =3D 'F'; /* fua */ --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00E17340D9A; Tue, 9 Sep 2025 11:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416140; cv=none; b=aosFBaO+BcPL+I+H4bFHNsuphaKx0I+cTig8876GhBj29fhyWWHoeSyMduauo3pkTUw+UVS8u7VIMJSjyTFZ2F/Q/ENnzZxMq7H3+B08pcKw6NygVR02gdx+1EhvADs+4uQzFVAaPuHacYpax7wum6bYZMtEfaQ+MEWxnIxUIWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416140; c=relaxed/simple; bh=sjy38NosnkftCFgQpo0IL2SdDw0IwlgiBVJt2eW9nh0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nX5n6P7lwUtVQjS0XTr9zp2q7Hs5qgswWhWLr70VF7+ZSfTaK+3gEjlcS2Il055vhgJgJUlOYiQuCAk9H826CML//hTRywKjVNmLxOMBjsfSe0JHmQ159KE9VvFXrYQiQBLZ4OTiQQwiYfX7+me2PH13LGxgMH4b8KwY+bYfKdo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=JzdqHa/l; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="JzdqHa/l" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416139; x=1788952139; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sjy38NosnkftCFgQpo0IL2SdDw0IwlgiBVJt2eW9nh0=; b=JzdqHa/l4bRRELodtVi7GNNmPnapRz20kLzorRyN3WB/PDR1szXYXLVe qX+qoPvG4c8lxNZUiWGmsZB6SHrJky7pzdsWAI0WDzeGkoFcFTxL7DAvE sD4sWk6aw+X2eUww6b0jDtzteafwAHTNSmWYCRp06FrjIUw2GP1iyHOed ctxBvZaQG5SXP6qa+CK5jDdHQ94muAB40uvpnkdozm8E65V8YExNBgHgD o0Mrtm87JoJMOtVW73HExkwLGtSUGycz3dScb3cdaU5ehJHIh6xx9sgwU aVRAkfsEw+o4jnFokWziRKhZpYrpWfMDBgium4w4vCzJBshkZYQx+SXOf w==; X-CSE-ConnectionGUID: AJN5zDhbT8uymMklZ/lssw== X-CSE-MsgGUID: +q5IZHMnTlWfrnosM3LO1w== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810950" 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; 09 Sep 2025 19:08:59 +0800 IronPort-SDR: 68c00aca_MHIqvl1aNDPXfPdRMjTwkMjkpCrB3qPC6t00OIkEV2jry/n kzK1hrDzGxgafn8h09rn/zLwoaFe2LreCxDlTaA== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:08:59 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:54 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 20/21] blkparse: parse zone management commands Date: Tue, 9 Sep 2025 13:07:22 +0200 Message-Id: <20250909110723.75676-21-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Parse management commands in blkparse. Signed-off-by: Johannes Thumshirn --- blkparse.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blkparse.c b/blkparse.c index 1a372e5..1e3718b 100644 --- a/blkparse.c +++ b/blkparse.c @@ -1651,6 +1651,9 @@ static void dump_trace_pc(struct blk_io_trace2 *t, st= ruct per_dev_info *pdi, case __BLK_TA_INSERT: log_pc(pci, t, "I"); break; + case __BLK_TA_ZONE_MGMT: + log_action(pci, t, "ZM"); + break; default: fprintf(stderr, "Bad pc action %x\n", act); break; @@ -1729,6 +1732,9 @@ static void dump_trace_fs(struct blk_io_trace2 *t, st= ruct per_dev_info *pdi, account_unplug(t, pci, 0); log_unplug(pci, t, "ZU"); break; + case __BLK_TA_ZONE_MGMT: + log_action(pci, t, "ZM"); + break; case __BLK_TA_SPLIT: log_track_split(pdi, t); log_split(pci, t, "X"); --=20 2.51.0 From nobody Thu Oct 2 23:53:20 2025 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75C7D340DAC; Tue, 9 Sep 2025 11:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416145; cv=none; b=PzWmZ/nyF7mr5eoqpA/T6adCli3V7AGOvDyv3PhXoPdDrWzJCCQ2fzVhaQboM7kyQLs/OzBJqFJhTv4a3muxaGjX+blX4GKaNMoW4ZVu5wA7ntaVez0zEOCSO1jKoApSFxjsfMvfXTdAyisQQHwvd6IdT7pnjpkrdvq68OVHwv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757416145; c=relaxed/simple; bh=clLA9tWFF0dM3xcPiJ8JYCP9d84ZpF4epwkmDjKG8sY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bgPLhlnUnRDHnUg7d4Z8a+BZG2ShgHZPBfpDkACUlEGkH3BlP4Ng66SAyc+T4wkct9vORbBxBAt6E67C4Hf3sVO5z1S0uvcj3c3vWo5/SPor13PfWTmCaDiEMsan3menRWxBpBBSsxK3lGENDwPF14SesaKs41dBM2TfyyM3EjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=aFpFFcRF; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="aFpFFcRF" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1757416143; x=1788952143; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=clLA9tWFF0dM3xcPiJ8JYCP9d84ZpF4epwkmDjKG8sY=; b=aFpFFcRFgVxrw0pgfcnoZS2uUDHd6OxLN1KE2dS+vlHS7IrGw+twxHyD MgwLkgHbnXZIo1JpVDRXePB7HSCQMlUnQOO3bKcVTKiBQAKVkaP4uq3gP vA6OQoAezXwh+5yQapgLd81suY03krx7tGMLCKuleWSLXgZO0L6FJg/mq PCa2JTMQZ+2utldsp0BW2qjb+ZdsD8INV24H6salLFwktbIIp8iRQZFiv evRvCuAK5TqFdaFDLM3Q6FCKZrqZGEIaqCvlmHSZJ3P6Kxfc7GMhciKhD 45tQJqgCy+FjnhX1jLqwXfrSkgHhoanGBUtFWWqKGVAwCmCaSwbpX6qvN g==; X-CSE-ConnectionGUID: Ew2F+RyERl6IFxny4yDc8g== X-CSE-MsgGUID: VLLsjRN1S7aB6f6+LHGXdA== X-IronPort-AV: E=Sophos;i="6.18,251,1751212800"; d="scan'208";a="112810963" 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; 09 Sep 2025 19:09:03 +0800 IronPort-SDR: 68c00acf_adlbHp1nnPv5ulJrlzstDkc3/w4XNGVvvEGzbkfRfyHILtn vLvcB0Me8Cdf/lazIPKZkzZuUfIxq6miMNYtOdA== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Sep 2025 04:09:03 -0700 WDCIronportException: Internal Received: from c02g55f6ml85.ad.shared (HELO C02G55F6ML85.wdc.com) ([10.224.183.46]) by uls-op-cesaip01.wdc.com with ESMTP; 09 Sep 2025 04:08:59 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org, John Garry , Hannes Reinecke , Damien Le Moal , Christoph Hellwig , Naohiro Aota , Shinichiro Kawasaki , Chaitanya Kulkarni , "Martin K . Petersen" , Johannes Thumshirn Subject: [PATCH 21/21] blkparse: parse zone append completions Date: Tue, 9 Sep 2025 13:07:23 +0200 Message-Id: <20250909110723.75676-22-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250909110723.75676-1-johannes.thumshirn@wdc.com> References: <20250909110723.75676-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Parse completion of Zone Append commands in blkparse. Signed-off-by: Johannes Thumshirn --- blkparse_fmt.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/blkparse_fmt.c b/blkparse_fmt.c index 467c8c5..725ddbe 100644 --- a/blkparse_fmt.c +++ b/blkparse_fmt.c @@ -331,6 +331,27 @@ static void process_zoned(char *act, struct blk_io_tra= ce2 *t, unsigned long long elapsed, char *name) { switch (act[1]) { + case 'A': /* Zone Append */ + if (elapsed !=3D -1ULL) { + if (t_sec(t)) + fprintf(ofp, "%llu + %u (%8llu) [%d]\n", + (unsigned long long) t->sector, + t_sec(t), elapsed, t->error); + else + fprintf(ofp, "%llu (%8llu) [%d]\n", + (unsigned long long) t->sector, + elapsed, t->error); + } else { + if (t_sec(t)) + fprintf(ofp, "%llu + %u [%d]\n", + (unsigned long long) t->sector, + t_sec(t), t->error); + else + fprintf(ofp, "%llu [%d]\n", + (unsigned long long) t->sector, + t->error); + } + break; case 'P': /* Zone Plug */ fprintf(ofp, "[%s]\n", name); break; --=20 2.51.0