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

Sde shutdown #41

Merged
merged 5 commits into from
Jul 3, 2023
Merged

Sde shutdown #41

merged 5 commits into from
Jul 3, 2023

Conversation

adanalis
Copy link
Contributor

This PR fixes the code that unregisters counters in the presence of groups. The basic idea behind the change is adding a reference count to each counter so we can keep track of the number of groups it belongs to. In the process of fixing this, I also abstracted the use of the hash-tables a bit, so we don't access their internal structure from multiple places in the code, and added some locking to prevent race conditions between reading and shutdown.

@gcongiu gcongiu requested review from gcongiu and removed request for gcongiu June 30, 2023 09:50
@adanalis adanalis force-pushed the sde_shutdown branch 2 times, most recently from 97d74fd to 058c16e Compare June 30, 2023 17:12
@gcongiu gcongiu self-requested a review June 30, 2023 17:14
@adanalis adanalis force-pushed the sde_shutdown branch 2 times, most recently from 8a9fa16 to 9844e0f Compare July 3, 2023 15:37
This function helps abstract the hash-table from other parts of the
code, instead of directly accessing the internal structure of the
hash table from all over the place.
Protected reading funtion with locks so it can't race against papi_sde_shutdown().
Counters can belong in groups, even multiple groups, and groups can recursively
belong in larger groups. This means that a counter (or group) cannot be
unregistered and freed without keep track of which groups it belong to.
Now each counter has a reference counter "ref_count" which is incremented
when it's added in a group and decremented when the counter is unregistered,
or when a parent group is unregistered.
If reading a group has been requested from the application/tool layer
(though PAPI_event_name_to_code()) before the group is actually registered
by the library, we will create a placeholder for it. This change allows
the group registration to overwrite the placeholder.
If the item being deleted from the hash-table happened to be on
the head of a list and there was no other item in the list, then
the head was not being cleaned properly.
@gcongiu gcongiu merged commit 517b23a into icl-utk-edu:master Jul 3, 2023
13 checks passed
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