linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: ast@fb.com, lkml <linux-kernel@vger.kernel.org>,
	acme@kernel.org, alexander.shishkin@linux.intel.com,
	mingo@redhat.com, daniel@iogearbox.net, rostedt@goodmis.org,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	sargun@sargun.me, Aravinda Prasad <aravinda@linux.vnet.ibm.com>,
	brendan.d.gregg@gmail.com
Subject: Re: [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info
Date: Tue, 15 Nov 2016 17:35:39 +0530	[thread overview]
Message-ID: <1a9acb25-8a0c-7072-bb45-bbc5acf6e546@linux.vnet.ibm.com> (raw)
In-Reply-To: <87inrpkceq.fsf@xmission.com>



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

  reply	other threads:[~2016-11-15 12:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 11:37 [PATCH 0/3] perf: add support for analyzing events for containers Hari Bathini
2016-11-10 11:38 ` [PATCH 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info Hari Bathini
2016-11-10 13:09   ` kbuild test robot
2016-11-10 13:19   ` Peter Zijlstra
2016-11-14 10:32     ` Hari Bathini
2016-11-14 10:46       ` Peter Zijlstra
2016-11-14 20:57         ` Eric W. Biederman
2016-11-15 12:05           ` Hari Bathini [this message]
2016-11-10 11:38 ` [PATCH 2/3] perf tool: " Hari Bathini
2016-11-10 11:39 ` [PATCH 3/3] perf tool: add cgroup identifier entry in perf report Hari Bathini
2016-11-10 19:48 ` [PATCH 0/3] perf: add support for analyzing events for containers Eric W. Biederman
2016-11-15 12:21   ` Hari Bathini
2016-11-16 17:27     ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a9acb25-8a0c-7072-bb45-bbc5acf6e546@linux.vnet.ibm.com \
    --to=hbathini@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=aravinda@linux.vnet.ibm.com \
    --cc=ast@fb.com \
    --cc=brendan.d.gregg@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sargun@sargun.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).