lkml.org 
[lkml]   [2013]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 12/12] [RFC] perf, persistent: ioctl functions to control persistency
On 22.08.13 14:18:06, Vince Weaver wrote:
> On Thu, 22 Aug 2013, Robert Richter wrote:
> > This is for Linux man-pages:
>
> Thanks, though you're missing out by not learning all about troff
> formatting.

Thanks for documenting perf_event_open(), it's a great help. The troff
thing I may learn in case I write a patch for man-pages. ;)

>
> > type ...
> >
> > PERF_TYPE_PERSISTENT (Since Linux 3.xx)
> >
> > This indicates a persistent event. There is a unique
> > identifier for each persistent event that needs to be
> > specified in the event's attribute config field.
> > Persistent events are listed under:
> >
> > /sys/bus/event_source/devices/persistent/
>
> Wait, so the first time you create a persistent event you do *not*
> set type PERF_TYPE_PERSISTENT? You only do that if you're
> "attaching" to an exisiting event? You might want to clarify that.

You just *open* an existing persistent event and may access buffers
with mmap(). After opening it you also may attach the event to the
process holding the fd with the ioctl. Then, the event is no longer
persistent and removed after all users finished using the event.
Without doing the attach-ioctl the event stays persistent in the
system.

> > persistent: (Since Linux 3.xx)
> >
> > Put event into persistent state after opening. After closing
> > the event's fd the event is persistent in the system and
> > continues to run.
>
> will there be some sort of tool that will let you kill runaway persistent
> events? Or will you have to manually perf_event_open() / iotcl() them
> by hand somehow?

The instance opening the event should also be responsible for removing
it. But there could be a perf tool for controlling persistent events
(create, list, remove, etc).

> > PERF_EVENT_IOC_DETACH (Since Linux 3.xx)
> >
> > Detach the event specified by the file descriptor from the
> > process and make it persistent in the system. After
> > closing the fd the event will continue to run. An unique
> > identifier for the persistent event is returned or an
> > error otherwise. The following allows to connect to the
> > event again:
>
> You might want to re-order things so it's clear you get the unique ID
> at ioctl time and not after the close happens.

Ah, yes, indeed:

Detach the event specified by the file descriptor from the
process and make it persistent in the system. An unique
identifier for the persistent event is returned or an
error otherwise. After closing the fd the event will
continue to run. The following allows to connect to the
event again:


> > PERF_EVENT_IOC_ATTACH (Since Linux 3.xx)
> >
> > Attach the event specified by the file descriptor to the
> > current process. The event is no longer persistent in the
> > system and will be removed after all users disconnected
> > from the event. Thus, if there are no other users the
> > event will be closed too after closing its file
> > descriptor, the event then no longer exists.

Thanks for review, Vince.

-Robert


\
 
 \ /
  Last update: 2013-08-23 12:41    [W:0.128 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site