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

Bluetooth: add exit path handling #67069

Closed
wants to merge 2 commits into from
Closed

Conversation

karthi012
Copy link
Contributor

When no response from the controller the host will BT_ASSERT the system which will go system reset, return on error will
result the bluetooth initialization failure and handle exit path.

added hci driver close support for h4 and h5

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
bt_hci_cmd_send_sync will return 0 on error if
CONFIG_BT_ASSERT is disabled, which make bt_enable
success even if there is no response from controller

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
@alwa-nordic
Copy link
Collaborator

Aborting threads may be not safe. Resources like mutexes are not automatically freed. Is the intention to be able to recover normal operation without reboot? Then we may need a safer approach. Or is the intention just to delay the system reset so the app can gracefully reset?

@jori-nordic
Copy link
Collaborator

jori-nordic commented Jan 3, 2024

Why not call bt_disable()? That is supposed to be the Bluetooth "exit path".

Could you also add a test? As @alwa-nordic said there are probably side-effects, e.g. resource leaks with the current patch.

Note that when this assert happens, it usually means either:

  • controller is completely borked, has probably asserted if running over h4 / IPC
  • host got itself in a deadlock

In both cases, attempting to re-start the Bluetooth subsystem will probably not work anyways. The non-bluetooth parts of the app might be salvageable though if that was your intention with this patch.

@kruithofa kruithofa removed their request for review January 17, 2024 12:08
@Thalley Thalley removed their request for review February 2, 2024 10:06
Copy link

github-actions bot commented Apr 3, 2024

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Apr 3, 2024
@parthitce parthitce removed the Stale label Apr 5, 2024
@karthi012
Copy link
Contributor Author

@alwa-nordic @jori-nordic Thanks for your comments. First i'm apologizing for long silence here. Let me share my thoughts on this, Consider a we have host and controller as running separately, let's take a nrf91dk for example, nrf9160 runnning host stack and nrf52840 in nrf91dk running as controller, There are possible case that the controller may not able to respond and if the controller is not responding, then reset the whole system is not wise option. IMO, if controller is not responding, application should take care of bluetooth failure, i think that is the wise option. Otherwise, we can end up in reset loop.
Let me check what could be the possible option here. But i need your thoughts on this. Thanks.

@MaureenHelm
Copy link
Member

@alwa-nordic @jori-nordic please revisit

@jori-nordic
Copy link
Collaborator

application should take care of bluetooth failure, i think that is the wise option

That's what I was suggesting in my comment above with bt_disable().

@alwa-nordic
Copy link
Collaborator

alwa-nordic commented May 23, 2024

What I'm saying is that I would prefer that we don't use k_thread_abort. It's a type of "come from", that is difficult to reason about. I would prefer that we signal the thread to exit gracefully.

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Jul 23, 2024
@parthitce parthitce removed the Stale label Jul 23, 2024
@jori-nordic
Copy link
Collaborator

jori-nordic commented Jul 23, 2024

@parthitce why did you remove the stale label? author is not responding

@parthitce
Copy link
Member

@parthitce why did you remove the stale label? author is not responding

@karthi012 is part of our team and he is currently occupied with other activities. IMO he should be able to respond sooner with the rebase and updates here. Also he doesn't have the rights to remove the stale in Zephyr RTOS repo, which I help him with.

@karthi012
Copy link
Contributor Author

Apologies here. I have been pretty occupied. I wil update this PR in upcoming week.

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Nov 14, 2024
@jhedberg
Copy link
Member

Apologies here. I have been pretty occupied. I wil update this PR in upcoming week.

@karthi012 this comment was made two months ago without any updates since then. Are you really planning to do anything about this PR anymore?

@github-actions github-actions bot removed the Stale label Nov 15, 2024
@karthi012
Copy link
Contributor Author

Worked mostly on free time. I have changes in my local which is not working completely. Need to fix that.

I'm closing this PR for now, will open PR once i'm finished.

@karthi012 karthi012 closed this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants