Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934841AbcLMSro (ORCPT ); Tue, 13 Dec 2016 13:47:44 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52599 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933449AbcLMSrj (ORCPT ); Tue, 13 Dec 2016 13:47:39 -0500 Subject: Re: [PATCH v3 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info To: "Eric W. Biederman" References: <148156671980.4651.13017595439842763683.stgit@hbathini.in.ibm.com> <148156676528.4651.9323274278676831770.stgit@hbathini.in.ibm.com> <871sxdf1ew.fsf@xmission.com> 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 From: Hari Bathini Date: Wed, 14 Dec 2016 00:17:26 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <871sxdf1ew.fsf@xmission.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16121318-0028-0000-0000-00000416082C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16121318-0029-0000-0000-000012738956 Message-Id: <51be4a2e-ebec-9047-8b3b-e011335bdd4d@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-13_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1612130290 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2127 Lines: 68 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; ? Thanks Hari