Attention is currently required from: Raul Rangel, Julius Werner, Rob Barnes, Karthik Ramasubramanian. Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/59021 )
Change subject: arch/x86/smp/spinlock: Fix threading when !STAGE_HAS_SPINLOCKS ......................................................................
Patch Set 2:
(2 comments)
File src/arch/x86/include/arch/smp/spinlock.h:
https://review.coreboot.org/c/coreboot/+/59021/comment/4fc0d775_87bb6758 PS2, Line 21: static spinlock_t x = SPIN_LOCK_UNLOCKED;
The lock variable is never accessed, so the compiler just removes it. Thus we don't need a . […]
What I meant was that !ROMSTAGE_OR_BEFORE is sort-of wrong guard to use here. With DRAM in your romstage you could have clean spinlock implemented for romstage.
https://review.coreboot.org/c/coreboot/+/59021/comment/17405903_4d98405f PS2, Line 50: thread_coop_disable();
In your first example, there is nothing wrong with disabling threading. […]
This function is attributed with __always_inline but got added a function call into it with CB:56320. I wasn't there then for review, but this alone would have gotten -1 from me when such a thing was not argumented at all.
There is a (serializing ?) rdmsr instruction in current_thread() implementation for both coop_disable() and coop_enable() which I do not count that as a noop. I find it odd to have spin_lock() implementation that now does not implement the lock but does something else.
Let's assume one has a serial console and lots of printk's going on. Majority of the time, co-operative muiltitasking is effectively disabled?