All of lore.kernel.org
 help / color / mirror / Atom feed
* perf: PERF_FLAG_FD_OUTPUT has been broken since 2.6.35
@ 2015-01-08 15:22 Vince Weaver
  2015-01-09 16:00 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Vince Weaver @ 2015-01-08 15:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo

Hello,

I was working on improving the manpage by working out how the 
perf_event_open() PERF_FLAG_FD_OUTPUT flag works.

It turns out it doesn't.

In kernel/events/core.c when opening a file this is done:

        if (output_event) {
           err = perf_event_set_output(event, output_event);
           if (err)
              goto err_context;
        }

	and perf_event_set_output() does:

                if (output_event->cpu == -1 && output_event->ctx != event->ctx) {
                   goto out;
                }

	But event->ctx is always NULL; it does not get set to ctx until
	after the call to perf_event_set_output().

	It looks like this was broken back in 2.6.35 days with the change:

		commit ac9721f3f54b27a16c7e1afb2481e7ee95a70318
		Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
		Date:   Thu May 27 12:54:41 2010 +0200

		perf_events: Fix races and clean up perf_event and perf_mmap_data interaction

So is this worth fixing seeing as apparently no one uses this feature?

As an aside, added error reporting is *really* needed as I had to sprinkle
all of events/core.c with printk() calls to even begin to understand why
I was getting the EINVAL result.

Vince

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-13 11:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 15:22 perf: PERF_FLAG_FD_OUTPUT has been broken since 2.6.35 Vince Weaver
2015-01-09 16:00 ` Peter Zijlstra
2015-01-09 16:26   ` Vince Weaver
2015-01-09 23:17     ` Arnaldo Carvalho de Melo
2015-01-13  9:36     ` Peter Zijlstra
2015-01-13 11:56       ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.