From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753599AbcFQTIc (ORCPT ); Fri, 17 Jun 2016 15:08:32 -0400 Received: from smtprelay0084.hostedemail.com ([216.40.44.84]:50747 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753357AbcFQTIb (ORCPT ); Fri, 17 Jun 2016 15:08:31 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3873:3874:4605:5007:6119:6261:7875:7903:8603:9163:10004:10400:10450:10455:10848:10967:11026:11232:11473:11658:11914:12043:12438:12517:12519:12740:13069:13138:13231:13311:13357:13439:14096:14097:14181:14659:14721:19904:19999:21080:30012:30029:30034:30054:30070:30080: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: sleet91_4a0ac53ee551f X-Filterd-Recvd-Size: 2834 Date: Fri, 17 Jun 2016 15:08:27 -0400 From: Steven Rostedt To: Jeremy Linton Cc: linux-kernel@vger.kernel.org, acme@redhat.com, namhyung@kernel.org, kapileshwar.singh@arm.com, scottwood@freescale.com, hekuang@huawei.com Subject: Re: [RFC/PATCH] perf: Add sizeof operator support Message-ID: <20160617150827.112f7a8d@gandalf.local.home> In-Reply-To: <57644828.3000000@arm.com> References: <1465922312-30064-1-git-send-email-jeremy.linton@arm.com> <20160617121736.023f009f@gandalf.local.home> <57642608.9070504@arm.com> <20160617125042.24c554a7@gandalf.local.home> <57644828.3000000@arm.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; 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 Fri, 17 Jun 2016 13:57:44 -0500 Jeremy Linton wrote: > That is the simple case, initially I was going to just hand code some of > the sizeofs in the kernel, but then I started noticing more complex > cases, and why I RFCed this patch. > > For example, on x64/xen there are fair number with sizeof(pXXval_t), > IIRC I've also seen a fair number of sizeof(struct page *). Some, but I > dont think all of these case be determined from the field sizes like > this one: Right, but there's no easy fix for that. Your patch wont fix these, because they can change over time. Now, what we can do is add a sizeof() helper that is like the TRACE_DEFINE_ENUM() macro. We could add a TRACE_DEFINE_SIZEOF(), that basically does the same, and in update_event_printk() we could substitute the sizeof() with the actual number value. You want to take a crack at that? Take a look at commit 0c564a538aa93. -- Steve > > [root@X tracing]# cat events/xen/xen_mmu_set_pte/format > name: xen_mmu_set_pte > ID: 45 > format: > field:unsigned short common_type; offset:0; size:2; > signed:0; > field:unsigned char common_flags; offset:2; size:1; > signed:0; > field:unsigned char common_preempt_count; offset:3; > size:1; signed:0; > field:int common_pid; offset:4; size:4; signed:1; > > field:pte_t * ptep; offset:8; size:8; signed:0; > field:pteval_t pteval; offset:16; size:8; signed:0; > > print fmt: "ptep %p pteval %0*llx (raw %0*llx)", REC->ptep, > (int)sizeof(pteval_t) * 2, (unsigned long > long)pte_val(native_make_pte(REC->pteval)), (int)sizeof(pteval_t) * 2, > (unsigned long long)REC->pteval >