kernel_thread() for non-GPL drivers

From: Ani Sinha
Date: Tue Jun 02 2015 - 15:43:46 EST


Hi Al :

I see that there has been some code re-org in linux 3.7 starting with

commit 7076aada1040de4ed79a5977dbabdb5e5ea5e249
Author: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Date: Mon Sep 10 16:44:54 2012 -0400

x86: split ret_from_fork

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

This removed the kernel_thread() x86 specific function that was
exported to all drivers. Then the following commit added a generic
kernel_thread() function which no longer can be used by modules
because the symbol is not exported anymore :

commit 2aa3a7f8660355c3dddead17e224545c1a3d5a5f
Author: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Date: Fri Sep 21 19:55:31 2012 -0400

preparation for generic kernel_thread()

Let architectures select GENERIC_KERNEL_THREAD and have their copy_thread()
treat NULL regs as "it came from kernel_thread(), sp argument contains
the function new thread will be calling and stack_size - the argument for
that function". Switching the architectures begins shortly...

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

All arch specific code now uses this as all of them has
GENERIC_KERNEL_THREAD turned on and then later eventually this #ifdef
was also removed:

commit ae903caae267154de7cf8576b130ff474630596b
Author: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Date: Fri Dec 14 12:44:11 2012 -0500

Bury the conditionals from kernel_thread/kernel_execve series

All architectures have
CONFIG_GENERIC_KERNEL_THREAD
CONFIG_GENERIC_KERNEL_EXECVE
__ARCH_WANT_SYS_EXECVE
None of them have __ARCH_WANT_KERNEL_EXECVE and there are only two callers
of kernel_execve() (which is a trivial wrapper for do_execve() now) left.
Kill the conditionals and make both callers use do_execve().

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>


So my question to you is, which api (for x86) are drivers supposed to
use if kernel_thread() is no longer available? It looks to me like
maybe we can use kthread_run() which eventually lazily creates a
kernel thread. Is my understanding correct?

Cheers,
ani
--
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/