mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Revert "tracing: Expose tracepoint BTF ids via tracefs"
This reverts commit eadc0725ab.
ld: drivers/net/wireless/mediatek/mt76/usb_trace.o:(.bss+0x40): multiple definition of `__bpf_trace_btf_ids_dev_reg_evt'; drivers/net/wireless/mediatek/mt76/trace.o:(.bss+0x80): first defined here
ld: drivers/media/platform/nvidia/tegra-vde/vde.o:(.bss+0x180): multiple definition of `__bpf_trace_btf_ids_register_access'; drivers/gpu/drm/tegra/trace.o:(.bss+0x0): first defined here
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -298,15 +298,6 @@ struct trace_event_class {
|
||||
struct list_head *(*get_fields)(struct trace_event_call *);
|
||||
struct list_head fields;
|
||||
int (*raw_init)(struct trace_event_call *);
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
/*
|
||||
* Per-template BTF ids set by DECLARE_EVENT_CLASS via BTF_ID() and
|
||||
* patched by resolve_btfids at link time. NULL for handcrafted classes.
|
||||
* [0] FUNC __bpf_trace_<template>
|
||||
* [1] STRUCT trace_event_raw_<template>
|
||||
*/
|
||||
const u32 *btf_ids;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int trace_event_reg(struct trace_event_call *event,
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/trace_events.h>
|
||||
#include <linux/btf_ids.h>
|
||||
|
||||
#ifndef TRACE_SYSTEM_VAR
|
||||
#define TRACE_SYSTEM_VAR TRACE_SYSTEM
|
||||
@@ -398,27 +397,6 @@ static inline notrace int trace_event_get_offsets_##call( \
|
||||
#define _TRACE_PERF_INIT(call)
|
||||
#endif /* CONFIG_PERF_EVENTS */
|
||||
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
/*
|
||||
* Per-template BTF id list, populated at link time by resolve_btfids:
|
||||
* [0] FUNC __bpf_trace_<call> (the BPF dispatcher)
|
||||
* [1] STRUCT trace_event_raw_<call> (the ring-buffer record)
|
||||
* Exposed via the events/<sys>/<name>/btf_ids tracefs file.
|
||||
*/
|
||||
#define _TRACE_BTF_IDS_DECLARE(call) \
|
||||
extern u32 __bpf_trace_btf_ids_##call[]; \
|
||||
BTF_ID_LIST_GLOBAL(__bpf_trace_btf_ids_##call, 2) \
|
||||
BTF_ID(func, __bpf_trace_##call) \
|
||||
BTF_ID(struct, trace_event_raw_##call)
|
||||
|
||||
#define _TRACE_BTF_IDS_INIT(call) \
|
||||
.btf_ids = __bpf_trace_btf_ids_##call,
|
||||
|
||||
#else
|
||||
#define _TRACE_BTF_IDS_DECLARE(call)
|
||||
#define _TRACE_BTF_IDS_INIT(call)
|
||||
#endif /* CONFIG_BPF_EVENTS */
|
||||
|
||||
#include "stages/stage6_event_callback.h"
|
||||
|
||||
|
||||
@@ -496,7 +474,6 @@ static inline void ftrace_test_probe_##call(void) \
|
||||
#undef DECLARE_EVENT_CLASS
|
||||
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
|
||||
_TRACE_PERF_PROTO(call, PARAMS(proto)); \
|
||||
_TRACE_BTF_IDS_DECLARE(call) \
|
||||
static char print_fmt_##call[] = print; \
|
||||
static struct trace_event_class __used __refdata event_class_##call = { \
|
||||
.system = TRACE_SYSTEM_STRING, \
|
||||
@@ -506,7 +483,6 @@ static struct trace_event_class __used __refdata event_class_##call = { \
|
||||
.probe = trace_event_raw_event_##call, \
|
||||
.reg = trace_event_reg, \
|
||||
_TRACE_PERF_INIT(call) \
|
||||
_TRACE_BTF_IDS_INIT(call) \
|
||||
};
|
||||
|
||||
#undef DECLARE_EVENT_SYSCALL_CLASS
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <linux/sort.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/btf.h>
|
||||
|
||||
#include <trace/events/sched.h>
|
||||
#include <trace/syscall.h>
|
||||
@@ -2227,61 +2226,6 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
static ssize_t
|
||||
event_btf_ids_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
|
||||
{
|
||||
struct trace_event_file *file;
|
||||
struct trace_event_call *call;
|
||||
const struct btf_type *t;
|
||||
struct module *mod = NULL;
|
||||
u32 raw_id = 0, tp_id = 0, obj_id = 0;
|
||||
const u32 *ids;
|
||||
struct btf *btf;
|
||||
char buf[128];
|
||||
int len;
|
||||
|
||||
/* Module unload could free call->class and ids[] mid-read. */
|
||||
scoped_guard(mutex, &event_mutex) {
|
||||
file = event_file_file(filp);
|
||||
if (!file)
|
||||
return -ENODEV;
|
||||
|
||||
call = file->event_call;
|
||||
ids = call->class->btf_ids;
|
||||
if (!ids)
|
||||
return -ENOENT;
|
||||
if (!(call->flags & TRACE_EVENT_FL_DYNAMIC))
|
||||
mod = (struct module *)call->module;
|
||||
|
||||
btf = btf_get_module_btf(mod);
|
||||
if (IS_ERR_OR_NULL(btf))
|
||||
return -ENOENT;
|
||||
|
||||
/* Module-local ids in ids[] need base+local relocation. */
|
||||
tp_id = btf_relocate_id(btf, ids[1]);
|
||||
|
||||
/*
|
||||
* Without FL_TRACEPOINT the dispatcher is shared (e.g. all
|
||||
* per-syscall events fan out from __bpf_trace_sys_enter), so
|
||||
* raw_btf_id has no per-event attach point — report 0.
|
||||
*/
|
||||
if (call->flags & TRACE_EVENT_FL_TRACEPOINT) {
|
||||
t = btf_type_by_id(btf, btf_relocate_id(btf, ids[0]));
|
||||
raw_id = t ? t->type : 0;
|
||||
}
|
||||
obj_id = btf_obj_id(btf);
|
||||
btf_put(btf);
|
||||
}
|
||||
|
||||
len = scnprintf(buf, sizeof(buf),
|
||||
"btf_obj_id: %u\nraw_btf_id: %u\ntp_btf_id: %u\n",
|
||||
obj_id, raw_id, tp_id);
|
||||
|
||||
return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t
|
||||
event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
|
||||
loff_t *ppos)
|
||||
@@ -2782,13 +2726,6 @@ static const struct file_operations ftrace_event_id_fops = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
static const struct file_operations ftrace_event_btf_ids_fops = {
|
||||
.read = event_btf_ids_read,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
#endif
|
||||
|
||||
static const struct file_operations ftrace_event_filter_fops = {
|
||||
.open = tracing_open_file_tr,
|
||||
.read = event_filter_read,
|
||||
@@ -3182,14 +3119,6 @@ static int event_callback(const char *name, umode_t *mode, void **data,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
if (call->class->btf_ids && strcmp(name, "btf_ids") == 0) {
|
||||
*mode = TRACE_MODE_READ;
|
||||
*fops = &ftrace_event_btf_ids_fops;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HIST_TRIGGERS
|
||||
if (strcmp(name, "hist") == 0) {
|
||||
*mode = TRACE_MODE_READ;
|
||||
@@ -3244,14 +3173,7 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
|
||||
.callback = event_callback,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
{
|
||||
.name = "btf_ids",
|
||||
.callback = event_callback,
|
||||
},
|
||||
#endif
|
||||
#define NR_RO_EVENT_ENTRIES (1 + IS_ENABLED(CONFIG_PERF_EVENTS) + \
|
||||
IS_ENABLED(CONFIG_BPF_EVENTS))
|
||||
#define NR_RO_EVENT_ENTRIES (1 + IS_ENABLED(CONFIG_PERF_EVENTS))
|
||||
/* Readonly files must be above this line and counted by NR_RO_EVENT_ENTRIES. */
|
||||
{
|
||||
.name = "enable",
|
||||
|
||||
@@ -1303,26 +1303,12 @@ struct trace_event_functions exit_syscall_print_funcs = {
|
||||
.trace = print_syscall_exit,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
/*
|
||||
* BTF id lists generated by DECLARE_EVENT_CLASS for the sys_enter and
|
||||
* sys_exit tracepoints. The auto-generated event_class_sys_{enter,exit}
|
||||
* is unused (per-syscall events share the handcrafted classes below),
|
||||
* but the id lists themselves are global and reusable.
|
||||
*/
|
||||
extern u32 __bpf_trace_btf_ids_sys_enter[];
|
||||
extern u32 __bpf_trace_btf_ids_sys_exit[];
|
||||
#endif
|
||||
|
||||
struct trace_event_class __refdata event_class_syscall_enter = {
|
||||
.system = "syscalls",
|
||||
.reg = syscall_enter_register,
|
||||
.fields_array = syscall_enter_fields_array,
|
||||
.get_fields = syscall_get_enter_fields,
|
||||
.raw_init = init_syscall_trace,
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
.btf_ids = __bpf_trace_btf_ids_sys_enter,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct trace_event_class __refdata event_class_syscall_exit = {
|
||||
@@ -1335,9 +1321,6 @@ struct trace_event_class __refdata event_class_syscall_exit = {
|
||||
},
|
||||
.fields = LIST_HEAD_INIT(event_class_syscall_exit.fields),
|
||||
.raw_init = init_syscall_trace,
|
||||
#ifdef CONFIG_BPF_EVENTS
|
||||
.btf_ids = __bpf_trace_btf_ids_sys_exit,
|
||||
#endif
|
||||
};
|
||||
|
||||
unsigned long __init __weak arch_syscall_addr(int nr)
|
||||
|
||||
Reference in New Issue
Block a user