Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1522614

Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info

From Hari Bathini <hbathini@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info
Date 2016-11-15 13:10 +0100
Message-ID <sDKIO-4KT-13@gated-at.bofh.it> (permalink)
References (1 earlier) <sBVS2-5xN-49@gated-at.bofh.it> <sBXqN-6H1-15@gated-at.bofh.it> <sDmQ9-5Ml-3@gated-at.bofh.it> <sDmZQ-5PY-15@gated-at.bofh.it> <sDwFP-3Pe-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Tuesday 15 November 2016 02:27 AM, Eric W. Biederman wrote:
> Peter Zijlstra <peterz@infradead.org> 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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include  namespaces related info Hari Bathini <hbathini@linux.vnet.ibm.com> - 2016-11-14 11:40 +0100
  Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include  namespaces related info Peter Zijlstra <peterz@infradead.org> - 2016-11-14 11:50 +0100
    Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info ebiederm@xmission.com (Eric W. Biederman) - 2016-11-14 22:10 +0100
      Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include  namespaces related info Hari Bathini <hbathini@linux.vnet.ibm.com> - 2016-11-15 13:10 +0100

csiph-web