summaryrefslogtreecommitdiffstats
path: root/libnetdata/ebpf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-12 07:26:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-12 07:26:17 +0000
commit7877a98bd9c00db5e81dd2f8c734cba2bab20be7 (patch)
treed18b767250f7c7ced9b8abe2ece784ac1fe24d3e /libnetdata/ebpf
parentReleasing debian version 1.35.1-2. (diff)
downloadnetdata-7877a98bd9c00db5e81dd2f8c734cba2bab20be7.tar.xz
netdata-7877a98bd9c00db5e81dd2f8c734cba2bab20be7.zip
Merging upstream version 1.36.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/ebpf')
-rw-r--r--libnetdata/ebpf/ebpf.c4
-rw-r--r--libnetdata/ebpf/ebpf.h48
2 files changed, 49 insertions, 3 deletions
diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c
index ffb602307..c48f2f24e 100644
--- a/libnetdata/ebpf/ebpf.c
+++ b/libnetdata/ebpf/ebpf.c
@@ -608,7 +608,7 @@ static void ebpf_update_maps(ebpf_module_t *em, struct bpf_object *obj)
void ebpf_update_controller(int fd, ebpf_module_t *em)
{
uint32_t key = NETDATA_CONTROLLER_APPS_ENABLED;
- uint32_t value = em->apps_charts | em->cgroup_charts;
+ uint32_t value = (em->apps_charts & NETDATA_EBPF_APPS_FLAG_YES) | em->cgroup_charts;
int ret = bpf_map_update_elem(fd, &key, &value, 0);
if (ret)
error("Add key(%u) for controller table failed.", key);
@@ -969,7 +969,7 @@ void ebpf_update_module_using_config(ebpf_module_t *modules)
EBPF_CFG_UPDATE_EVERY, modules->update_every);
modules->apps_charts = appconfig_get_boolean(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_APPLICATION,
- modules->apps_charts);
+ (int) (modules->apps_charts & NETDATA_EBPF_APPS_FLAG_YES));
modules->cgroup_charts = appconfig_get_boolean(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_CGROUP,
modules->cgroup_charts);
diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h
index ec486b59a..55b68a51e 100644
--- a/libnetdata/ebpf/ebpf.h
+++ b/libnetdata/ebpf/ebpf.h
@@ -34,6 +34,7 @@
#define EBPF_CFG_PROGRAM_PATH "btf path"
#define EBPF_CFG_UPDATE_EVERY "update every"
+#define EBPF_CFG_UPDATE_APPS_EVERY_DEFAULT 10
#define EBPF_CFG_PID_SIZE "pid table size"
#define EBPF_CFG_APPLICATION "apps"
#define EBPF_CFG_CGROUP "cgroups"
@@ -212,6 +213,12 @@ typedef struct ebpf_plugin_stats {
uint32_t trampolines; // Number of trampolines used
} ebpf_plugin_stats_t;
+typedef enum netdata_apps_integration_flags {
+ NETDATA_EBPF_APPS_FLAG_NO,
+ NETDATA_EBPF_APPS_FLAG_YES,
+ NETDATA_EBPF_APPS_FLAG_CHART_CREATED
+} netdata_apps_integration_flags_t;
+
typedef struct ebpf_module {
const char *thread_name;
const char *config_name;
@@ -219,7 +226,7 @@ typedef struct ebpf_module {
void *(*start_routine)(void *);
int update_every;
int global_charts;
- int apps_charts;
+ netdata_apps_integration_flags_t apps_charts;
int cgroup_charts;
netdata_run_mode_t mode;
uint32_t thread_id;
@@ -233,6 +240,8 @@ typedef struct ebpf_module {
uint64_t kernels;
netdata_ebpf_load_mode_t load;
netdata_ebpf_targets_t *targets;
+ struct bpf_link **probe_links;
+ struct bpf_object *objects;
} ebpf_module_t;
extern int ebpf_get_kernel_version();
@@ -266,6 +275,43 @@ typedef struct netdata_ebpf_histogram {
uint64_t histogram[NETDATA_EBPF_HIST_MAX_BINS];
} netdata_ebpf_histogram_t;
+typedef struct ebpf_filesystem_partitions {
+ char *filesystem;
+ char *optional_filesystem;
+ char *family;
+ char *family_name;
+ struct bpf_object *objects;
+ struct bpf_link **probe_links;
+
+ netdata_ebpf_histogram_t hread;
+ netdata_ebpf_histogram_t hwrite;
+ netdata_ebpf_histogram_t hopen;
+ netdata_ebpf_histogram_t hadditional;
+
+ uint32_t flags;
+ uint32_t enabled;
+
+ ebpf_addresses_t addresses;
+ uint64_t kernels;
+} ebpf_filesystem_partitions_t;
+
+typedef struct ebpf_sync_syscalls {
+ char *syscall;
+ int enabled;
+ uint32_t flags;
+
+ // BTF structure
+ struct bpf_object *objects;
+ struct bpf_link **probe_links;
+
+ // BPF structure
+#ifdef LIBBPF_MAJOR_VERSION
+ struct sync_bpf *sync_obj;
+#else
+ void *sync_obj;
+#endif
+} ebpf_sync_syscalls_t;
+
extern void ebpf_histogram_dimension_cleanup(char **ptr, size_t length);
// Tracepoint helpers