From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu
Subject: Re: [PATCH] perf_event: fix loss of notification with multi-event sampling
Date: Tue, 22 Nov 2011 11:40:57 +0100 [thread overview]
Message-ID: <1321958457.5148.17.camel@twins> (raw)
In-Reply-To: <20111116145320.GA20146@quad>
On Wed, 2011-11-16 at 15:53 +0100, Stephane Eranian wrote:
> + /* ring_buffer waitq pointer */
> + wait_queue_head_t *waitq;
Not a big issue, but is there a reason to keep this pointer instead of
always having to do:
rcu_read_lock();
rb = rcu_dereference(event->rb);
if (rb)
wake_up_all(rb->waitq);
rcu_read_unlock();
Hmm, looking at that there must be a reason we go through all the RCU
trouble for event->rb, assuming there is, your lack of rcu in say
perf_poll() could go funny.
/me ponders..
Ah, could it be a race of poll()/wakeup() vs perf_event_set_output() ?
Suppose you're a threaded proglet and either one cpu/thread has an
incoming event that does a wakeup, or one thread is stuck in poll()
whilst another thread does perf_event_set_output(), it could swizzle the
event->rb right out from under you.
Now, this is of course a somewhat silly thing to do.. but still it
shouldn't make things go *bang*.
Now the above wake_up_all() thing would work just fine, its just poll()
that I'm not sure how to fix.
next prev parent reply other threads:[~2011-11-22 10:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 14:53 [PATCH] perf_event: fix loss of notification with multi-event sampling Stephane Eranian
2011-11-22 10:40 ` Peter Zijlstra [this message]
2011-11-22 13:15 ` Stephane Eranian
2011-11-22 13:29 ` Peter Zijlstra
2011-11-22 14:13 ` Stephane Eranian
2011-11-22 14:28 ` Stephane Eranian
2011-11-22 21:15 ` Peter Zijlstra
2011-11-23 9:30 ` Stephane Eranian
2011-11-23 10:06 ` Peter Zijlstra
2011-11-23 10:10 ` Stephane Eranian
2011-11-23 10:36 ` Peter Zijlstra
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=1321958457.5148.17.camel@twins \
--to=peterz@infradead.org \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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