I want to generate a CPU soft lockup
to learn debugging crashes. How can I create a CPU soft lockup with a userspace C
program in 4.15.0-142-generic #146~16.04.1-Ubuntu SMP X86_64
platform?
Asked
Active
Viewed 245 times
0

Franc
- 319
- 9
- 28
-
@stark edited my question. – Franc Oct 19 '21 at 03:10
-
I don't really think it's possible to cause a CPU soft lookup from userspace. If there is a way, I would consider it a serious bug. After all, why would such a feature be useful? If you really wish to cause a soft lockup that is then detected you could try lowering `/proc/sys/kernel/watchdog_threshold` (but still no guarantee) or create and load a kernel module which disables interrupts and busyloops for 20+ seconds. – Marco Bonelli Oct 19 '21 at 20:32
-
@MarcoBonelli Is the answers to https://stackoverflow.com/questions/18280164/how-to-tell-the-difference-between-soft-lockup-in-kernel-and-softlockup-in-users not correct? That question was talking about soft lockup in kernel/user space. – Franc Oct 20 '21 at 04:26
-
1The fact that it *can* happen doesn't mean that it should be possible to trigger it when you want. That's what I'm trying to say. If a userspace program that does i/o communicates with some buggy or really overloaded device then yeah sure it can soft lock up, but those are to be considered bugs. And of course in kernel space if you are able to load a module you can very well do what you want and create a soft lockup... but you said from userspace, right? – Marco Bonelli Oct 20 '21 at 13:14