mirror of https://gitee.com/openkylin/linux.git
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "A number of PMU driver corner case fixes, a race fix, an event grouping fix, plus a bunch of tooling fixes/updates" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits) perf/x86/intel: Fix spurious NMI on fixed counter perf/core: Fix exclusive events' grouping perf/x86/amd/uncore: Set the thread mask for F17h L3 PMCs perf/x86/amd/uncore: Do not set 'ThreadMask' and 'SliceMask' for non-L3 PMCs perf/core: Fix race between close() and fork() perf intel-pt: Fix potential NULL pointer dereference found by the smatch tool perf intel-bts: Fix potential NULL pointer dereference found by the smatch tool perf script: Assume native_arch for pipe mode perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view perf hists browser: Fix potential NULL pointer dereference found by the smatch tool perf cs-etm: Fix potential NULL pointer dereference found by the smatch tool perf parse-events: Remove unused variable: error perf parse-events: Remove unused variable 'i' perf metricgroup: Add missing list_del_init() when flushing egroups list perf tools: Use list_del_init() more thorougly perf tools: Use zfree() where applicable tools lib: Adopt zalloc()/zfree() from tools/perf perf tools: Move get_current_dir_name() cond prototype out of util.h perf namespaces: Move the conditional setns() prototype to namespaces.h ...
This commit is contained in:
commit
1d03985933
|
@ -202,15 +202,22 @@ static int amd_uncore_event_init(struct perf_event *event)
|
|||
hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
|
||||
hwc->idx = -1;
|
||||
|
||||
if (event->cpu < 0)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* SliceMask and ThreadMask need to be set for certain L3 events in
|
||||
* Family 17h. For other events, the two fields do not affect the count.
|
||||
*/
|
||||
if (l3_mask)
|
||||
hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK);
|
||||
if (l3_mask && is_llc_event(event)) {
|
||||
int thread = 2 * (cpu_data(event->cpu).cpu_core_id % 4);
|
||||
|
||||
if (event->cpu < 0)
|
||||
return -EINVAL;
|
||||
if (smp_num_siblings > 1)
|
||||
thread += cpu_data(event->cpu).apicid & 1;
|
||||
|
||||
hwc->config |= (1ULL << (AMD64_L3_THREAD_SHIFT + thread) &
|
||||
AMD64_L3_THREAD_MASK) | AMD64_L3_SLICE_MASK;
|
||||
}
|
||||
|
||||
uncore = event_to_amd_uncore(event);
|
||||
if (!uncore)
|
||||
|
|
|
@ -2161,12 +2161,10 @@ static void intel_pmu_disable_event(struct perf_event *event)
|
|||
cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx);
|
||||
cpuc->intel_cp_status &= ~(1ull << hwc->idx);
|
||||
|
||||
if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
|
||||
if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL))
|
||||
intel_pmu_disable_fixed(hwc);
|
||||
return;
|
||||
}
|
||||
|
||||
x86_pmu_disable_event(event);
|
||||
else
|
||||
x86_pmu_disable_event(event);
|
||||
|
||||
/*
|
||||
* Needs to be called after x86_pmu_disable_event,
|
||||
|
|
|
@ -1055,6 +1055,11 @@ static inline int in_software_context(struct perf_event *event)
|
|||
return event->ctx->pmu->task_ctx_nr == perf_sw_context;
|
||||
}
|
||||
|
||||
static inline int is_exclusive_pmu(struct pmu *pmu)
|
||||
{
|
||||
return pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE;
|
||||
}
|
||||
|
||||
extern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX];
|
||||
|
||||
extern void ___perf_sw_event(u32, u64, struct pt_regs *, u64);
|
||||
|
|
|
@ -2553,6 +2553,9 @@ static int __perf_install_in_context(void *info)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool exclusive_event_installable(struct perf_event *event,
|
||||
struct perf_event_context *ctx);
|
||||
|
||||
/*
|
||||
* Attach a performance event to a context.
|
||||
*
|
||||
|
@ -2567,6 +2570,8 @@ perf_install_in_context(struct perf_event_context *ctx,
|
|||
|
||||
lockdep_assert_held(&ctx->mutex);
|
||||
|
||||
WARN_ON_ONCE(!exclusive_event_installable(event, ctx));
|
||||
|
||||
if (event->cpu != -1)
|
||||
event->cpu = cpu;
|
||||
|
||||
|
@ -4360,7 +4365,7 @@ static int exclusive_event_init(struct perf_event *event)
|
|||
{
|
||||
struct pmu *pmu = event->pmu;
|
||||
|
||||
if (!(pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE))
|
||||
if (!is_exclusive_pmu(pmu))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
@ -4391,7 +4396,7 @@ static void exclusive_event_destroy(struct perf_event *event)
|
|||
{
|
||||
struct pmu *pmu = event->pmu;
|
||||
|
||||
if (!(pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE))
|
||||
if (!is_exclusive_pmu(pmu))
|
||||
return;
|
||||
|
||||
/* see comment in exclusive_event_init() */
|
||||
|
@ -4411,14 +4416,15 @@ static bool exclusive_event_match(struct perf_event *e1, struct perf_event *e2)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Called under the same ctx::mutex as perf_install_in_context() */
|
||||
static bool exclusive_event_installable(struct perf_event *event,
|
||||
struct perf_event_context *ctx)
|
||||
{
|
||||
struct perf_event *iter_event;
|
||||
struct pmu *pmu = event->pmu;
|
||||
|
||||
if (!(pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE))
|
||||
lockdep_assert_held(&ctx->mutex);
|
||||
|
||||
if (!is_exclusive_pmu(pmu))
|
||||
return true;
|
||||
|
||||
list_for_each_entry(iter_event, &ctx->event_list, event_entry) {
|
||||
|
@ -4465,12 +4471,20 @@ static void _free_event(struct perf_event *event)
|
|||
if (event->destroy)
|
||||
event->destroy(event);
|
||||
|
||||
if (event->ctx)
|
||||
put_ctx(event->ctx);
|
||||
|
||||
/*
|
||||
* Must be after ->destroy(), due to uprobe_perf_close() using
|
||||
* hw.target.
|
||||
*/
|
||||
if (event->hw.target)
|
||||
put_task_struct(event->hw.target);
|
||||
|
||||
/*
|
||||
* perf_event_free_task() relies on put_ctx() being 'last', in particular
|
||||
* all task references must be cleaned up.
|
||||
*/
|
||||
if (event->ctx)
|
||||
put_ctx(event->ctx);
|
||||
|
||||
exclusive_event_destroy(event);
|
||||
module_put(event->pmu->module);
|
||||
|
||||
|
@ -4650,8 +4664,17 @@ int perf_event_release_kernel(struct perf_event *event)
|
|||
mutex_unlock(&event->child_mutex);
|
||||
|
||||
list_for_each_entry_safe(child, tmp, &free_list, child_list) {
|
||||
void *var = &child->ctx->refcount;
|
||||
|
||||
list_del(&child->child_list);
|
||||
free_event(child);
|
||||
|
||||
/*
|
||||
* Wake any perf_event_free_task() waiting for this event to be
|
||||
* freed.
|
||||
*/
|
||||
smp_mb(); /* pairs with wait_var_event() */
|
||||
wake_up_var(var);
|
||||
}
|
||||
|
||||
no_ctx:
|
||||
|
@ -10930,11 +10953,6 @@ SYSCALL_DEFINE5(perf_event_open,
|
|||
goto err_alloc;
|
||||
}
|
||||
|
||||
if ((pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE) && group_leader) {
|
||||
err = -EBUSY;
|
||||
goto err_context;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up the group leader (we will attach this event to it):
|
||||
*/
|
||||
|
@ -11022,6 +11040,18 @@ SYSCALL_DEFINE5(perf_event_open,
|
|||
move_group = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Failure to create exclusive events returns -EBUSY.
|
||||
*/
|
||||
err = -EBUSY;
|
||||
if (!exclusive_event_installable(group_leader, ctx))
|
||||
goto err_locked;
|
||||
|
||||
for_each_sibling_event(sibling, group_leader) {
|
||||
if (!exclusive_event_installable(sibling, ctx))
|
||||
goto err_locked;
|
||||
}
|
||||
} else {
|
||||
mutex_lock(&ctx->mutex);
|
||||
}
|
||||
|
@ -11058,9 +11088,6 @@ SYSCALL_DEFINE5(perf_event_open,
|
|||
* because we need to serialize with concurrent event creation.
|
||||
*/
|
||||
if (!exclusive_event_installable(event, ctx)) {
|
||||
/* exclusive and group stuff are assumed mutually exclusive */
|
||||
WARN_ON_ONCE(move_group);
|
||||
|
||||
err = -EBUSY;
|
||||
goto err_locked;
|
||||
}
|
||||
|
@ -11527,11 +11554,11 @@ static void perf_free_event(struct perf_event *event,
|
|||
}
|
||||
|
||||
/*
|
||||
* Free an unexposed, unused context as created by inheritance by
|
||||
* perf_event_init_task below, used by fork() in case of fail.
|
||||
* Free a context as created by inheritance by perf_event_init_task() below,
|
||||
* used by fork() in case of fail.
|
||||
*
|
||||
* Not all locks are strictly required, but take them anyway to be nice and
|
||||
* help out with the lockdep assertions.
|
||||
* Even though the task has never lived, the context and events have been
|
||||
* exposed through the child_list, so we must take care tearing it all down.
|
||||
*/
|
||||
void perf_event_free_task(struct task_struct *task)
|
||||
{
|
||||
|
@ -11561,7 +11588,23 @@ void perf_event_free_task(struct task_struct *task)
|
|||
perf_free_event(event, ctx);
|
||||
|
||||
mutex_unlock(&ctx->mutex);
|
||||
put_ctx(ctx);
|
||||
|
||||
/*
|
||||
* perf_event_release_kernel() could've stolen some of our
|
||||
* child events and still have them on its free_list. In that
|
||||
* case we must wait for these events to have been freed (in
|
||||
* particular all their references to this task must've been
|
||||
* dropped).
|
||||
*
|
||||
* Without this copy_process() will unconditionally free this
|
||||
* task (irrespective of its reference count) and
|
||||
* _free_event()'s put_task_struct(event->hw.target) will be a
|
||||
* use-after-free.
|
||||
*
|
||||
* Wait for all events to drop their context reference.
|
||||
*/
|
||||
wait_var_event(&ctx->refcount, refcount_read(&ctx->refcount) == 1);
|
||||
put_ctx(ctx); /* must be last */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// SPDX-License-Identifier: LGPL-2.1
|
||||
#ifndef __TOOLS_LINUX_ZALLOC_H
|
||||
#define __TOOLS_LINUX_ZALLOC_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void *zalloc(size_t size);
|
||||
void __zfree(void **ptr);
|
||||
|
||||
#define zfree(ptr) __zfree((void **)(ptr))
|
||||
|
||||
#endif // __TOOLS_LINUX_ZALLOC_H
|
|
@ -0,0 +1,15 @@
|
|||
// SPDX-License-Identifier: LGPL-2.1
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
void *zalloc(size_t size)
|
||||
{
|
||||
return calloc(1, size);
|
||||
}
|
||||
|
||||
void __zfree(void **ptr)
|
||||
{
|
||||
free(*ptr);
|
||||
*ptr = NULL;
|
||||
}
|
|
@ -18,3 +18,4 @@ tools/lib/find_bit.c
|
|||
tools/lib/bitmap.c
|
||||
tools/lib/str_error_r.c
|
||||
tools/lib/vsprintf.c
|
||||
tools/lib/zalloc.c
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <linux/coresight-pmu.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../util/auxtrace.h"
|
||||
#include "../../util/evlist.h"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "cs-etm.h"
|
||||
#include "../../perf.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "../../util/cpumap.h"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
#include "../util/env.h"
|
||||
#include "../util/util.h"
|
||||
#include "../util/debug.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
const char *const arc_triplets[] = {
|
||||
"arc-linux-",
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <regex.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../perf.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/perf_regs.h"
|
||||
#include "../../util/debug.h"
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
||||
const struct sample_reg sample_reg_masks[] = {
|
||||
SMPL_REG(r0, PERF_REG_POWERPC_R0),
|
||||
SMPL_REG(r1, PERF_REG_POWERPC_R1),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../util/evlist.h"
|
||||
#include "../../util/auxtrace.h"
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../util/header.h"
|
||||
#include "../../util/util.h"
|
||||
|
||||
#define SYSINFO_MANU "Manufacturer:"
|
||||
#define SYSINFO_TYPE "Type:"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/types.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../util/machine.h"
|
||||
#include "../../util/tool.h"
|
||||
#include "../../util/map.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/debug.h"
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../util/cpumap.h"
|
||||
#include "../../util/evsel.h"
|
||||
#include "../../util/evlist.h"
|
||||
#include "../../util/session.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/pmu.h"
|
||||
#include "../../util/debug.h"
|
||||
#include "../../util/tsc.h"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <cpuid.h>
|
||||
|
||||
#include "../../perf.h"
|
||||
|
@ -25,7 +26,6 @@
|
|||
#include "../../util/auxtrace.h"
|
||||
#include "../../util/tsc.h"
|
||||
#include "../../util/intel-pt.h"
|
||||
#include "../../util/util.h"
|
||||
|
||||
#define KiB(x) ((x) * 1024)
|
||||
#define MiB(x) ((x) * 1024 * 1024)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <regex.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../perf.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/perf_regs.h"
|
||||
#include "../../util/debug.h"
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "../util/stat.h"
|
||||
|
@ -214,7 +215,7 @@ int bench_futex_hash(int argc, const char **argv)
|
|||
&worker[i].futex[nfutexes-1], t);
|
||||
}
|
||||
|
||||
free(worker[i].futex);
|
||||
zfree(&worker[i].futex);
|
||||
}
|
||||
|
||||
print_summary();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <subcmd/parse-options.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <errno.h>
|
||||
#include "bench.h"
|
||||
#include "futex.h"
|
||||
|
@ -217,7 +218,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
|
|||
worker[i].tid, worker[i].futex, t);
|
||||
|
||||
if (multi)
|
||||
free(worker[i].futex);
|
||||
zfree(&worker[i].futex);
|
||||
}
|
||||
|
||||
print_summary();
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "debug.h"
|
||||
#include "../perf.h"
|
||||
#include "../util/util.h"
|
||||
#include <subcmd/parse-options.h>
|
||||
#include "../util/header.h"
|
||||
#include "../util/cloexec.h"
|
||||
|
@ -24,6 +23,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#define K 1024
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../perf.h"
|
||||
#include "../builtin.h"
|
||||
#include "../util/util.h"
|
||||
#include <subcmd/parse-options.h>
|
||||
#include "../util/cloexec.h"
|
||||
|
||||
|
@ -35,6 +34,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/numa.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include <numa.h>
|
||||
#include <numaif.h>
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
*/
|
||||
#include "builtin.h"
|
||||
|
||||
#include "util/util.h"
|
||||
#include "util/color.h"
|
||||
#include <linux/list.h>
|
||||
#include "util/cache.h"
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include "util/symbol.h"
|
||||
|
||||
#include "perf.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* epoll ... Event poll performance
|
||||
*/
|
||||
#include "perf.h"
|
||||
#include "util/util.h"
|
||||
#include <subcmd/parse-options.h>
|
||||
#include "builtin.h"
|
||||
#include "bench/bench.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
typedef int (*bench_fn_t)(int argc, const char **argv);
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <asm/bug.h>
|
||||
#include <sys/param.h>
|
||||
#include "util.h"
|
||||
#include "debug.h"
|
||||
#include "builtin.h"
|
||||
#include <subcmd/parse-options.h>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "util/debug.h"
|
||||
#include "util/config.h"
|
||||
#include <linux/string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static bool use_system_config, use_user_config;
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
#include "util/tool.h"
|
||||
#include "util/sort.h"
|
||||
#include "util/symbol.h"
|
||||
#include "util/util.h"
|
||||
#include "util/data.h"
|
||||
#include "util/config.h"
|
||||
#include "util/time-utils.h"
|
||||
#include "util/annotate.h"
|
||||
#include "util/map.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
|
|
@ -431,7 +431,7 @@ static void delete_filter_func(struct list_head *head)
|
|||
struct filter_entry *pos, *tmp;
|
||||
|
||||
list_for_each_entry_safe(pos, tmp, head, list) {
|
||||
list_del(&pos->list);
|
||||
list_del_init(&pos->list);
|
||||
free(pos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
#include <subcmd/help.h>
|
||||
#include "util/debug.h"
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -224,7 +224,7 @@ static int perf_event__repipe_sample(struct perf_tool *tool,
|
|||
struct perf_evsel *evsel,
|
||||
struct machine *machine)
|
||||
{
|
||||
if (evsel->handler) {
|
||||
if (evsel && evsel->handler) {
|
||||
inject_handler f = evsel->handler;
|
||||
return f(tool, event, sample, evsel, machine);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "util/evlist.h"
|
||||
#include "util/evsel.h"
|
||||
#include "util/util.h"
|
||||
#include "util/config.h"
|
||||
#include "util/map.h"
|
||||
#include "util/symbol.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <locale.h>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "util/evsel.h"
|
||||
#include "util/evlist.h"
|
||||
#include "util/term.h"
|
||||
#include "util/util.h"
|
||||
#include "util/cache.h"
|
||||
#include "util/symbol.h"
|
||||
#include "util/thread.h"
|
||||
|
@ -32,6 +31,7 @@
|
|||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <poll.h>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "util/evlist.h"
|
||||
#include "util/evsel.h"
|
||||
#include "util/util.h"
|
||||
#include "util/cache.h"
|
||||
#include "util/symbol.h"
|
||||
#include "util/thread.h"
|
||||
|
@ -30,6 +29,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/hash.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static struct perf_session *session;
|
||||
|
||||
|
@ -454,7 +454,7 @@ static int report_lock_acquire_event(struct perf_evsel *evsel,
|
|||
/* broken lock sequence, discard it */
|
||||
ls->discard = 1;
|
||||
bad_hist[BROKEN_ACQUIRE]++;
|
||||
list_del(&seq->list);
|
||||
list_del_init(&seq->list);
|
||||
free(seq);
|
||||
goto end;
|
||||
default:
|
||||
|
@ -515,7 +515,7 @@ static int report_lock_acquired_event(struct perf_evsel *evsel,
|
|||
/* broken lock sequence, discard it */
|
||||
ls->discard = 1;
|
||||
bad_hist[BROKEN_ACQUIRED]++;
|
||||
list_del(&seq->list);
|
||||
list_del_init(&seq->list);
|
||||
free(seq);
|
||||
goto end;
|
||||
default:
|
||||
|
@ -570,7 +570,7 @@ static int report_lock_contended_event(struct perf_evsel *evsel,
|
|||
/* broken lock sequence, discard it */
|
||||
ls->discard = 1;
|
||||
bad_hist[BROKEN_CONTENDED]++;
|
||||
list_del(&seq->list);
|
||||
list_del_init(&seq->list);
|
||||
free(seq);
|
||||
goto end;
|
||||
default:
|
||||
|
@ -639,7 +639,7 @@ static int report_lock_release_event(struct perf_evsel *evsel,
|
|||
|
||||
ls->nr_release++;
|
||||
free_seq:
|
||||
list_del(&seq->list);
|
||||
list_del_init(&seq->list);
|
||||
free(seq);
|
||||
end:
|
||||
return 0;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "perf.h"
|
||||
#include "builtin.h"
|
||||
#include "namespaces.h"
|
||||
#include "util/util.h"
|
||||
#include "util/strlist.h"
|
||||
#include "util/strfilter.h"
|
||||
#include "util/symbol.h"
|
||||
|
@ -28,6 +27,7 @@
|
|||
#include "util/probe-finder.h"
|
||||
#include "util/probe-event.h"
|
||||
#include "util/probe-file.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*"
|
||||
#define DEFAULT_FUNC_FILTER "!_*"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "perf.h"
|
||||
|
||||
#include "util/build-id.h"
|
||||
#include "util/util.h"
|
||||
#include <subcmd/parse-options.h>
|
||||
#include "util/parse-events.h"
|
||||
#include "util/config.h"
|
||||
|
@ -54,6 +53,7 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
struct switch_output {
|
||||
bool enabled;
|
||||
|
@ -1110,7 +1110,7 @@ record__switch_output(struct record *rec, bool at_exit)
|
|||
rec->switch_output.cur_file = n;
|
||||
if (rec->switch_output.filenames[n]) {
|
||||
remove(rec->switch_output.filenames[n]);
|
||||
free(rec->switch_output.filenames[n]);
|
||||
zfree(&rec->switch_output.filenames[n]);
|
||||
}
|
||||
rec->switch_output.filenames[n] = new_filename;
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
#include "builtin.h"
|
||||
|
||||
#include "util/util.h"
|
||||
#include "util/config.h"
|
||||
|
||||
#include "util/annotate.h"
|
||||
|
@ -16,6 +15,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include "util/map.h"
|
||||
#include "util/symbol.h"
|
||||
#include "util/callchain.h"
|
||||
|
@ -298,7 +298,7 @@ static int process_read_event(struct perf_tool *tool,
|
|||
struct report *rep = container_of(tool, struct report, tool);
|
||||
|
||||
if (rep->show_threads) {
|
||||
const char *name = evsel ? perf_evsel__name(evsel) : "unknown";
|
||||
const char *name = perf_evsel__name(evsel);
|
||||
int err = perf_read_values_add_value(&rep->show_threads_values,
|
||||
event->read.pid, event->read.tid,
|
||||
evsel->idx,
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "builtin.h"
|
||||
#include "perf.h"
|
||||
|
||||
#include "util/util.h"
|
||||
#include "util/evlist.h"
|
||||
#include "util/cache.h"
|
||||
#include "util/evsel.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <inttypes.h>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "util/symbol.h"
|
||||
#include "util/thread.h"
|
||||
#include "util/trace-event.h"
|
||||
#include "util/util.h"
|
||||
#include "util/evlist.h"
|
||||
#include "util/evsel.h"
|
||||
#include "util/sort.h"
|
||||
|
@ -34,6 +33,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/utsname.h>
|
||||
#include "asm/bug.h"
|
||||
#include "util/mem-events.h"
|
||||
|
@ -3752,7 +3752,8 @@ int cmd_script(int argc, const char **argv)
|
|||
goto out_delete;
|
||||
|
||||
uname(&uts);
|
||||
if (!strcmp(uts.machine, session->header.env.arch) ||
|
||||
if (data.is_pipe || /* assume pipe_mode indicates native_arch */
|
||||
!strcmp(uts.machine, session->header.env.arch) ||
|
||||
(!strcmp(uts.machine, "x86_64") &&
|
||||
!strcmp(session->header.env.arch, "i386")))
|
||||
native_arch = true;
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "perf.h"
|
||||
#include "builtin.h"
|
||||
#include "util/cgroup.h"
|
||||
#include "util/util.h"
|
||||
#include <subcmd/parse-options.h>
|
||||
#include "util/parse-events.h"
|
||||
#include "util/pmu.h"
|
||||
|
@ -67,6 +66,7 @@
|
|||
#include "asm/bug.h"
|
||||
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <api/fs/fs.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
@ -1349,8 +1349,8 @@ static int add_default_attributes(void)
|
|||
fprintf(stderr,
|
||||
"Cannot set up top down events %s: %d\n",
|
||||
str, err);
|
||||
free(str);
|
||||
parse_events_print_error(&errinfo, str);
|
||||
free(str);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
|
@ -1586,7 +1586,7 @@ static void runtime_stat_delete(struct perf_stat_config *config)
|
|||
for (i = 0; i < config->stats_num; i++)
|
||||
runtime_stat__exit(&config->stats[i]);
|
||||
|
||||
free(config->stats);
|
||||
zfree(&config->stats);
|
||||
}
|
||||
|
||||
static const char * const stat_report_usage[] = {
|
||||
|
@ -2003,7 +2003,7 @@ int cmd_stat(int argc, const char **argv)
|
|||
perf_stat__exit_aggr_mode();
|
||||
perf_evlist__free_stats(evsel_list);
|
||||
out:
|
||||
free(stat_config.walltime_run);
|
||||
zfree(&stat_config.walltime_run);
|
||||
|
||||
if (smi_cost && smi_reset)
|
||||
sysfs__write_int(FREEZE_ON_SMI_PATH, 0);
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
#include <traceevent/event-parse.h>
|
||||
|
||||
#include "builtin.h"
|
||||
|
||||
#include "util/util.h"
|
||||
|
||||
#include "util/color.h"
|
||||
#include <linux/list.h>
|
||||
#include "util/cache.h"
|
||||
|
@ -24,6 +21,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include "util/symbol.h"
|
||||
#include "util/thread.h"
|
||||
#include "util/callchain.h"
|
||||
|
|
|
@ -101,7 +101,7 @@ static void perf_top__resize(struct perf_top *top)
|
|||
|
||||
static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
|
||||
{
|
||||
struct perf_evsel *evsel = hists_to_evsel(he->hists);
|
||||
struct perf_evsel *evsel;
|
||||
struct symbol *sym;
|
||||
struct annotation *notes;
|
||||
struct map *map;
|
||||
|
@ -110,6 +110,8 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
|
|||
if (!he || !he->ms.sym)
|
||||
return -1;
|
||||
|
||||
evsel = hists_to_evsel(he->hists);
|
||||
|
||||
sym = he->ms.sym;
|
||||
map = he->ms.map;
|
||||
|
||||
|
@ -226,7 +228,7 @@ static void perf_top__record_precise_ip(struct perf_top *top,
|
|||
static void perf_top__show_details(struct perf_top *top)
|
||||
{
|
||||
struct hist_entry *he = top->sym_filter_entry;
|
||||
struct perf_evsel *evsel = hists_to_evsel(he->hists);
|
||||
struct perf_evsel *evsel;
|
||||
struct annotation *notes;
|
||||
struct symbol *symbol;
|
||||
int more;
|
||||
|
@ -234,6 +236,8 @@ static void perf_top__show_details(struct perf_top *top)
|
|||
if (!he)
|
||||
return;
|
||||
|
||||
evsel = hists_to_evsel(he->hists);
|
||||
|
||||
symbol = he->ms.sym;
|
||||
notes = symbol__annotation(symbol);
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include <linux/random.h>
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
|
@ -1038,10 +1039,10 @@ static struct thread_trace *thread_trace__new(void)
|
|||
{
|
||||
struct thread_trace *ttrace = zalloc(sizeof(struct thread_trace));
|
||||
|
||||
if (ttrace)
|
||||
if (ttrace) {
|
||||
ttrace->files.max = -1;
|
||||
|
||||
ttrace->syscall_stats = intlist__new(NULL);
|
||||
ttrace->syscall_stats = intlist__new(NULL);
|
||||
}
|
||||
|
||||
return ttrace;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "util/bpf-loader.h"
|
||||
#include "util/debug.h"
|
||||
#include "util/event.h"
|
||||
#include "util/util.h"
|
||||
#include <api/fs/fs.h>
|
||||
#include <api/fs/tracing_path.h>
|
||||
#include <errno.h>
|
||||
|
@ -30,6 +29,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
const char perf_usage_string[] =
|
||||
"perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
|
||||
|
|
|
@ -407,7 +407,7 @@ static void free_arch_std_events(void)
|
|||
|
||||
list_for_each_entry_safe(es, next, &arch_std_events, list) {
|
||||
FOR_ALL_EVENT_STRUCT_FIELDS(FREE_EVENT_FIELD);
|
||||
list_del(&es->list);
|
||||
list_del_init(&es->list);
|
||||
free(es);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -898,11 +898,11 @@ def trace_end():
|
|||
if is_table_empty("ptwrite"):
|
||||
drop("ptwrite")
|
||||
if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"):
|
||||
do_query(query, 'DROP VIEW power_events_view');
|
||||
drop("mwait")
|
||||
drop("pwre")
|
||||
drop("exstop")
|
||||
drop("pwrx")
|
||||
do_query(query, 'DROP VIEW power_events_view');
|
||||
if is_table_empty("cbr"):
|
||||
drop("cbr")
|
||||
|
||||
|
|
|
@ -608,11 +608,11 @@ def trace_end():
|
|||
if is_table_empty("ptwrite"):
|
||||
drop("ptwrite")
|
||||
if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"):
|
||||
do_query(query, 'DROP VIEW power_events_view');
|
||||
drop("mwait")
|
||||
drop("pwre")
|
||||
drop("exstop")
|
||||
drop("pwrx")
|
||||
do_query(query, 'DROP VIEW power_events_view');
|
||||
if is_table_empty("cbr"):
|
||||
drop("cbr")
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include "tests.h"
|
||||
|
@ -115,8 +116,8 @@ noinline int test_dwarf_unwind__thread(struct thread *thread)
|
|||
}
|
||||
|
||||
out:
|
||||
free(sample.user_stack.data);
|
||||
free(sample.user_regs.regs);
|
||||
zfree(&sample.user_stack.data);
|
||||
zfree(&sample.user_regs.regs);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "util/expr.h"
|
||||
#include "tests.h"
|
||||
#include <stdlib.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static int test(struct parse_ctx *ctx, const char *e, double val2)
|
||||
{
|
||||
|
@ -58,7 +59,7 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)
|
|||
TEST_ASSERT_VAL("find other", other[3] == NULL);
|
||||
|
||||
for (i = 0; i < num_other; i++)
|
||||
free((void *)other[i]);
|
||||
zfree(&other[i]);
|
||||
free((void *)other);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <util/llvm-utils.h>
|
||||
#include <util/cache.h>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include "cpumap.h"
|
||||
#include "mem2node.h"
|
||||
#include "tests.h"
|
||||
|
@ -67,7 +68,7 @@ int test__mem2node(struct test *t __maybe_unused, int subtest __maybe_unused)
|
|||
T("failed: mem2node__node", -1 == mem2node__node(&map, 0x1050));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(nodes); i++)
|
||||
free(nodes[i].set);
|
||||
zfree(&nodes[i].set);
|
||||
|
||||
mem2node__exit(&map);
|
||||
return 0;
|
||||
|
|
|
@ -53,7 +53,7 @@ static void *thread_fn(void *arg)
|
|||
{
|
||||
struct thread_data *td = arg;
|
||||
ssize_t ret;
|
||||
int go;
|
||||
int go = 0;
|
||||
|
||||
if (thread_init(td))
|
||||
return NULL;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "parse-events.h"
|
||||
#include "evlist.h"
|
||||
|
@ -237,7 +238,7 @@ static void free_event_nodes(struct list_head *events)
|
|||
|
||||
while (!list_empty(events)) {
|
||||
node = list_entry(events->next, struct event_node, list);
|
||||
list_del(&node->list);
|
||||
list_del_init(&node->list);
|
||||
free(node);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "tests.h"
|
||||
#include "thread_map.h"
|
||||
#include "debug.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#define NAME (const char *) "perf"
|
||||
#define NAMEUL (unsigned long) NAME
|
||||
|
@ -133,7 +134,7 @@ int test__thread_map_remove(struct test *test __maybe_unused, int subtest __mayb
|
|||
thread_map__remove(threads, 0));
|
||||
|
||||
for (i = 0; i < threads->nr; i++)
|
||||
free(threads->map[i].comm);
|
||||
zfree(&threads->map[i].comm);
|
||||
|
||||
free(threads);
|
||||
return 0;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <linux/rbtree.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "map.h"
|
||||
#include "symbol.h"
|
||||
#include "util.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "../util.h"
|
||||
#include "../string2.h"
|
||||
#include "../config.h"
|
||||
#include "../../perf.h"
|
||||
|
@ -17,6 +16,7 @@
|
|||
#include "keysyms.h"
|
||||
#include "../color.h"
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static int ui_browser__percent_color(struct ui_browser *browser,
|
||||
double percent, bool current)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define HE_COLORSET_TOP 50
|
||||
#define HE_COLORSET_MEDIUM 51
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "../../util/util.h"
|
||||
#include "../browser.h"
|
||||
#include "../helpline.h"
|
||||
#include "../ui.h"
|
||||
|
@ -15,6 +14,7 @@
|
|||
#include <pthread.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/ttydefaults.h>
|
||||
#include <asm/bug.h>
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <linux/string.h>
|
||||
#include <sys/ttydefaults.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../../util/callchain.h"
|
||||
#include "../../util/evsel.h"
|
||||
|
@ -18,7 +19,6 @@
|
|||
#include "../../util/symbol.h"
|
||||
#include "../../util/pstack.h"
|
||||
#include "../../util/sort.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/top.h"
|
||||
#include "../../util/thread.h"
|
||||
#include "../../arch/common.h"
|
||||
|
@ -639,7 +639,11 @@ int hist_browser__run(struct hist_browser *browser, const char *help,
|
|||
switch (key) {
|
||||
case K_TIMER: {
|
||||
u64 nr_entries;
|
||||
hbt->timer(hbt->arg);
|
||||
|
||||
WARN_ON_ONCE(!hbt);
|
||||
|
||||
if (hbt)
|
||||
hbt->timer(hbt->arg);
|
||||
|
||||
if (hist_browser__has_filter(browser) ||
|
||||
symbol_conf.report_hierarchy)
|
||||
|
@ -2821,7 +2825,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
|
|||
{
|
||||
struct hists *hists = evsel__hists(evsel);
|
||||
struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts);
|
||||
struct branch_info *bi;
|
||||
struct branch_info *bi = NULL;
|
||||
#define MAX_OPTIONS 16
|
||||
char *options[MAX_OPTIONS];
|
||||
struct popup_action actions[MAX_OPTIONS];
|
||||
|
@ -3087,7 +3091,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
|
|||
goto skip_annotation;
|
||||
|
||||
if (sort__mode == SORT_MODE__BRANCH) {
|
||||
bi = browser->he_selection->branch_info;
|
||||
|
||||
if (browser->he_selection)
|
||||
bi = browser->he_selection->branch_info;
|
||||
|
||||
if (bi == NULL)
|
||||
goto skip_annotation;
|
||||
|
@ -3271,7 +3277,8 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
|
|||
|
||||
switch (key) {
|
||||
case K_TIMER:
|
||||
hbt->timer(hbt->arg);
|
||||
if (hbt)
|
||||
hbt->timer(hbt->arg);
|
||||
|
||||
if (!menu->lost_events_warned &&
|
||||
menu->lost_events &&
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/ttydefaults.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <linux/bitops.h>
|
||||
#include "../../util/util.h"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Display a menu with individual samples to browse with perf script */
|
||||
#include "util.h"
|
||||
#include "hist.h"
|
||||
#include "evsel.h"
|
||||
#include "hists.h"
|
||||
|
@ -8,6 +7,7 @@
|
|||
#include "config.h"
|
||||
#include "time-utils.h"
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static u64 context_len = 10 * NSEC_PER_MSEC;
|
||||
|
||||
|
@ -46,14 +46,14 @@ int res_sample_browse(struct res_sample *res_samples, int num_res,
|
|||
if (asprintf(&names[i], "%s: CPU %d tid %d", tbuf,
|
||||
res_samples[i].cpu, res_samples[i].tid) < 0) {
|
||||
while (--i >= 0)
|
||||
free(names[i]);
|
||||
zfree(&names[i]);
|
||||
free(names);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
choice = ui__popup_menu(num_res, names);
|
||||
for (i = 0; i < num_res; i++)
|
||||
free(names[i]);
|
||||
zfree(&names[i]);
|
||||
free(names);
|
||||
|
||||
if (choice < 0 || choice >= num_res)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "../../util/sort.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/hist.h"
|
||||
#include "../../util/debug.h"
|
||||
#include "../../util/symbol.h"
|
||||
#include "../browser.h"
|
||||
#include "../libslang.h"
|
||||
#include "config.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#define SCRIPT_NAMELEN 128
|
||||
#define SCRIPT_MAX_NO 64
|
||||
|
@ -142,7 +142,7 @@ static int list_scripts(char *script_name, bool *custom,
|
|||
out:
|
||||
free(buf);
|
||||
for (i = 0; i < max_std; i++)
|
||||
free(paths[i]);
|
||||
zfree(&paths[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
|
|||
gtk_container_add(GTK_CONTAINER(window), view);
|
||||
|
||||
list_for_each_entry_safe(pos, n, ¬es->src->source, al.node) {
|
||||
list_del(&pos->al.node);
|
||||
list_del_init(&pos->al.node);
|
||||
disasm_line__free(pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "../util.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/debug.h"
|
||||
#include "gtk.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
struct perf_gtk_context *pgctx;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <linux/string.h>
|
||||
|
||||
#include "../../util/callchain.h"
|
||||
#include "../../util/util.h"
|
||||
#include "../../util/hist.h"
|
||||
#include "../../util/map.h"
|
||||
#include "../../util/map_groups.h"
|
||||
|
@ -14,6 +13,7 @@
|
|||
#include "../../util/string2.h"
|
||||
#include "../../util/thread.h"
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <linux/kernel.h>
|
||||
#ifdef HAVE_BACKTRACE_SUPPORT
|
||||
#include <execinfo.h>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "../../util/util.h"
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ttydefaults.h>
|
||||
|
||||
#include "../../util/cache.h"
|
||||
|
|
|
@ -25,6 +25,7 @@ perf-y += rbtree.o
|
|||
perf-y += libstring.o
|
||||
perf-y += bitmap.o
|
||||
perf-y += hweight.o
|
||||
perf-y += zalloc.o
|
||||
perf-y += smt.o
|
||||
perf-y += strbuf.o
|
||||
perf-y += string.o
|
||||
|
@ -241,3 +242,7 @@ $(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
|
|||
$(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
|
||||
$(call rule_mkdir)
|
||||
$(call if_changed_dep,cc_o_c)
|
||||
|
||||
$(OUTPUT)util/zalloc.o: ../lib/zalloc.c FORCE
|
||||
$(call rule_mkdir)
|
||||
$(call if_changed_dep,cc_o_c)
|
||||
|
|
|
@ -1119,16 +1119,14 @@ static int disasm_line__parse(char *line, const char **namep, char **rawp)
|
|||
*namep = strdup(name);
|
||||
|
||||
if (*namep == NULL)
|
||||
goto out_free_name;
|
||||
goto out;
|
||||
|
||||
(*rawp)[0] = tmp;
|
||||
*rawp = skip_spaces(*rawp);
|
||||
|
||||
return 0;
|
||||
|
||||
out_free_name:
|
||||
free((void *)namep);
|
||||
*namep = NULL;
|
||||
out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1237,8 +1235,7 @@ void disasm_line__free(struct disasm_line *dl)
|
|||
dl->ins.ops->free(&dl->ops);
|
||||
else
|
||||
ins__delete(&dl->ops);
|
||||
free((void *)dl->ins.name);
|
||||
dl->ins.name = NULL;
|
||||
zfree(&dl->ins.name);
|
||||
annotation_line__delete(&dl->al);
|
||||
}
|
||||
|
||||
|
@ -1589,7 +1586,7 @@ static void delete_last_nop(struct symbol *sym)
|
|||
return;
|
||||
}
|
||||
|
||||
list_del(&dl->al.node);
|
||||
list_del_init(&dl->al.node);
|
||||
disasm_line__free(dl);
|
||||
}
|
||||
}
|
||||
|
@ -2466,7 +2463,7 @@ void annotated_source__purge(struct annotated_source *as)
|
|||
struct annotation_line *al, *n;
|
||||
|
||||
list_for_each_entry_safe(al, n, &as->source, node) {
|
||||
list_del(&al->node);
|
||||
list_del_init(&al->node);
|
||||
disasm_line__free(disasm_line(al));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "cpumap.h"
|
||||
#include "color.h"
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include "evlist.h"
|
||||
#include "machine.h"
|
||||
#include "session.h"
|
||||
#include "util.h"
|
||||
#include "thread.h"
|
||||
#include "debug.h"
|
||||
#include "auxtrace.h"
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "../perf.h"
|
||||
#include "util.h"
|
||||
#include "evlist.h"
|
||||
#include "dso.h"
|
||||
#include "map.h"
|
||||
|
@ -408,7 +408,7 @@ void auxtrace_queues__free(struct auxtrace_queues *queues)
|
|||
|
||||
buffer = list_entry(queues->queue_array[i].head.next,
|
||||
struct auxtrace_buffer, list);
|
||||
list_del(&buffer->list);
|
||||
list_del_init(&buffer->list);
|
||||
auxtrace_buffer__free(buffer);
|
||||
}
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ void auxtrace_index__free(struct list_head *head)
|
|||
struct auxtrace_index *auxtrace_index, *n;
|
||||
|
||||
list_for_each_entry_safe(auxtrace_index, n, head, list) {
|
||||
list_del(&auxtrace_index->list);
|
||||
list_del_init(&auxtrace_index->list);
|
||||
free(auxtrace_index);
|
||||
}
|
||||
}
|
||||
|
@ -1413,7 +1413,7 @@ void auxtrace_cache__free(struct auxtrace_cache *c)
|
|||
return;
|
||||
|
||||
auxtrace_cache__drop(c);
|
||||
free(c->hashtable);
|
||||
zfree(&c->hashtable);
|
||||
free(c);
|
||||
}
|
||||
|
||||
|
@ -1459,12 +1459,11 @@ void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key)
|
|||
|
||||
static void addr_filter__free_str(struct addr_filter *filt)
|
||||
{
|
||||
free(filt->str);
|
||||
zfree(&filt->str);
|
||||
filt->action = NULL;
|
||||
filt->sym_from = NULL;
|
||||
filt->sym_to = NULL;
|
||||
filt->filename = NULL;
|
||||
filt->str = NULL;
|
||||
}
|
||||
|
||||
static struct addr_filter *addr_filter__new(void)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <errno.h>
|
||||
#include "perf.h"
|
||||
#include "debug.h"
|
||||
|
@ -828,7 +829,7 @@ static void
|
|||
bpf_map_op__delete(struct bpf_map_op *op)
|
||||
{
|
||||
if (!list_empty(&op->list))
|
||||
list_del(&op->list);
|
||||
list_del_init(&op->list);
|
||||
if (op->key_type == BPF_MAP_KEY_RANGES)
|
||||
parse_events__clear_array(&op->k.array);
|
||||
free(op);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "strlist.h"
|
||||
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static bool no_buildid_cache;
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "call-path.h"
|
||||
|
||||
static void call_path__init(struct call_path *cp, struct call_path *parent,
|
||||
|
@ -39,7 +40,7 @@ void call_path_root__free(struct call_path_root *cpr)
|
|||
struct call_path_block *pos, *n;
|
||||
|
||||
list_for_each_entry_safe(pos, n, &cpr->blocks, node) {
|
||||
list_del(&pos->node);
|
||||
list_del_init(&pos->node);
|
||||
free(pos);
|
||||
}
|
||||
free(cpr);
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "asm/bug.h"
|
||||
|
||||
#include "hist.h"
|
||||
#include "util.h"
|
||||
#include "sort.h"
|
||||
#include "machine.h"
|
||||
#include "map.h"
|
||||
|
@ -636,7 +636,7 @@ add_child(struct callchain_node *parent,
|
|||
struct callchain_list *call, *tmp;
|
||||
|
||||
list_for_each_entry_safe(call, tmp, &new->val, list) {
|
||||
list_del(&call->list);
|
||||
list_del_init(&call->list);
|
||||
map__zput(call->ms.map);
|
||||
free(call);
|
||||
}
|
||||
|
@ -1002,7 +1002,7 @@ merge_chain_branch(struct callchain_cursor *cursor,
|
|||
callchain_cursor_append(cursor, list->ip,
|
||||
list->ms.map, list->ms.sym,
|
||||
false, NULL, 0, 0, 0, list->srcline);
|
||||
list_del(&list->list);
|
||||
list_del_init(&list->list);
|
||||
map__zput(list->ms.map);
|
||||
free(list);
|
||||
}
|
||||
|
@ -1453,13 +1453,13 @@ static void free_callchain_node(struct callchain_node *node)
|
|||
struct rb_node *n;
|
||||
|
||||
list_for_each_entry_safe(list, tmp, &node->parent_val, list) {
|
||||
list_del(&list->list);
|
||||
list_del_init(&list->list);
|
||||
map__zput(list->ms.map);
|
||||
free(list);
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(list, tmp, &node->val, list) {
|
||||
list_del(&list->list);
|
||||
list_del_init(&list->list);
|
||||
map__zput(list->ms.map);
|
||||
free(list);
|
||||
}
|
||||
|
@ -1544,7 +1544,7 @@ int callchain_node__make_parent_list(struct callchain_node *node)
|
|||
|
||||
out:
|
||||
list_for_each_entry_safe(chain, new, &head, list) {
|
||||
list_del(&chain->list);
|
||||
list_del_init(&chain->list);
|
||||
map__zput(chain->ms.map);
|
||||
free(chain);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "util.h"
|
||||
#include "../perf.h"
|
||||
#include <subcmd/parse-options.h>
|
||||
#include "evsel.h"
|
||||
#include "cgroup.h"
|
||||
#include "evlist.h"
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -124,7 +124,7 @@ static struct cgroup *cgroup__new(const char *name)
|
|||
return cgroup;
|
||||
|
||||
out_free_name:
|
||||
free(cgroup->name);
|
||||
zfree(&cgroup->name);
|
||||
out_err:
|
||||
free(cgroup);
|
||||
return NULL;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "comm.h"
|
||||
#include "util.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include "rwsem.h"
|
||||
|
||||
struct comm_str {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*/
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include "util.h"
|
||||
#include "cache.h"
|
||||
#include "callchain.h"
|
||||
#include <subcmd/exec-cmd.h>
|
||||
|
@ -23,7 +22,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#include <linux/zalloc.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
#define MAXNAME (256)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "evsel.h"
|
||||
#include "counts.h"
|
||||
#include "util.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
struct perf_counts *perf_counts__new(int ncpus, int nthreads)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "util.h"
|
||||
#include <api/fs/fs.h>
|
||||
#include "../perf.h"
|
||||
#include "cpumap.h"
|
||||
|
@ -11,6 +10,7 @@
|
|||
#include "asm/bug.h"
|
||||
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static int max_cpu_num;
|
||||
static int max_present_cpu_num;
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <api/fs/fs.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include "cputopo.h"
|
||||
#include "cpumap.h"
|
||||
#include "util.h"
|
||||
#include "env.h"
|
||||
|
||||
#define CORE_SIB_FMT \
|
||||
|
@ -343,7 +344,7 @@ void numa_topology__delete(struct numa_topology *tp)
|
|||
u32 i;
|
||||
|
||||
for (i = 0; i < tp->nr; i++)
|
||||
free(tp->nodes[i].cpus);
|
||||
zfree(&tp->nodes[i].cpus);
|
||||
|
||||
free(tp);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <linux/err.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <opencsd/c_api/opencsd_c_api.h>
|
||||
#include <opencsd/etmv4/trc_pkt_types_etmv4.h>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#include <opencsd/ocsd_if_types.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -554,8 +555,7 @@ static void cs_etm__free_traceid_queues(struct cs_etm_queue *etmq)
|
|||
etmq->traceid_queues_list = NULL;
|
||||
|
||||
/* finally free the traceid_queues array */
|
||||
free(etmq->traceid_queues);
|
||||
etmq->traceid_queues = NULL;
|
||||
zfree(&etmq->traceid_queues);
|
||||
}
|
||||
|
||||
static void cs_etm__free_queue(void *priv)
|
||||
|
@ -2538,7 +2538,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
|
||||
if (session->itrace_synth_opts->set) {
|
||||
etm->synth_opts = *session->itrace_synth_opts;
|
||||
} else {
|
||||
itrace_synth_opts__set_default(&etm->synth_opts,
|
||||
|
@ -2568,7 +2568,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
|
|||
err_free_metadata:
|
||||
/* No need to check @metadata[j], free(NULL) is supported */
|
||||
for (j = 0; j < num_cpu; j++)
|
||||
free(metadata[j]);
|
||||
zfree(&metadata[j]);
|
||||
zfree(&metadata);
|
||||
err_free_traceid_list:
|
||||
intlist__delete(traceid_list);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <inttypes.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <babeltrace/ctf-writer/writer.h>
|
||||
#include <babeltrace/ctf-writer/clock.h>
|
||||
#include <babeltrace/ctf-writer/stream.h>
|
||||
|
@ -22,7 +23,6 @@
|
|||
#include "asm/bug.h"
|
||||
#include "data-convert-bt.h"
|
||||
#include "session.h"
|
||||
#include "util.h"
|
||||
#include "debug.h"
|
||||
#include "tool.h"
|
||||
#include "evlist.h"
|
||||
|
@ -1353,7 +1353,7 @@ static void free_streams(struct ctf_writer *cw)
|
|||
for (cpu = 0; cpu < cw->stream_cnt; cpu++)
|
||||
ctf_stream__delete(cw->stream[cpu]);
|
||||
|
||||
free(cw->stream);
|
||||
zfree(&cw->stream);
|
||||
}
|
||||
|
||||
static int ctf_writer__setup_env(struct ctf_writer *cw,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
@ -20,7 +21,7 @@ static void close_dir(struct perf_data_file *files, int nr)
|
|||
{
|
||||
while (--nr >= 1) {
|
||||
close(files[nr].fd);
|
||||
free(files[nr].path);
|
||||
zfree(&files[nr].path);
|
||||
}
|
||||
free(files);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "evsel.h"
|
||||
#include "machine.h"
|
||||
|
@ -13,11 +14,11 @@
|
|||
#include "symbol.h"
|
||||
#include "map.h"
|
||||
#include "event.h"
|
||||
#include "util.h"
|
||||
#include "thread-stack.h"
|
||||
#include "callchain.h"
|
||||
#include "call-path.h"
|
||||
#include "db-export.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
struct deferred_export {
|
||||
struct list_head node;
|
||||
|
@ -33,7 +34,7 @@ static int db_export__deferred(struct db_export *dbe)
|
|||
de = list_entry(dbe->deferred.next, struct deferred_export,
|
||||
node);
|
||||
err = dbe->export_comm(dbe, de->comm);
|
||||
list_del(&de->node);
|
||||
list_del_init(&de->node);
|
||||
free(de);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -49,7 +50,7 @@ static void db_export__free_deferred(struct db_export *dbe)
|
|||
while (!list_empty(&dbe->deferred)) {
|
||||
de = list_entry(dbe->deferred.next, struct deferred_export,
|
||||
node);
|
||||
list_del(&de->node);
|
||||
list_del_init(&de->node);
|
||||
free(de);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <api/debug.h>
|
||||
#include <linux/time64.h>
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "util.h"
|
||||
#include "debug.h"
|
||||
#include "symbol.h"
|
||||
|
||||
#include "demangle-java.h"
|
||||
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
enum {
|
||||
MODE_PREFIX = 0,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <asm/bug.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -21,7 +22,7 @@
|
|||
#include "dso.h"
|
||||
#include "machine.h"
|
||||
#include "auxtrace.h"
|
||||
#include "util.h"
|
||||
#include "util.h" /* O_CLOEXEC for older systems */
|
||||
#include "debug.h"
|
||||
#include "string2.h"
|
||||
#include "vdso.h"
|
||||
|
@ -433,7 +434,7 @@ static void dso__list_add(struct dso *dso)
|
|||
|
||||
static void dso__list_del(struct dso *dso)
|
||||
{
|
||||
list_del(&dso->data.open_entry);
|
||||
list_del_init(&dso->data.open_entry);
|
||||
WARN_ONCE(dso__data_open_cnt <= 0,
|
||||
"DSO data fd counter out of bounds.");
|
||||
dso__data_open_cnt--;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include "util.h"
|
||||
#include <stdlib.h>
|
||||
#include "debug.h"
|
||||
#include "dwarf-aux.h"
|
||||
#include "string2.h"
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
#include "cpumap.h"
|
||||
#include "env.h"
|
||||
#include <linux/ctype.h>
|
||||
#include "util.h"
|
||||
#include <linux/zalloc.h>
|
||||
#include "bpf-event.h"
|
||||
#include <errno.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct perf_env perf_env;
|
||||
|
||||
|
@ -186,7 +187,7 @@ void perf_env__exit(struct perf_env *env)
|
|||
zfree(&env->caches);
|
||||
|
||||
for (i = 0; i < env->nr_memory_nodes; i++)
|
||||
free(env->memory_nodes[i].set);
|
||||
zfree(&env->memory_nodes[i].set);
|
||||
zfree(&env->memory_nodes);
|
||||
}
|
||||
|
||||
|
@ -286,9 +287,9 @@ int perf_env__nr_cpus_avail(struct perf_env *env)
|
|||
|
||||
void cpu_cache_level__free(struct cpu_cache_level *cache)
|
||||
{
|
||||
free(cache->type);
|
||||
free(cache->map);
|
||||
free(cache->size);
|
||||
zfree(&cache->type);
|
||||
zfree(&cache->map);
|
||||
zfree(&cache->size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
|
||||
#include <api/fs/fs.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include "event.h"
|
||||
#include "debug.h"
|
||||
#include "hist.h"
|
||||
|
@ -855,7 +856,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
free(synthesize_threads);
|
||||
free_dirent:
|
||||
for (i = 0; i < n; i++)
|
||||
free(dirent[i]);
|
||||
zfree(&dirent[i]);
|
||||
free(dirent);
|
||||
|
||||
return err;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* Parts came from builtin-{top,stat,record}.c, see those files for further
|
||||
* copyright notes.
|
||||
*/
|
||||
#include "util.h"
|
||||
#include <api/fs/fs.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
@ -33,6 +32,7 @@
|
|||
#include <linux/hash.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
#ifdef LACKS_SIGQUEUE_PROTOTYPE
|
||||
int sigqueue(pid_t pid, int sig, const union sigval value);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <linux/perf_event.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -27,7 +28,6 @@
|
|||
#include "event.h"
|
||||
#include "evsel.h"
|
||||
#include "evlist.h"
|
||||
#include "util.h"
|
||||
#include "cpumap.h"
|
||||
#include "thread_map.h"
|
||||
#include "target.h"
|
||||
|
@ -1298,7 +1298,7 @@ static void perf_evsel__free_config_terms(struct perf_evsel *evsel)
|
|||
struct perf_evsel_config_term *term, *h;
|
||||
|
||||
list_for_each_entry_safe(term, h, &evsel->config_terms, list) {
|
||||
list_del(&term->list);
|
||||
list_del_init(&term->list);
|
||||
free(term);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
// SPDX-License-Identifier: LGPL-2.1
|
||||
// Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
//
|
||||
#ifndef HAVE_GET_CURRENT_DIR_NAME
|
||||
#include "util.h"
|
||||
#include "get_current_dir_name.h"
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: LGPL-2.1
|
||||
// Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
//
|
||||
#ifndef __PERF_GET_CURRENT_DIR_NAME_H
|
||||
#ifndef HAVE_GET_CURRENT_DIR_NAME
|
||||
char *get_current_dir_name(void);
|
||||
#endif // HAVE_GET_CURRENT_DIR_NAME
|
||||
#endif // __PERF_GET_CURRENT_DIR_NAME_H
|
|
@ -1,7 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include "util.h"
|
||||
#include "string2.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -15,6 +14,7 @@
|
|||
#include <linux/bitops.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/zalloc.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <linux/time64.h>
|
||||
|
@ -1052,7 +1052,7 @@ static int cpu_cache_level__read(struct cpu_cache_level *cache, u32 cpu, u16 lev
|
|||
|
||||
scnprintf(file, PATH_MAX, "%s/size", path);
|
||||
if (sysfs__read_str(file, &cache->size, &len)) {
|
||||
free(cache->type);
|
||||
zfree(&cache->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1061,8 +1061,8 @@ static int cpu_cache_level__read(struct cpu_cache_level *cache, u32 cpu, u16 lev
|
|||
|
||||
scnprintf(file, PATH_MAX, "%s/shared_cpu_list", path);
|
||||
if (sysfs__read_str(file, &cache->map, &len)) {
|
||||
free(cache->map);
|
||||
free(cache->type);
|
||||
zfree(&cache->map);
|
||||
zfree(&cache->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
#include "config.h"
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <subcmd/help.h>
|
||||
#include "../builtin.h"
|
||||
#include "levenshtein.h"
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static int autocorrect;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "callchain.h"
|
||||
#include "util.h"
|
||||
#include "build-id.h"
|
||||
#include "hist.h"
|
||||
#include "map.h"
|
||||
|
@ -20,6 +19,7 @@
|
|||
#include <inttypes.h>
|
||||
#include <sys/param.h>
|
||||
#include <linux/time64.h>
|
||||
#include <linux/zalloc.h>
|
||||
|
||||
static bool hists__filter_entry_by_dso(struct hists *hists,
|
||||
struct hist_entry *he);
|
||||
|
@ -472,16 +472,16 @@ static int hist_entry__init(struct hist_entry *he,
|
|||
return 0;
|
||||
|
||||
err_srcline:
|
||||
free(he->srcline);
|
||||
zfree(&he->srcline);
|
||||
|
||||
err_rawdata:
|
||||
free(he->raw_data);
|
||||
zfree(&he->raw_data);
|
||||
|
||||
err_infos:
|
||||
if (he->branch_info) {
|
||||
map__put(he->branch_info->from.map);
|
||||
map__put(he->branch_info->to.map);
|
||||
free(he->branch_info);
|
||||
zfree(&he->branch_info);
|
||||
}
|
||||
if (he->mem_info) {
|
||||
map__put(he->mem_info->iaddr.map);
|
||||
|
@ -489,7 +489,7 @@ static int hist_entry__init(struct hist_entry *he,
|
|||
}
|
||||
err:
|
||||
map__zput(he->ms.map);
|
||||
free(he->stat_acc);
|
||||
zfree(&he->stat_acc);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -1254,10 +1254,10 @@ void hist_entry__delete(struct hist_entry *he)
|
|||
zfree(&he->stat_acc);
|
||||
free_srcline(he->srcline);
|
||||
if (he->srcfile && he->srcfile[0])
|
||||
free(he->srcfile);
|
||||
zfree(&he->srcfile);
|
||||
free_callchain(he->callchain);
|
||||
free(he->trace_output);
|
||||
free(he->raw_data);
|
||||
zfree(&he->trace_output);
|
||||
zfree(&he->raw_data);
|
||||
ops->free(he);
|
||||
}
|
||||
|
||||
|
@ -2741,10 +2741,10 @@ static void hists_evsel__exit(struct perf_evsel *evsel)
|
|||
|
||||
list_for_each_entry_safe(node, tmp, &hists->hpp_formats, list) {
|
||||
perf_hpp_list__for_each_format_safe(&node->hpp, fmt, pos) {
|
||||
list_del(&fmt->list);
|
||||
list_del_init(&fmt->list);
|
||||
free(fmt);
|
||||
}
|
||||
list_del(&node->list);
|
||||
list_del_init(&node->list);
|
||||
free(node);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue