Skip to content

Commit

Permalink
Swap 6.8 (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoftsm authored Mar 29, 2024
1 parent 4af2b4b commit 791490f
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
fail-fast: false
matrix:
kernel_version:
- '6.8.2'
- '5.16.18'
- '5.15.63'
- '5.14.0'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
strategy:
matrix:
kernel_version:
- '6.8.2'
- '5.16.18'
- '5.15.63'
- '5.14.0'
Expand Down
Empty file added kernel-patches/6.8.2/.gitkeep
Empty file.
6 changes: 5 additions & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ NETDATA_ALL_APPS= btrfs \
zfs \
#

# Kernel newer than 6.8.0 ( 395264 = 6 * 65536 + 8 * 256)
ifeq ($(shell test $(CURRENT_KERNEL) -ge 395264 ; echo $$?),0)
NETDATA_APPS= swap \
#
# Kernel newer than 5.15.256 ( 331776 = 5 * 65536 + 16 * 256)
ifeq ($(shell test $(CURRENT_KERNEL) -ge 331776 ; echo $$?),0)
else ifeq ($(shell test $(CURRENT_KERNEL) -ge 331776 ; echo $$?),0)
NETDATA_APPS= cachestat \
#
# Kernel newer than 5.14.256 ( 331520 = 5 * 65536 + 14 * 256)
Expand Down
4 changes: 4 additions & 0 deletions kernel/rename_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ parse_kernel_version() {
select_kernel_version() {
KVER=$(parse_kernel_version "${1}" "${2}")

VER6_8_0="006008"
VER5_16_0="005016"
VER5_15_0="005015"
VER5_14_0="005014"
Expand All @@ -32,6 +33,8 @@ select_kernel_version() {
KSELECTED="3.10";
elif [ "${KVER}" -eq "${VER4_18_0}" ]; then
KSELECTED="4.18";
elif [ "${KVER}" -ge "${VER6_8_0}" ]; then
KSELECTED="6.8";
elif [ "${KVER}" -ge "${VER5_16_0}" ]; then
KSELECTED="5.16";
elif [ "${KVER}" -ge "${VER5_15_0}" ]; then
Expand Down Expand Up @@ -64,3 +67,4 @@ KNAME=$(select_kernel_version "${1}" "${2}")

cp "r${NAME}_kern.o" "../rnetdata_ebpf_${NAME}.${KNAME}.o"
cp "p${NAME}_kern.o" "../pnetdata_ebpf_${NAME}.${KNAME}.o"

4 changes: 4 additions & 0 deletions kernel/swap_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ struct bpf_map_def SEC("maps") swap_ctrl = {
*
***********************************************************************************/

#if (LINUX_VERSION_CODE > KERNEL_VERSION(6,7,255))
SEC("kprobe/swap_read_folio")
#else
SEC("kprobe/swap_readpage")
#endif
int netdata_swap_readpage(struct pt_regs* ctx)
{
netdata_swap_access_t data = {};
Expand Down
8 changes: 5 additions & 3 deletions kernel/tester_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ebpf_module_t ebpf_modules[] = {
.flags = NETDATA_FLAG_SYNC, .name = "syncfs", .update_names = NULL, .ctrl_table = NULL },
{ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
.flags = NETDATA_FLAG_SYNC, .name = "sync_file_range", .update_names = NULL, .ctrl_table = NULL },
{ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
{ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14 | NETDATA_V6_8,
.flags = NETDATA_FLAG_SWAP, .name = "swap", .update_names = NULL, .ctrl_table = "swap_ctrl" },
{ .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_14,
.flags = NETDATA_FLAG_VFS, .name = "vfs", .update_names = NULL, .ctrl_table = "vfs_ctrl" },
Expand Down Expand Up @@ -212,7 +212,7 @@ int ebpf_get_redhat_release()
*/
static char *ebpf_select_kernel_name(uint32_t selector)
{
static char *kernel_names[] = { "3.10", "4.14", "4.16", "4.18", "5.4", "5.10", "5.11", "5.14", "5.15", "5.16" };
static char *kernel_names[] = { "3.10", "4.14", "4.16", "4.18", "5.4", "5.10", "5.11", "5.14", "5.15", "5.16", "6.8" };

return kernel_names[selector];
}
Expand All @@ -237,7 +237,9 @@ static int ebpf_select_max_index(int rhf_version, uint32_t kver)
else if (kver >= NETDATA_EBPF_KERNEL_4_11)
return 3;
} else { // Kernels from kernel.org
if (kver >= NETDATA_EBPF_KERNEL_5_16)
if (kver >= NETDATA_EBPF_KERNEL_6_8)
return 10;
else if (kver >= NETDATA_EBPF_KERNEL_5_16)
return 9;
else if (kver >= NETDATA_EBPF_KERNEL_5_15)
return 8;
Expand Down
25 changes: 14 additions & 11 deletions kernel/tester_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ enum netdata_ebpf_kernel_versions {
NETDATA_EBPF_KERNEL_5_11 = 330496, // 330240 = 5 * 65536 + 11 * 256
NETDATA_EBPF_KERNEL_5_14 = 331264, // 331264 = 5 * 65536 + 14 * 256
NETDATA_EBPF_KERNEL_5_15 = 331520, // 331520 = 5 * 65536 + 15 * 256
NETDATA_EBPF_KERNEL_5_16 = 331776 // 331776 = 5 * 65536 + 16 * 256
NETDATA_EBPF_KERNEL_5_16 = 331776, // 331776 = 5 * 65536 + 16 * 256
NETDATA_EBPF_KERNEL_6_8 = 395264 // 395264 = 5 * 65536 + 8 * 256
};

/**
Expand All @@ -60,16 +61,17 @@ enum netdata_ebpf_kernel_versions {


enum netdata_kernel_flag {
NETDATA_V3_10 = 1 << 0,
NETDATA_V4_14 = 1 << 1,
NETDATA_V4_16 = 1 << 2,
NETDATA_V4_18 = 1 << 3,
NETDATA_V5_4 = 1 << 4,
NETDATA_V5_10 = 1 << 5,
NETDATA_V5_11 = 1 << 6,
NETDATA_V5_14 = 1 << 7,
NETDATA_V5_15 = 1 << 8,
NETDATA_V5_16 = 1 << 9
NETDATA_V3_10 = 1 << 0,
NETDATA_V4_14 = 1 << 1,
NETDATA_V4_16 = 1 << 2,
NETDATA_V4_18 = 1 << 3,
NETDATA_V5_4 = 1 << 4,
NETDATA_V5_10 = 1 << 5,
NETDATA_V5_11 = 1 << 6,
NETDATA_V5_14 = 1 << 7,
NETDATA_V5_15 = 1 << 8,
NETDATA_V5_16 = 1 << 9,
NETDATA_V6_8 = 1 << 10
};

enum netdata_kernel_counter {
Expand All @@ -83,6 +85,7 @@ enum netdata_kernel_counter {
NETDATA_5_14,
NETDATA_5_15,
NETDATA_5_16,
NETDATA_6_8,

NETDATA_VERSION_END
};
Expand Down

0 comments on commit 791490f

Please sign in to comment.