diff --git a/add-riscv64-support.patch b/add-riscv64-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..b957909675bbffe81cfc4fa9583d4ac244759342 --- /dev/null +++ b/add-riscv64-support.patch @@ -0,0 +1,66 @@ +From 756f6595b562a3fff5de9ab8dd38865f20aa022c Mon Sep 17 00:00:00 2001 +From: laokz +Date: Thu, 25 Apr 2024 22:21:28 +0800 +Subject: [PATCH] add riscv64 support + +Signal info referenced: +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/kernel/signal.c#L373 + +Max CPUs referenced: +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/Kconfig#L411 + +Local disk suport PCI and VIRTIO both. +--- + sysmonitor-1.3.2/module/signo_catch.c | 8 ++++++++ + sysmonitor-1.3.2/script/get_local_disk.sh | 2 ++ + sysmonitor-1.3.2/src/sys_resources.c | 2 ++ + 3 files changed, 12 insertions(+) + +diff --git a/sysmonitor-1.3.2/module/signo_catch.c b/sysmonitor-1.3.2/module/signo_catch.c +index c038e161ff19..043a14838f98 100644 +--- a/module/signo_catch.c ++++ b/module/signo_catch.c +@@ -272,6 +272,14 @@ static int pre_handler(struct kprobe *p, struct pt_regs *regs) + data.p = (struct task_struct *)((unsigned long *)regs->dx); + do_store_sig_info(&data); + #endif ++ ++#if defined(CONFIG_RISCV) && defined(CONFIG_64BIT) ++ send_sig_info_data_t data; ++ data.sig = regs->a0; ++ data.info = (struct kernel_siginfo *)((unsigned long *)regs->a1); ++ data.p = (struct task_struct *)((unsigned long *)regs->a2); ++ do_store_sig_info(&data); ++#endif + return 0; + } + +diff --git a/sysmonitor-1.3.2/script/get_local_disk.sh b/sysmonitor-1.3.2/script/get_local_disk.sh +index 318374cbffdd..063e540cebd4 100755 +--- a/script/get_local_disk.sh ++++ b/script/get_local_disk.sh +@@ -9,6 +9,8 @@ fc_disk_file="" + local_disk_file="" + if uname -a | grep -q aarch64; then + fc_local_disk=`ls -l /sys/block/ | grep -E 'pci|HISI0162' 2> /dev/null` ++elif uname -a | grep -q riscv64; then ++ fc_local_disk=`ls -l /sys/block/ | grep -E 'pci|virtio' 2> /dev/null` + else + fc_local_disk=`ls -l /sys/block/ | grep pci 2> /dev/null` + fi +diff --git a/sysmonitor-1.3.2/src/sys_resources.c b/sysmonitor-1.3.2/src/sys_resources.c +index fdf52561e07d..87f2fdd73b10 100644 +--- a/src/sys_resources.c ++++ b/src/sys_resources.c +@@ -64,6 +64,8 @@ + #define MAX_DOMAIN_CPU_COUNT 256 + #ifdef __x86_64__ + #define DOMAIN_CPU_LEN 1024 /* x86 supports max 8192 CPUs */ ++#elif defined(__riscv) ++#define DOMAIN_CPU_LEN 64 /* riscv supports max 512 CPUs */ + #else + #define DOMAIN_CPU_LEN 128 /* arm64 supports max 1024 CPUs */ + #endif +-- +2.39.5 + diff --git a/sysmonitor-kmod.spec b/sysmonitor-kmod.spec index b157b64fbe1d0dc3a88ad60fe3e2931b34be49fc..f732a8053805e7d9b155c5758dba1af08d3da71e 100644 --- a/sysmonitor-kmod.spec +++ b/sysmonitor-kmod.spec @@ -7,7 +7,7 @@ %define kmod_name sysmonitor %define version 1.3.2 -%define releaseversion 1.5 +%define releaseversion 1.6 Summary: System Monitor Daemon Name: %{kmod_name}-kmod Version: %{version} @@ -38,6 +38,7 @@ Provides: sysmonitor Patch1: bugfix-fix-signal-monitor-err.patch Patch2: bugfix-fix-fd-path-failed-to-open.patch Patch3: update-support-loongarch-fix-compilation-errors.patch +Patch4: add-riscv64-support.patch %description System Monitor Daemon @@ -172,6 +173,12 @@ systemctl daemon-reload 2>/dev/null 1>/dev/null /usr/lib/systemd/system/multi-user.target.wants/sysmonitor.service %changelog +* Mon Jun 03 2024 laokz - 1.3.2-1.6 +- Type:update +- CVE:NA +- SUG:NA +- DESC: support riscv64 build + * Mon Jun 03 2024 yueyuankun - 1.3.2-1.5 - Type:update - CVE:NA