kmod/core: protect kpatch_[un]register with mutex

Use a mutex in the register/unregister functions to protect changes to
kpatch_num_registered, kpatch_func_hash and calls to the ftrace
functions by other register/unregister invocations.
kmod/core: improve performance for cumulative patching

When multiple patch modules patch the same function, there's no need to
patch all the intermediate functions.  Just hook them all into the
original function and use the ftrace handler to find the newest one.

Also use a mutex in the register/unregister functions to protect changes
to kpatch_num_registered, kpatch_func_hash and calls to the ftrace
functions by other register/unregister invocations.
Merge pull request #69 from jpoimboe/core-cumulative-performance

kmod/core: improve performance for cumulative patching