Re: [PATCH -mm] tracing: Fix section mismatch intrace_hw_branches.c

From: Frederic Weisbecker
Date: Sun Feb 22 2009 - 11:22:49 EST


On Sun, Feb 22, 2009 at 07:33:08PM +0600, Rakib Mullick wrote:
> On 2/21/09, Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:
>
> > Hi,
> >
> > When I saw this patch, I searched the real purpose of __cpuinit and its
> > real impact.
> > But I didn't find any comments about it inside the kernel.
> >
> > But today, by looking at the discussion around latest git pull for x86
> > to mainline, I discover that __cpuinit becomes __init on UP.
> >
> > So, unless I missed something, this patch seems to me very dangerous.
> > The init and reset callbacks of a tracer can be called at any time, not only
> > on initcalls time (__init functions are freed from memory after the middle stage
> > of the boot).
> > With this patch, on UP we will dereference freed memory while activating this tracer.
> If the init and reset callbacks of a tracer can be called regardless
> of cpu hotpluging then it is. If the tracer's init or reset doesn't
> rely on cpuhotplug then it shouldn't use it.
> There's a another way to fix the warning is by remove __cpuinitdata
> from bts_hotcpu_notifier.


Yes, they can be called on UP, on SMP with or without cpu hotplug,
and everytime (boot, runtime).

init() is called when you switch to a tracer:

echo tracer_name > /debug/tracing/current_tracer

and reset() is called when you switch to another one.

But removing __cpuinitdata will mean a kind of waste of memory (though it's only
a little struct).


> Thanks,

--
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/