Skip to content

Conversation

@cvinayak
Copy link
Contributor

ULL reference count is checked in ULL_LOW context to decide
if LLL events are pending, but the reference count can be
decremented by the ULL HIGH execution context which can
prevent the set disabled_cb function not being called due
to no pending event to produce the done events.

Fixed by checking the reference count in the ULL HIGH
execution context using a mayfly to schedule the check.

Signed-off-by: Vinayak Kariappa Chettimada [email protected]

@cvinayak cvinayak requested review from asmk-ot and mtpr-ot August 18, 2021 01:49
@cvinayak cvinayak force-pushed the github_lll_pending_check branch 3 times, most recently from b6fa31e to 005a50d Compare August 18, 2021 11:18
@cvinayak cvinayak marked this pull request as ready for review August 23, 2021 10:09
@cvinayak cvinayak requested a review from Thalley August 23, 2021 10:19
Copy link
Contributor

@Thalley Thalley left a comment

Choose a reason for hiding this comment

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

LGTM, but unsure about the details of the changes, so definitely need someone with more knowledge to really check it.

@mtpr-ot
Copy link
Contributor

mtpr-ot commented Aug 23, 2021

This is a complex set of changes. Will need to take some more time to review.

@cvinayak
Copy link
Contributor Author

This is a complex set of changes. Will need to take some more time to review.

@mtpr-ot The changes in this PR are to make access to ULL reference count context safe with ULL_HIGH priority != ULL_LOW priority, in which scenarios ULL_HIGH where reference count gets decremented would pre-empt the ULL_LOW code after ull_ref_get() call.

Copy link
Contributor

@mtpr-ot mtpr-ot Aug 24, 2021

Choose a reason for hiding this comment

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

Please update comment

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is correct. For some reason the calling context was assumed to be ULL_LOW, but it's called from conn_cleanup, which is ULL_HIGH.

Copy link
Contributor

@mtpr-ot mtpr-ot Aug 24, 2021

Choose a reason for hiding this comment

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

Calling cig_disabled_cb here directly in ULL_HIGH seems like the correct thing to do. However, this will cause recursing call to cis_disabled_cb, when more than one CIS is associated with an ACL connection - which it cannot handle. Either we need to make sure cis_released_cb is deferred, or for efficiency, we will need to guard for re-entrance into cis_disabled_cb to prevent stopping ticker twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Give me a solution ;-), will chaining the call to cig_disabled_cb using mayfly help?

Copy link
Contributor

Choose a reason for hiding this comment

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

In cis_disabled_cb, check at entry if this is the last CIS, and only then stop ticker at end of function. This ensures that (efficient) handling of disabling multiple CISes associated with same ACL conn, where this function would be called recursively in certain cases.
E.g.:

is_last_cis = cig->lll.num_cis == 1;
.
.
if (is_last_cis && cig->lll.num_cis == 0) {
    ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR,
    .
    .

As an alternative, pull out the ull_con_iso commit, and I'll do it in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As an alternative, pull out the ull_con_iso commit, and I'll do it in a separate PR.

Ok, seems best, will remove the commit from the PR, you can clean up the commit and send it in a new PR.

@cvinayak cvinayak added this to the v2.7.0 milestone Aug 26, 2021
Use consistent naming for ticker operation callback
functions.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
ULL reference count is checked in ULL_LOW context to decide
if LLL events are pending, but the reference count can be
decremented by the ULL HIGH execution context which can
prevent the set `disabled_cb` function not being called due
to no pending event to produce the done events.

Fixed by checking the reference count in the ULL HIGH
execution context using a mayfly to schedule the check.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
Minor rename of Connection ISO disabled callback function
names.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
@cvinayak cvinayak force-pushed the github_lll_pending_check branch from 005a50d to f6628d8 Compare August 27, 2021 06:55
@cvinayak cvinayak requested a review from mtpr-ot August 27, 2021 06:56
@cfriedt cfriedt merged commit 22a48e5 into zephyrproject-rtos:main Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants