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

[Backport v2.7-branch] kernel shell, stacks shell commands: always use k_thread_foreach_unlocked #64658

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

finikorg
Copy link
Collaborator

@finikorg finikorg commented Oct 31, 2023

call k_thread_foreach_unlocked to avoid assertions caused by calling shell_print while holding a global lock

Fixes #32145

call k_thread_foreach_unlocked to avoid assertions caused
by calling shell_print while holding a global lock

Signed-off-by: Maxim Adelman <[email protected]>
(cherry picked from commit ecf2cb5)
@github-actions github-actions bot added the area: Shell Shell subsystem label Oct 31, 2023
@finikorg finikorg marked this pull request as ready for review October 31, 2023 17:47
@jhedberg jhedberg changed the title kernel shell, stacks shell commands: iterate unlocked on SMP [Backport v2.7-branch] kernel shell, stacks shell commands: iterate unlocked on SMP Nov 6, 2023
@cfriedt
Copy link
Member

cfriedt commented Jan 9, 2024

@jakub-uC - I think this one might require your approval

@cfriedt
Copy link
Member

cfriedt commented Jan 30, 2024

@jakub-uC - just a gentle ping again. Does this backport look OK to you?

@henrikbrixandersen henrikbrixandersen added this to the v2.7.6 milestone Feb 8, 2024
Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

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

Actually, upon revisiting this, I think we need to exclusively use the unlocked variant here, which would mirror main.

k_thread_foreach_unlocked(shell_tdata_dump, (void *)sh);

@cfriedt
Copy link
Member

cfriedt commented Feb 13, 2024

@finikorg - would you be able to do perform the necessary rework?

@finikorg
Copy link
Collaborator Author

@finikorg - would you be able to do perform the necessary rework?

Is backport assumes we backport existing changes only?

@cfriedt
Copy link
Member

cfriedt commented Feb 13, 2024

@finikorg - would you be able to do perform the necessary rework?

Is backport assumes we backport existing changes only?

Yeah, technically, I guess that's the case - so maybe cherry-picking multiple commits would be better.

Copy link
Contributor

@jakub-uC jakub-uC left a comment

Choose a reason for hiding this comment

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

Change itself is fine for me. I apologize, I've missed this PR.

@cfriedt cfriedt self-requested a review February 27, 2024 17:37
@cfriedt cfriedt changed the title [Backport v2.7-branch] kernel shell, stacks shell commands: iterate unlocked on SMP [Backport v2.7-branch] kernel shell, stacks shell commands: always use k_thread_foreach_unlocked Feb 27, 2024
@cfriedt
Copy link
Member

cfriedt commented Feb 27, 2024

4c731f2 has been cherry-picked on top of the original commit which reflects what is in main today and has resolved the same bug reported by multiple organizations.

Always use k_thread_foreach_unlocked with callbacks which print
something out to the shell, as they might call arch_irq_unlock.
Fixes #66660.

Signed-off-by: Benedikt Schmidt <[email protected]>
(cherry picked from commit 4c731f2)
@cfriedt cfriedt force-pushed the backport-59244-to-v2.7-branch branch from dd63f90 to 1d73bfa Compare February 27, 2024 17:59
@cfriedt cfriedt merged commit 25398f3 into v2.7-branch Feb 27, 2024
22 checks passed
@nashif nashif deleted the backport-59244-to-v2.7-branch branch November 16, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Shell Shell subsystem
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants