Linux Kernel: Unable to load simple Linux kernel module with jobs
I am having a problem using working tiers in my Linux kernel module. My modules compile without any error, but it fails during load. I am unable to load the next module and get the following error in dmesg.
[root@nanderson test_mod]# insmod workqueue_test.ko
insmod: ERROR: could not insert module workqueue_test.ko: Unknown symbol in module
[root@nanderson test_mod]# dmesg -c
[50404.453417] workqueue_test: Unknown symbol destroy_workqueue (err 0)
[50404.453437] workqueue_test: Unknown symbol __alloc_workqueue_key (err 0)
[root@nanderson test_mod]#
Following is the module code: -
1 #include <linux/module.h>
2 #include <linux/kernel.h>
3 #include <linux/kthread.h>
4 #include <linux/blkdev.h>
5 #include <linux/fs.h>
6 #include <linux/delay.h>
7 #include <linux/workqueue.h>
8 #include <linux/completion.h>
9
10
11 #define LOG_ENTRY() \
12 do {\
13 printk(KERN_INFO "++ %s %d %s\n", __func__, __LINE__,\
14 current->comm);\
15 } while (0);
16
17 #define LOG_INFO() \
18 do {\
19 printk(KERN_INFO "%s %d %s\n", __func__, __LINE__,\
20 current->comm); mdelay(1000);\
21 } while (0);
22
23 #define LOG_EXIT() \
24 do {\
25 printk(KERN_INFO "-- %s %d %s\n", __func__, __LINE__,\
26 current->comm);\
27 } while (0);
28
29
30 void
31 async_callback(void *data)
32 {
33
34 }
35
36 int
37 init_module(void)
38 {
39 struct workqueue_struct *async_queue;
40
41 LOG_ENTRY();
42 if ((async_queue = create_workqueue("HGST_WORKQUEUE")) == NULL) {
43 printk(KERN_ERR "failed to create workqueue\n");
44 return -1;
45 }
46
47 mdelay(10000);
48 destroy_workqueue(async_queue);
49 LOG_EXIT();
50 return 0;
51 }
52
53
54 void
55 cleanup_module(void)
56 {
57 printk(KERN_INFO "Unloading MOdule..\n");
58 }
I also looked at / proc / kallsysm for unknown characters that were sent by insmod, it looks like the characters available are as follows: -
[root@nanderson test_mod]# cat /proc/kallsyms | grep __alloc_workqueue_key
ffffffff81084a10 T __alloc_workqueue_key
ffffffff8187a090 r __ksymtab___alloc_workqueue_key
ffffffff8188bd70 r __kcrctab___alloc_workqueue_key
ffffffff81892ba0 r __kstrtab___alloc_workqueue_key
[root@nanderson test_mod]#
Can someone tell me what might be the problem or am I missing something?
Thank.
+3
source to share