Re: [BUG] Incorrect ordering of klp and ftrace module notifier callbacks

From: Jiri Kosina
Date: Thu Jan 28 2016 - 15:59:21 EST


On Thu, 28 Jan 2016, Jessica Yu wrote:

> So it doesn't look like a simple priority tweak will work, since we want a
> ftrace->klp->klp->ftrace ordering from module load->module unload. Perhaps we
> can split the ftrace and klp notifiers into separate coming and going handlers
> with the appropriate priorities set to enforce correct ordering (not terribly
> pretty, but it works). Is there a better solution?

Given the facts that:

- we want the ordering ftrace -> klp for load and klp -> ftrace for
unload

- we already do have separate klp_module_notify_coming() and
klp_module_notify_going(), and klp_module_notify() is just a stub that
decides which one to call

I'd suggest we keep just a single ftrace_module_notify() (with INT_MIN+1,
priority), and then introduce separate notifiers

- klp_module_notify_going() with INT_MIN+2, that triggers action iff
action == MODULE_STATE_GOING

- klp_module_notify_going() with INT_MIN, that triggers action only iff
action == MODULE_STATE_COMING

Thanks,

--
Jiri Kosina
SUSE Labs