Re: Linux module for causing a system hard lock-up
On Thu, Jun 9, 2011 at 11:46, Michael Blizek mic...@michaelblizek.twilightparadox.com wrote: Hi! I am not sure whether my version works on smp. If it does not, maybe try something like this: #include linux/stop_machine.h int func(void *) { while (1) { } return 0; } int init_module(void) { stop_machine(func, 0, 0); return 0; } -Michi I vote thisI was into the same situation years ago, when I inaccidentally do busy looping during kernel module load. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Linux module for causing a system hard lock-up
Hi all, I am trying to hard lockup my Linux system (Debian) for evaluating some crash report mechanism. Basically, what I want to do is to load a module that will cause a non-interruptible hang. I found the following code on this website (http://oslearn.blogspot.com/2011/04/use-nmi-watchdog.html), but the module fails to hard lockup my system: #include linux/module.h #include linux/kernel.h /* printk() */ int init_module(void) { unsigned long flags; static spinlock_t lock; spin_lock_init(lock); spin_lock_irqsave(lock, flags); printk(KERN_INFO Hello, world\n); spin_lock_irqsave(lock, flags); //spin_lock(lock); printk(KERN_INFO Hello, world\n); return 0; } void cleanup_module(void) { printk(KERN_INFO Goodbye cruel world\n); } Could anyone please let me know how can I achieve this? Thanks in advance. John K. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux module for causing a system hard lock-up
Hello, Could anyone please let me know how can I achieve this? Is hard lockup detector enabled in your system? Could you post your .config. thanks, Daniel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
RE: Linux module for causing a system hard lock-up
Hello, Could anyone please let me know how can I achieve this? Is hard lockup detector enabled in your system? Could you post your .config. Hi there, At the moment I haven't enabled a hard lockup detector (I guess you're talking about NMI watchdog, right?) but I am just trying to hard lockup Linux using a kernel module. I was expecting the posted module to do that but apparently it doesn't (Linux still works great after loading it). Thanks, John K. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
RE: Linux module for causing a system hard lock-up
-Original Message- From: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies- boun...@kernelnewbies.org] On Behalf Of limp Sent: Wednesday, June 08, 2011 3:24 PM To: kernelnewbies@kernelnewbies.org Cc: 'Daniel Baluta' Subject: RE: Linux module for causing a system hard lock-up Hello, Could anyone please let me know how can I achieve this? Is hard lockup detector enabled in your system? Could you post your .config. Hi there, At the moment I haven't enabled a hard lockup detector (I guess you're talking about NMI watchdog, right?) but I am just trying to hard lockup Linux using a kernel module. I was expecting the posted module to do that but apparently it doesn't (Linux still works great after loading it). Thanks, John K. Looking at your original code, I would expect it to lock up a single processor system but not an SMP system. On SMP spinlock_irq_save() will disable interrupts on the local CPU, but they are still enabled on the others. You might want to try replacing the calls to spinlock_irq_save() with calls to cli(), which if I am not mistaken will disable interrupts on all CPUs. Something like this perhaps: int init_module(void) { cli(); return 0; } Or perhaps this: int init_module(void) { cli(); while(1); return 0; } ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux module for causing a system hard lock-up
On Wed, Jun 08, 2011 at 11:24:06PM +0100, limp wrote: Hello, Could anyone please let me know how can I achieve this? Is hard lockup detector enabled in your system? Could you post your .config. Hi there, At the moment I haven't enabled a hard lockup detector (I guess you're talking about NMI watchdog, right?) but I am just trying to hard lockup Linux using a kernel module. I was expecting the posted module to do that but apparently it doesn't (Linux still works great after loading it). That's because only the thread that loaded the module is stuck, not the whole system. It continues on just fine, you are going to have to do more work to bring the whole system down. greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux module for causing a system hard lock-up
Hi! On 20:27 Wed 08 Jun , limp wrote: Hi all, I am trying to hard lockup my Linux system (Debian) for evaluating some crash report mechanism. ... int init_module(void) { unsigned long flags; static spinlock_t lock; spin_lock_init(lock); spin_lock_irqsave(lock, flags); printk(KERN_INFO Hello, world\n); spin_lock_irqsave(lock, flags); //spin_lock(lock); printk(KERN_INFO Hello, world\n); return 0; } Do you have SMP? On non-smp spin_lock_irqsave is mapped to local_irq_save(). Maybe try this: int init_module(void) { unsigned long iflags; local_irq_save(iflags); while (1) { } local_irq_restore(iflags); return 0; } -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies