On Fri, Nov 07, 2014 at 07:40:11PM +0100, Petr Mladek wrote: > On Fri 2014-11-07 12:07:11, Seth Jennings wrote: > > On Fri, Nov 07, 2014 at 06:13:07PM +0100, Petr Mladek wrote: > > > On Thu 2014-11-06 08:39:08, Seth Jennings wrote: [...] > > > > + up(&lpc_mutex); > > > > + WARN("failed to apply patch '%s' to module '%s'\n", > > > > + patch->mod->name, mod->name); > > > > + return 0; > > > > +} > > > > + > > > > +static struct notifier_block lp_module_nb = { > > > > + .notifier_call = lp_module_notify, > > > > + .priority = INT_MIN, /* called last */ > > > > > > The handler for MODULE_STATE_COMMING would need have higger priority, > > > if we want to cleanly unregister the ftrace handlers. > > > > Yes, we might need two handlers at different priorities if we decide to > > go that direction: one for MODULE_STATE_GOING at high/max and one for > > MODULE_STATE_COMING at low/min. > > kGraft has notifier only for the going state. The initialization is > called directly from load_module() after ftrace_module_init() > and complete_formation() before it is executed by parse_args(). > > I need to investigate if the notifier is more elegant and safe or not. I looked it up and having a COMING notifier with priority INT_MIN is effectively the same as having a call between complete_formation() and parse_args() since the notifiers are called as the last thing in complete_formation(). I think I've found a clean way to avoid the ref taking on the patched modules using only the notifier and lpc_mutex. It will be in v2 (hopefully out in the next couple of days). Thanks, Seth > > Best Regards, > Petr -- To unsubscribe from this list: send the line "unsubscribe live-patching" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html