[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a8bzfvnx.fsf@xmission.com>
Date: Wed, 14 Dec 2016 08:58:42 +1300
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Hari Bathini <hbathini@...ux.vnet.ibm.com>
Cc: ast@...com, peterz@...radead.org,
lkml <linux-kernel@...r.kernel.org>, acme@...nel.org,
alexander.shishkin@...ux.intel.com, mingo@...hat.com,
daniel@...earbox.net, rostedt@...dmis.org,
Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
sargun@...gun.me, Aravinda Prasad <aravinda@...ux.vnet.ibm.com>,
brendan.d.gregg@...il.com
Subject: Re: [PATCH v3 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info
Hari Bathini <hbathini@...ux.vnet.ibm.com> writes:
> Hi Eric,
>
>
> On Monday 12 December 2016 11:57 PM, Eric W. Biederman wrote:
>> Hari Bathini <hbathini@...ux.vnet.ibm.com> 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
Powered by blists - more mailing lists