From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759552AbcLAOND (ORCPT ); Thu, 1 Dec 2016 09:13:03 -0500 Received: from smtprelay0241.hostedemail.com ([216.40.44.241]:47899 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759485AbcLAOM7 (ORCPT ); Thu, 1 Dec 2016 09:12:59 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2693:2898:3138:3139:3140:3141:3142:3622:3865:3867:3868:3870:3873:3874:4250:4321:4605:5007:6119:6261:6742:7875:7903:10004:10848:10967:11026:11232:11473:11658:11914:12043:12291:12296:12438:12555:12683:12740:12760:13439:14181:14659:14721:21080:21220:21434:21451:30012:30029:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: jeans30_53c99f6948455 X-Filterd-Recvd-Size: 5616 Date: Thu, 1 Dec 2016 09:12:54 -0500 From: Steven Rostedt To: Ross Zwisler Cc: linux-kernel@vger.kernel.org, Alexander Viro , Andrew Morton , Christoph Hellwig , Dan Williams , Dave Chinner , Ingo Molnar , Jan Kara , Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@ml01.01.org Subject: Re: [PATCH v2 1/6] tracing: add __print_flags_u64() Message-ID: <20161201091254.3e9f99b0@gandalf.local.home> In-Reply-To: <1480549533-29038-2-git-send-email-ross.zwisler@linux.intel.com> References: <1480549533-29038-1-git-send-email-ross.zwisler@linux.intel.com> <1480549533-29038-2-git-send-email-ross.zwisler@linux.intel.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 30 Nov 2016 16:45:28 -0700 Ross Zwisler wrote: > Add __print_flags_u64() and the helper trace_print_flags_seq_u64() in the > same spirit as __print_symbolic_u64() and trace_print_symbols_seq_u64(). > These functions allow us to print symbols associated with flags that are 64 > bits wide even on 32 bit machines. > > These will be used by the DAX code so that we can print the flags set in a > pfn_t such as PFN_SG_CHAIN, PFN_SG_LAST, PFN_DEV and PFN_MAP. > > Without this new function I was getting errors like the following when > compiling for i386: > > ./include/linux/pfn_t.h:13:22: warning: large integer implicitly truncated > to unsigned type [-Woverflow] > #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1)) > ^ > > Signed-off-by: Ross Zwisler > --- > include/linux/trace_events.h | 4 ++++ > include/trace/trace_events.h | 11 +++++++++++ > kernel/trace/trace_output.c | 38 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 53 insertions(+) > > diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h > index be00761..db2c3ba 100644 > --- a/include/linux/trace_events.h > +++ b/include/linux/trace_events.h > @@ -23,6 +23,10 @@ const char *trace_print_symbols_seq(struct trace_seq *p, unsigned long val, > const struct trace_print_flags *symbol_array); > > #if BITS_PER_LONG == 32 > +const char *trace_print_flags_seq_u64(struct trace_seq *p, const char *delim, > + unsigned long long flags, > + const struct trace_print_flags_u64 *flag_array); > + > const char *trace_print_symbols_seq_u64(struct trace_seq *p, > unsigned long long val, > const struct trace_print_flags_u64 > diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h > index 467e12f..c6e9f72 100644 > --- a/include/trace/trace_events.h > +++ b/include/trace/trace_events.h > @@ -283,8 +283,16 @@ TRACE_MAKE_SYSTEM_STR(); > trace_print_symbols_seq(p, value, symbols); \ > }) > > +#undef __print_flags_u64 > #undef __print_symbolic_u64 > #if BITS_PER_LONG == 32 > +#define __print_flags_u64(flag, delim, flag_array...) \ > + ({ \ > + static const struct trace_print_flags_u64 __flags[] = \ > + { flag_array, { -1, NULL } }; \ > + trace_print_flags_seq_u64(p, delim, flag, __flags); \ > + }) > + > #define __print_symbolic_u64(value, symbol_array...) \ > ({ \ > static const struct trace_print_flags_u64 symbols[] = \ > @@ -292,6 +300,9 @@ TRACE_MAKE_SYSTEM_STR(); > trace_print_symbols_seq_u64(p, value, symbols); \ > }) > #else > +#define __print_flags_u64(flag, delim, flag_array...) \ > + __print_flags(flag, delim, flag_array) > + > #define __print_symbolic_u64(value, symbol_array...) \ > __print_symbolic(value, symbol_array) > #endif > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c > index 3fc2042..ed4398f 100644 > --- a/kernel/trace/trace_output.c > +++ b/kernel/trace/trace_output.c > @@ -124,6 +124,44 @@ EXPORT_SYMBOL(trace_print_symbols_seq); > > #if BITS_PER_LONG == 32 > const char * > +trace_print_flags_seq_u64(struct trace_seq *p, const char *delim, > + unsigned long long flags, > + const struct trace_print_flags_u64 *flag_array) > +{ > + unsigned long mask; Don't you want mask to be unsigned long long? -- Steve > + const char *str; > + const char *ret = trace_seq_buffer_ptr(p); > + int i, first = 1; > + > + for (i = 0; flag_array[i].name && flags; i++) { > + > + mask = flag_array[i].mask; > + if ((flags & mask) != mask) > + continue; > + > + str = flag_array[i].name; > + flags &= ~mask; > + if (!first && delim) > + trace_seq_puts(p, delim); > + else > + first = 0; > + trace_seq_puts(p, str); > + } > + > + /* check for left over flags */ > + if (flags) { > + if (!first && delim) > + trace_seq_puts(p, delim); > + trace_seq_printf(p, "0x%llx", flags); > + } > + > + trace_seq_putc(p, 0); > + > + return ret; > +} > +EXPORT_SYMBOL(trace_print_flags_seq_u64); > + > +const char * > trace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val, > const struct trace_print_flags_u64 *symbol_array) > {