Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

break from long loops on shutdown request #971

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

en-sc
Copy link
Collaborator

@en-sc en-sc commented Dec 1, 2023

In loops that typically take longer time to complete, check if there is a pending shutdown request. If so, terminate the loop. This allows to respond to a signal requesting a shutdown during some loops which do not return control to main OpenOCD loop.

@en-sc en-sc force-pushed the en-sc/keep-alive branch 2 times, most recently from a5d385f to b0bdd59 Compare December 1, 2023 13:34
@en-sc
Copy link
Collaborator Author

en-sc commented Dec 1, 2023

Related patch to mainline OpenOCD: https://review.openocd.org/c/openocd/+/8032

Copy link
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this improvement.

As already noted in the upstream review (https://review.openocd.org/c/openocd/+/8032):

  • Please create a new error code to denote interrupted operation, e.g. ERROR_INTERRUPTED or ERROR_SHUTDOWN
  • Is the new function openocd_shutdown_by_signal() needed? If so, please give it a better name.

@en-sc en-sc force-pushed the en-sc/keep-alive branch 3 times, most recently from c8573c8 to 0658f6c Compare December 7, 2023 10:38
src/target/riscv/program.c Outdated Show resolved Hide resolved
src/target/riscv/riscv-013.c Outdated Show resolved Hide resolved
src/target/riscv/riscv.c Outdated Show resolved Hide resolved
@en-sc en-sc force-pushed the en-sc/keep-alive branch 2 times, most recently from 620aa69 to f50344c Compare December 12, 2023 08:07
@en-sc en-sc changed the title check if shutdown is requested on keep_alive() break from long loops on shutdown request Dec 13, 2023
@en-sc
Copy link
Collaborator Author

en-sc commented Dec 25, 2023

@JanMatCodasip, can you please take a look at this one. The only difference with recently merged to mainline https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff;h=2e920a212fbe2de705811d547c169c1ae1611a02 is RISC-V specific.

timsifive
timsifive previously approved these changes Dec 26, 2023
JanMatCodasip
JanMatCodasip previously approved these changes Jan 2, 2024
Copy link
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you.

@JanMatCodasip
Copy link
Collaborator

@en-sc There is now a little conflict in riscv_program_exec() after merging another merge request. Could you please resolve it. Thank you.

In loops that typically take longer time to complete, check if there is
a pending shutdown request. If so, terminate the loop.

This allows to respond to a signal requesting a shutdown during some
loops which do not return control to main OpenOCD loop.

Change-Id: Iace0b58eddde1237832d0f9333a7c7b930565674
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
@en-sc
Copy link
Collaborator Author

en-sc commented Jan 9, 2024

@JanMatCodasip, I've resolved the merge conflict you mentioned. Please, take a look.

@JanMatCodasip
Copy link
Collaborator

I've resolved the merge conflict you mentioned.

Thank you. If nobody comes with any other feedback, let's merge tomorrow.

Generally, I would recommend to have a cool-down period 1-2 days for approved merge requests prior to the actual merge -- to give anyone from the community some time window to post additional comments, if desired so.

@JanMatCodasip JanMatCodasip merged commit b6fa69b into riscv-collab:riscv Jan 11, 2024
4 checks passed
@en-sc en-sc deleted the en-sc/keep-alive branch January 11, 2024 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants