Anolis龙蜥操作系统安装测试plugsched

简介: Anolis龙蜥操作系统安装测试plugsched

Anolis开源plugsched 是 Linux 内核调度器子系统热升级的 SDK,它可以实现在不重启系统、应用的情况下动态替换调度器子系统。

龙蜥实验室中2核的机器1小时的时间不能完成内核的编译,需要阿里云ECS创建一台16核以上的按量计费机器,安装 Anolis OS 7.9 ANCK镜像,下载的kernel源码包是匹配这个版本的系统
因为需要编译内核,所以占用cpu较多,其他模块占用cpu较少
plugsched sdk在容器中可以找到
运行的脚本内容为以下内容,按 https://gitee.com/anolis/plugsched 说明整理,包括debuginfo包安装,容器启动,编译rpm包,安装rpm包,测试等过程,都在脚本中完成

#  Anolis OS 7.9 ANCK 使用
echo "=====安装 debuginfo====="
yum install anolis-repos -y
yum install yum-utils podman kernel-debuginfo-$(uname -r) kernel-devel-$(uname -r) --enablerepo=Plus-debuginfo --enablerepo=Plus -y
# yum install 如果没有安装debuginfo包,这里下载后安装
wget -c https://mirrors.openanolis.cn/anolis/7.9/Plus/x86_64/debug/Packages/kernel-debuginfo-common-x86_64-$(uname -r).rpm
rpm -ivh kernel-debuginfo-common-x86_64-$(uname -r).rpm
wget -c https://mirrors.openanolis.cn/anolis/7.9/Plus/x86_64/debug/Packages/kernel-debuginfo-$(uname -r).rpm
rpm -ivh kernel-debuginfo-$(uname -r).rpm
mkdir /tmp/work && cd /tmp/work
yumdownloader --source kernel-$(uname -r) --enablerepo=Plus --enablerepo=Plus-debuginfo
wget -c https://mirrors.openanolis.cn/anolis/7.9/Plus/source/Packages/kernel-4.19.91-25.7.an7.src.rpm
# 启动容器
podman run -itd --name=plugsched -v /tmp/work:/tmp/work -v /usr/src/kernels:/usr/src/kernels -v /usr/lib/debug/lib/modules:/usr/lib/debug/lib/modules docker.io/plugsched/plugsched-sdk

echo "=====创建 rpm====="
cat >/tmp/work/core.diff <<EOF
diff --git a/scheduler/kernel/sched/mod/core.c b/scheduler/kernel/sched/mod/core.c
index 9f16b72..21262fd 100644
--- a/scheduler/kernel/sched/mod/core.c
+++ b/scheduler/kernel/sched/mod/core.c
@@ -3234,6 +3234,9 @@ static void __sched notrace __schedule(bool preempt)
        struct rq *rq;
        int cpu;
 
+       if (sched_feat(PLUGSCHED_TEST))
+               printk_once("I am the new scheduler: __schedule\n");
+
        cpu = smp_processor_id();
        rq = cpu_rq(cpu);
        prev = rq->curr;
diff --git a/scheduler/kernel/sched/mod/features.h b/scheduler/kernel/sched/mod/features.h
index 4c40fac..8d1eafd 100644
--- a/scheduler/kernel/sched/mod/features.h
+++ b/scheduler/kernel/sched/mod/features.h
@@ -1,4 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+SCHED_FEAT(PLUGSCHED_TEST, false)
+
 /*
  * Only give sleepers 50% of their service deficit. This allows
  * them to run sooner, but does not allow tons of sleepers to
EOF

cat >/tmp/work/create_rpm.sh <<EOF
set -x
cd /tmp/work
uname_r=\$(uname -r)
plugsched-cli extract_src kernel-\${uname_r%.*}.src.rpm ./kernel
plugsched-cli init $(uname -r) ./kernel ./scheduler
patch -p1 <core.diff
plugsched-cli build /tmp/work/scheduler
cp /usr/local/lib/plugsched/rpmbuild/RPMS/x86_64/scheduler-xxx-\${uname_r%.*}.yyy.x86_64.rpm /tmp/work/scheduler-xxx.rpm
EOF

# 执行容器中命令
podman exec plugsched bash /tmp/work/create_rpm.sh

echo "=====安装 scheduler====="
cat /sys/kernel/debug/sched_features
rpm -ivh /tmp/work/scheduler-xxx.rpm
lsmod | grep scheduler
dmesg | tail -n 10
cat /sys/kernel/debug/sched_features
echo PLUGSCHED_TEST > /sys/kernel/debug/sched_features
dmesg | tail -n 5

echo "=====移除 scheduler====="
rpm -e scheduler-xxx
dmesg | tail -n 8
cat /sys/kernel/debug/sched_features
目录
相关文章
|
18天前
|
安全 Linux 测试技术
提升龙蜥内核测试能力!探究持续性模糊测试优化实践
清华大学软件学院对Anolis OS使用靶向模糊测试方法将测试工作引向修改的代码,进而提高对业务代码的测试能力。
|
27天前
|
Linux 数据安全/隐私保护 虚拟化
Linux技术基础(1)——操作系统的安装
本文是龙蜥操作系统(Anolis OS) 8.4 的安装指南,用户可以从[龙蜥社区下载页面](https://openanolis.cn/download)获取ISO镜像。安装方法包括物理机的光驱和USB闪存方式,以及虚拟机中的VMware Workstation Pro设置。安装过程涉及选择语言、配置安装目标、选择软件集合和内核,设置Root密码及创建新用户。安装完成后,可通过文本模式或图形化界面验证系统版本,如Anolis OS 8.4,标志着安装成功。
|
1月前
|
数据安全/隐私保护 虚拟化 Windows
如何在 VM 虚拟机中安装 Windows Server 2012 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Windows Server 2012 操作系统保姆级教程(附链接)
60 0
|
1月前
|
数据安全/隐私保护 虚拟化 Windows
如何在 VM 虚拟机中安装 Windows 7 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Windows 7 操作系统保姆级教程(附链接)
81 0
如何在 VM 虚拟机中安装 Windows 7 操作系统保姆级教程(附链接)
|
1月前
|
数据安全/隐私保护 虚拟化 Windows
如何在 VM 虚拟机中安装 Windows XP 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Windows XP 操作系统保姆级教程(附链接)
109 0
|
1月前
|
Linux 网络安全 数据安全/隐私保护
如何在 VM 虚拟机中安装 CentOS Linux 9 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 CentOS Linux 9 操作系统保姆级教程(附链接)
144 0
|
1月前
|
安全 Linux 网络安全
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
89 0
|
30天前
|
物联网 Windows
安装windows 10操作系统
安装windows 10操作系统
44 1
|
30天前
如何在vm虚拟机里面安装win10操作系统
如何在vm虚拟机里面安装win10操作系统
11 0