migrate an old kernel module (working in single core) to dual core - repost
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have a kernel module code that is working fine in an old single core intel PC with linux kernel 2.4.20-8 (RedHat9). Now, i have got a new PC which has got two processors ( I guess).
# cat cpuinfo
processor : 0, vendor_id : GenuineIntel, model name: Intel(R) Pentium(R) 4 CPU 3.00GHz
processor : 1, vendor_id: GenuineIntel, model name: Intel(R) Pentium(R) 4 CPU 3.00GHz
I compiled my kernel module and inserted it using insmod.
I getting a kernel panic, which was not happening when I run my code in the old PC.
My kernel module does the following.
Starts with module_init ()
As part of initialization, it does "dev_add_pack (¶m);".
Whenever a packet is received, it results in calling "my_call_back_1".
my_call_back_1 constructs a ring buffer and calls "schedule_task (&q);".
When the scheduler schedules my_call_back_2 function, it takes care of processing the packet.
When I send certain traffic to the "eth0", the kernel panic happens.
I see the backtrace as follows, where I see MULTIPLE context_thread.
NOTE: Sometimes, I see "alloc_skb" in the callback trace, sometimes I see '__kfree_skb" in the callback trace and hence I am not sure whether both the processors are trying to access the same code.
I am not sure whether the issue is due to DUAL processor or dual core.
Any special care required w.r.t semaphores?
Are the interrupts from device is getting processed by both the processors simulatenously and resulting in race conditin?
Can anyone help me to resolve this issue?