From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754356AbdBPKgw (ORCPT ); Thu, 16 Feb 2017 05:36:52 -0500 Received: from merlin.infradead.org ([205.233.59.134]:40620 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753526AbdBPKgu (ORCPT ); Thu, 16 Feb 2017 05:36:50 -0500 Date: Thu, 16 Feb 2017 11:36:37 +0100 From: Peter Zijlstra To: Hari Bathini Cc: ast@fb.com, lkml , acme@kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, daniel@iogearbox.net, rostedt@goodmis.org, Ananth N Mavinakayanahalli , ebiederm@xmission.com, sargun@sargun.me, Aravinda Prasad , brendan.d.gregg@gmail.com, jolsa@redhat.com Subject: Re: [PATCH v6 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info Message-ID: <20170216103637.GL6536@twins.programming.kicks-ass.net> References: <148654265580.27983.8822211570127163843.stgit@hbathini.in.ibm.com> <148654268436.27983.5340774362600828412.stgit@hbathini.in.ibm.com> <20170216102824.GZ6515@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170216102824.GZ6515@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 16, 2017 at 11:28:24AM +0100, Peter Zijlstra wrote: > On Wed, Feb 08, 2017 at 02:01:24PM +0530, Hari Bathini wrote: > > @@ -862,6 +886,18 @@ enum perf_event_type { > > */ > > PERF_RECORD_SWITCH_CPU_WIDE = 15, > > > > + /* > > + * struct { > > + * struct perf_event_header header; > > + * u32 pid; > > + * u32 tid; > > + * u32 nr_namespaces; > > + * struct namespace_link_info link_info[NAMESPACES_MAX]; > > + * struct sample_id sample_id; > > + * }; > > + */ > > + PERF_RECORD_NAMESPACES = 16, > > This thing works by accident, there's a u32 hole in that structure. > Also, the array isn't NAMESPACES_MAX long, its nr_namespaces, that's > what its there for. The entries should be internally consistent. Also, namespace_link_info isn't specified. Easies would be to write something like: { char name[8]; u64 inode; u64 dev; }[nr_namespace];