Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753493AbcKOMFw (ORCPT ); Tue, 15 Nov 2016 07:05:52 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56875 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751340AbcKOMFv (ORCPT ); Tue, 15 Nov 2016 07:05:51 -0500 Subject: Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info To: "Eric W. Biederman" , Peter Zijlstra References: <147877784354.29988.8570048236764105701.stgit@hbathini.in.ibm.com> <147877788475.29988.17221764769834489874.stgit@hbathini.in.ibm.com> <20161110131905.GU3117@twins.programming.kicks-ass.net> <334ecc4f-aacf-4cbe-8858-7ec674f98b24@linux.vnet.ibm.com> <20161114104612.GA3102@twins.programming.kicks-ass.net> <87inrpkceq.fsf@xmission.com> 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 , sargun@sargun.me, Aravinda Prasad , brendan.d.gregg@gmail.com From: Hari Bathini Date: Tue, 15 Nov 2016 17:35:39 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <87inrpkceq.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: 16111512-0004-0000-0000-000001B840C7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16111512-0005-0000-0000-0000091AEF7B Message-Id: <1a9acb25-8a0c-7072-bb45-bbc5acf6e546@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-15_04:,, 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-1611150221 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2029 Lines: 70 On Tuesday 15 November 2016 02:27 AM, Eric W. Biederman wrote: > Peter Zijlstra writes: > >> On Mon, Nov 14, 2016 at 04:02:30PM +0530, Hari Bathini wrote: >> >>>>> PERF_RECORD_SWITCH_CPU_WIDE = 15, >>>>> + /* >>>>> + * struct { >>>>> + * struct perf_event_header header; >>>>> + * >>>>> + * u32 pid, tid; >>>>> + * u64 time; >>>>> + * u32 uts_ns_inum; >>>>> + * u32 ipc_ns_inum; >>>>> + * u32 mnt_ns_inum; >>>>> + * u32 pid_ns_inum; >>>>> + * u32 net_ns_inum; >>>>> + * u32 cgroup_ns_inum; >>>>> + * u32 user_ns_inum; >>>>> + * struct sample_id sample_id; >>>>> + * }; >>>>> + */ >>>>> + PERF_RECORD_NAMESPACES = 16, >>>> So this format is not extensible, that is, if someone adds yet another >>>> namespace, we'll need to introduce PERF_RECORD_NAMESPACES2. >>>> >>>> Is there a 'natural' and exposed namespace index that we can use to >>>> change it like: >>>> >>>> u32 nr_nss; >>>> u32 namespace[nr_nss]; >>>> >>>> ? >>> Nothing of that sort exists, currently. >>> Maybe, time to introduce with this patch-set..? >> Would be good, but you'll have to sort that with the namespace folks. > The somewhat easy answer is to use the unshare flags. AKA CLONE_NEWNS, > CLONE_NEWUSER, ... > > In the worst case things may get extended to the point where perf would > have to use a different set of values than we use to unshare, clone, and > setns (as the clone flags are effectively all used up) but for the > existing namespaces that index should work just fine. > > That won't allow for a natural array in the record but it will allow for > an array with that has a tag for which namespace it is in, or > alternative it will allow for one record per namespace. struct namespace_info { u64 flags; u32 inode_num; /* any other essential namespace info */ }; struct { struct perf_event_header header; u32 pid, tid; u64 time; struct namespace_info ns_info[]; struct sample_id sample_id; }; Something of this sort should do..? Thanks Hari