Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
71c9556e46
!23 sync 24.03lts
From: @Jer6y 
Reviewed-by: @jianli-97 
Signed-off-by: @jianli-97
2024-03-26 01:05:23 +00:00
Jer6y
a1793935dc riscv: add riscv support and update to v1.19.1
*add riscv support
*update to v1.19.1

Signed-off-by: luojun <luojun.oerv@isrc.iscas.ac.cn>
2024-03-24 20:51:35 +08:00
openeuler-ci-bot
24b29d0b18
!18 move readme to docdir/stalld
From: @duyiwei7w 
Reviewed-by: @fu-shanqing 
Signed-off-by: @fu-shanqing
2023-09-14 09:15:49 +00:00
duyiwei
6d14cfda29 move README
Signed-off-by: duyiwei <duyiwei@kylinos.cn>
2023-09-14 14:58:52 +08:00
openeuler-ci-bot
53ce4fbc80
!13 add support for loongarch64
From: @lvgenggeng 
Reviewed-by: @yangzhao_kl 
Signed-off-by: @yangzhao_kl
2023-08-02 01:23:30 +00:00
lvgenggeng
27d2e16a65 add support for loongarch64
Signed-off-by: lvgenggeng <lvgenggeng@uniontech.com>
2023-07-20 10:41:04 +08:00
openeuler-ci-bot
8dce5255f4
!11 Specification NestOS Project Component Description File
From: @duyiwei7w 
Reviewed-by: @fu-shanqing 
Signed-off-by: @fu-shanqing
2023-06-21 07:15:09 +00:00
duyiwei
a8f28689a1
Specification NestOS Project Component Description File
Signed-off-by: duyiwei <duyiwei@kylinos.cn>
2023-06-21 06:20:06 +00:00
openeuler-ci-bot
16942023ed
!9 为该仓库新建yaml文件
From: @dingdingaaaaa 
Reviewed-by: @duyiwei7w 
Signed-off-by: @duyiwei7w
2022-11-29 07:31:31 +00:00
丁紫薇
82f68079d8
add stalld.yaml.
Signed-off-by: 丁紫薇 <dingziwei@kylinos.cn>
2022-11-28 07:50:39 +00:00
6 changed files with 116 additions and 18 deletions

View File

@ -1,30 +1,73 @@
# stalld
#### 介绍
The stalld program is a mechanism to prevent the starvation of operating system threads in a Linux system.
The stalld program (which stands for 'stall daemon') is a
mechanism to prevent the starvation of operating system threads in a
Linux system. The premise is to start up on a housekeeping cpu (one
that is not used for real-application purposes) and to periodically
monitor the state of each thread in the system, looking for a thread
that has been on a run queue (i.e. ready to run) for a specifed length
of time without being run. This condition is usually hit when the
thread is on the same cpu as a high-priority cpu-intensive task and
therefore is being given no opportunity to run.
When a thread is judged to be starving, stalld changes
that thread to use the SCHED_DEADLINE policy and gives the thread a
small slice of time for that cpu (specified on the command line). The
thread then runs and when that timeslice is used, the thread is then
returned to its original scheduling policy and stalld then
continues to monitor thread states.
There is now an experimental option to boost using SCHED_FIFO. This
logic is used if the running kernel does not support the
SCHED_DEADLINE policy and may be forced by using the -F/--force_fifo
option.
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
Install stalld rpm package:
yum install stalld
#### 使用说明
Logging options
1. xxxx
2. xxxx
3. xxxx
-l/--log_only: only log information (do not boost) [false]
-v/--verbose: print info to the std output [false]
-k/--log_kmsg: print log to the kernel buffer [false]
-s/--log_syslog: print log to syslog [true]
Startup options
-c/--cpu: list of cpus to monitor for stalled threads [all cpus]
-f/--foreground: run in foreground [false but true when -v]
-P/--pidfile: write daemon pid to specified file [no pidfile]
Boosting options
-p/--boost_period: SCHED_DEADLINE period [ns] that the starving task will receive [1000000000]
-r/--boost_runtime: SCHED_DEADLINE runtime [ns] that the starving task will receive [20000]
-d/--boost_duration: how long [s] the starving task will run with SCHED_DEADLINE [3]
-F/--force_fifo: force using SCHED_FIFO for boosting
Monitoring options
-t/--starving_threshold: how long [s] the starving task will wait before being boosted [60]
-A/--aggressive_mode: dispatch one thread per run queue, even when there is no starving
threads on all CPU (uses more CPU/power). [false]
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
master分支使用最新的上游版本如果检测到上游有最新版本发布先形成issue后再提交对应PR更新流程如下。
1. 提交issue
2. Fork 本仓库
3. 新建 Feat_xxx 分支
4. 提交代码
5. 新建 Pull Request
#### 特技

