From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935429AbcLMUEc (ORCPT ); Tue, 13 Dec 2016 15:04:32 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:57121 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933355AbcLMUCH (ORCPT ); Tue, 13 Dec 2016 15:02:07 -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> <871sxdf1ew.fsf@xmission.com> <51be4a2e-ebec-9047-8b3b-e011335bdd4d@linux.vnet.ibm.com> Date: Wed, 14 Dec 2016 08:58:42 +1300 In-Reply-To: <51be4a2e-ebec-9047-8b3b-e011335bdd4d@linux.vnet.ibm.com> (Hari Bathini's message of "Wed, 14 Dec 2016 00:17:26 +0530") Message-ID: <87a8bzfvnx.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=1cGtGs-0006OZ-84;;;mid=<87a8bzfvnx.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=101.100.131.98;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+hgQ6d0GD/CotoR/ylY6UzP4KAncqcbvY= 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 * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Hari Bathini X-Spam-Relay-Country: X-Spam-Timing: total 781 ms - load_scoreonly_sql: 0.08 (0.0%), signal_user_changed: 7 (0.9%), b_tie_ro: 5 (0.7%), parse: 1.40 (0.2%), extract_message_metadata: 7 (0.9%), get_uri_detail_list: 1.23 (0.2%), tests_pri_-1000: 4.1 (0.5%), tests_pri_-950: 1.28 (0.2%), tests_pri_-900: 17 (2.2%), tests_pri_-400: 63 (8.0%), check_bayes: 61 (7.9%), b_tokenize: 27 (3.5%), b_tok_get_all: 10 (1.3%), b_comp_prob: 2.3 (0.3%), b_tok_touch_all: 3.9 (0.5%), b_finish: 0.78 (0.1%), tests_pri_0: 650 (83.3%), check_dkim_signature: 0.63 (0.1%), check_dkim_adsp: 52 (6.7%), tests_pri_500: 4.1 (0.5%), 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hari Bathini writes: > Hi Eric, > > > On Monday 12 December 2016 11:57 PM, Eric W. Biederman wrote: >> 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. > > Do you mean.. > > st_dev = encode_dev(inode->i_sb->s_dev); ? > st_ino = inode->i_ino; ? Yes. I believe that is how those values make it to user space during a stat system call. Eric