Re: [stable] [perf] overflow/perf_count_sw_cpu_clock crashesrecent kernels

From: Peter Zijlstra
Date: Wed Aug 03 2011 - 07:50:45 EST


On Tue, 2011-08-02 at 09:35 -0700, Greg KH wrote:
> On Fri, Jul 29, 2011 at 01:59:10PM +0200, Peter Zijlstra wrote:
> > On Thu, 2011-07-28 at 22:05 -0700, Greg KH wrote:
> > >
> > > What is that commit id so it can be properly referenced in the patch
> > > below? And what tree should this patch go into? .39? 3.0? Anything
> > > newer?
> >
> > .32+ in as far as anybody is still maintaining them, if it fails to
> > apply to any of them (quite possible) do tell and I can provide
> > backports etc..
>
> I've applied it to 3.0, and it didn't apply to any older kernel due to
> file movements, so if you could, can you provide a version for
> .32-stable?


---
From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>

The below patch is for -stable only, upstream has a much larger patch
that contains the below hunk in commit a8b0ca17b80e92faab46ee7179ba9e99ccb61233

Vince found that under certain circumstances software event overflows
go wrong and deadlock. Avoid trying to delete a timer from the timer
callback.

Reported-by: Vince Weaver <vweaver1@xxxxxxxxxxxx>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
kernel/perf_event.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 183d437..8f97aea 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -3693,12 +3693,8 @@ static int __perf_event_overflow(struct perf_event *event, int nmi,
if (events && atomic_dec_and_test(&event->event_limit)) {
ret = 1;
event->pending_kill = POLL_HUP;
- if (nmi) {
- event->pending_disable = 1;
- perf_pending_queue(&event->pending,
- perf_pending_event);
- } else
- perf_event_disable(event);
+ event->pending_disable = 1;
+ perf_pending_queue(&event->pending, perf_pending_event);
}

perf_event_output(event, nmi, data, regs);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/