^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) %define api.pure full
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) %parse-param {void *_parse_state}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) %parse-param {void *scanner}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) %lex-param {void* scanner}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) %locations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) %{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define YYDEBUG 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <fnmatch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/zalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "pmu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "evsel.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "parse-events.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "parse-events-bison.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define ABORT_ON(val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) if (val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) YYABORT; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static struct list_head* alloc_list(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) list = malloc(sizeof(*list));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) if (!list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) INIT_LIST_HEAD(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) return list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static void free_list_evsel(struct list_head* list_evsel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct evsel *evsel, *tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) list_for_each_entry_safe(evsel, tmp, list_evsel, core.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) list_del_init(&evsel->core.node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) evsel__delete(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) free(list_evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) static void inc_group_count(struct list_head *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct parse_events_state *parse_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* Count groups only have more than 1 members */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if (!list_is_last(list->next, list))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) parse_state->nr_groups++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) %}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) %token PE_START_EVENTS PE_START_TERMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) %token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_SW PE_RAW PE_TERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) %token PE_VALUE_SYM_TOOL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) %token PE_EVENT_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) %token PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) %token PE_BPF_OBJECT PE_BPF_SOURCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) %token PE_MODIFIER_EVENT PE_MODIFIER_BP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) %token PE_ERROR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) %token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) %token PE_ARRAY_ALL PE_ARRAY_RANGE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) %token PE_DRV_CFG_TERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) %type <num> PE_VALUE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) %type <num> PE_VALUE_SYM_HW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) %type <num> PE_VALUE_SYM_SW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) %type <num> PE_VALUE_SYM_TOOL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) %type <num> PE_RAW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) %type <num> PE_TERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) %type <num> value_sym
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) %type <str> PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) %type <str> PE_BPF_OBJECT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) %type <str> PE_BPF_SOURCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) %type <str> PE_NAME_CACHE_TYPE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) %type <str> PE_NAME_CACHE_OP_RESULT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) %type <str> PE_MODIFIER_EVENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) %type <str> PE_MODIFIER_BP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) %type <str> PE_EVENT_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) %type <str> PE_DRV_CFG_TERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) %destructor { free ($$); } <str>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) %type <term> event_term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) %destructor { parse_events_term__delete ($$); } <term>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) %type <list_terms> event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) %type <list_terms> opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) %type <list_terms> opt_pmu_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) %destructor { parse_events_terms__delete ($$); } <list_terms>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) %type <list_evsel> event_pmu
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) %type <list_evsel> event_legacy_symbol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) %type <list_evsel> event_legacy_cache
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) %type <list_evsel> event_legacy_mem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) %type <list_evsel> event_legacy_tracepoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) %type <list_evsel> event_legacy_numeric
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) %type <list_evsel> event_legacy_raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) %type <list_evsel> event_bpf_file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) %type <list_evsel> event_def
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) %type <list_evsel> event_mod
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) %type <list_evsel> event_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) %type <list_evsel> event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) %type <list_evsel> events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) %type <list_evsel> group_def
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) %type <list_evsel> group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) %type <list_evsel> groups
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) %destructor { free_list_evsel ($$); } <list_evsel>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) %type <tracepoint_name> tracepoint_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) %destructor { free ($$.sys); free ($$.event); } <tracepoint_name>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) %type <array> array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) %type <array> array_term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) %type <array> array_terms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) %destructor { free ($$.ranges); } <array>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) %union
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) char *str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) u64 num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) struct list_head *list_evsel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct list_head *list_terms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct tracepoint_name {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) char *sys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) char *event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) } tracepoint_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct parse_events_array array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) %%
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) start:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) PE_START_EVENTS start_events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) PE_START_TERMS start_terms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) start_events: groups
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) /* frees $1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) parse_events_update_lists($1, &parse_state->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) groups:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) groups ',' group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct list_head *list = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) struct list_head *group = $3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /* frees $3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) parse_events_update_lists(group, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) groups ',' event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) struct list_head *list = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct list_head *event = $3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /* frees $3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) parse_events_update_lists(event, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) group:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) group_def ':' PE_MODIFIER_EVENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct list_head *list = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) err = parse_events__modifier_group(list, $3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) free($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) free_list_evsel(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) group_def
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) group_def:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) PE_NAME '{' events '}'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) struct list_head *list = $3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) inc_group_count(list, _parse_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) parse_events__set_leader($1, list, _parse_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) '{' events '}'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) struct list_head *list = $2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) inc_group_count(list, _parse_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) parse_events__set_leader(NULL, list, _parse_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) events:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) events ',' event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) struct list_head *event = $3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) struct list_head *list = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) /* frees $3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) parse_events_update_lists(event, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) event: event_mod
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) event_mod:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) event_name PE_MODIFIER_EVENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) struct list_head *list = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * Apply modifier on all events added by single event definition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) * (there could be more events added for multiple tracepoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) * definitions via '*?'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) err = parse_events__modifier_event(list, $2, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) free($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) free_list_evsel(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) event_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) event_name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) PE_EVENT_NAME event_def
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) err = parse_events_name($2, $1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) free_list_evsel($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) $$ = $2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) event_def
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) event_def: event_pmu |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) event_legacy_symbol |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) event_legacy_cache sep_dc |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) event_legacy_mem |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) event_legacy_tracepoint sep_dc |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) event_legacy_numeric sep_dc |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) event_legacy_raw sep_dc |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) event_bpf_file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) event_pmu:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) PE_NAME opt_pmu_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) struct parse_events_error *error = parse_state->error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) struct list_head *list = NULL, *orig_terms = NULL, *terms= NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) char *pattern = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) #define CLEANUP_YYABORT \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) parse_events_terms__delete($2); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) parse_events_terms__delete(orig_terms); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) free(list); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) free($1); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) free(pattern); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) YYABORT; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) } while(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) if (parse_events_copy_term_list($2, &orig_terms))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) CLEANUP_YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) error->idx = @1.first_column;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) if (!list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) CLEANUP_YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) if (parse_events_add_pmu(_parse_state, list, $1, $2, false, false)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) struct perf_pmu *pmu = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) int ok = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) if (asprintf(&pattern, "%s*", $1) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) CLEANUP_YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) while ((pmu = perf_pmu__scan(pmu)) != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) char *name = pmu->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) if (!strncmp(name, "uncore_", 7) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) strncmp($1, "uncore_", 7))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) name += 7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) if (!fnmatch(pattern, name, 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) if (parse_events_copy_term_list(orig_terms, &terms))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) CLEANUP_YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true, false))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) ok++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) parse_events_terms__delete(terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) if (!ok)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) CLEANUP_YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) parse_events_terms__delete($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) parse_events_terms__delete(orig_terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) free(pattern);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) #undef CLEANUP_YYABORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) PE_KERNEL_PMU_EVENT sep_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) err = parse_events_multi_pmu_add(_parse_state, $1, &list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) char pmu_name[128];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) snprintf(pmu_name, sizeof(pmu_name), "%s-%s", $1, $3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) free($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) if (parse_events_multi_pmu_add(_parse_state, pmu_name, &list) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) PE_PMU_EVENT_FAKE sep_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) if (!list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) err = parse_events_add_pmu(_parse_state, list, $1, NULL, false, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) PE_PMU_EVENT_FAKE opt_pmu_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) if (!list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) err = parse_events_add_pmu(_parse_state, list, $1, $2, false, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) parse_events_terms__delete($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) value_sym:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) PE_VALUE_SYM_HW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) PE_VALUE_SYM_SW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) event_legacy_symbol:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) value_sym '/' event_config '/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) int type = $1 >> 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) int config = $1 & 255;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) err = parse_events_add_numeric(_parse_state, list, type, config, $3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) parse_events_terms__delete($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) free_list_evsel(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) value_sym sep_slash_slash_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) int type = $1 >> 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) int config = $1 & 255;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) ABORT_ON(parse_events_add_numeric(_parse_state, list, type, config, NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) PE_VALUE_SYM_TOOL sep_slash_slash_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) ABORT_ON(parse_events_add_tool(_parse_state, list, $1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) event_legacy_cache:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) struct parse_events_error *error = parse_state->error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) err = parse_events_add_cache(list, &parse_state->idx, $1, $3, $5, error, $6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) parse_events_terms__delete($6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) free($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) free($5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) free_list_evsel(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) struct parse_events_error *error = parse_state->error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) err = parse_events_add_cache(list, &parse_state->idx, $1, $3, NULL, error, $4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) parse_events_terms__delete($4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) free($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) free_list_evsel(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) PE_NAME_CACHE_TYPE opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) struct parse_events_error *error = parse_state->error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) err = parse_events_add_cache(list, &parse_state->idx, $1, NULL, NULL, error, $2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) parse_events_terms__delete($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) free_list_evsel(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) event_legacy_mem:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) err = parse_events_add_breakpoint(list, &parse_state->idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) $2, $6, $4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) free($6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) if (parse_events_add_breakpoint(list, &parse_state->idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) $2, NULL, $4)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) err = parse_events_add_breakpoint(list, &parse_state->idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) $2, $4, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) free($4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) PE_PREFIX_MEM PE_VALUE sep_dc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) if (parse_events_add_breakpoint(list, &parse_state->idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) $2, NULL, 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) event_legacy_tracepoint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) tracepoint_name opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) struct parse_events_error *error = parse_state->error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) error->idx = @1.first_column;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) err = parse_events_add_tracepoint(list, &parse_state->idx, $1.sys, $1.event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) error, $2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) parse_events_terms__delete($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) free($1.sys);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) free($1.event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) tracepoint_name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) PE_NAME '-' PE_NAME ':' PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) struct tracepoint_name tracepoint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) ABORT_ON(asprintf(&tracepoint.sys, "%s-%s", $1, $3) < 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) tracepoint.event = $5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) free($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) $$ = tracepoint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) PE_NAME ':' PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) struct tracepoint_name tracepoint = {$1, $3};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) $$ = tracepoint;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) event_legacy_numeric:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) PE_VALUE ':' PE_VALUE opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) err = parse_events_add_numeric(_parse_state, list, (u32)$1, $3, $4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) parse_events_terms__delete($4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) event_legacy_raw:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) PE_RAW opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) err = parse_events_add_numeric(_parse_state, list, PERF_TYPE_RAW, $1, $2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) parse_events_terms__delete($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) event_bpf_file:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) PE_BPF_OBJECT opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) err = parse_events_load_bpf(parse_state, list, $1, false, $2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) parse_events_terms__delete($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) PE_BPF_SOURCE opt_event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) struct list_head *list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) list = alloc_list();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) ABORT_ON(!list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) err = parse_events_load_bpf(_parse_state, list, $1, true, $2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) parse_events_terms__delete($2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) free(list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) $$ = list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) opt_event_config:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) '/' event_config '/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) $$ = $2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) '/' '/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) $$ = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) $$ = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) opt_pmu_config:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) '/' event_config '/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) $$ = $2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) '/' '/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) $$ = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) start_terms: event_config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) struct parse_events_state *parse_state = _parse_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) if (parse_state->terms) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) parse_events_terms__delete ($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) parse_state->terms = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) event_config:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) event_config ',' event_term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) struct list_head *head = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) struct parse_events_term *term = $3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) if (!head) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) parse_events_term__delete(term);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) list_add_tail(&term->list, head);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) $$ = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) event_term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) struct list_head *head = malloc(sizeof(*head));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) struct parse_events_term *term = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) ABORT_ON(!head);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) INIT_LIST_HEAD(head);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) list_add_tail(&term->list, head);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) $$ = head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) event_term:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) PE_RAW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_CONFIG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) NULL, $1, false, &@1, NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) PE_NAME '=' PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) if (parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) $1, $3, &@1, &@3)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) free($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) PE_NAME '=' PE_VALUE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) if (parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) $1, $3, false, &@1, &@3)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) PE_NAME '=' PE_VALUE_SYM_HW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) int config = $3 & 255;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) if (parse_events_term__sym_hw(&term, $1, config)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) if (parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) $1, 1, true, &@1, NULL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) PE_VALUE_SYM_HW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) int config = $1 & 255;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) PE_TERM '=' PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) if (parse_events_term__str(&term, (int)$1, NULL, $3, &@1, &@3)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) free($3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) PE_TERM '=' PE_VALUE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3, false, &@1, &@3));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) PE_TERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1, true, &@1, NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) PE_NAME array '=' PE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) if (parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) $1, $4, &@1, &@4)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) free($4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) free($2.ranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) term->array = $2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) PE_NAME array '=' PE_VALUE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) if (parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) $1, $4, false, &@1, &@4)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) free($2.ranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) term->array = $2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) PE_DRV_CFG_TERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) char *config = strdup($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) ABORT_ON(!config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) if (parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_DRV_CFG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) config, $1, &@1, NULL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) free($1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) free(config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) YYABORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) $$ = term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) array:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) '[' array_terms ']'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) $$ = $2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) PE_ARRAY_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) $$.nr_ranges = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) $$.ranges = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) array_terms:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) array_terms ',' array_term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) struct parse_events_array new_array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) new_array.nr_ranges = $1.nr_ranges + $3.nr_ranges;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) new_array.ranges = realloc($1.ranges,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) sizeof(new_array.ranges[0]) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) new_array.nr_ranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) ABORT_ON(!new_array.ranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) memcpy(&new_array.ranges[$1.nr_ranges], $3.ranges,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) $3.nr_ranges * sizeof(new_array.ranges[0]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) free($3.ranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) $$ = new_array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) array_term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) array_term:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) PE_VALUE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) struct parse_events_array array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) array.nr_ranges = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) array.ranges = malloc(sizeof(array.ranges[0]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) ABORT_ON(!array.ranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) array.ranges[0].start = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) array.ranges[0].length = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) $$ = array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) PE_VALUE PE_ARRAY_RANGE PE_VALUE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) struct parse_events_array array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) ABORT_ON($3 < $1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) array.nr_ranges = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) array.ranges = malloc(sizeof(array.ranges[0]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) ABORT_ON(!array.ranges);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) array.ranges[0].start = $1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) array.ranges[0].length = $3 - $1 + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) $$ = array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) sep_dc: ':' |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) sep_slash_slash_dc: '/' '/' | ':' |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) %%
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) void parse_events_error(YYLTYPE *loc, void *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) void *scanner __maybe_unused,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) char const *msg __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951) parse_events_evlist_error(parse_state, loc->last_column, "parser error");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) }