[coreboot] Fw:Re: I want to submit some code, but there aresomeproblems.
王翔
merle at tya.email
Tue Jul 3 16:10:49 CEST 2018
> Oh! SMP_PAUSE actually jumps here! I would *not* expect that, when I
> read code like this:
>
> SMP_PAUSE(active);
> foo();
> bar(42);
> SMP_RESUME();
>
> Something like the following would be a lot clearer for me:
>
> if (mhartid() == active) {
> foo();
> bar(42);
> }
>
> Or maybe:
>
> if (running_on_hart(active)) { ... }
>
> But note that this lacks the barriers/locking that your code has.
>
> Jonathan Neuschäfer
```
if (running_on_hart(active)) { ... }
```
Yes, these codes are clearer.
/*
* If your code needs to temporarily block multiple-threads, do this:
* SMP_PAUSE(active) // `active` is hartid of working thread
* ... single-threaded work ...
* SMP_RESUME()
* ... multi-threaded work ...
*/
But sometimes multi-threaded work has to wait for the single-threaded work to complete.
etc:
single-threaded work : init ddr controller
multi-threaded work : some operations related to memory
It is necessary to wait for the completion of single-threaded work.
Xiang Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot/attachments/20180703/761199fa/attachment.html>
More information about the coreboot
mailing list