Lines Matching refs:spec
29 * usdt.bpf.h defines two BPF maps that usdt_manager expects: USDT spec map
30 * and IP-to-spec-ID map, which is auxiliary map necessary for kernels that
112 * prepares `struct usdt_spec` (USDT spec), which is then provided to BPF-side
113 * code through spec map. This allows BPF applications to quickly fetch the
139 * potentially having a completely different USDT spec associated with it.
140 * To wire all this up together libbpf allocates a unique integer spec ID for
141 * each unique USDT spec. Spec IDs are allocated as sequential small integers
147 * Spec ID is the key in spec BPF map, value is the actual USDT spec layed out
149 * know its associated spec ID. It gets it either through BPF cookie, which
150 * libbpf sets to spec ID during attach time, or, if kernel is too old to
151 * support BPF cookie, through IP-to-spec-ID map that libbpf maintains in such
155 * calculate absolute IP addresses for IP-to-spec-ID map, and thus such mode
173 * locations. As such, it's wasteful to allocate as many USDT spec IDs as
176 * the minimal required amount of unique USDT specs (and thus spec IDs). This
177 * is trivially achieved by using USDT spec string (Arguments string from USDT
178 * note) as a lookup key in a hashmap. USDT spec string uniquely defines
180 * sharing USDT spec string can safely share the same USDT spec and spec ID.
181 * Note, this spec string deduplication is happening only during the same USDT
182 * attachment, so each USDT spec shares the same USDT cookie value. This is
184 * as even if USDT spec string is the same, USDT cookie value can be
186 * USDT attachments by taking into account USDT spec string *and* USDT cookie
187 * value, which would complicated spec ID accounting significantly for little
239 struct usdt_spec spec;
576 static int parse_usdt_spec(struct usdt_spec *spec, const struct usdt_note *note, __u64 usdt_cookie);
691 * the need to lookup USDT spec by absolute IP of
697 * an index of USDT spec), so for newer kernels with
765 /* Record adjusted addresses and offsets and parse USDT spec */
785 err = parse_usdt_spec(&target->spec, ¬e, usdt_cookie);
846 /* try to return the list of previously used spec IDs to usdt_manager
850 /* if there were no free spec IDs yet, just transfer our IDs */
908 /* check if we already allocated spec ID for this spec string */
923 /* get next free spec ID, giving preference to free list, if not empty */
927 /* cache spec ID for current spec string for future lookups */
934 /* don't allocate spec ID bigger than what fits in specs map */
940 /* cache spec ID for current spec string for future lookups */
948 /* remember new spec ID in the link for later return back to free list on detach */
1037 * newly allocated, we'll need to fill out spec map, otherwise
1038 * entire spec should be valid and can be just used by a new
1039 * uprobe. We reuse spec when USDT arg spec is identical. We
1048 if (is_new && bpf_map_update_elem(spec_map_fd, &spec_id, &target->spec, BPF_ANY)) {
1050 pr_warn("usdt: failed to set USDT spec #%d for '%s:%s' in '%s': %d\n",
1058 pr_warn("usdt: IP collision detected for spec #%d for '%s:%s' in '%s'\n",
1061 pr_warn("usdt: failed to map IP 0x%lx to spec #%d for '%s:%s' in '%s': %d\n",
1172 if (args >= data + len) /* missing arguments spec */
1190 static int parse_usdt_spec(struct usdt_spec *spec, const struct usdt_note *note, __u64 usdt_cookie)
1196 spec->usdt_cookie = usdt_cookie;
1197 spec->arg_cnt = 0;
1201 if (spec->arg_cnt >= USDT_MAX_ARG_CNT) {
1202 pr_warn("usdt: too many USDT arguments (> %d) for '%s:%s' with args spec '%s'\n",
1207 arg = &spec->args[spec->arg_cnt];
1208 len = parse_usdt_arg(s, spec->arg_cnt, arg, &arg_sz);
1221 pr_warn("usdt: unsupported arg #%d (spec '%s') size: %d\n",
1222 spec->arg_cnt, s, arg_sz);
1227 spec->arg_cnt++;
1319 pr_warn("usdt: unrecognized arg #%d spec '%s'\n", arg_num, arg_str);
1360 pr_warn("usdt: unrecognized arg #%d spec '%s'\n", arg_num, arg_str);
1419 pr_warn("usdt: unrecognized arg #%d spec '%s'\n", arg_num, arg_str);
1505 pr_warn("usdt: unrecognized arg #%d spec '%s'\n", arg_num, arg_str);
1585 pr_warn("usdt: unrecognized arg #%d spec '%s'\n", arg_num, arg_str);