Compare commits
10 Commits
86eebebca7
...
d351b0add8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d351b0add8 | ||
|
|
9ceda5876d | ||
|
|
22560aeff3 | ||
|
|
48ce8a58c0 | ||
|
|
340865df3a | ||
|
|
85019c60a9 | ||
|
|
3255dd9742 | ||
|
|
f0938cbe68 | ||
|
|
75ca68d574 | ||
|
|
5ce7fe310a |
26
Add-stack-protector-compile-option.patch
Normal file
26
Add-stack-protector-compile-option.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From 7b9428779bbbff411c802e5c80a3fbdaee8608e9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lv Ying <lvying6@huawei.com>
|
||||||
|
Date: Tue, 8 Mar 2022 19:06:34 -0800
|
||||||
|
Subject: [PATCH] Add stack protector compile option
|
||||||
|
|
||||||
|
Signed-off-by: Lv Ying <lvying6@huawei.com>
|
||||||
|
---
|
||||||
|
Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 1e070a6..84ff9fd 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -4,7 +4,7 @@ CLANG ?= clang -v
|
||||||
|
VMLINUX ?= vmlinux.h
|
||||||
|
|
||||||
|
INCLUDES := -I$(OUTPUT) -I$(dir $(VMLINUX))
|
||||||
|
-CFLAGS := -g -Wall
|
||||||
|
+CFLAGS := -g -Wall -fstack-protector-strong
|
||||||
|
ARCH := $(shell uname -m | sed 's/x86_64/x86/')
|
||||||
|
|
||||||
|
APPS = readahead_tune
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
37
Drop-using-legacy-BPF-map-declaration.patch
Normal file
37
Drop-using-legacy-BPF-map-declaration.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 870d20f15defab4e3ff6f1cee721b8373ce2eb6d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lv Ying <lvying6@huawei.com>
|
||||||
|
Date: Wed, 3 Aug 2022 08:14:25 +0800
|
||||||
|
Subject: [PATCH] Drop using legacy BPF map declaration
|
||||||
|
https://github.com/libbpf/libbpf/wiki/Libbpf:-the-road-to-v1.0#drop-support-for-legacy-bpf-map-declaration-syntax
|
||||||
|
|
||||||
|
Signed-off-by: Lv Ying <lvying6@huawei.com>
|
||||||
|
---
|
||||||
|
readahead_tune.bpf.c | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/readahead_tune.bpf.c b/readahead_tune.bpf.c
|
||||||
|
index 24a6ff9..cb29f3d 100644
|
||||||
|
--- a/readahead_tune.bpf.c
|
||||||
|
+++ b/readahead_tune.bpf.c
|
||||||
|
@@ -43,12 +43,12 @@ struct {
|
||||||
|
__uint(max_entries, MAP_ARRAY_SIZE);
|
||||||
|
} arraymap SEC(".maps");
|
||||||
|
|
||||||
|
-struct bpf_map_def SEC("maps") htab = {
|
||||||
|
- .type = BPF_MAP_TYPE_HASH,
|
||||||
|
- .key_size = sizeof(long),
|
||||||
|
- .value_size = sizeof(struct file_rd_hnode),
|
||||||
|
- .max_entries = MAX_HASH_TABLE_ENTRY,
|
||||||
|
-};
|
||||||
|
+struct {
|
||||||
|
+ __uint(type, BPF_MAP_TYPE_HASH);
|
||||||
|
+ __type(key, u64);
|
||||||
|
+ __type(value, struct file_rd_hnode);
|
||||||
|
+ __uint(max_entries, MAX_HASH_TABLE_ENTRY);
|
||||||
|
+} htab SEC(".maps");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This first paramater should be the exact position of variable, otherwise the start
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
62
adapted-libbpf-library-interface-to-fix-build-failure.patch
Normal file
62
adapted-libbpf-library-interface-to-fix-build-failure.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
From acd74c90cf258fd70bd0c59a441c980b14886686 Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhoupengcheng <zhoupengcheng11@huawei.com>
|
||||||
|
Date: Mon, 26 Feb 2024 10:27:19 +0800
|
||||||
|
Subject: [PATCH] adapted-libbpf-library-interface-to-fix-build-failure 1.
|
||||||
|
adapted bpf_prog_load() 2. bpf_object__find_program_by_title() is
|
||||||
|
discarding,Replace bpf_object__find_program_by_name() with
|
||||||
|
bpf_object__find_program_by_title()
|
||||||
|
|
||||||
|
---
|
||||||
|
readahead_tune.c | 15 ++++++++++-----
|
||||||
|
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/readahead_tune.c b/readahead_tune.c
|
||||||
|
index f07f56e..7ec00ca 100644
|
||||||
|
--- a/readahead_tune.c
|
||||||
|
+++ b/readahead_tune.c
|
||||||
|
@@ -163,8 +163,13 @@ int main(int argc, char *argv[])
|
||||||
|
const char *file = "readahead_tune.bpf.o";
|
||||||
|
struct bpf_object *obj = NULL;
|
||||||
|
unsigned int where = TERM;
|
||||||
|
- int prog_fd = -1;
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ LIBBPF_OPTS(bpf_prog_load_opts, opts);
|
||||||
|
+ struct bpf_insn insns[] = {
|
||||||
|
+ { BPF_ALU64 | BPF_MOV | BPF_K, BPF_REG_0, 0, 0, 0 },
|
||||||
|
+ { BPF_JMP | BPF_EXIT, 0, 0, 0, 0 },
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
int err = argp_parse(&argp, argc, argv, 0, NULL, NULL);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
@@ -188,7 +193,7 @@ int main(int argc, char *argv[])
|
||||||
|
/* Bump RLIMIT_MEMLOCK to create BPF maps */
|
||||||
|
bump_memlock_rlimit(where);
|
||||||
|
|
||||||
|
- err = bpf_prog_load(file, BPF_PROG_TYPE_UNSPEC, &obj, &prog_fd);
|
||||||
|
+ err = bpf_prog_load(BPF_PROG_TYPE_UNSPEC, file, "GPL", insns, sizeof(insns)/sizeof(insns[0]), &opts);
|
||||||
|
if (err) {
|
||||||
|
log(where, LOG_ERR, "Failed to load BPF program\n");
|
||||||
|
return err;
|
||||||
|
@@ -208,7 +213,7 @@ int main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *prog_name = "raw_tracepoint.w/" READ_TP_NAME;
|
||||||
|
- struct bpf_program *prog = bpf_object__find_program_by_title(obj, prog_name);
|
||||||
|
+ struct bpf_program *prog = bpf_object__find_program_by_name(obj, prog_name);
|
||||||
|
if (!prog) {
|
||||||
|
log(where, LOG_ERR, "Failed to find program %s\n", prog_name);
|
||||||
|
err = -EINVAL;
|
||||||
|
@@ -223,7 +228,7 @@ int main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
|
||||||
|
prog_name = "raw_tracepoint/" RELEASE_TP_NAME;
|
||||||
|
- prog = bpf_object__find_program_by_title(obj, prog_name);
|
||||||
|
+ prog = bpf_object__find_program_by_name(obj, prog_name);
|
||||||
|
if (!prog) {
|
||||||
|
log(where, LOG_ERR, "Failed to find program %s\n", prog_name);
|
||||||
|
err = -EINVAL;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,12 +1,16 @@
|
|||||||
Name: A-Tune-BPF-Collection
|
Name: A-Tune-BPF-Collection
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 2
|
Release: 7
|
||||||
License: Mulan PSL v2
|
License: MulanPSL-2.0
|
||||||
Summary: BPF program collection to adjust fine-grained kernel mode to get better performance
|
Summary: BPF program collection to adjust fine-grained kernel mode to get better performance
|
||||||
URL: https://gitee.com/openeuler/A-Tune-BPF-Collection
|
URL: https://gitee.com/openeuler/A-Tune-BPF-Collection
|
||||||
Source0: https://gitee.com/openeuler/A-Tune-BPF-Collection/repository/archive/v%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/A-Tune-BPF-Collection/repository/archive/v%{version}.tar.gz
|
||||||
|
|
||||||
Patch1: use-generated-vmlinux.h-instead-of-bpftool-gen-vmlin.patch
|
Patch1: remove-spec-file-and-change-start_readahead_tune-s-d.patch
|
||||||
|
Patch2: Drop-using-legacy-BPF-map-declaration.patch
|
||||||
|
Patch3: use-generated-vmlinux.h-instead-of-bpftool-gen-vmlin.patch
|
||||||
|
Patch4: Add-stack-protector-compile-option.patch
|
||||||
|
Patch5: adapted-libbpf-library-interface-to-fix-build-failure.patch
|
||||||
|
|
||||||
BuildRequires: clang, llvm, libbpf-devel
|
BuildRequires: clang, llvm, libbpf-devel
|
||||||
Requires: libbpf
|
Requires: libbpf
|
||||||
@ -22,6 +26,7 @@ readahead_tune: trace file reading characteristics, then ajust file read mode to
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
%define __os_install_post %{nil}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -D -p -m 0755 readahead_tune %{buildroot}/%{_sbindir}/readahead_tune
|
install -D -p -m 0755 readahead_tune %{buildroot}/%{_sbindir}/readahead_tune
|
||||||
@ -38,6 +43,33 @@ install -D -p -m 0644 readahead_tune.conf %{buildroot}%{_sysconfdir}/sysconfig/r
|
|||||||
%config(noreplace) %{_sysconfdir}/sysconfig/readahead_tune.conf
|
%config(noreplace) %{_sysconfdir}/sysconfig/readahead_tune.conf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Feb 27 2024 zhoupengcheng<zhoupengcheng11@huawei.com> - 1.0.0-7
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: adapted libbpf library interface to fix build failure
|
||||||
|
|
||||||
|
* Fri May 5 2023 li-miaomiao_zhr<mmlidc@isoftstone.com> - 1.0.0-6
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: fix wrong file name referenced in spec file causing build failure,remove spec file from the source package
|
||||||
|
|
||||||
|
* Fri Aug 05 2022 fushanqing <fushanqing@kylinos.cn> - 1.0.0-5
|
||||||
|
- Unified license name specification
|
||||||
|
|
||||||
|
* Wed Aug 3 2022 lvying<lvying6@huawei.com> - 1.0.0-4
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Adapt new kernel and BPF compatibility
|
||||||
|
|
||||||
|
* Wed Mar 9 2022 lvying<lvying6@huawei.com> - 1.0.0-3
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Add stack protector compile option
|
||||||
|
|
||||||
* Wed Dec 8 2021 lvying<lvying6@huawei.com> - 1.0.0-2
|
* Wed Dec 8 2021 lvying<lvying6@huawei.com> - 1.0.0-2
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
79
remove-spec-file-and-change-start_readahead_tune-s-d.patch
Normal file
79
remove-spec-file-and-change-start_readahead_tune-s-d.patch
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
From 6b8c86e0caf821c7b58d168a0161a6aab000c8f2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lv Ying <lvying6@huawei.com>
|
||||||
|
Date: Tue, 2 Aug 2022 19:18:17 +0800
|
||||||
|
Subject: [PATCH] remove spec file and change start_readahead_tune's directory
|
||||||
|
|
||||||
|
Signed-off-by: Lv Ying <lvying6@huawei.com>
|
||||||
|
---
|
||||||
|
atune_bpf_collection.spec | 45 ---------------------------------------
|
||||||
|
start_readahead_tune | 3 +++
|
||||||
|
2 files changed, 3 insertions(+), 45 deletions(-)
|
||||||
|
delete mode 100644 atune_bpf_collection.spec
|
||||||
|
|
||||||
|
diff --git a/atune_bpf_collection.spec b/atune_bpf_collection.spec
|
||||||
|
deleted file mode 100644
|
||||||
|
index 0ce6dce..0000000
|
||||||
|
--- a/atune_bpf_collection.spec
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,45 +0,0 @@
|
||||||
|
-Name: A-Tune-BPF-Collection
|
||||||
|
-Version: 0.1
|
||||||
|
-Release: 1
|
||||||
|
-License: Mulan PSL v2
|
||||||
|
-Summary: BPF program collection to adjust fine-grained kernel mode to get better performance
|
||||||
|
-URL: https://gitee.com/openeuler/A-Tune-BPF-Collection
|
||||||
|
-Source0: https://gitee.com/openeuler/A-Tune-BPF-Collection/repository/archive/v%{version}.tar.gz
|
||||||
|
-
|
||||||
|
-BuildRequires: clang, llvm, libbpf-devel, bpftool, dwarves
|
||||||
|
-Requires: libbpf
|
||||||
|
-Provides: readahead_tune
|
||||||
|
-
|
||||||
|
-%define debug_package %{nil}
|
||||||
|
-
|
||||||
|
-%description
|
||||||
|
-A-Tune BPF Collection contains a set of BPF program which can interact with kernel in real time.
|
||||||
|
-It has the following capabilities:
|
||||||
|
-readahead_tune: trace file reading characteristics, then ajust file read mode to get maximum I/O efficency
|
||||||
|
-
|
||||||
|
-%prep
|
||||||
|
-%autosetup -n %{name}-%{version} -p1
|
||||||
|
-
|
||||||
|
-%build
|
||||||
|
-make %{?_smp_mflags}
|
||||||
|
-
|
||||||
|
-%install
|
||||||
|
-install -D -p -m 0755 readahead_tune %{buildroot}/%{_sbindir}/readahead_tune
|
||||||
|
-install -D -p -m 0644 readahead_tune.bpf.o %{buildroot}/%{_sbindir}/readahead_tune.bpf.o
|
||||||
|
-install -D -p -m 0755 start_readahead_tune %{buildroot}/%{_sbindir}/start_readahead_tune
|
||||||
|
-install -D -p -m 0755 stop_readahead_tune %{buildroot}/%{_sbindir}/stop_readahead_tune
|
||||||
|
-install -D -p -m 0644 readahead_tune.conf %{buildroot}%{_sysconfdir}/sysconfig/readahead_tune.conf
|
||||||
|
-
|
||||||
|
-%files
|
||||||
|
-%{_sbindir}/readahead_tune
|
||||||
|
-%{_sbindir}/readahead_tune.bpf.o
|
||||||
|
-%{_sbindir}/start_readahead_tune
|
||||||
|
-%{_sbindir}/stop_readahead_tune
|
||||||
|
-%config(noreplace) %{_sysconfdir}/sysconfig/readahead_tune.conf
|
||||||
|
-
|
||||||
|
-%changelog
|
||||||
|
-* Tue Nov 9 2021 lvying<lvying6@huawei.com> - 0.1-1
|
||||||
|
-- Type:feature
|
||||||
|
-- ID:NA
|
||||||
|
-- SUG:NA
|
||||||
|
-- DESC: Init A-Tune-BPF-Collection repo and add readahead_tune service
|
||||||
|
diff --git a/start_readahead_tune b/start_readahead_tune
|
||||||
|
index afae00c..5d5cd08 100755
|
||||||
|
--- a/start_readahead_tune
|
||||||
|
+++ b/start_readahead_tune
|
||||||
|
@@ -1,5 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
+# change working directory to current binary position
|
||||||
|
+cd "$(dirname "$0")"
|
||||||
|
+
|
||||||
|
function usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $0 [ -h | --help] [ -c | --config CONFIG_FILE ]"
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user