On 9 November 2018 at 21:34, Josh Poimboeuf <jpoim...@redhat.com> wrote: > On Fri, Nov 09, 2018 at 02:57:46PM -0500, Steven Rostedt wrote: >> On Fri, 9 Nov 2018 13:35:05 -0600 >> Josh Poimboeuf <jpoim...@redhat.com> wrote: >> .. >> > > So what's the reason for skipping init calls? >> > >> > This is the runtime changing code (static_call_update). Presumably the >> > init sections no longer exist and we shouldn't write to any (former) >> > call sites there. >> > >> > That's probably a dangerous assumption though... If >> > static_call_update() were called early, some init code might not get >> > patched and then call into the wrong function. >> > >> > I'm thinking we should just disallow static call sites in init sections. >> > I can't think of a good reason why they would be needed in init code. >> > We can WARN when detecting them during boot / module init. >> > >> >> What I would do is to allow init (like ftrace now does). I have >> ftrace_free_init_mem() that removes all the mcount references for init >> calls from its list. You could add a static_call_free_init() to >> kernel_init() in init/main.c too. > > That makes sense for ftrace, but I don't see much point in allowing it > for static calls. Maybe we could just add support for it later if it > turns out to be useful. >
I don't see how you can prevent that. Some arch may use a static call in its version of some library code which could be used anywhere, including in .init code.