On Thu, Jul 03, 2014 at 11:36:38AM +0800, Chen LinX wrote:
From: "Chen LinX" <linx.z.chen@xxxxxxxxx>But it does not, right?
when do cpu hotplug test and run below perf test together, pmu may access freed perf_event
while true;
do
perf record -a -g -f sleep 10
rm perf.*
done
the scenario is that when cpu offline firstly, the 'perf_cpu_notify' will disable event on the
pmu and remove it from the context list. after cpu online, the perf app may enable the event
that without linked in context list again. when cpu offine the second time, the 'perf_cpu_notify'Failed how, below is __perf_install_in_context.
can't disable event on the pmu as the event doesn't link to context list. the perf app may free
this event later(the free procedure try to disable event on the pmu but as the cpu is offline,
the 'cpu_function_call(event->cpu, __perf_remove_from_context, event)' is failed)
. then afterIn fact it does not. If you look at perf_event_enable() there's a code
cpu online again, pmu will access freed perf_event and hit panic.
so adding PERF_ATTACH_CONTEXT flag check before enable event to avoid this scenario.
path that doesn't call __perf_event_enable().
[ 157.670138 ] [<ffffffff8216321f>] __perf_install_in_context+0xff/0x170And yet, __perf_install_in_context isn't mentioned at all in the above.
Change-Id: I7265d83159b9180e9be3a370ba50e067385547bdWrong SoB-chain, Yanmin didn't author this patch did he, seeing how From
Signed-off-by: Yanmin Zhang <yanmin.zhang@xxxxxxxxx>
Signed-off-by: Chen LinX <linx.z.chen@xxxxxxxxx>
is you. And Yanmin didn't actually send me this patch either.