I'm making a minimal Linux distro with buildroot to learn kernel module development.

If I call a minimal module hello.ko (or almost any other name I've tried), everything works fine.

However, if I use the exact same code, but call the module workqueue.ko, insmod workqueue.ko fails, dmesg contains:

workqueue: module is already loaded

and insmod outputs to stderr:

insmod: can't insert 'workqueue.ko': invalid argument

Both lsmod and cat /proc/modules are empty.

This is the exact repo that produced the problem.

For reference the module code is:

#include <linux/module.h>
#include <linux/kernel.h>


int init_module(void)
    printk(KERN_INFO "hello init\n");
    return 0;

void cleanup_module(void)
    printk(KERN_INFO "hello cleanup\n");

and the kernel version (default implied by buildroot) is 4.9.

1 Answer 1

$ uname -a
Linux alan-laptop 4.10.14-200.fc25.x86_64 #1 SMP Wed May 3 22:52:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ ls /sys/module/workqueue/
parameters  uevent
$ ls /sys/module/workqueue/parameters/
debug_force_rr_cpu  disable_numa  power_efficient

It's a builtin already. Maybe to provide a namespace for the parameters that effect kernel workqueue behaviour.

  • Hmmm, can you find where in the source that gets created? I could not find any settings in .config. Why not just use other /sys files that don't conflict with module names? Commented May 14, 2017 at 11:45
  • 1
    @CiroSantilli709大抓捕六四事件法轮功 You know how to define a module, you can just use git grep to search for a definition of the module workqueue.
    – sourcejedi
    Commented May 14, 2017 at 12:10
  • @CiroSantilli包子露宪六四事件法轮功 that's not what the link says. It is /sys/module/ that shows builtins like this "workqueue". They don't show up in /proc/modules.
    – sourcejedi
    Commented May 15, 2018 at 17:46
  • Yes, you are right, I copied wrong. Commented May 15, 2018 at 19:21
  • fun fact: some things under /sys/module are not necessarily moduels it seems unix.stackexchange.com/questions/225706/… Commented May 15, 2018 at 19:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .