Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp801818pxj; Thu, 3 Jun 2021 21:21:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6oo8d8ImiWohhpNfG892MGGw/e4pwyu9SKSPNGquzwd7qrwyU6u6/z8Vl79EgV4OoYCrc X-Received: by 2002:a17:906:c411:: with SMTP id u17mr2406316ejz.60.1622780497224; Thu, 03 Jun 2021 21:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622780497; cv=none; d=google.com; s=arc-20160816; b=bACPVx7jmfY6+Lzg6FXkkwBqL6f426F1/OrwL1Qoe089rdwJjZrB0I+EKSpUvP4CQc 4KEmRu1KnMZPhcz2szB6HrJiObKzTTCSN6EpAzU2SVy17+TX4QJhSe3y8BK///8dFaMR MKTHHndu7V6DF4N36XoZWlNUwljzHTUX6SuE9Yx92ROuyRkvlSoJ2Bpf4TpzbZnXFvKS JbsGetbmWv8ve2T3T9p3k9mo9y32NPbGCk3D9vZxM2uHNyYOsoEBsaVU3HkvrKB3hiH5 ZVSoCXGl4jVE5nayh23mohN0dQ4PuJ4jnDB5D7qTNyisLhh/q2IhhNgGaC4akSv3gmdG CibQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=2DsWcNVIw76aexZIHmAjMwfc0u/2gpHbpLpGVeH5tiE=; b=M7/+rGmGjp8hyWX5D/uLhuG1PpnE4owHYpoG+KqbmE22FVPBNgtg8AkLJP8vvRnNRh zPTCLFfCli2yi2Br8S2/Qe/TJTWKU/Vmn5rqPMN2axwlPJKrB7dcigAQShU6dRPvjrC6 xtFzI1Cjg6j9y8RCiJKabCauVecXT7G7UbjxYbD4QciUQJa6v7xHqOQsnF9D0v2/HnGT buNJV+JEGOShezaGiiFKppwVhTrd9uaFRPvyn+/EUMNIylG7orZd/Vu5pSmaXUl3hZe4 hQwUSEHtAV4EM6sD+ieUd/9lQjbItA/aYWC26WMDai7WdA7WCO+lxdsYX/eceDflOkN7 0lmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si3767696ejb.275.2021.06.03.21.21.13; Thu, 03 Jun 2021 21:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbhFDEVm (ORCPT + 99 others); Fri, 4 Jun 2021 00:21:42 -0400 Received: from smtprelay0049.hostedemail.com ([216.40.44.49]:60632 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229452AbhFDEVl (ORCPT ); Fri, 4 Jun 2021 00:21:41 -0400 Received: from omf05.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 2A43F180A55E1; Fri, 4 Jun 2021 04:19:55 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA id 3D999B2795; Fri, 4 Jun 2021 04:19:52 +0000 (UTC) Message-ID: <1e068d21106bb6db05b735b4916bb420e6c9842a.camel@perches.com> Subject: Re: [PATCH V3 7/9] tracing: Add __print_ns_to_secs() and __print_ns_without_secs() helpers From: Joe Perches To: Steven Rostedt , Daniel Bristot de Oliveira Cc: linux-kernel@vger.kernel.org, Phil Auld , Sebastian Andrzej Siewior , Kate Carcia , Jonathan Corbet , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexandre Chartre , Clark Willaims , John Kacur , Juri Lelli , linux-doc@vger.kernel.org Date: Thu, 03 Jun 2021 21:19:50 -0700 In-Reply-To: <20210603172902.41648183@gandalf.local.home> References: <2c59beee3b36b15592bfbb9f26dee7f8b55fd814.1621024265.git.bristot@redhat.com> <20210603172902.41648183@gandalf.local.home> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3D999B2795 X-Spam-Status: No, score=-0.90 X-Stat-Signature: 5t93p93qdgp44jy6mg3at4bsag6b3te5 X-Rspamd-Server: rspamout03 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19AEbHkhP1XrqS3t2H/RM7OUQRY2pqJ5Co= X-HE-Tag: 1622780392-643404 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2021-06-03 at 17:29 -0400, Steven Rostedt wrote: > > +++ b/include/trace/trace_events.h > > @@ -358,6 +358,21 @@ TRACE_MAKE_SYSTEM_STR(); > > ? trace_print_hex_dump_seq(p, prefix_str, prefix_type, \ > > ? rowsize, groupsize, buf, len, ascii) > > ? > > > > +#undef __print_ns_to_secs > > +#define __print_ns_to_secs(value) \ > > + ({ \ > > + u64 ____val = (u64)value; \ > > + do_div(____val, NSEC_PER_SEC); \ > > + ____val; \ > > + }) > > I know my name is on this, but we need parenthesis around "value". If tracing cleanups for trace_events.h are being done, perhaps another bit of untidiness is the macro definition and uses of __assign_str. $ git grep -w -1 __assign_str include/trace/trace_events.h include/trace/trace_events.h- include/trace/trace_events.h:#undef __assign_str include/trace/trace_events.h:#define __assign_str(dst, src) \ include/trace/trace_events.h- strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); Its definition has a semicolon as do most uses but a dozen handfuls of other uses do not have a semicolon. It'd be more consistent to add a semicolon to the uses without them and when done treewide, then remove the semicolon from the macro declaration. $ git grep -P '\b__assign_str\b' | wc -l 551 $ git grep -P '\b__assign_str\b.*;' | wc -l 480 For instance: sunrpc.h has a mixture of uses with and without semicolons. $ git grep -P '\b__assign_str\b' include/trace/events/sunrpc.h | wc -l 65 $ git grep -P '\b__assign_str\b.*;' include/trace/events/sunrpc.h | wc -l 38 It's especially odd in the last block below to have 3 successive uses where the first and last has a semicolon, but the middle one does not. So perhaps as a start: --- include/trace/events/sunrpc.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index d02e01a27b690..861f199896c6a 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -154,8 +154,8 @@ TRACE_EVENT(rpc_clnt_new, __entry->client_id = clnt->cl_clid; __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); - __assign_str(program, program) - __assign_str(server, server) + __assign_str(program, program); + __assign_str(server, server); ), TP_printk("client=%u peer=[%s]:%s program=%s server=%s", @@ -180,8 +180,8 @@ TRACE_EVENT(rpc_clnt_new_err, TP_fast_assign( __entry->error = error; - __assign_str(program, program) - __assign_str(server, server) + __assign_str(program, program); + __assign_str(server, server); ), TP_printk("program=%s server=%s error=%d", @@ -284,8 +284,8 @@ TRACE_EVENT(rpc_request, __entry->client_id = task->tk_client->cl_clid; __entry->version = task->tk_client->cl_vers; __entry->async = RPC_IS_ASYNC(task); - __assign_str(progname, task->tk_client->cl_program->name) - __assign_str(procname, rpc_proc_name(task)) + __assign_str(progname, task->tk_client->cl_program->name); + __assign_str(procname, rpc_proc_name(task)); ), TP_printk("task:%u@%u %sv%d %s (%ssync)", @@ -494,10 +494,10 @@ DECLARE_EVENT_CLASS(rpc_reply_event, __entry->task_id = task->tk_pid; __entry->client_id = task->tk_client->cl_clid; __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); - __assign_str(progname, task->tk_client->cl_program->name) + __assign_str(progname, task->tk_client->cl_program->name); __entry->version = task->tk_client->cl_vers; - __assign_str(procname, rpc_proc_name(task)) - __assign_str(servername, task->tk_xprt->servername) + __assign_str(procname, rpc_proc_name(task)); + __assign_str(servername, task->tk_xprt->servername); ), TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s", @@ -622,8 +622,8 @@ TRACE_EVENT(rpc_stats_latency, __entry->task_id = task->tk_pid; __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); __entry->version = task->tk_client->cl_vers; - __assign_str(progname, task->tk_client->cl_program->name) - __assign_str(procname, rpc_proc_name(task)) + __assign_str(progname, task->tk_client->cl_program->name); + __assign_str(procname, rpc_proc_name(task)); __entry->backlog = ktime_to_us(backlog); __entry->rtt = ktime_to_us(rtt); __entry->execute = ktime_to_us(execute); @@ -669,15 +669,15 @@ TRACE_EVENT(rpc_xdr_overflow, __entry->task_id = task->tk_pid; __entry->client_id = task->tk_client->cl_clid; __assign_str(progname, - task->tk_client->cl_program->name) + task->tk_client->cl_program->name); __entry->version = task->tk_client->cl_vers; - __assign_str(procedure, task->tk_msg.rpc_proc->p_name) + __assign_str(procedure, task->tk_msg.rpc_proc->p_name); } else { __entry->task_id = 0; __entry->client_id = 0; - __assign_str(progname, "unknown") + __assign_str(progname, "unknown"); __entry->version = 0; - __assign_str(procedure, "unknown") + __assign_str(procedure, "unknown"); } __entry->requested = requested; __entry->end = xdr->end; @@ -735,9 +735,9 @@ TRACE_EVENT(rpc_xdr_alignment, __entry->task_id = task->tk_pid; __entry->client_id = task->tk_client->cl_clid; __assign_str(progname, - task->tk_client->cl_program->name) + task->tk_client->cl_program->name); __entry->version = task->tk_client->cl_vers; - __assign_str(procedure, task->tk_msg.rpc_proc->p_name) + __assign_str(procedure, task->tk_msg.rpc_proc->p_name); __entry->offset = offset; __entry->copied = copied; @@ -1107,9 +1107,9 @@ TRACE_EVENT(xprt_retransmit, __entry->xid = be32_to_cpu(rqst->rq_xid); __entry->ntrans = rqst->rq_ntrans; __assign_str(progname, - task->tk_client->cl_program->name) + task->tk_client->cl_program->name); __entry->version = task->tk_client->cl_vers; - __assign_str(procedure, task->tk_msg.rpc_proc->p_name) + __assign_str(procedure, task->tk_msg.rpc_proc->p_name); ), TP_printk( @@ -1842,7 +1842,7 @@ TRACE_EVENT(svc_xprt_accept, TP_fast_assign( __assign_str(addr, xprt->xpt_remotebuf); - __assign_str(protocol, xprt->xpt_class->xcl_name) + __assign_str(protocol, xprt->xpt_class->xcl_name); __assign_str(service, service); ),