Under preemption, the state of the CPU must be protected. For example, on x86, entering and exiting FPU mode is now a critical section that must occur while preemption is disabled. Think what would happen if the kernel is executing a floating-point instruction and is then preempted. Remember, the kernel does not save FPU state except for user tasks. Therefore, upon preemption, the FPU registers will be sold to the lowest bidder.

Documentation/preempt-locking.txt

The reason of my computer hanging on shutdown seems to be the cpufreq driver getting preempted...

Follow

@niconiconi what have you been through to dig it up like this...

@ghost 24 hours of git bisect, another 24 hours of compiling kernel with different configurations, finally lots of printk()s, and reading things in Documentation/... And using a serial console / netconsole is mandatory here... eventually realized a few developers have already identified the problem in November and working on it...

@niconiconi I mean how do you even know where to dig at. My laptop randomly blacks out and the fan just twitches until I force-poweroff, but I can't find a clue in default logs so I just reboot every time it happens ¯\_(ツ)_/¯

@ghost sounds like a GPU hang to me, much harder to debug since it's not easily reproducible. Hanging on reboot is simpler, since you can just read the kernel source and add printk() to all the functions you've gone though, and check the logs on the console.

@niconiconi who knows, I don't recall seeing it with power plugged in, maybe something wrong with power management. cursed reproducibility

Sign in to participate in the conversation
Fairground

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!