Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932205AbcLLSa6 (ORCPT ); Mon, 12 Dec 2016 13:30:58 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:35025 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752847AbcLLSa5 (ORCPT ); Mon, 12 Dec 2016 13:30:57 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Hari Bathini Cc: ast@fb.com, peterz@infradead.org, lkml , acme@kernel.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, daniel@iogearbox.net, rostedt@goodmis.org, Ananth N Mavinakayanahalli , sargun@sargun.me, Aravinda Prasad , brendan.d.gregg@gmail.com References: <148156671980.4651.13017595439842763683.stgit@hbathini.in.ibm.com> <148156676528.4651.9323274278676831770.stgit@hbathini.in.ibm.com> Date: Tue, 13 Dec 2016 07:27:35 +1300 In-Reply-To: <148156676528.4651.9323274278676831770.stgit@hbathini.in.ibm.com> (Hari Bathini's message of "Mon, 12 Dec 2016 23:49:36 +0530") Message-ID: <871sxdf1ew.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1cGVNE-00049j-ER;;;mid=<871sxdf1ew.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=101.100.131.98;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/NWdUGXrZENG04F0EDwn9t9wddoMEm3mQ= X-SA-Exim-Connect-IP: 101.100.131.98 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Hari Bathini X-Spam-Relay-Country: X-Spam-Timing: total 621 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.7 (0.6%), b_tie_ro: 2.6 (0.4%), parse: 1.35 (0.2%), extract_message_metadata: 5 (0.8%), get_uri_detail_list: 2.4 (0.4%), tests_pri_-1000: 6 (1.0%), tests_pri_-950: 1.95 (0.3%), tests_pri_-900: 1.73 (0.3%), tests_pri_-400: 34 (5.5%), check_bayes: 32 (5.2%), b_tokenize: 12 (2.0%), b_tok_get_all: 8 (1.4%), b_comp_prob: 3.9 (0.6%), b_tok_touch_all: 4.0 (0.6%), b_finish: 0.93 (0.1%), tests_pri_0: 539 (86.7%), check_dkim_signature: 0.85 (0.1%), check_dkim_adsp: 4.5 (0.7%), tests_pri_500: 6 (1.0%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v3 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2009 Lines: 66 Hari Bathini writes: > With the advert of container technologies like docker, that depend > on namespaces for isolation, there is a need for tracing support for > namespaces. This patch introduces new PERF_RECORD_NAMESPACES event > for tracing based on namespaces related info. > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > index c66a485..2a48fc6 100644 > --- a/include/uapi/linux/perf_event.h > +++ b/include/uapi/linux/perf_event.h > @@ -344,7 +344,8 @@ struct perf_event_attr { > use_clockid : 1, /* use @clockid for time fields */ > context_switch : 1, /* context switch data */ > write_backward : 1, /* Write ring buffer from end to beginning */ > - __reserved_1 : 36; > + namespaces : 1, /* include namespaces data */ > + __reserved_1 : 35; > > union { > __u32 wakeup_events; /* wakeup every n events */ > @@ -610,6 +611,18 @@ struct perf_event_header { > __u16 size; > }; > > +enum { > + NET_NS_INDEX = 0, > + UTS_NS_INDEX = 1, > + IPC_NS_INDEX = 2, > + PID_NS_INDEX = 3, > + USER_NS_INDEX = 4, > + MNT_NS_INDEX = 5, > + CGROUP_NS_INDEX = 6, > + > + NAMESPACES_MAX, /* maximum available namespaces */ > +}; > + > enum perf_event_type { > > /* > @@ -862,6 +875,18 @@ enum perf_event_type { > */ > PERF_RECORD_SWITCH_CPU_WIDE = 15, > > + /* > + * struct { > + * struct perf_event_header header; > + * > + * u32 pid, tid; > + * u64 dev_num; > + * u64 inode_num[NAMESPACES_MAX]; There needs to be one device number per inode. While it is true that today the device number is always the same. That is not necessarily so. I reserve the right to have the device number vary per namespace so that I don't need to implement a namespace of namespaces. These are st_dev and st_ino of the inode for the namespace. > + * struct sample_id sample_id; > + * }; > + */ > + PERF_RECORD_NAMESPACES = 16, > + > PERF_RECORD_MAX, /* non-ABI */ > };