> Oh! SMP_PAUSE actually jumps here! I would *not* expect that, when I<br><div><includetail><div style="font:Verdana normal 14px;color:#000;"><div style="position:relative;">> read code like this:<br>><br>    > SMP_PAUSE(active);<br>       > foo();<br>   > bar(42);<br> > SMP_RESUME();<br>><br>> Something like the following would be a lot clearer for me:<br>><br>      > if (mhartid() == active) {<br>               > foo();<br>> bar(42);<br>    > }<br>> <br>> Or maybe:<br>><br>   > if (running_on_hart(active)) { ... }<br>><br>> But note that this lacks the barriers/locking that your code has.<br>><br>> Jonathan Neuschäfer</div><div style="position:relative;"><br></div>```<br>if (running_on_hart(active)) { ... }<br>```<br>Yes, these codes are clearer.<br><br>/*<br> * If your code needs to temporarily block multiple-threads, do this:<br> *     SMP_PAUSE(active)    // `active` is hartid of working thread<br> *     ... single-threaded work ...<br> *     SMP_RESUME()<br> *     ... multi-threaded work ...<br> */<br>But sometimes multi-threaded work has to wait for the single-threaded work to complete.<br><br>etc:<br>    single-threaded work : init ddr controller<br>    multi-threaded work  : some operations related to memory<br><br>It is necessary to wait for the completion of single-threaded work.<div style="position:relative;"><span id="result_box" class="" lang="en"><span class=""><br></span></span></div><div style="position:relative;">Xiang Wang<br></div></div><!--<![endif]--></includetail></div>