[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B5576D8.90804@cn.fujitsu.com>
Date: Tue, 19 Jan 2010 17:09:44 +0800
From: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
To: Frederic Weisbecker <fweisbec@...il.com>
CC: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
Paul Mackerras <paulus@...ba.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] perf_event: fix race in perf_swevent_get_recursion_context()
Frederic Weisbecker wrote:
>
> I still don't understand the problem.
>
> It's not like a fight between different cpus, it's a local per cpu
> fight.
>
> NMIs can't nest other NMIs but hardirq can nest another hardirqs,
> we don't care much about these though.
> So let's imagine the following sequence, a fight between nested
> hardirqs:
>
> cpuctx->recursion[irq] initially = 0
>
> Interrupt (level 0):
>
> if (cpuctx->recursion[rctx]) {
> put_cpu_var(perf_cpu_context);
> return -1;
> }
>
> Interrupt (level 1):
>
>
> cpuctx->recursion[rctx]++; // = 1
>
> ...
> do something
> ...
> cpuctx->recursion[rctx]--; // = 0
>
> End Interrupt (level 1)
>
> cpuctx->recursion[rctx]++; // = 1
>
> ...
> do something
> ...
> cpuctx->recursion[rctx]--; // = 0
>
> End interrupt (level 0)
>
> Another sequence could be Interrupt level 0 has
> already incremented recursion and we are interrupted by
> irq level 1 which then won't be able to get the recursion
> context. But that's not a big deal I think.
>
Thanks Frederic, i forget this feature of nesting of hard-irq :-(
Sorry for disturb you all
- Xiao
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists