Lines Matching +full:protect +full:- +full:exec

4  *    Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra
12 * For licencing details see kernel-base/COPYING
21 * Kernel-internal data types and definitions:
39 #include <linux/rhashtable-types.h>
100 return frag->pad < sizeof(u64); in perf_raw_frag_last()
108 * -1ULL means invalid/unknown.
118 * The hw_idx index is between -1 (unknown) and max depth,
138 int idx; /* index in shared_regs->regs[] */
144 * PERF_EVENT_FLAG_ARCH bits are reserved for architecture-specific
153 * struct hw_perf_event - performance event hardware details:
175 /* for tp_event->class */
220 #define PERF_HES_UPTODATE 0x02 /* event->count up-to-date */
300 * struct pmu - generic performance monitoring unit
314 * various common per-pmu feature flags
328 * Fully disable/enable this PMU, can be used to protect from the PMI
338 * -ENOENT -- @event is not for this PMU
340 * -ENODEV -- @event is for this PMU but PMU not present
341 * -EBUSY -- @event is for this PMU but PMU temporarily unavailable
342 * -EINVAL -- @event is for this PMU but @event is not valid
343 * -EOPNOTSUPP -- @event is for this PMU, @event is valid, but not supported
344 * -EACCES -- @event is for this PMU, @event is valid, but no privileges
346 * 0 -- @event is for this PMU and valid
360 * Flags for ->add()/->del()/ ->start()/->stop(). There are
369 * transaction, see the ->*_txn() methods.
378 * ->add() called without PERF_EF_START should result in the same state
379 * as ->add() followed by ->stop().
381 * ->del() must always PERF_EF_UPDATE stop an event. If it calls
382 * ->stop() that must deal with already being stopped without
392 * returns !0. ->start() will be used to continue.
397 * is on -- will be called from NMI context with the PMU generates
400 * ->stop() with PERF_EF_UPDATE will read the counter and update
401 * period/count values like ->read() would.
403 * ->start() with PERF_EF_RELOAD will reprogram the counter
404 * value, must be preceded by a ->stop() with PERF_EF_UPDATE.
422 * Start the transaction, after this ->add() doesn't need to
429 * If ->start_txn() disabled the ->add() schedulability test
430 * then ->commit_txn() is required to perform one. On success
432 * open until ->cancel_txn() is called.
438 * Will cancel the transaction, assumes ->del() is called
439 * for each successful ->add() during the transaction.
453 * context-switches callback
464 * PMU specific parts of task perf event context (i.e. ctx->task_ctx_data)
474 * Set up pmu-private data structures for an AUX area
481 * Free pmu-private AUX data structures
487 * state, so that preempting ->start()/->stop() callbacks does
501 * supplied filters are valid, -errno otherwise.
511 * translate hw-agnostic filters into hardware configuration in
514 * Runs as a part of filter sync sequence that is done in ->start()
528 * or non-zero for "match".
552 * struct perf_addr_filter - address range filter definition
554 * @path: object file's path for file-based filters
559 * This is a hardware-agnostic filter configuration as specified by the user.
570 * struct perf_addr_filters_head - container for address range filters
574 * @nr_file_filters: number of file-based filters
591 * enum perf_event_state - the states of an event:
594 PERF_EVENT_STATE_DEAD = -4,
595 PERF_EVENT_STATE_EXIT = -3,
596 PERF_EVENT_STATE_ERROR = -2,
597 PERF_EVENT_STATE_OFF = -1,
649 * event->sibling_list is modified whole holding both ctx->lock and ctx->mutex
650 * as such iteration must hold either lock. However, since ctx->lock is an IRQ
652 * disabled is sufficient since it will hold-off the IPIs.
658 lockdep_is_held(&(event)->ctx->mutex) != LOCK_STATE_HELD))
665 if ((event)->group_leader == (event)) \
666 list_for_each_entry((sibling), &(event)->sibling_list, sibling_list)
669 * struct perf_event - performance event kernel representation:
675 * modifications require ctx->lock
681 * Locked for modification by both ctx->mutex and ctx->lock; holding
710 * event->pmu will always point to pmu in which this event belongs.
711 * Whereas event->pmu_ctx->pmu may point to other pmu when group of
725 * been scheduled in, if this is a per-task event)
740 * event->pmu_ctx points to perf_event_pmu_context in which the event
742 * sw event is part of a group which also contains non-sw events.
755 * Protect attach/detach and child_list:
794 /* vma address array for file-based filders */
836 * Certain events gets forwarded to another pmu internally by over-
837 * writing kernel copy of event->attr.type without user being aware
838 * of it. event->orig_type contains original 'type' requested by
846 * ,-----------------------[1:n]------------------------.
848 * perf_event_context <-[1:n]-> perf_event_pmu_context <-[1:n]- perf_event
850 * `--[n:1]-> pmu <-[1:n]--'
857 * modification, both: ctx->mutex && ctx->lock
858 * reading, either: ctx->mutex || ctx->lock
861 * with ctx->mutex held; this means that as long as we can guarantee the epc
865 * ctx->mutex pinning the configuration. Since we hold a reference on
867 * associated pmu_ctx must exist and cannot change due to ctx->mutex.
881 /* Used to avoid freeing per-cpu perf_event_pmu_context */
887 atomic_t refcount; /* event <-> epc */
907 * struct perf_event_context - event context structure
913 * Protect the states of the events in the list,
918 * Protect the list of events. Locking either mutex or lock
938 refcount_t refcount; /* event <-> ctx */
962 * Sum (event->pending_sigtrap + event->pending_work)
964 * The SIGTRAP is targeted at ctx->task, as such it won't do changing
993 * struct perf_event_cpu_context - per cpu event context structure
1005 * Per-CPU storage for iterators used in visit_groups_merge. The default
1036 * This is a per-cpu dynamically allocated data structure.
1059 ctx ? lockdep_is_held(&ctx->lock) in perf_cgroup_from_task()
1123 return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_NO_FLAGS; in branch_sample_no_flags()
1128 return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_NO_CYCLES; in branch_sample_no_cycles()
1133 return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_TYPE_SAVE; in branch_sample_type()
1138 return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_HW_INDEX; in branch_sample_hw_index()
1143 return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_PRIV_SAVE; in branch_sample_priv()
1148 return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_COUNTERS; in branch_sample_counters()
1153 return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK; in branch_sample_call_stack()
1219 data->sample_flags = PERF_SAMPLE_PERIOD; in perf_sample_data_init()
1220 data->period = period; in perf_sample_data_init()
1221 data->dyn_size = 0; in perf_sample_data_init()
1224 data->addr = addr; in perf_sample_data_init()
1225 data->sample_flags |= PERF_SAMPLE_ADDR; in perf_sample_data_init()
1235 data->callchain = perf_callchain(event, regs); in perf_sample_save_callchain()
1236 size += data->callchain->nr; in perf_sample_save_callchain()
1238 data->dyn_size += size * sizeof(u64); in perf_sample_save_callchain()
1239 data->sample_flags |= PERF_SAMPLE_CALLCHAIN; in perf_sample_save_callchain()
1245 struct perf_raw_frag *frag = &raw->frag; in perf_sample_save_raw_data()
1250 sum += frag->size; in perf_sample_save_raw_data()
1253 frag = frag->next; in perf_sample_save_raw_data()
1257 raw->size = size - sizeof(u32); in perf_sample_save_raw_data()
1258 frag->pad = raw->size - sum; in perf_sample_save_raw_data()
1260 data->raw = raw; in perf_sample_save_raw_data()
1261 data->dyn_size += size; in perf_sample_save_raw_data()
1262 data->sample_flags |= PERF_SAMPLE_RAW; in perf_sample_save_raw_data()
1274 size += brs->nr * sizeof(struct perf_branch_entry); in perf_sample_save_brstack()
1282 size += brs->nr * sizeof(u64); in perf_sample_save_brstack()
1284 data->br_stack = brs; in perf_sample_save_brstack()
1285 data->br_stack_cntr = brs_cntr; in perf_sample_save_brstack()
1286 data->dyn_size += size; in perf_sample_save_brstack()
1287 data->sample_flags |= PERF_SAMPLE_BRANCH_STACK; in perf_sample_save_brstack()
1295 size += event->header_size + event->id_header_size; in perf_sample_data_size()
1296 size += data->dyn_size; in perf_sample_data_size()
1308 br->mispred = 0; in perf_clear_branch_entry_bitfields()
1309 br->predicted = 0; in perf_clear_branch_entry_bitfields()
1310 br->in_tx = 0; in perf_clear_branch_entry_bitfields()
1311 br->abort = 0; in perf_clear_branch_entry_bitfields()
1312 br->cycles = 0; in perf_clear_branch_entry_bitfields()
1313 br->type = 0; in perf_clear_branch_entry_bitfields()
1314 br->spec = PERF_BR_SPEC_NA; in perf_clear_branch_entry_bitfields()
1315 br->reserved = 0; in perf_clear_branch_entry_bitfields()
1355 __is_default_overflow_handler((event)->overflow_handler)
1363 return __is_default_overflow_handler(event->orig_overflow_handler); in uses_default_overflow_handler()
1384 struct perf_event_attr *attr = &event->attr; in event_has_any_exclude_flag()
1386 return attr->exclude_idle || attr->exclude_user || in event_has_any_exclude_flag()
1387 attr->exclude_kernel || attr->exclude_hv || in event_has_any_exclude_flag()
1388 attr->exclude_guest || attr->exclude_host; in event_has_any_exclude_flag()
1393 return event->attr.sample_period != 0; in is_sampling_event()
1401 return event->event_caps & PERF_EV_CAP_SOFTWARE; in is_software_event()
1409 return event->pmu_ctx->pmu->task_ctx_nr == perf_sw_context; in in_software_context()
1414 return pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE; in is_exclusive_pmu()
1427 * When generating a perf sample in-line, instead of from an interrupt /
1429 * like: SW_CONTEXT_SWITCHES, SW_MIGRATIONS and the tie-in with tracepoints.
1432 * - ip for PERF_SAMPLE_IP
1433 * - cs for user_mode() tests
1434 * - sp for PERF_SAMPLE_CALLCHAIN
1435 * - eflags for MISC bits and CALLCHAIN (see: perf_hw_regs())
1477 task->sched_migrated = 1; in perf_event_task_migrate()
1487 task->sched_migrated) { in perf_event_task_sched_in()
1489 task->sched_migrated = 0; in perf_event_task_sched_in()
1521 DECLARE_STATIC_CALL(__perf_guest_state, *perf_guest_cbs->state);
1522 DECLARE_STATIC_CALL(__perf_guest_get_ip, *perf_guest_cbs->get_ip);
1523 DECLARE_STATIC_CALL(__perf_guest_handle_intel_pt_intr, *perf_guest_cbs->handle_intel_pt_intr);
1546 extern void perf_event_comm(struct task_struct *tsk, bool exec);
1571 if (ctx->contexts < sysctl_perf_event_max_contexts_per_stack) { in perf_callchain_store_context()
1572 struct perf_callchain_entry *entry = ctx->entry; in perf_callchain_store_context()
1573 entry->ip[entry->nr++] = ip; in perf_callchain_store_context()
1574 ++ctx->contexts; in perf_callchain_store_context()
1577 ctx->contexts_maxed = true; in perf_callchain_store_context()
1578 return -1; /* no more room, stop walking the stack */ in perf_callchain_store_context()
1584 if (ctx->nr < ctx->max_stack && !ctx->contexts_maxed) { in perf_callchain_store()
1585 struct perf_callchain_entry *entry = ctx->entry; in perf_callchain_store()
1586 entry->ip[entry->nr++] = ip; in perf_callchain_store()
1587 ++ctx->nr; in perf_callchain_store()
1590 return -1; /* no more room, stop walking the stack */ in perf_callchain_store()
1618 return sysctl_perf_event_paranoid > -1; in perf_is_paranoid()
1624 return -EACCES; in perf_allow_kernel()
1632 return -EACCES; in perf_allow_cpu()
1639 if (sysctl_perf_event_paranoid > -1 && !perfmon_capable()) in perf_allow_tracepoint()
1640 return -EPERM; in perf_allow_tracepoint()
1663 return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK; in has_branch_stack()
1668 return event->attr.branch_sample_type != 0; in needs_branch_stack()
1673 return event->pmu->setup_aux; in has_aux()
1678 return !!event->attr.write_backward; in is_write_backward()
1683 return event->pmu->nr_addr_filters; in has_addr_filter()
1692 struct perf_addr_filters_head *ifh = &event->addr_filters; in perf_event_addr_filters()
1694 if (event->parent) in perf_event_addr_filters()
1695 ifh = &event->parent->addr_filters; in perf_event_addr_filters()
1743 unsigned long size) { return -EINVAL; } in perf_aux_output_skip()
1759 static inline struct file *perf_event_get(unsigned int fd) { return ERR_PTR(-EINVAL); } in perf_event_get()
1762 return ERR_PTR(-EINVAL); in perf_get_event()
1766 return ERR_PTR(-EINVAL); in perf_event_attrs()
1771 return -EINVAL; in perf_event_read_local()
1774 static inline int perf_event_task_disable(void) { return -EINVAL; } in perf_event_task_disable()
1775 static inline int perf_event_task_enable(void) { return -EINVAL; } in perf_event_task_enable()
1778 return -EINVAL; in perf_event_refresh()
1795 static inline void perf_event_comm(struct task_struct *tsk, bool exec) { } in perf_event_comm() argument
1804 static inline int perf_swevent_get_recursion_context(void) { return -1; } in perf_swevent_get_recursion_context()
1809 static inline int __perf_event_disable(void *info) { return -1; } in __perf_event_disable()
1814 return -EINVAL; in perf_event_period()