)]}'
{"src/target/riscv/riscv.c":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"349293ad0e5cea73a041e1bd4b3be257cbca4233","unresolved":true,"context_lines":[{"line_number":4034,"context_line":""},{"line_number":4035,"context_line":"\tif (target-\u003esmp) {"},{"line_number":4036,"context_line":"\t\ttargets \u003d target-\u003esmp_targets;"},{"line_number":4037,"context_line":"\t\tentry \u003d list_first_entry(targets, struct target_list, lh);"},{"line_number":4038,"context_line":"\t\tstruct target *first_target \u003d entry-\u003etarget;"},{"line_number":4039,"context_line":"\t\tif (first_target !\u003d target) {"},{"line_number":4040,"context_line":"\t\t\tLOG_TARGET_DEBUG(target, \"target already polled in smp group %d\", target-\u003esmp);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"499e334f_7401f9be","line":4037,"updated":"2026-05-26 12:29:05.000000000","message":"There seems to be an issue with this approach regarding the interaction between `target-\u003eexamined` and `poll()`.\n\nConsider the following examples of 2 targets in an SMP group (`rv0` and `rv1`) (`rv0` is the first in the SMP group and in target list):\n\n1. Target `examine()` fails on `rv0` and continues to fail. `rv1` is never polled.\n\n2. All accesses to `rv1` fails. This causes `poll()` to fail on `rv0`. Now `rv0` is needlessly re-examined again and again (succeeds every time). Before the change both targets were re-examined.\n\n3. Examine succeeds on `rv0`, fails on `rv1`. During `poll()` of `rv0` `rv1` is accessed, **though it is not examined**. Note, that this is not specific to this patch. @Tomas, please comment on this when you have the time.\n\nTBH I don\u0027t see an easy fix for these issues.","commit_id":"3ab4f860debbad765d71fd3ba2c5add1059470aa"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"71764a5015f9989489bf596a78fca46eab7feca4","unresolved":true,"context_lines":[{"line_number":4034,"context_line":""},{"line_number":4035,"context_line":"\tif (target-\u003esmp) {"},{"line_number":4036,"context_line":"\t\ttargets \u003d target-\u003esmp_targets;"},{"line_number":4037,"context_line":"\t\tentry \u003d list_first_entry(targets, struct target_list, lh);"},{"line_number":4038,"context_line":"\t\tstruct target *first_target \u003d entry-\u003etarget;"},{"line_number":4039,"context_line":"\t\tif (first_target !\u003d target) {"},{"line_number":4040,"context_line":"\t\t\tLOG_TARGET_DEBUG(target, \"target already polled in smp group %d\", target-\u003esmp);"}],"source_content_type":"text/x-csrc","patch_set":4,"id":"381daf2a_f23222be","line":4037,"in_reply_to":"499e334f_7401f9be","updated":"2026-06-01 10:54:40.000000000","message":"Thanks for the detailed description. I made some simple modifications, which seem to fix some of the issues mentioned above.","commit_id":"3ab4f860debbad765d71fd3ba2c5add1059470aa"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"4bf6bc55e7802ed8c53fa579023513f60e736407","unresolved":true,"context_lines":[{"line_number":4042,"context_line":"\t\t\tif (t \u003d\u003d target)"},{"line_number":4043,"context_line":"\t\t\t\tbreak;"},{"line_number":4044,"context_line":"\t\t\tif (target_was_examined(t)) {"},{"line_number":4045,"context_line":"\t\t\t\tLOG_TARGET_DEBUG(target, \"target already polled in smp group %d\", target-\u003esmp);"},{"line_number":4046,"context_line":"\t\t\t\treturn i-\u003esmp_polled;"},{"line_number":4047,"context_line":"\t\t\t}"},{"line_number":4048,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"3ffab51e_2576ea92","line":4045,"updated":"2026-06-01 12:56:46.000000000","message":"This seems strange.\n\nImagine two targets. Both are examined. The order when polling is `tgt0`, `tgt1`. The order in SMP group is `tgt1`, `tgt0`.\n`riscv_openocd_poll()` is entered, `target` is `tgt0`.\nFirst iteration of the `foreach_smp_target`, `tgt1` is not `target`, `tgt1` is examined, this log message is printed and `riscv_openocd_poll()` is exited. Seems like an error.\n\nMoreover, the check `target_was_examined(t)` is a property of `t`, but reporting is done on `target`, which is not equal to `t`.","commit_id":"2513d81c72e7c405d4701594660bad122d1941c0"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"e052bba4ab07149e81aa35c2f1dc09003cf67a81","unresolved":true,"context_lines":[{"line_number":4042,"context_line":"\t\t\tif (t \u003d\u003d target)"},{"line_number":4043,"context_line":"\t\t\t\tbreak;"},{"line_number":4044,"context_line":"\t\t\tif (target_was_examined(t)) {"},{"line_number":4045,"context_line":"\t\t\t\tLOG_TARGET_DEBUG(target, \"target already polled in smp group %d\", target-\u003esmp);"},{"line_number":4046,"context_line":"\t\t\t\treturn i-\u003esmp_polled;"},{"line_number":4047,"context_line":"\t\t\t}"},{"line_number":4048,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"f458bbdf_7162888a","line":4045,"in_reply_to":"3ffab51e_2576ea92","updated":"2026-06-01 14:43:06.000000000","message":"\u003eImagine two targets. Both are examined. The order when polling is tgt0, tgt1. \u003eThe order in SMP group is tgt1, tgt0.\n\nI didn\u0027t consider the possibility of inconsistency between the order of the polling targets(based on `target create`) and the order of the smp goup(based on `target smp`) here.\n\n\u003eMoreover, the check target_was_examined(t) is a property of t, but reporting \u003eis done on target, which is not equal to t.\n\nBased on the above assumption, under `target_was_examined(t) \u003d\u003d true`, all harts have already been polled.","commit_id":"2513d81c72e7c405d4701594660bad122d1941c0"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"4bf6bc55e7802ed8c53fa579023513f60e736407","unresolved":true,"context_lines":[{"line_number":4043,"context_line":"\t\t\t\tbreak;"},{"line_number":4044,"context_line":"\t\t\tif (target_was_examined(t)) {"},{"line_number":4045,"context_line":"\t\t\t\tLOG_TARGET_DEBUG(target, \"target already polled in smp group %d\", target-\u003esmp);"},{"line_number":4046,"context_line":"\t\t\t\treturn i-\u003esmp_polled;"},{"line_number":4047,"context_line":"\t\t\t}"},{"line_number":4048,"context_line":"\t\t}"},{"line_number":4049,"context_line":"\t} else {"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"ea056d34_cdc64dfe","line":4046,"updated":"2026-06-01 12:56:46.000000000","message":"Returning a `bool` seems like an error.\n\nMoreover, AFAIU `i` corresponds to `target`, which is not equal to `t` here. I don\u0027t get what is the intention here.","commit_id":"2513d81c72e7c405d4701594660bad122d1941c0"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"4bf6bc55e7802ed8c53fa579023513f60e736407","unresolved":true,"context_lines":[{"line_number":4100,"context_line":""},{"line_number":4101,"context_line":"\tif (result !\u003d ERROR_OK) {"},{"line_number":4102,"context_line":"\t\tLOG_TARGET_WARNING(target, \"failed to poll all harts\u0027 state\");"},{"line_number":4103,"context_line":"\t\treturn i-\u003esmp_polled;"},{"line_number":4104,"context_line":"\t}"},{"line_number":4105,"context_line":""},{"line_number":4106,"context_line":"\tLOG_TARGET_DEBUG(target, \"should_remain_halted\u003d%d, should_resume\u003d%d\","}],"source_content_type":"text/x-csrc","patch_set":5,"id":"a2ae6fca_e3bed866","line":4103,"updated":"2026-06-01 12:56:46.000000000","message":"Same as above. Returning a `bool` instead of an error code.","commit_id":"2513d81c72e7c405d4701594660bad122d1941c0"}]}
