Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp644199lqs; Fri, 14 Jun 2024 00:50:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbAnHsykh2BuExhLIGfCKF48y2/xzfQr4I+wlbtfm+QpPsvrFF9g/zKCg11c5iCv5dOJVL65jhpK8wnqpeTVjiQWQyXHlgTKQChmm5+A== X-Google-Smtp-Source: AGHT+IHUHgEyXH2LTkUKnIaUSjfdk6gdeDZdeDBVxM+0PMOyVn5K+SgTdXWqEn+rAjZBLOk7WDky X-Received: by 2002:a05:620a:40d5:b0:795:5aab:7fe8 with SMTP id af79cd13be357-798d23f7704mr225253085a.15.1718351455260; Fri, 14 Jun 2024 00:50:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718351455; cv=pass; d=google.com; s=arc-20160816; b=uVEOMCxS0IDE/xKn7kn2wBx2UBYa6vbaTxLAYsZrVNO8TNobuLjacDd8y1uFIHSNjz U90SW826F7N++mQDNCoH+Znr7qYZv1cQQYKpVqr0XwVM0lx3irgkvuD2dvttt7TtEkA0 rWI0ktitdUGf5SV4AZLWmRbFh/wFs7CV30/yEYGOS1gFkaib29Pa7c8APt47ks0xMHuk kW5fVTYT7D8OUbALTTY85LqwJV0Xb4fGXRnnEbS0dOlSWQUSIcM35dxFzhtOAI2LniAS CYEFsRfFoEgAAmj5asNaOFPoXO+B6k3vNuM6u/oxvFVXIEDS2zLRm3kg65/Eyclpen4r IFQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=c+LzkA3DnddFYA90okhzJURV2JFxhnSjssu++lJ6/jc=; fh=jfN0iayymdWknu78aswpvPYsxtsw43OkqqoH94MbHDg=; b=mVoEvmHXCnypXh6UNJzCS6MRwckIRv/sreJQqefWPoFSXQRRDKdQNwkYbPb07Ps1NH 4u9LtDGHWTk6ovogCQ7b4enE5krLu+BgadDU0dUe/bzxZHoCiYmreCEiCIik24tDM41r f/yTsTXOr1EyjP2Tjwkn3ylp4WA9LTk2C6zfQGoYruQDeFmNbxglg+UgW6LsC3hkcd4i 3Pp15Xvy4fpVv9BZsD55ydqoEb2k86HfYTptF4SpdkgLZbKGG0lg1EasOHVeexmfGDZk y1TnlawAU8iWktVBTfiGd2EE9sz3u69WKiRQKTkIO4ukVRSBQRL+oMzlUusRM2zuRE+9 mccQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-214479-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214479-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-798aadc29cbsi313270585a.187.2024.06.14.00.50.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 00:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214479-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-214479-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214479-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 01A561C21790 for ; Fri, 14 Jun 2024 07:50:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EAE214B945; Fri, 14 Jun 2024 07:50:49 +0000 (UTC) Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) (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 AD8FA14659D for ; Fri, 14 Jun 2024 07:50:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718351448; cv=none; b=OMfV7zYd73MQFope6joAgdFMvwloOzk2qcOPG5LX+VNwoNd47hs1R2zfOINb/E9edAhZ0nkhL+Y0Hr4//siRyVCcPuR5YpdRDW3d84X67y/yjQDuEy+y/asHIoxJfQcF03gPY70VOwPkn4RDo2pDAympagqJYYNoOfHH/SVN88g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718351448; c=relaxed/simple; bh=Ia62ZQlXIBEvcF6Cn2AYPvblXrtFyt9cKO4gD7R9fhU=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=K+RKdRkMOcUC+ddyTxkbl5skEb8oz+xRlvlWOv5emZim5gQtDRt8x6QSw4KcmglCfWBGeKU3QwI3+ZP0WrZaKJuwfOklzd9pl+Uwy7G7eNtTi3Tmydla0WPpMHAJMsJY3iNARm+Qail0b7w3kRJ7+IFRtrgccSj29lqNky4J+IY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 45E7nkcg067511; Fri, 14 Jun 2024 15:49:46 +0800 (+08) (envelope-from Dongliang.Cui@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx02.spreadtrum.com [10.0.64.8]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4W0rsz65KPz2S7Bgg; Fri, 14 Jun 2024 15:45:27 +0800 (CST) Received: from tj10379pcu.spreadtrum.com (10.5.32.15) by BJMBX02.spreadtrum.com (10.0.64.8) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 14 Jun 2024 15:49:43 +0800 From: Dongliang Cui To: , , , , , CC: , , , , , , , , Dongliang Cui Subject: [PATCH v5] block: Add ioprio to block_rq tracepoint Date: Fri, 14 Jun 2024 15:49:36 +0800 Message-ID: <20240614074936.113659-1-dongliang.cui@unisoc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL:SHSQR01.spreadtrum.com 45E7nkcg067511 Sometimes we need to track the processing order of requests with ioprio set. So the ioprio of request can be useful information. Example: block_rq_insert: 8,0 RA 16384 () 6500840 + 32 be,0,6 [binder:815_3] block_rq_issue: 8,0 RA 16384 () 6500840 + 32 be,0,6 [binder:815_3] block_rq_complete: 8,0 RA () 6500840 + 32 be,0,6 [0] Signed-off-by: Dongliang Cui --- Changes in v5: - Remove redundant changes. --- --- include/trace/events/block.h | 41 ++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 0e128ad51460..1527d5d45e01 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -9,9 +9,17 @@ #include #include #include +#include #define RWBS_LEN 8 +#define IOPRIO_CLASS_STRINGS \ + { IOPRIO_CLASS_NONE, "none" }, \ + { IOPRIO_CLASS_RT, "rt" }, \ + { IOPRIO_CLASS_BE, "be" }, \ + { IOPRIO_CLASS_IDLE, "idle" }, \ + { IOPRIO_CLASS_INVALID, "invalid"} + #ifdef CONFIG_BUFFER_HEAD DECLARE_EVENT_CLASS(block_buffer, @@ -82,6 +90,7 @@ TRACE_EVENT(block_rq_requeue, __field( dev_t, dev ) __field( sector_t, sector ) __field( unsigned int, nr_sector ) + __field( unsigned short, ioprio ) __array( char, rwbs, RWBS_LEN ) __dynamic_array( char, cmd, 1 ) ), @@ -90,16 +99,20 @@ TRACE_EVENT(block_rq_requeue, __entry->dev = rq->q->disk ? disk_devt(rq->q->disk) : 0; __entry->sector = blk_rq_trace_sector(rq); __entry->nr_sector = blk_rq_trace_nr_sectors(rq); + __entry->ioprio = rq->ioprio; blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); __get_str(cmd)[0] = '\0'; ), - TP_printk("%d,%d %s (%s) %llu + %u [%d]", + TP_printk("%d,%d %s (%s) %llu + %u %s,%u,%u [%d]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, __get_str(cmd), - (unsigned long long)__entry->sector, - __entry->nr_sector, 0) + (unsigned long long)__entry->sector, __entry->nr_sector, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio), 0) ); DECLARE_EVENT_CLASS(block_rq_completion, @@ -113,6 +126,7 @@ DECLARE_EVENT_CLASS(block_rq_completion, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( int , error ) + __field( unsigned short, ioprio ) __array( char, rwbs, RWBS_LEN ) __dynamic_array( char, cmd, 1 ) ), @@ -122,16 +136,20 @@ DECLARE_EVENT_CLASS(block_rq_completion, __entry->sector = blk_rq_pos(rq); __entry->nr_sector = nr_bytes >> 9; __entry->error = blk_status_to_errno(error); + __entry->ioprio = rq->ioprio; blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); __get_str(cmd)[0] = '\0'; ), - TP_printk("%d,%d %s (%s) %llu + %u [%d]", + TP_printk("%d,%d %s (%s) %llu + %u %s,%u,%u [%d]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, __get_str(cmd), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->error) + (unsigned long long)__entry->sector, __entry->nr_sector, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio), __entry->error) ); /** @@ -180,6 +198,7 @@ DECLARE_EVENT_CLASS(block_rq, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( unsigned int, bytes ) + __field( unsigned short, ioprio ) __array( char, rwbs, RWBS_LEN ) __array( char, comm, TASK_COMM_LEN ) __dynamic_array( char, cmd, 1 ) @@ -190,17 +209,21 @@ DECLARE_EVENT_CLASS(block_rq, __entry->sector = blk_rq_trace_sector(rq); __entry->nr_sector = blk_rq_trace_nr_sectors(rq); __entry->bytes = blk_rq_bytes(rq); + __entry->ioprio = rq->ioprio; blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); __get_str(cmd)[0] = '\0'; memcpy(__entry->comm, current->comm, TASK_COMM_LEN); ), - TP_printk("%d,%d %s %u (%s) %llu + %u [%s]", + TP_printk("%d,%d %s %u (%s) %llu + %u %s,%u,%u [%s]", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, __entry->bytes, __get_str(cmd), - (unsigned long long)__entry->sector, - __entry->nr_sector, __entry->comm) + (unsigned long long)__entry->sector, __entry->nr_sector, + __print_symbolic(IOPRIO_PRIO_CLASS(__entry->ioprio), + IOPRIO_CLASS_STRINGS), + IOPRIO_PRIO_HINT(__entry->ioprio), + IOPRIO_PRIO_LEVEL(__entry->ioprio), __entry->comm) ); /** -- 2.25.1