The method
struct task_struct *kthread_create_on_cpu(int(*threadfn)(void *data),
void *data, unsigned int cpu,
const char *namefmt)
is defined in kthread.c file and prototyped in kthread.h. But it is not exported.
In my driver I want to start a kthread on a given CPU, so I do:
#include <linux/kthread.h>
int udpsrv_start_single( unsigned int cpu)
{
DEBUG_PRINT_INFO( "[udpsrv] udpsrv_start: Initializing...n");
//(...)
kthread->thread = kthread_create_on_cpu((void *)kthread_start_single,
NULL, cpu, "mpsrv");
//(...)
I can compile but I get linkage error on resolving module symbols on MODPOST:
1> LD [M] /tmp/VisualKernel/mpsrvlkm.o 1> Building modules, stage 2. 1> MODPOST 1 modules 1>EXEC : warning : "kthread_create_on_cpu"[/tmp/VisualKernel/mpsrvlkm.ko] undefined!
How should I proceed? How to import this symbol or what to do instead?
Advertisement
Answer
kthread_create_on_cpu is not exported by kernel, it is internal function used by CPU hotplug threads (see linux/smpboot.h).
I suggest you to use kthread_bind instead.