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

usdt: Decrement usdt semaphore value during probe detach #1370

Merged
merged 1 commit into from
Jun 15, 2020

Conversation

danobi
Copy link
Member

@danobi danobi commented Jun 5, 2020

Before, I think we were intentionally leaking the bcc usdt context so
that usdt semaphore values would not go back to zero. Reason is that
bcc_usdt_close() decrements usdt semaphore value.

However, this causes issues if we don't eventually decrement the counter
as the tracee will forever be on more expensive code paths.

This commit defers semaphore decrement until probe is detached.

Checklist
  • Language changes are updated in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md

@danobi danobi force-pushed the free_usdt_context branch from 451b53b to 8162b3b Compare June 5, 2020 01:25
@danobi danobi force-pushed the free_usdt_context branch from 8162b3b to f93e4c5 Compare June 5, 2020 23:32
@dalehamel
Copy link
Contributor

LGTM, as we discussed on IRC, keeping track of the semaphore in bpftrace is asking for trouble if bpftrace crashes. The kernel API i'm working on wrapping in iovisor/bcc#2738 i think avoids this, but obviously that needs to be finished first, and we'll need to support both approaches for a while, to maintain support for older kernels.

@danobi
Copy link
Member Author

danobi commented Jun 12, 2020

Yeah, kernel support would be optimal. For correctness, I think bpftrace still needs to support both approaches until we're pretty sure everyone is running a new-enough kernel.

Before, I think we were intentionally leaking the bcc usdt context so
that usdt semaphore values would not go back to zero. Reason is that
bcc_usdt_close() decrements usdt semaphore value.

However, this causes issues if we don't eventually decrement the counter
as the tracee will forever be on more expensive code paths.

This commit defers semaphore decrement until probe is detached.
@danobi danobi force-pushed the free_usdt_context branch from f93e4c5 to 0c6553d Compare June 12, 2020 18:51
@danobi danobi merged commit 825b6ff into bpftrace:master Jun 15, 2020
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.

2 participants