summaryrefslogtreecommitdiffstats
path: root/libnetdata
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 /libnetdata
parent9fe43430f2a12a89a5f84c8cda43066272d1281d (diff)
New eBPF kernel (#10434)
Bring support for kernel 5.10.
Diffstat (limited to 'libnetdata')
-rw-r--r--libnetdata/ebpf/ebpf.c15
-rw-r--r--libnetdata/ebpf/ebpf.h14
2 files changed, 16 insertions, 13 deletions
diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c
index dfcbd7fcf5..a9ff21f693 100644
--- a/libnetdata/ebpf/ebpf.c
+++ b/libnetdata/ebpf/ebpf.c
@@ -242,16 +242,18 @@ char *ebpf_kernel_suffix(int version, int isrh)
{
if (isrh) {
if (version >= NETDATA_EBPF_KERNEL_4_11)
- return "4.18.0";
+ return "4.18";
else
- return "3.10.0";
+ return "3.10";
} else {
- if (version >= NETDATA_EBPF_KERNEL_4_17)
- return "5.4.20";
+ if (version >= NETDATA_EBPF_KERNEL_5_10)
+ return "5.10";
+ else if (version >= NETDATA_EBPF_KERNEL_4_17)
+ return "5.4";
else if (version >= NETDATA_EBPF_KERNEL_4_15)
- return "4.16.18";
+ return "4.16";
else if (version >= NETDATA_EBPF_KERNEL_4_11)
- return "4.14.171";
+ return "4.14";
}
return NULL;
@@ -294,6 +296,7 @@ struct bpf_link **ebpf_load_program(char *plugins_dir, ebpf_module_t *em, char *
snprintf(lpath, 4096, "%s/%s", plugins_dir, lname);
if (bpf_prog_load(lpath, BPF_PROG_TYPE_KPROBE, obj, &prog_fd)) {
+ em->enabled = CONFIG_BOOLEAN_NO;
info("Cannot load program: %s", lpath);
return NULL;
} else {
diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h
index 379f2be45e..d4faccffd2 100644
--- a/libnetdata/ebpf/ebpf.h
+++ b/libnetdata/ebpf/ebpf.h
@@ -32,6 +32,13 @@
#define NETDATA_RH_8 2048
/**
+ * Kernel 5.10
+ *
+ * 330240 = 5*65536 + 10*256
+ */
+#define NETDATA_EBPF_KERNEL_5_10 330240
+
+/**
* Kernel 4.17
*
* 266496 = 4*65536 + 17*256
@@ -55,11 +62,6 @@
#define VERSION_STRING_LEN 256
#define EBPF_KERNEL_REJECT_LIST_FILE "ebpf_kernel_reject_list.txt"
-typedef struct netdata_ebpf_events {
- char type;
- char *name;
-} netdata_ebpf_events_t;
-
typedef struct ebpf_data {
int *map_fd;
@@ -83,14 +85,12 @@ typedef struct ebpf_module {
int global_charts;
int apps_charts;
netdata_run_mode_t mode;
- netdata_ebpf_events_t *probes;
uint32_t thread_id;
int optional;
} ebpf_module_t;
#define NETDATA_MAX_PROBES 64
-extern int clean_kprobe_events(FILE *out, int pid, netdata_ebpf_events_t *ptr);
extern int get_kernel_version(char *out, int size);
extern int get_redhat_release();
extern int has_condition_to_run(int version);