lkml.org 
[lkml]   [2013]   [Aug]   [22]   [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 Thu, 22 Aug 2013, Robert Richter wrote:

> From: Robert Richter <robert.richter@linaro.org>
>
> Implementing ioctl functions to control persistent events. There are
> functions to detach or attach an event to or from a process. The
> PERF_EVENT_IOC_DETACH ioctl call makes an event persistent. After
> closing the event's fd it runs then in the background of the system
> without the need of a controlling process. The perf_event_open()
> syscall can be used to reopen the event by any process. The
> PERF_EVENT_IOC_ATTACH ioctl attaches the event again so that it is
> removed after closing the event's fd.


> PERF_EVENT_IOC_ATTACH (Since Linux 3.xx)
> PERF_EVENT_IOC_DETACH (Since Linux 3.xx)

I think these aren't very good names for the ioctls. Maybe something
like
PERF_EVENT_IOC_MAKE_PERSISTENT
PERF_EVENT_IOC_UNPERSIST
I know that last one's not a real word but I can't think of what the
proper term would be. Maybe
PERF_EVENT_IOC_RELEASE_PERSISTENT
PERF_EVENT_IOC_RECLAIM_PERSISTENT

> This is for Linux man-pages:

Thanks, though you're missing out by not learning all about troff
formatting.

> 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.

> 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?

> 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.

> 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.

Vince


\
 
 \ /
  Last update: 2013-08-22 20:21    [W:0.147 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site