From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751967AbcFTAoq (ORCPT ); Sun, 19 Jun 2016 20:44:46 -0400 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:57512 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751379AbcFTAoj (ORCPT ); Sun, 19 Jun 2016 20:44:39 -0400 X-Original-SENDERIP: 156.147.1.127 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 165.244.98.204 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org Date: Mon, 20 Jun 2016 09:29:33 +0900 From: Namhyung Kim To: Steven Rostedt CC: Jeremy Linton , , , , , Subject: Re: [RFC/PATCH] perf: Add sizeof operator support Message-ID: <20160620002932.GC25962@sejong> 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> <20160617150827.112f7a8d@gandalf.local.home> MIME-Version: 1.0 In-Reply-To: <20160617150827.112f7a8d@gandalf.local.home> User-Agent: Mutt/1.6.1 (2016-04-27) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB06/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/06/20 09:29:35, Serialize by Router on LGEKRMHUB06/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/06/20 09:29:35, Serialize complete at 2016/06/20 09:29:35 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 17, 2016 at 03:08:27PM -0400, Steven Rostedt wrote: > 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. Or, maybe we can limit the use of sizeof() to the format fields and obvious simple types only which we already know the size. Just an idea.. Thanks, Namhyung > > -- 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 > > >