-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Associative arrays (global or TLS) are variables that are indexed with a tuple (one or more values). The underlying storage is provided by the dvars (dynamic variables) BPF hash map. Since dvars elements are indexed using a unique 64-bit ID, and given that it provides storage for both regular TLS variables and associate array elements, the algorithms to calculate the ID are designed to provide orthogonal value ranges. 1. Thread-local storage (TLS) variables: self->a dvar key = TLS key (highest bit = 0) 2. Global associative array elements: a[tuple] dvar key = &tuples[var id, tuple, 0] (highest bit = 1) 3. TLS associative array elements: self->a[tuple] dvar key = &tuples[var id, tuple, TLS key] (highest bit = 1) Given that the TLS key can never be 0, uniqueness of the dvar key is guaranteed in this scheme. A new BPF hash map (tuples) associates the concatenation of the tuple values as key with the address of the hash map element (which is guaranteed to be unique). Since BPF maps are allocated in kernel space, these addresses will always have high order bit 1. To ensure uniqueness between global associate array elements and TLS associate array elements, and to ensure uniqueness between elements with the same tuple index in different arrays, the key in the tuples map is determined based on a rewritten tuple: [ variable ID, original tuple values, TLS variable key or 0 ] While variable IDs are not unique between variable kinds, the final component in the rewritten tuple is the TLS variable key (for TLS associative arrays - never 0) or 0 (for global associative arrays). Various new tests are added to exercise the new functionality. Running out of dynamic variable space is not being reported as a drop yet due to lack of drop counter support. It generates an error instead, and therefore the test for the drop reporting remains XFAIL. Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
34 changed files
with
880 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.