Attention is currently required from: Furquan Shaikh, Julius Werner. Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/56350 )
Change subject: lib/thread: Allow nesting thread_cooperate and thread_prevent_coop ......................................................................
Patch Set 2:
(4 comments)
File src/include/thread.h:
https://review.coreboot.org/c/coreboot/+/56350/comment/7c32798b_bbce09b6 PS1, Line 54: void thread_prevent_coop(void);
While we're here, are we happy with the names for this? I feel like something that makes it a bit mo […]
Done
File src/lib/thread.c:
https://review.coreboot.org/c/coreboot/+/56350/comment/08d499f9_c44113c4 PS1, Line 217: thread_cooperate();
I agree this doesn't belong here, but maybe it would be better to put it at the end of threads_initi […]
I think moving the `initialized = 1` after the `idle_thread_init` solves that problem. The reason it was before the `idle_thread_init` call was because then the BSP thread wouldn't have its `can_yield` set correctly with out it. I'll rework this.
https://review.coreboot.org/c/coreboot/+/56350/comment/c568c3a9_ac2d3eae PS1, Line 34: return (t != NULL && t->can_yield > 0);
This check is a bit odd since under normal use can_yield should either be 0 or negative. […]
Normally `can_yield` will be 1. It's setup by `prepare_thread`. I wanted to keep it so 1 means can_yield. 0 or negative means can't yield. This is why I kept the name. I can rework it if you feel strongly about it.
https://review.coreboot.org/c/coreboot/+/56350/comment/bb29a2bd_87bdc280 PS1, Line 363:
Would be good to assert() that we were in a critical section when this is called.
Done