Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2536976rwl; Thu, 13 Apr 2023 07:45:01 -0700 (PDT) X-Google-Smtp-Source: AKy350auLePo4HkIplIuZ0G+DP/v1H1LxggIEYVZQj3gh6HgfIGq7kJMPo+5sfeUS3joh3CS7uLE X-Received: by 2002:a17:903:1c5:b0:19e:bc01:610e with SMTP id e5-20020a17090301c500b0019ebc01610emr3333610plh.33.1681397101062; Thu, 13 Apr 2023 07:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681397101; cv=none; d=google.com; s=arc-20160816; b=m98vlm0od+bzrSFkbSuEcjRAIakNb9IiZDL142QD+pdXV7DrtOeyK/p09x/KVoUdX7 RdPvkEI2zUfbpgBrfxTCngcNLwhkEfp5LVEaWYhX8sWnTKonoCmOeO3hpP3m6I81iSLD OxRt1MnsRuQ8iWTTmLBv/nJPx+I03oFcBiJi9JNAAY7xo3S/5oD+rKatkoE89/r07aoN uH7Hp9k8/zIG6BaI3WpM67jkMI2ZHauo2wKiFAaYTgcsFqq9j7U84JrB/5YiRzKEVkL/ bNugijKJXe6uFRE3LLhmoJgV+gGQ5+bkeYiN1TGlFYI9t0T32t1eANDosIesnUDdOYKd FMWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SgO9r6ZIT4cxFKm5pI2zOrrRBYitMm4hGkLybLuMc0Y=; b=mxQuQ84mNNHn0WZs5/MkB6Ne5EACsgr3tfQHvFLO4hVbdfLFzvlQ0HtBWECPuIpxsv k5poM/7uuxViFzlcXlGtk/b3esLswTta036fXGBIKunOsUsvRZ5kYCgUM3e/vZSIZn9N 3ZKdQf7taDwoijIff0SvMt6ItvUqgFxakVxNPlF1X/TzLeXlTj7waBr7HzZTj2vH/Gjv 3OkPHObIPmF4MQcKf0nqH1N5mv5Xbc4hl9CTOgrQQUlzhtMCPtno7mmVovhG6pqXEJEh PNk1JsiGGC/p1gfwj4DegZTjmP6soqjnEPEzzohmn457+h+NdJuUpasCLaFnKVkZASld 7FJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UTXz1aFr; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170903124e00b001a1c8afd0e4si2218385plh.635.2023.04.13.07.44.46; Thu, 13 Apr 2023 07:45:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UTXz1aFr; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbjDMOmg (ORCPT + 99 others); Thu, 13 Apr 2023 10:42:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbjDMOmf (ORCPT ); Thu, 13 Apr 2023 10:42:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E9D34C3C; Thu, 13 Apr 2023 07:42:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CEDA463F2B; Thu, 13 Apr 2023 14:42:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F932C433D2; Thu, 13 Apr 2023 14:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681396953; bh=CIG3609dFwAQvwvxEdGD0oZDB/oc+gaHoSMvtpFiB+s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UTXz1aFrD/HsHugXVQVxvOlEGdF97Ba5phWJJudjIczGZ1vOhBY/06HkXksnL5rIJ Oh0eWtA6qvzrnIg0o3xRhD2iob0eL/2DuMJ4ap+2hAFPE+afRDkn3n6FnCRnGvVzgq hSr/oldye+hhZgfZcJPCXp44m5oYkql9bvH3o3vpKYjylfm1fYBptMW6sVV1jIxpdD WOiMdGVaGhAmwejzfVvQ21HlsJz+orEKNnko5sb3Nxnc3d+UxupxtEAJyaQp4no67T 5gbrV2FZ4I4EZ7amVAEXFBFdPxpMShWhcQwJvKLS77GhEbFDqsvuIDiEjvM8MX9ukA fe2epWg+EIwGA== Date: Thu, 13 Apr 2023 07:42:32 -0700 From: "Darrick J. Wong" To: "Ritesh Harjani (IBM)" Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Jan Kara , Christoph Hellwig , Ojaswin Mujoo , Disha Goel Subject: Re: [RFCv3 10/10] iomap: Add trace points for DIO path Message-ID: <20230413144232.GD360877@frogsfrogsfrogs> References: <93ab8386c4620395c5e674a7930506895fc758ef.1681365596.git.ritesh.list@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93ab8386c4620395c5e674a7930506895fc758ef.1681365596.git.ritesh.list@gmail.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Apr 13, 2023 at 02:10:32PM +0530, Ritesh Harjani (IBM) wrote: > This patch adds trace point events for iomap DIO path. > > > xfs_io-8815 [000] 526.790418: iomap_dio_rw_begin: dev 7:7 ino 0xc isize 0x0 pos 0x0 count 4096 flags DIRECT dio_flags DIO_FORCE_WAIT done_before 0 aio 0 ret 0 > xfs_io-8815 [000] 526.790978: iomap_dio_complete: dev 7:7 ino 0xc isize 0x1000 pos 0x1000 flags DIRECT aio 0 error 0 ret 4096 > xfs_io-8815 [000] 526.790988: iomap_dio_rw_end: dev 7:7 ino 0xc isize 0x1000 pos 0x1000 count 0 flags DIRECT dio_flags DIO_FORCE_WAIT done_before 0 aio 0 ret 4096 > fsx-8827 [005] 526.939345: iomap_dio_rw_begin: dev 7:7 ino 0xc isize 0x922f8 pos 0x4f000 count 61440 flags NOWAIT|DIRECT|ALLOC_CACHE dio_flags done_before 0 aio 1 ret 0 > fsx-8827 [005] 526.939459: iomap_dio_rw_end: dev 7:7 ino 0xc isize 0x922f8 pos 0x4f000 count 0 flags NOWAIT|DIRECT|ALLOC_CACHE dio_flags done_before 0 aio 1 ret -529 > ksoftirqd/5-41 [005] 526.939564: iomap_dio_complete: dev 7:7 ino 0xc isize 0x922f8 pos 0x5e000 flags NOWAIT|DIRECT|ALLOC_CACHE aio 1 error 0 ret 61440 > > Tested-by: Disha Goel > Signed-off-by: Ritesh Harjani (IBM) > --- > fs/iomap/direct-io.c | 3 ++ > fs/iomap/trace.c | 1 + > fs/iomap/trace.h | 90 ++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 94 insertions(+) > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 5871956ee880..bb7a6dfbc8b3 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -130,6 +130,7 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) > if (ret > 0) > ret += dio->done_before; > > + trace_iomap_dio_complete(iocb, dio->error, ret); > kfree(dio); > > return ret; > @@ -681,6 +682,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, > struct iomap_dio *dio; > ssize_t ret = 0; > > + trace_iomap_dio_rw_begin(iocb, iter, dio_flags, done_before, ret); > dio = __iomap_dio_rw(iocb, iter, ops, dops, dio_flags, private, > done_before); > if (IS_ERR_OR_NULL(dio)) { > @@ -689,6 +691,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, > } > ret = iomap_dio_complete(dio); > out: > + trace_iomap_dio_rw_end(iocb, iter, dio_flags, done_before, ret); > return ret; > } > EXPORT_SYMBOL_GPL(iomap_dio_rw); > diff --git a/fs/iomap/trace.c b/fs/iomap/trace.c > index da217246b1a9..728d5443daf5 100644 > --- a/fs/iomap/trace.c > +++ b/fs/iomap/trace.c > @@ -3,6 +3,7 @@ > * Copyright (c) 2019 Christoph Hellwig > */ > #include > +#include > > /* > * We include this last to have the helpers above available for the trace > diff --git a/fs/iomap/trace.h b/fs/iomap/trace.h > index f6ea9540d082..dcb4dd4db5fb 100644 > --- a/fs/iomap/trace.h > +++ b/fs/iomap/trace.h > @@ -183,6 +183,96 @@ TRACE_EVENT(iomap_iter, > (void *)__entry->caller) > ); > > +#define TRACE_IOMAP_DIO_STRINGS \ > + {IOMAP_DIO_FORCE_WAIT, "DIO_FORCE_WAIT" }, \ > + {IOMAP_DIO_OVERWRITE_ONLY, "DIO_OVERWRITE_ONLY" }, \ > + {IOMAP_DIO_PARTIAL, "DIO_PARTIAL" } Can you make the strings line up too, please? > + > +DECLARE_EVENT_CLASS(iomap_dio_class, > + TP_PROTO(struct kiocb *iocb, struct iov_iter *iter, > + unsigned int dio_flags, u64 done_before, int ret), We're passing in ssize_t values for @ret, shouldn't the types match? > + TP_ARGS(iocb, iter, dio_flags, done_before, ret), > + TP_STRUCT__entry( > + __field(dev_t, dev) > + __field(ino_t, ino) > + __field(loff_t, isize) > + __field(loff_t, pos) > + __field(u64, count) What's the difference between "length" as used in the other tracepoints and "count" here? > + __field(u64, done_before) > + __field(int, ki_flags) > + __field(unsigned int, dio_flags) > + __field(bool, aio) > + __field(int, ret) > + ), > + TP_fast_assign( > + __entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev; > + __entry->ino = file_inode(iocb->ki_filp)->i_ino; > + __entry->isize = file_inode(iocb->ki_filp)->i_size; > + __entry->pos = iocb->ki_pos; > + __entry->count = iov_iter_count(iter); > + __entry->done_before = done_before; > + __entry->dio_flags = dio_flags; > + __entry->ki_flags = iocb->ki_flags; > + __entry->aio = !is_sync_kiocb(iocb); > + __entry->ret = ret; > + ), > + TP_printk("dev %d:%d ino 0x%lx isize 0x%llx pos 0x%llx count %llu " count and done_before are lengths of file operations, in bytes, right? Everywhere else we use 0x%llx for that. > + "flags %s dio_flags %s done_before %llu aio %d ret %d", > + MAJOR(__entry->dev), MINOR(__entry->dev), > + __entry->ino, > + __entry->isize, > + __entry->pos, > + __entry->count, > + __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS), > + __print_flags(__entry->dio_flags, "|", TRACE_IOMAP_DIO_STRINGS), > + __entry->done_before, > + __entry->aio, > + __entry->ret) > +) > + > +#define DEFINE_DIO_RW_EVENT(name) \ > +DEFINE_EVENT(iomap_dio_class, name, \ > + TP_PROTO(struct kiocb *iocb, struct iov_iter *iter, \ > + unsigned int dio_flags, u64 done_before, \ > + int ret), \ > + TP_ARGS(iocb, iter, dio_flags, done_before, ret)) > +DEFINE_DIO_RW_EVENT(iomap_dio_rw_begin); > +DEFINE_DIO_RW_EVENT(iomap_dio_rw_end); > + > +TRACE_EVENT(iomap_dio_complete, > + TP_PROTO(struct kiocb *iocb, int error, int ret), > + TP_ARGS(iocb, error, ret), > + TP_STRUCT__entry( > + __field(dev_t, dev) > + __field(ino_t, ino) > + __field(loff_t, isize) > + __field(loff_t, pos) > + __field(int, ki_flags) > + __field(bool, aio) > + __field(int, error) > + __field(int, ret) Same comment about @ret and ssize_t here. --D > + ), > + TP_fast_assign( > + __entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev; > + __entry->ino = file_inode(iocb->ki_filp)->i_ino; > + __entry->isize = file_inode(iocb->ki_filp)->i_size; > + __entry->pos = iocb->ki_pos; > + __entry->ki_flags = iocb->ki_flags; > + __entry->aio = !is_sync_kiocb(iocb); > + __entry->error = error; > + __entry->ret = ret; > + ), > + TP_printk("dev %d:%d ino 0x%lx isize 0x%llx pos 0x%llx flags %s aio %d error %d ret %d", > + MAJOR(__entry->dev), MINOR(__entry->dev), > + __entry->ino, > + __entry->isize, > + __entry->pos, > + __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS), > + __entry->aio, > + __entry->error, > + __entry->ret) > +); > + > #endif /* _IOMAP_TRACE_H */ > > #undef TRACE_INCLUDE_PATH > -- > 2.39.2 >