Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1593247yba; Sat, 6 Apr 2019 17:15:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyakBLhvhsC8HJdy1N+W5vA0q2bdRT2KWOvhZV67kPU85jmtAyQZo92UMC+nSXyiSMX18L+ X-Received: by 2002:a17:902:7794:: with SMTP id o20mr21233925pll.189.1554596138476; Sat, 06 Apr 2019 17:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554596138; cv=none; d=google.com; s=arc-20160816; b=mGH6ylGryyV+QyGlyIrLL4Eq2sQV2OKOxplMO1yEWQbecF45JFJX74ERrPw4c22qDR FUWVCu88WdaoHIuYXeO2/YRb+7HD2a4lN/QRWrfVrxXywQyOgVinYmosH1BqPhvhj0IK UMg49B/iugXjhDc67SBItcYGabDX0XmrvnGeihZ8XCs6BfeKZhGv7X/XMvRUd2MAqqlF xZfxYAKdZK0kvlKxdRhpl+1VApErz3t91Jsd8xIeB9AHgzsfkU7R7Pb8AmyFsutPJwzv pPu0ebFxPfJHyUBXikFTuulAIo+5cAFMEi+HLjV3S1aZtoUOgRM3MZtRnaBdWHv0E4ro Z2gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xpLDkw+BUdZ0Aj8067Cc92iF94gR3dOyLGJxS0j9kLY=; b=CIOLQPTVQfD6Rz2LB22DUeA87+xKNcVprwwIMJimtvRkMczzWTBKFabhF6EWV+uD0E SDXfHKGsWuBHmGSYfJCnTIIEJKqrPjME1J4JFwZdLUXqWcGcuq8jOPK8HMRZe3sBJ1Fc OrMHyQNWxQvRtfjZ7wzq9suFzZspafo9c0T/gqQLYX5M+pwlyojI4Alr7yiZJNofZN7Z PUM5qbCUgVuOSX/1DHCQVIn8hNi7ys1qa56gGgH9BzExUhJ3kc6GQIStDbYyBtP+WhFG Cc//9J+sXnaoD2I2NoRcjOMH78Ib7wgjMNKzCKX6+C0nY0JOhRlS86tZnkCXRRH+KelI xnHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=ssNMnh4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si23395711pfn.30.2019.04.06.17.15.22; Sat, 06 Apr 2019 17:15:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=ssNMnh4U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726396AbfDGAOA (ORCPT + 99 others); Sat, 6 Apr 2019 20:14:00 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:45031 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbfDGAN7 (ORCPT ); Sat, 6 Apr 2019 20:13:59 -0400 Received: by mail-qk1-f196.google.com with SMTP id y5so5964511qkc.11 for ; Sat, 06 Apr 2019 17:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xpLDkw+BUdZ0Aj8067Cc92iF94gR3dOyLGJxS0j9kLY=; b=ssNMnh4Ux5zm12pMOJInWXjgczb1a71FwaOwUL5r9ybbVVoubuFUPDUG20DJAenx9t ihKq1PkZPTJuGuRbptQS7gu5/NsIAsu81SozFMXxAFgjd75YRPs0PuC2sR0QmzQHzPg0 g8HEeztXHSAQ2CnTTAkTluPeF0TfrJKRdoFE8SP+7ri8MDHQ6lY+xb8w32Ye30CeoBSo OzZ5WotSF7Y0Uyu9z4eBdSCLg3GqrfjH0QfVbeVlDQqGvBmgckJFjqn9iuhdXGhIKNd9 aiwku8Dlc6vshk/R41UA94Zvubqv0fH9SfvxKo6qG0kJm3EkygzVzrRxa7Z5dD3fhG/6 ZZlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xpLDkw+BUdZ0Aj8067Cc92iF94gR3dOyLGJxS0j9kLY=; b=Q4/pKJEWFUl95aBJ1yNQvRxO10K1UXQp1lkQgENUwuxhKRw9JnWL2dR07BFb8e2C4k u20SNELCzVLvheFOU7obtQExLzT+c8F+9qYTrLUZIP+xPmAX6Eb9AkrllaMkvLWiesdU luDMauC48lrwPCIEE8yftt0H4AksPh8HW4EJK7skzcJFk0KkciT5V9vZjYzAu2FbkJM9 2+b8+0h7EDC7NBM9WLmEf2aTwsG+cNbGTnP7M9cM5c/BjxSl2GXToLDUO6wM1r3Zt6JF Epbf+yQl95lWFPC2Mr0nZUzdvOKs3M5Sdg/KoUej+4QCCPMFCSQMa84COS9gini5H3qV bzrw== X-Gm-Message-State: APjAAAUn57Y7cty6iL1h4mo1mRJJP7JuXTid5ldEn1IOlzQr88s70VMD A80v1o4htk88VVgAr4socB+rVQ== X-Received: by 2002:a37:6814:: with SMTP id d20mr17113928qkc.102.1554596038610; Sat, 06 Apr 2019 17:13:58 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id f20sm16471992qtk.14.2019.04.06.17.13.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Apr 2019 17:13:57 -0700 (PDT) Date: Sat, 6 Apr 2019 20:13:56 -0400 From: Josef Bacik To: Matt Mullins Cc: hall@fb.com, ast@kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Josef Bacik , Jens Axboe , Steven Rostedt , Ingo Molnar , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , linux-block@vger.kernel.org, nbd@other.debian.org Subject: Re: [PATCH bpf-next v2 3/5] nbd: add tracepoints for send/receive timing Message-ID: <20190407001355.4zyulck2z2vggqbi@MacBook-Pro-91.local> References: <20190405235506.29236-1-mmullins@fb.com> <20190405235506.29236-4-mmullins@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190405235506.29236-4-mmullins@fb.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 05, 2019 at 04:55:04PM -0700, Matt Mullins wrote: > From: Andrew Hall > > This adds four tracepoints to nbd, enabling separate tracing of payload > and header sending/receipt. > > In the send path for headers that have already been sent, we also > explicitly initialize the handle so it can be referenced by the later > tracepoint. > > Signed-off-by: Andrew Hall > Signed-off-by: Matt Mullins > --- > drivers/block/nbd.c | 8 ++++ > include/trace/events/nbd.h | 92 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 100 insertions(+) > > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c > index 7393d04d255c..d3d914620f66 100644 > --- a/drivers/block/nbd.c > +++ b/drivers/block/nbd.c > @@ -513,6 +513,10 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) > if (sent) { > if (sent >= sizeof(request)) { > skip = sent - sizeof(request); > + > + // initialize handle for tracing purposes > + handle = nbd_cmd_handle(cmd); > + Don't use c++ style commenting. > goto send_pages; > } > iov_iter_advance(&from, sent); > @@ -536,6 +540,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) > (unsigned long long)blk_rq_pos(req) << 9, blk_rq_bytes(req)); > result = sock_xmit(nbd, index, 1, &from, > (type == NBD_CMD_WRITE) ? MSG_MORE : 0, &sent); > + trace_nbd_header_sent(req, handle); > if (result <= 0) { > if (was_interrupted(result)) { > /* If we havne't sent anything we can just return BUSY, > @@ -608,6 +613,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) > bio = next; > } > out: > + trace_nbd_payload_sent(req, handle); > nsock->pending = NULL; > nsock->sent = 0; > return 0; > @@ -655,6 +661,7 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) > tag, req); > return ERR_PTR(-ENOENT); > } > + trace_nbd_header_received(req, handle); > cmd = blk_mq_rq_to_pdu(req); > > mutex_lock(&cmd->lock); > @@ -708,6 +715,7 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) > } > } > out: > + trace_nbd_payload_received(req, handle); > mutex_unlock(&cmd->lock); > return ret ? ERR_PTR(ret) : cmd; > } > diff --git a/include/trace/events/nbd.h b/include/trace/events/nbd.h > index 5928255ed02e..eef476fef95a 100644 > --- a/include/trace/events/nbd.h > +++ b/include/trace/events/nbd.h > @@ -7,6 +7,98 @@ > > #include > > +TRACE_EVENT(nbd_header_sent, > + > + TP_PROTO(struct request *req, u64 handle), > + > + TP_ARGS(req, handle), > + > + TP_STRUCT__entry( > + __field(struct request *, req) > + __field(u64, handle) > + ), > + > + TP_fast_assign( > + __entry->req = req; > + __entry->handle = handle; > + ), > + > + TP_printk( > + "nbd header sent: request %p, handle 0x%016llx", > + __entry->req, > + __entry->handle > + ) > +); > + These are all the same, use DECLARE_EVENT_CLASS() and then just DEFINE_EVENT() for each individual event. Also no pointers, we don't want to leak pointers to userspace for stuff. Thanks, Josef