30
riscv_support.patch Normal file
View File

@ -0,0 +1,30 @@
diff --git a/Makefile b/Makefile
index f866a74..76aefe2 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,12 @@ USE_BPF := 0
FCF_PROTECTION := $(CF_PROTECTION_OPTS)
TMOPTS := -mtune=powerpc
endif
+ifeq ($(ARCH),riscv64)
+USE_BPF :=0
+FCF_PROTECTION := $(CF_PROTECTION_OPTS)
+TMOPTS := -march=rv64gc -mabi=lp64d
+endif
+
$(info USE_BPF=$(USE_BPF))
$(info FCF_PROTECTION=$(FCF_PROTECTION))
diff --git a/src/stalld.h b/src/stalld.h
index a5b9dbc..7362d4e 100644
--- a/src/stalld.h
+++ b/src/stalld.h
@@ -119,7 +119,7 @@ struct stalld_backend {
#elif __arm__
# define __NR_sched_setattr 380
# define __NR_sched_getattr 381
-#elif __aarch64__ || __loongarch64
+#elif __aarch64__ || __loongarch64 || __riscv
# define __NR_sched_setattr 274
# define __NR_sched_getattr 275
#elif __powerpc__

Binary file not shown.

BIN
stalld-v1.19.1.tar.bz2 Normal file

Binary file not shown.

View File

@ -1,11 +1,12 @@
Name: stalld
Version: 1.16
Version: v1.19.1
Release: 1
Summary: Daemon that finds starving tasks and gives them a temporary boost
License: GPLv2
URL: https://gitlab.com/rt-linux-tools/%{name}
Source0: https://gitlab.com/rt-linux-tools/%{name}/-/archive/v%{version}/%{name}-%{version}.tar.bz2
Source0: https://gitlab.com/rt-linux-tools/%{name}/-/archive/%{version}/%{name}-%{version}.tar.bz2
Patch0: riscv_support.patch
BuildRequires: glibc-devel
BuildRequires: gcc
@ -14,6 +15,15 @@ BuildRequires: systemd
Requires: systemd
%ifnarch i686
BuildRequires: bpftool
BuildRequires: clang
BuildRequires: libbpf-devel
BuildRequires: llvm
Requires: libbpf
%endif
%description
The stalld program monitors the set of system threads,
looking for threads that are ready-to-run but have not
@ -23,21 +33,23 @@ boost using the SCHED_DEADLINE policy. The default is to
allow 10 microseconds of runtime for 1 second of clock time.
%prep
%autosetup
%autosetup -p1
%build
%make_build CFLAGS="%{optflags} %{build_cflags} -DVERSION="\\\"%{version}\\\""" LDFLAGS="%{build_ldflags}"
%install
%make_install DOCDIR=%{_docdir} MANDIR=%{_mandir} BINDIR=%{_bindir} DATADIR=%{_datadir} VERSION=%{version}
%make_install -C redhat UNITDIR=%{_unitdir}
%make_install -C systemd UNITDIR=%{_unitdir}
mkdir -p %{buildroot}%{_docdir}/%{name}
mv %{buildroot}%{_docdir}/README.md %{buildroot}%{_docdir}/%{name}/
%files
%{_bindir}/%{name}
%{_bindir}/throttlectl
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/stalld
%doc %{_docdir}/README.md
%doc %{_docdir}/%{name}/README.md
%doc %{_mandir}/man8/stalld.8*
%license gpl-2.0.txt
@ -51,6 +63,15 @@ allow 10 microseconds of runtime for 1 second of clock time.
%systemd_postun_with_restart %{name}.service
%changelog
* Sat Mar 23 2024 luojun <luojun.oerv@isrc.iscas.ac.cn> - v1.19.1-1
- update to v1.19 and support for oe-riscv
* Thu Sep 14 2023 duyiwei <duyiwei@kylinos.cn> - 1.16-3
- move README
* Thu Jul 20 2023 lvgenggeng <lvgenggeng@uniontech.com> - 1.16-2
- add support for loongarch64
* Mon Nov 07 2022 duyiwei <duyiwei@kylinos.cn> - 1.16-1
- upgrade version to 1.16

4
stalld.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: gitlab
src_repo: rt-linux-tools/stalld
tag_prefix: "v"
separator: "."