summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2021-01-13 15:02:20 +0000
committerGitHub <noreply@github.com>2021-01-13 15:02:20 +0000
commit7f002c126d41c434df422804941bb254f13a913f (patch)
tree70909ca867fc9f9f2f435523b57886e3c0e26020 /collectors
parent9fe43430f2a12a89a5f84c8cda43066272d1281d (diff)
New eBPF kernel (#10434)
Bring support for kernel 5.10.
Diffstat (limited to 'collectors')
-rw-r--r--collectors/ebpf.plugin/ebpf.c44
-rw-r--r--collectors/ebpf.plugin/ebpf.h6
-rw-r--r--collectors/ebpf.plugin/ebpf_kernel_reject_list.txt1
-rw-r--r--collectors/ebpf.plugin/ebpf_process.c12
-rw-r--r--collectors/ebpf.plugin/ebpf_socket.c16
5 files changed, 5 insertions, 74 deletions
diff --git a/collectors/ebpf.plugin/ebpf.c b/collectors/ebpf.plugin/ebpf.c
index 6cd8b96aa4..56e084e973 100644
--- a/collectors/ebpf.plugin/ebpf.c
+++ b/collectors/ebpf.plugin/ebpf.c
@@ -75,43 +75,15 @@ pthread_mutex_t lock;
pthread_mutex_t collect_data_mutex;
pthread_cond_t collect_data_cond_var;
-netdata_ebpf_events_t process_probes[] = {
- { .type = 'r', .name = "vfs_write" },
- { .type = 'r', .name = "vfs_writev" },
- { .type = 'r', .name = "vfs_read" },
- { .type = 'r', .name = "vfs_readv" },
- { .type = 'r', .name = "do_sys_open" },
- { .type = 'r', .name = "vfs_unlink" },
- { .type = 'p', .name = "do_exit" },
- { .type = 'p', .name = "release_task" },
- { .type = 'r', .name = "_do_fork" },
- { .type = 'r', .name = "__close_fd" },
- { .type = 'p', .name = "try_to_wake_up" },
- { .type = 'r', .name = "__x64_sys_clone" },
- { .type = 0, .name = NULL }
-};
-
-netdata_ebpf_events_t socket_probes[] = {
- { .type = 'p', .name = "tcp_cleanup_rbuf" },
- { .type = 'p', .name = "tcp_close" },
- { .type = 'p', .name = "udp_recvmsg" },
- { .type = 'r', .name = "udp_recvmsg" },
- { .type = 'r', .name = "udp_sendmsg" },
- { .type = 'p', .name = "do_exit" },
- { .type = 'p', .name = "tcp_sendmsg" },
- { .type = 'r', .name = "tcp_sendmsg" },
- { .type = 0, .name = NULL }
-};
-
ebpf_module_t ebpf_modules[] = {
{ .thread_name = "process", .config_name = "process", .enabled = 0, .start_routine = ebpf_process_thread,
- .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY, .probes = process_probes,
+ .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
.optional = 0 },
{ .thread_name = "socket", .config_name = "socket", .enabled = 0, .start_routine = ebpf_socket_thread,
- .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY, .probes = socket_probes,
+ .update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
.optional = 0 },
{ .thread_name = NULL, .enabled = 0, .start_routine = NULL, .update_time = 1,
- .global_charts = 0, .apps_charts = 1, .mode = MODE_ENTRY, .probes = NULL,
+ .global_charts = 0, .apps_charts = 1, .mode = MODE_ENTRY,
.optional = 0 },
};
@@ -166,15 +138,6 @@ static void clean_ip_structure(ebpf_network_viewer_ip_list_t **clean)
*clean = NULL;
}
-static void change_events()
-{
- if (ebpf_modules[0].mode == MODE_ENTRY)
- change_process_event();
-
- if (ebpf_modules[1].mode == MODE_ENTRY)
- change_socket_event();
-}
-
/**
* Clean Loaded Events
*
@@ -1966,7 +1929,6 @@ int main(int argc, char **argv)
{NULL , NULL, NULL, 0, NULL, NULL, NULL}
};
- change_events();
//clean_loaded_events();
int i;
diff --git a/collectors/ebpf.plugin/ebpf.h b/collectors/ebpf.plugin/ebpf.h
index 51b88fe228..1f58229515 100644
--- a/collectors/ebpf.plugin/ebpf.h
+++ b/collectors/ebpf.plugin/ebpf.h
@@ -109,8 +109,6 @@ extern int ebpf_nprocs;
extern int running_on_kernel;
extern char *ebpf_plugin_dir;
extern char kernel_string[64];
-extern netdata_ebpf_events_t process_probes[];
-extern netdata_ebpf_events_t socket_probes[];
extern pthread_mutex_t collect_data_mutex;
extern pthread_cond_t collect_data_cond_var;
@@ -193,8 +191,4 @@ extern uint32_t finalized_threads;
#define EBPF_MAX_SYNCHRONIZATION_TIME 300
-// External functions
-extern void change_socket_event();
-extern void change_process_event();
-
#endif /* NETDATA_COLLECTOR_EBPF_H */
diff --git a/collectors/ebpf.plugin/ebpf_kernel_reject_list.txt b/collectors/ebpf.plugin/ebpf_kernel_reject_list.txt
index 832be363b8..d56b216a9c 100644
--- a/collectors/ebpf.plugin/ebpf_kernel_reject_list.txt
+++ b/collectors/ebpf.plugin/ebpf_kernel_reject_list.txt
@@ -1,2 +1 @@
Ubuntu 4.18.0-13.
-Ubuntu 4.18.0-25.
diff --git a/collectors/ebpf.plugin/ebpf_process.c b/collectors/ebpf.plugin/ebpf_process.c
index a6a4d38a0b..9a1d69c066 100644
--- a/collectors/ebpf.plugin/ebpf_process.c
+++ b/collectors/ebpf.plugin/ebpf_process.c
@@ -968,22 +968,10 @@ static void ebpf_process_allocate_global_vectors(size_t length)
prev_apps_data = callocz((size_t)pid_max, sizeof(ebpf_process_publish_apps_t *));
}
-void change_process_event()
-{
- int i;
- if (running_on_kernel < NETDATA_KERNEL_V5_3)
- process_probes[EBPF_SYS_CLONE_IDX].name = NULL;
-
- for (i = 0; process_probes[i].name; i++) {
- process_probes[i].type = 'p';
- }
-}
-
static void change_syscalls()
{
static char *lfork = { "do_fork" };
process_id_names[7] = lfork;
- process_probes[8].name = lfork;
}
/**
diff --git a/collectors/ebpf.plugin/ebpf_socket.c b/collectors/ebpf.plugin/ebpf_socket.c
index 2a3c01c61e..2f73cf4dd4 100644
--- a/collectors/ebpf.plugin/ebpf_socket.c
+++ b/collectors/ebpf.plugin/ebpf_socket.c
@@ -1851,24 +1851,12 @@ static void ebpf_socket_allocate_global_vectors(size_t length)
outbound_vectors.plot = callocz(network_viewer_opt.max_dim, sizeof(netdata_socket_plot_t));
}
-void change_socket_event()
-{
- socket_probes[0].type = 'p';
- socket_probes[4].type = 'p';
- socket_probes[5].type = 'p';
- socket_probes[7].name = NULL;
-}
-
/**
* Set local function pointers, this function will never be compiled with static libraries
*/
-static void set_local_pointers(ebpf_module_t *em)
+static void set_local_pointers()
{
map_fd = socket_data.map_fd;
-
- if (em->mode == MODE_ENTRY) {
- change_socket_event();
- }
}
/**
@@ -1926,7 +1914,7 @@ void *ebpf_socket_thread(void *ptr)
goto endsocket;
}
- set_local_pointers(em);
+ set_local_pointers();
probe_links = ebpf_load_program(ebpf_plugin_dir, em, kernel_string, &objects, socket_data.map_fd);
if (!probe_links) {
pthread_mutex_unlock(&lock);