From: Robert Richter <rric@kernel.org>
To: Vince Weaver <vincent.weaver@maine.edu>
Cc: Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Jiri Olsa <jolsa@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 12/12] [RFC] perf, persistent: ioctl functions to control persistency
Date: Tue, 27 Aug 2013 13:54:22 +0200 [thread overview]
Message-ID: <20130827115422.GD15884@rric.localhost> (raw)
In-Reply-To: <alpine.DEB.2.10.1308231704450.24113@vincent-weaver-1.um.maine.edu>
On 23.08.13 17:08:11, Vince Weaver wrote:
> On Fri, 23 Aug 2013, Borislav Petkov wrote:
>
> > Maybe this makes it more understandable for you but this is beside the
> > point.
>
> Understandability doesn't matter?
I agree with Vince on this, the naming should be intuitive. Esp. since
'attach' is used in tracing in different context, we should avoid
using the term here for less confusion.
I got another idea for this, what about UNCLAIM and CLAIM? It is
exactly, what it is. A process unclaims an event telling it doesn't
care anymore. Another process comes and claims the event, meaning the
process wants the event no longer to be shared with others and being
released after closing.
> > But I have to say the reversed thing above does sound confusing, now
> > that I'm looking at the code. Actually, at the time we discussed this,
> > my idea was to do it like this:
> >
> > 1. we open a perf event and get its file descriptor
> > 2. ioctl ATTACH to it so that it is attached to the process.
> >
> > ... do some tracing and collecting and fiddling...
You don't need to attach to a persistent event, you can just use the
event with perf_event_open, mmap, close.
> > 3. ioctl DETACH from it so that it is "forked in the background" so to
> > speak, very similar to a background job in the shell.
With 'detach' we move the event into the 'background' so that it is
still available after opening.
> Would it make sense to actually fork a kernel thread that "owns" the
> event?
There is no need for a kernel thread, there is nothing to do. We just
increase the refcount so that the event is not destroyed.
> The way it is now events can "get loose" if either the user
> forgets about them or the tool that opened them crashes, and it's
> impossible to kill these events with normal tools. You possibly
> wouldn't even know one was running (except you'd have one fewer
> counter to work with) unless you poked around under /sys.
As boris said, there could be some sort of 'kill' tool for events.
That's what we need sysfs for, it tells which events are running.
> > 4. The rest of the code continues and deallocates the event *BUT* (and
> > this is the key thing!) the counter/tracepoint remains operational in
> > the kernel, running all the time.
The event remains operational esp. after closing it or killing/
terminating the process owning it.
> > 5. Now, after a certain point, you come back and ioctl ATTACH to this
> > already opened event and read/collect its buffers again.
-Robert
next prev parent reply other threads:[~2013-08-27 11:54 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 14:13 [PATCH v3 00/12] perf, persistent: Add persistent events Robert Richter
2013-08-22 14:13 ` [PATCH v3 01/12] perf, mmap: Factor out ring_buffer_detach_all() Robert Richter
2013-08-22 14:13 ` [PATCH v3 02/12] perf, mmap: Factor out try_get_event()/put_event() Robert Richter
2013-08-22 14:13 ` [PATCH v3 03/12] perf, mmap: Factor out perf_alloc/free_rb() Robert Richter
2013-08-22 14:13 ` [PATCH v3 04/12] perf, mmap: Factor out perf_get_fd() Robert Richter
2013-08-22 14:13 ` [PATCH v3 05/12] perf: Add persistent events Robert Richter
2013-08-22 14:13 ` [PATCH v3 06/12] mce, x86: Enable " Robert Richter
2013-08-22 14:13 ` [PATCH v3 07/12] perf, persistent: Implementing a persistent pmu Robert Richter
2013-08-22 14:13 ` [PATCH v3 08/12] perf, persistent: Exposing persistent events using sysfs Robert Richter
2013-08-22 18:00 ` Vince Weaver
2013-08-23 9:37 ` Robert Richter
2013-08-23 16:39 ` Vince Weaver
2013-08-27 11:16 ` Robert Richter
2013-08-22 14:13 ` [PATCH v3 09/12] perf, persistent: Use unique event ids Robert Richter
2013-08-22 14:13 ` [PATCH v3 10/12] perf, persistent: Implement reference counter for events Robert Richter
2013-08-22 14:13 ` [PATCH v3 11/12] perf, persistent: Dynamically resize list of sysfs entries Robert Richter
2013-08-22 14:13 ` [PATCH v3 12/12] [RFC] perf, persistent: ioctl functions to control persistency Robert Richter
2013-08-22 18:18 ` Vince Weaver
2013-08-23 9:11 ` Borislav Petkov
2013-08-23 9:45 ` Robert Richter
2013-08-23 10:44 ` Robert Richter
2013-08-23 11:34 ` Borislav Petkov
2013-08-23 17:07 ` Vince Weaver
2013-08-23 19:39 ` Borislav Petkov
2013-08-23 21:08 ` Vince Weaver
2013-08-23 21:09 ` Borislav Petkov
2013-08-27 11:54 ` Robert Richter [this message]
2013-08-27 12:22 ` Borislav Petkov
2013-08-27 12:41 ` Robert Richter
2013-08-27 12:48 ` Borislav Petkov
2013-08-23 10:07 ` Robert Richter
2013-08-27 12:17 ` Robert Richter
2013-08-24 9:38 ` [PATCH v3 00/12] perf, persistent: Add persistent events Borislav Petkov
2013-08-27 12:27 ` Robert Richter
2013-08-27 12:38 ` Borislav Petkov
2014-03-28 14:54 ` Jean Pihet
2014-03-29 9:42 ` Borislav Petkov
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=20130827115422.GD15884@rric.localhost \
--to=rric@kernel.org \
--cc=acme@infradead.org \
--cc=bp@alien8.de \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=vincent.weaver@maine.edu \
/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).