Unable to remove kernel module showing permanent using lsmod
Dear All, Need your assistance: Currently I am using Wind River Linux distribution OS with kernel version 2.6.27.39 and Wind River version pne-3. After loading of my kernel module, I found it was permanent in the kernel using lsmod (for ex see below Ref 1). When I tried to remove, it was displaying as “ERROR: Removing 'hsl_module': Device or resource busy”. For your information, the same module is working fine with the Wind River pne-2 Linux Distribution OS with kernel version 2.6.21.
From the kernel source, I came to know that only possibility of showing permanent is “if there is non-availability of cleanup_module and with the availability of init_module”.
But in my case, cleanup module also available in memory, after loading the module. I used to check using the file in /proc/kallsyms for the availability of cleanup module in memory. Thanks for reading. Prompt reply is expected to identify the root cause. Ref 1: Module Size Used by hsl_module 530454 0 [permanent] Thanks, Sakthi Selvam
On Thu, Mar 24, 2011 at 12:08, sakthi selvam <sakthi.cdm@gmail.com> wrote:
But in my case, cleanup module also available in memory, after loading the module. I used to check using the file in /proc/kallsyms for the availability of cleanup module in memory.
AFAIK, such thing could happen due to certain data structure(s) from that module that are continously accessed or locked. So, to avoid race condition ( and missing pointer), keeping the module in memory is the right way to do. But of course, AFAIK too, you can try rmmod -f. But the risk is all yours. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
On 03/24/2011 01:38 PM, Mulyadi Santosa wrote:
On Thu, Mar 24, 2011 at 12:08, sakthi selvam<sakthi.cdm@gmail.com> wrote:
But in my case, cleanup module also available in memory, after loading the module. I used to check using the file in /proc/kallsyms for the availability of cleanup module in memory. AFAIK, such thing could happen due to certain data structure(s) from that module that are continously accessed or locked. So, to avoid race condition ( and missing pointer), keeping the module in memory is the right way to do.
But of course, AFAIK too, you can try rmmod -f. But the risk is all yours.
I got same problem too. Doing rmmod -f doesnt solve it. Any other solution?
On Thu, Mar 24, 2011 at 02:47:15PM +0700, Kacrut wrote:
On 03/24/2011 01:38 PM, Mulyadi Santosa wrote:
On Thu, Mar 24, 2011 at 12:08, sakthi selvam<sakthi.cdm@gmail.com> wrote:
But in my case, cleanup module also available in memory, after loading the module. I used to check using the file in /proc/kallsyms for the availability of cleanup module in memory. AFAIK, such thing could happen due to certain data structure(s) from that module that are continously accessed or locked. So, to avoid race condition ( and missing pointer), keeping the module in memory is the right way to do.
But of course, AFAIK too, you can try rmmod -f. But the risk is all yours.
I got same problem too. Doing rmmod -f doesnt solve it. Any other solution?
Nope, your kernel is probably configured to not allow kernel modules to be unloaded. I would ask your vendor about this as they are the ones that can support your kernel the best, not the community. best of luck, greg k-h
Hi sakthi, On Wed, Mar 23, 2011 at 10:08 PM, sakthi selvam <sakthi.cdm@gmail.com> wrote:
Dear All,
Need your assistance:
Currently I am using Wind River Linux distribution OS with kernel version 2.6.27.39 and Wind River version pne-3. After loading of my kernel module, I found it was permanent in the kernel using lsmod (for ex see below Ref 1). When I tried to remove, it was displaying as “ERROR: Removing 'hsl_module': Device or resource busy”. For your information, the same module is working fine with the Wind River pne-2 Linux Distribution OS with kernel version 2.6.21.
From the kernel source, I came to know that only possibility of showing permanent is “if there is non-availability of cleanup_module and with the availability of init_module”.
But in my case, cleanup module also available in memory, after loading the module. I used to check using the file in /proc/kallsyms for the availability of cleanup module in memory.
Thanks for reading. Prompt reply is expected to identify the root cause.
Ref 1: Module Size Used by hsl_module 530454 0 [permanent]
Modules show up as permanent when they don't have a module_exit procedure declared. Since no module_exit was provided, they can't be unloaded. -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com
Dear all, Thanks for your suggestion. Finally, I identified the solution for the permanent issued I faced after loading my kernel module. The solution is the kernel macro; 'USE_IMMEDIATE' has to be defined (to be given as -DUSE_IMMEDIATE along with compiler flags) during compilation of my module. Actually, I don't know much deep about the usage of this kernel macro and how it resolves the issue, but one thing I came to know that it was used during module relocation while inserting the module. If anyone help me to get know much about it, then it will be fine. Also, for your information, I have used my own Makefile for compilation of kernel loadable modules. So, I have to add myself this macro to get rid of this permanent issue. Another fine solution is, you can make use of kernel build Makefile itself (if linux kernel version is above 2.4) to build your kernel loadable modules. Because it itself include all default macros and flags needed for compilation of your module. I have specified below the sample Makefile for compiling kernel loadable modules with kernel build Makefile. *Reference:* obj-m += hello.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean Regards, Sakthi On Thu, Mar 24, 2011 at 10:38 AM, sakthi selvam <sakthi.cdm@gmail.com>wrote:
Dear All,
Need your assistance:
Currently I am using Wind River Linux distribution OS with kernel version 2.6.27.39 and Wind River version pne-3. After loading of my kernel module, I found it was permanent in the kernel using lsmod (for ex see below Ref 1). When I tried to remove, it was displaying as “ERROR: Removing 'hsl_module': Device or resource busy”. For your information, the same module is working fine with the Wind River pne-2 Linux Distribution OS with kernel version 2.6.21. From the kernel source, I came to know that only possibility of showing permanent is “if there is non-availability of cleanup_module and with the availability of init_module”.
But in my case, cleanup module also available in memory, after loading the module. I used to check using the file in /proc/kallsyms for the availability of cleanup module in memory.
Thanks for reading. Prompt reply is expected to identify the root cause.
Ref 1: Module Size Used by hsl_module 530454 0 [permanent]
Thanks, Sakthi Selvam
On Sun, Apr 17, 2011 at 13:19, sakthi selvam <sakthi.cdm@gmail.com> wrote:
Dear all,
Thanks for your suggestion. Finally, I identified the solution for the permanent issued I faced after loading my kernel module. The solution is the kernel macro; 'USE_IMMEDIATE' has to be defined (to be given as -DUSE_IMMEDIATE along with compiler flags) during compilation of my module.
Great! :) Well, I think this is what this list for...to help someone able to solve his/her own problem... and for sure, you learn something :) Regarding the macro, I never read about that before...quite likely that's an internal "define" block that enable a block of code (ala "if define then....")..and it seems, that's somewhat critical... -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
participants (5)
-
Dave Hylands -
Greg KH -
Kacrut -
Mulyadi Santosa -
sakthi selvam