/tools/lib/bpf/ |
D | bpf.c | 62 static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, in sys_bpf() argument 65 return syscall(__NR_bpf, cmd, attr, size); in sys_bpf() 68 static inline int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size) in sys_bpf_prog_load() argument 73 fd = sys_bpf(BPF_PROG_LOAD, attr, size); in sys_bpf_prog_load() 81 union bpf_attr attr; in bpf_create_map_xattr() local 83 memset(&attr, '\0', sizeof(attr)); in bpf_create_map_xattr() 85 attr.map_type = create_attr->map_type; in bpf_create_map_xattr() 86 attr.key_size = create_attr->key_size; in bpf_create_map_xattr() 87 attr.value_size = create_attr->value_size; in bpf_create_map_xattr() 88 attr.max_entries = create_attr->max_entries; in bpf_create_map_xattr() [all …]
|
/tools/arch/x86/include/asm/ |
D | inat.h | 110 static inline int inat_is_legacy_prefix(insn_attr_t attr) in inat_is_legacy_prefix() argument 112 attr &= INAT_PFX_MASK; in inat_is_legacy_prefix() 113 return attr && attr <= INAT_LGCPFX_MAX; in inat_is_legacy_prefix() 116 static inline int inat_is_address_size_prefix(insn_attr_t attr) in inat_is_address_size_prefix() argument 118 return (attr & INAT_PFX_MASK) == INAT_PFX_ADDRSZ; in inat_is_address_size_prefix() 121 static inline int inat_is_operand_size_prefix(insn_attr_t attr) in inat_is_operand_size_prefix() argument 123 return (attr & INAT_PFX_MASK) == INAT_PFX_OPNDSZ; in inat_is_operand_size_prefix() 126 static inline int inat_is_rex_prefix(insn_attr_t attr) in inat_is_rex_prefix() argument 128 return (attr & INAT_PFX_MASK) == INAT_PFX_REX; in inat_is_rex_prefix() 131 static inline int inat_last_prefix_id(insn_attr_t attr) in inat_last_prefix_id() argument [all …]
|
/tools/perf/tests/ |
D | parse-events.c | 53 TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type); in test__checkevent_tracepoint() 55 PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type); in test__checkevent_tracepoint() 56 TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period); in test__checkevent_tracepoint() 69 PERF_TYPE_TRACEPOINT == evsel->core.attr.type); in test__checkevent_tracepoint_multi() 71 PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type); in test__checkevent_tracepoint_multi() 73 1 == evsel->core.attr.sample_period); in test__checkevent_tracepoint_multi() 83 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); in test__checkevent_raw() 84 TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config); in test__checkevent_raw() 93 TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type); in test__checkevent_numeric() 94 TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config); in test__checkevent_numeric() [all …]
|
D | bp_account.c | 29 static int __event(bool is_x, void *addr, struct perf_event_attr *attr) in __event() argument 33 memset(attr, 0, sizeof(struct perf_event_attr)); in __event() 34 attr->type = PERF_TYPE_BREAKPOINT; in __event() 35 attr->size = sizeof(struct perf_event_attr); in __event() 37 attr->config = 0; in __event() 38 attr->bp_type = is_x ? HW_BREAKPOINT_X : HW_BREAKPOINT_W; in __event() 39 attr->bp_addr = (unsigned long) addr; in __event() 40 attr->bp_len = sizeof(long); in __event() 42 attr->sample_period = 1; in __event() 43 attr->sample_type = PERF_SAMPLE_IP; in __event() [all …]
|
D | wp.c | 35 static void get__perf_event_attr(struct perf_event_attr *attr, int wp_type, in get__perf_event_attr() argument 38 memset(attr, 0, sizeof(struct perf_event_attr)); in get__perf_event_attr() 39 attr->type = PERF_TYPE_BREAKPOINT; in get__perf_event_attr() 40 attr->size = sizeof(struct perf_event_attr); in get__perf_event_attr() 41 attr->config = 0; in get__perf_event_attr() 42 attr->bp_type = wp_type; in get__perf_event_attr() 43 attr->bp_addr = (unsigned long)wp_addr; in get__perf_event_attr() 44 attr->bp_len = wp_len; in get__perf_event_attr() 45 attr->sample_period = 1; in get__perf_event_attr() 46 attr->sample_type = PERF_SAMPLE_IP; in get__perf_event_attr() [all …]
|
/tools/testing/selftests/bpf/prog_tests/ |
D | obj_name.c | 25 union bpf_attr attr; in test_obj_name() local 30 ncopy = name_len < sizeof(attr.prog_name) ? in test_obj_name() 31 name_len : sizeof(attr.prog_name); in test_obj_name() 32 bzero(&attr, sizeof(attr)); in test_obj_name() 33 attr.prog_type = BPF_PROG_TYPE_SCHED_CLS; in test_obj_name() 34 attr.insn_cnt = 2; in test_obj_name() 35 attr.insns = ptr_to_u64(prog); in test_obj_name() 36 attr.license = ptr_to_u64(""); in test_obj_name() 37 memcpy(attr.prog_name, tests[i].name, ncopy); in test_obj_name() 39 fd = syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); in test_obj_name() [all …]
|
D | perf_branches.c | 104 struct perf_event_attr attr = {0}; in test_perf_branches_hw() local 109 attr.size = sizeof(attr); in test_perf_branches_hw() 110 attr.type = PERF_TYPE_HARDWARE; in test_perf_branches_hw() 111 attr.config = PERF_COUNT_HW_CPU_CYCLES; in test_perf_branches_hw() 112 attr.freq = 1; in test_perf_branches_hw() 113 attr.sample_freq = 4000; in test_perf_branches_hw() 114 attr.sample_type = PERF_SAMPLE_BRANCH_STACK; in test_perf_branches_hw() 115 attr.branch_sample_type = PERF_SAMPLE_BRANCH_USER | PERF_SAMPLE_BRANCH_ANY; in test_perf_branches_hw() 116 pfd = syscall(__NR_perf_event_open, &attr, -1, 0, -1, PERF_FLAG_FD_CLOEXEC); in test_perf_branches_hw() 145 struct perf_event_attr attr = {0}; in test_perf_branches_no_hw() local [all …]
|
D | test_global_funcs.c | 33 struct bpf_prog_load_attr attr; in check_load() local 37 memset(&attr, 0, sizeof(struct bpf_prog_load_attr)); in check_load() 38 attr.file = file; in check_load() 39 attr.prog_type = BPF_PROG_TYPE_UNSPEC; in check_load() 40 attr.log_level = extra_prog_load_log_flags; in check_load() 41 attr.prog_flags = BPF_F_TEST_RND_HI32; in check_load() 43 err = bpf_prog_load_xattr(&attr, &obj, &prog_fd); in check_load()
|
D | bpf_verif_scale.c | 22 struct bpf_prog_load_attr attr; in check_load() local 26 memset(&attr, 0, sizeof(struct bpf_prog_load_attr)); in check_load() 27 attr.file = file; in check_load() 28 attr.prog_type = type; in check_load() 29 attr.log_level = 4 | extra_prog_load_log_flags; in check_load() 30 attr.prog_flags = BPF_F_TEST_RND_HI32; in check_load() 31 err = bpf_prog_load_xattr(&attr, &obj, &prog_fd); in check_load()
|
D | task_fd_query_tp.c | 9 struct perf_event_attr attr = {}; in test_task_fd_query_tp_core() local 31 attr.config = strtol(buf, NULL, 0); in test_task_fd_query_tp_core() 32 attr.type = PERF_TYPE_TRACEPOINT; in test_task_fd_query_tp_core() 33 attr.sample_type = PERF_SAMPLE_RAW; in test_task_fd_query_tp_core() 34 attr.sample_period = 1; in test_task_fd_query_tp_core() 35 attr.wakeup_events = 1; in test_task_fd_query_tp_core() 36 pmu_fd = syscall(__NR_perf_event_open, &attr, -1 /* pid */, in test_task_fd_query_tp_core()
|
/tools/build/feature/ |
D | test-bpf.c | 24 union bpf_attr attr; in main() local 27 attr.prog_type = BPF_PROG_TYPE_KPROBE; in main() 28 attr.insn_cnt = 0; in main() 29 attr.insns = 0; in main() 30 attr.license = 0; in main() 31 attr.log_buf = 0; in main() 32 attr.log_size = 0; in main() 33 attr.log_level = 0; in main() 34 attr.kern_version = 0; in main() 35 attr.prog_flags = 0; in main() [all …]
|
/tools/testing/selftests/powerpc/ptrace/ |
D | perf-hwbreak.c | 37 static inline int sys_perf_event_open(struct perf_event_attr *attr, pid_t pid, in sys_perf_event_open() argument 41 attr->size = sizeof(*attr); in sys_perf_event_open() 42 return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags); in sys_perf_event_open() 47 struct perf_event_attr attr; in breakpoint_test() local 51 memset(&attr, 0, sizeof(attr)); in breakpoint_test() 52 attr.disabled = 1; in breakpoint_test() 53 attr.type = PERF_TYPE_BREAKPOINT; in breakpoint_test() 54 attr.bp_type = HW_BREAKPOINT_R; in breakpoint_test() 56 attr.bp_addr = (__u64)(&attr) & 0xfffffffffffff800; in breakpoint_test() 57 attr.bp_len = len; in breakpoint_test() [all …]
|
/tools/perf/util/ |
D | topdown.c | 6 int topdown_filter_events(const char **attr, char **str, bool use_group) in topdown_filter_events() argument 13 for (i = 0; attr[i]; i++) { in topdown_filter_events() 14 if (pmu_have_event("cpu", attr[i])) { in topdown_filter_events() 15 len += strlen(attr[i]) + 1; in topdown_filter_events() 16 attr[i - off] = attr[i]; in topdown_filter_events() 20 attr[i - off] = NULL; in topdown_filter_events() 32 for (i = 0; attr[i]; i++) { in topdown_filter_events() 33 strcpy(s, attr[i]); in topdown_filter_events()
|
D | evsel.c | 182 evsel->id_pos = __perf_evsel__calc_id_pos(evsel->core.attr.sample_type); in evsel__calc_id_pos() 183 evsel->is_pos = __perf_evsel__calc_is_pos(evsel->core.attr.sample_type); in evsel__calc_id_pos() 189 if (!(evsel->core.attr.sample_type & bit)) { in __evsel__set_sample_bit() 190 evsel->core.attr.sample_type |= bit; in __evsel__set_sample_bit() 199 if (evsel->core.attr.sample_type & bit) { in __evsel__reset_sample_bit() 200 evsel->core.attr.sample_type &= ~bit; in __evsel__reset_sample_bit() 215 evsel->core.attr.read_format |= PERF_FORMAT_ID; in evsel__set_sample_id() 237 struct perf_event_attr *attr, int idx) in evsel__init() argument 239 perf_evsel__init(&evsel->core, attr); in evsel__init() 251 evsel->sample_size = __evsel__sample_size(attr->sample_type); in evsel__init() [all …]
|
D | perf_api_probe.c | 32 fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, -1, flags); in perf_do_probe_api() 46 fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, -1, flags); in perf_do_probe_api() 83 evsel->core.attr.sample_type |= PERF_SAMPLE_IDENTIFIER; in perf_probe_sample_identifier() 88 evsel->core.attr.comm_exec = 1; in perf_probe_comm_exec() 93 evsel->core.attr.context_switch = 1; in perf_probe_context_switch() 98 evsel->core.attr.text_poke = 1; in perf_probe_text_poke() 123 struct perf_event_attr attr = { in perf_can_record_cpu_wide() local 137 fd = sys_perf_event_open(&attr, -1, cpu, -1, 0); in perf_can_record_cpu_wide() 151 struct perf_event_attr attr = { in perf_can_aux_sample() local 162 fd = sys_perf_event_open(&attr, -1, 0, -1, 0); in perf_can_aux_sample()
|
D | record.c | 52 struct perf_event_attr *attr = &evsel->core.attr; in evsel__config_leader_sampling() local 73 attr->freq = 0; in evsel__config_leader_sampling() 74 attr->sample_freq = 0; in evsel__config_leader_sampling() 75 attr->sample_period = 0; in evsel__config_leader_sampling() 78 attr->write_backward = 0; in evsel__config_leader_sampling() 88 attr->sample_type = read_sampler->core.attr.sample_type | in evsel__config_leader_sampling() 89 leader->core.attr.sample_type; in evsel__config_leader_sampling() 115 evsel->core.attr.comm_exec = 1; in perf_evlist__config() 134 if (evsel->core.attr.sample_type == first->core.attr.sample_type) in perf_evlist__config() 248 fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, -1, in perf_evlist__can_select_event()
|
/tools/testing/selftests/mqueue/ |
D | mq_open_tests.c | 68 static inline void test_queue(struct mq_attr *attr, struct mq_attr *result); 69 static inline int test_queue_fail(struct mq_attr *attr, struct mq_attr *result); 200 static inline void test_queue(struct mq_attr *attr, struct mq_attr *result) in test_queue() argument 205 if ((queue = mq_open(queue_path, flags, perms, attr)) == -1) in test_queue() 222 static inline int test_queue_fail(struct mq_attr *attr, struct mq_attr *result) in test_queue_fail() argument 227 if ((queue = mq_open(queue_path, flags, perms, attr)) == -1) in test_queue_fail() 241 struct mq_attr attr, result; in main() local 430 attr.mq_maxmsg = cur_max_msgs; in main() 431 attr.mq_msgsize = cur_max_msgsize; in main() 432 if (test_queue_fail(&attr, &result)) in main() [all …]
|
/tools/testing/selftests/powerpc/pmu/ |
D | per_event_excludes.c | 37 e->attr.disabled = 1; in per_event_excludes() 42 e->attr.disabled = 1; in per_event_excludes() 43 e->attr.exclude_user = 1; in per_event_excludes() 44 e->attr.exclude_hv = 1; in per_event_excludes() 49 e->attr.disabled = 1; in per_event_excludes() 50 e->attr.exclude_user = 1; in per_event_excludes() 51 e->attr.exclude_kernel = 1; in per_event_excludes() 56 e->attr.disabled = 1; in per_event_excludes() 57 e->attr.exclude_hv = 1; in per_event_excludes() 58 e->attr.exclude_kernel = 1; in per_event_excludes()
|
D | event.c | 16 int perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu, in perf_event_open() argument 19 return syscall(__NR_perf_event_open, attr, pid, cpu, in perf_event_open() 29 e->attr.type = type; in event_init_opts() 30 e->attr.config = config; in event_init_opts() 31 e->attr.size = sizeof(e->attr); in event_init_opts() 33 e->attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | \ in event_init_opts() 54 e->fd = perf_event_open(&e->attr, pid, cpu, group_fd, 0); in event_open_with_options()
|
/tools/testing/selftests/bpf/ |
D | test_stub.c | 13 struct bpf_prog_load_attr attr; in bpf_prog_test_load() local 15 memset(&attr, 0, sizeof(struct bpf_prog_load_attr)); in bpf_prog_test_load() 16 attr.file = file; in bpf_prog_test_load() 17 attr.prog_type = type; in bpf_prog_test_load() 18 attr.expected_attach_type = 0; in bpf_prog_test_load() 19 attr.prog_flags = BPF_F_TEST_RND_HI32; in bpf_prog_test_load() 20 attr.log_level = extra_prog_load_log_flags; in bpf_prog_test_load() 22 return bpf_prog_load_xattr(&attr, pobj, prog_fd); in bpf_prog_test_load()
|
D | test_verifier_log.c | 50 union bpf_attr attr; in load() local 52 bzero(&attr, sizeof(attr)); in load() 53 attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER; in load() 54 attr.insn_cnt = (__u32)(sizeof(code_sample) / sizeof(struct bpf_insn)); in load() 55 attr.insns = ptr_to_u64(code_sample); in load() 56 attr.license = ptr_to_u64("GPL"); in load() 57 attr.log_buf = ptr_to_u64(log); in load() 58 attr.log_size = log_len; in load() 59 attr.log_level = log_level; in load() 61 return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); in load()
|
/tools/bpf/bpftool/ |
D | netlink_dumper.c | 14 static void xdp_dump_prog_id(struct nlattr **tb, int attr, in xdp_dump_prog_id() argument 18 if (!tb[attr]) in xdp_dump_prog_id() 24 NET_DUMP_UINT("id", " id %u", libbpf_nla_getattr_u32(tb[attr])) in xdp_dump_prog_id() 29 static int do_xdp_dump_one(struct nlattr *attr, unsigned int ifindex, in do_xdp_dump_one() argument 35 if (libbpf_nla_parse_nested(tb, IFLA_XDP_MAX, attr, NULL) < 0) in do_xdp_dump_one() 81 static int do_bpf_dump_one_act(struct nlattr *attr) in do_bpf_dump_one_act() argument 85 if (libbpf_nla_parse_nested(tb, TCA_ACT_BPF_MAX, attr, NULL) < 0) in do_bpf_dump_one_act() 102 static int do_dump_one_act(struct nlattr *attr) in do_dump_one_act() argument 106 if (!attr) in do_dump_one_act() 109 if (libbpf_nla_parse_nested(tb, TCA_ACT_MAX, attr, NULL) < 0) in do_dump_one_act() [all …]
|
/tools/arch/x86/lib/ |
D | insn.c | 111 insn_attr_t attr; in insn_get_prefixes() local 123 attr = inat_get_opcode_attribute(b); in insn_get_prefixes() 124 while (inat_is_legacy_prefix(attr)) { in insn_get_prefixes() 133 if (inat_is_address_size_prefix(attr)) { in insn_get_prefixes() 139 } else if (inat_is_operand_size_prefix(attr)) { in insn_get_prefixes() 148 attr = inat_get_opcode_attribute(b); in insn_get_prefixes() 165 attr = inat_get_opcode_attribute(b); in insn_get_prefixes() 166 if (inat_is_rex_prefix(attr)) { in insn_get_prefixes() 179 attr = inat_get_opcode_attribute(b); in insn_get_prefixes() 180 if (inat_is_vex_prefix(attr)) { in insn_get_prefixes() [all …]
|
/tools/testing/selftests/powerpc/pmu/ebb/ |
D | event_attributes_test.c | 36 event.attr.exclusive = 0; in event_attributes() 43 event.attr.freq = 1; in event_attributes() 50 event.attr.sample_period = 1; in event_attributes() 57 event.attr.enable_on_exec = 1; in event_attributes() 64 event.attr.inherit = 1; in event_attributes() 96 leader.attr.config &= ~(1ull << 63); in event_attributes() 110 leader.attr.exclusive = 0; in event_attributes() 117 leader.attr.pinned = 0; in event_attributes()
|
/tools/perf/arch/arm64/util/ |
D | arm-spe.c | 78 if (evsel->core.attr.type == arm_spe_pmu->type) { in arm_spe_recording_options() 83 evsel->core.attr.freq = 0; in arm_spe_recording_options() 84 evsel->core.attr.sample_period = 1; in arm_spe_recording_options() 141 tracking_evsel->core.attr.freq = 0; in arm_spe_recording_options() 142 tracking_evsel->core.attr.sample_period = 1; in arm_spe_recording_options() 200 struct perf_event_attr *attr; in arm_spe_pmu_default_config() local 202 attr = zalloc(sizeof(struct perf_event_attr)); in arm_spe_pmu_default_config() 203 if (!attr) { in arm_spe_pmu_default_config() 213 &attr->sample_period) != 1) { in arm_spe_pmu_default_config() 215 attr->sample_period = 4096; in arm_spe_pmu_default_config() [all …]
|