Linux Kernel : Not able to load simple linux kernel module with workqueues -
i'm having issue using workqueues in linux kernel module. modules compiles without giving error @ time of loading fails. i'm not able load following module , getting following error in dmesg.
[root@nanderson test_mod]# insmod workqueue_test.ko insmod: error: 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 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 {\ 13 printk(kern_info "++ %s %d %s\n", __func__, __line__,\ 14 current->comm);\ 15 } while (0); 16 17 #define log_info() \ 18 {\ 19 printk(kern_info "%s %d %s\n", __func__, __line__,\ 20 current->comm); mdelay(1000);\ 21 } while (0); 22 23 #define log_exit() \ 24 {\ 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 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 looked /proc/kallsysm unknown symbols reposted insmod looks symbols available following output:-
[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 tell me might problem or i'm missing ?
thanks.
you need
module_license("gpl");
in code use gpl symbols (exported using export_symbol_gpl).
otherwise module loader not see such symbols.
Comments
Post a Comment