From b7ce76b06c7c45e7a8b427dcf655608219a46685 Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Sat, 12 Oct 2024 14:36:31 +0800 Subject: [PATCH 1/4] feat(lab4): update procmgr test_sched Signed-off-by: Yiyang Wu --- .../system-servers/procmgr/procmgr.c | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/Lab4/user/system-services/system-servers/procmgr/procmgr.c b/Lab4/user/system-services/system-servers/procmgr/procmgr.c index 33628190..2bcb889d 100644 --- a/Lab4/user/system-services/system-servers/procmgr/procmgr.c +++ b/Lab4/user/system-services/system-servers/procmgr/procmgr.c @@ -678,6 +678,60 @@ void boot_default_apps(void) #endif } +static void bind_to_cpu(int cpu) +{ + cpu_set_t mask; + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + sched_setaffinity(0, sizeof(mask), &mask); + + /* + * Invoke usys_yield to ensure current thread to run on the target CPU. + * If current thread is running on another CPU, it will be migrated to + * the specific CPU after setting affinity. + */ + usys_yield(); +} + +void *thread_routine1(void *arg) +{ + bind_to_cpu(0); + for (int i = 0; i < 3; ++i) { + printf("Hello from thread 2\n"); + usys_yield(); + } + printf("Cooperative Schedluing Test Done!\n"); + return NULL; +} + +void *thread_routine2(void *arg) +{ + printf("Hello, I am thread 3. I'm spinning.\n"); + + while (1) { + } + return 0; +} + +void test_sched(void) +{ + pthread_t tid; + pthread_create(&tid, NULL, thread_routine1, NULL); + usys_yield(); + for (int i = 0; i < 3; ++i) { + printf("Hello from thread 1\n"); + usys_yield(); + } + pthread_join(tid, NULL); + + printf("Thread 1 creates a spinning thread!\n"); + pthread_create(&tid, NULL, thread_routine2, NULL); + usys_yield(); + printf("Thread 1 successfully regains the control!\n"); + printf("Preemptive Schedluing Test Done!\n"); +} + int main(int argc, char *argv[], char *envp[]) { cap_t cap; @@ -694,6 +748,7 @@ int main(int argc, char *argv[], char *envp[]) init_root_proc_node(); + test_sched(); boot_default_servers(); /* Configure system servers, and boot some of them. */ From 3f459d6c03d3dc75ec140a8bb13c07af34a66c70 Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Sat, 12 Oct 2024 15:46:36 +0800 Subject: [PATCH 2/4] feat(lab4): reimplement testing Signed-off-by: Yiyang Wu --- Lab4/kernel/arch/aarch64/main.c.dbg.obj | Bin 10240 -> 18392 bytes Lab4/kernel/arch/aarch64/main.c.obj | Bin 10920 -> 18560 bytes .../arch/aarch64/plat/raspi3/irq/timer.c | 3 +- Lab4/kernel/object/thread.c.dbg.obj | Bin 17912 -> 17992 bytes Lab4/kernel/object/thread.c.obj | Bin 16144 -> 16224 bytes Lab4/kernel/sched/policy_rr.c | 2 +- Lab4/kernel/tests/runtime/CMakeLists.txt | 2 +- Lab4/kernel/tests/runtime/lab4.c.obj | Bin 5120 -> 0 bytes Lab4/kernel/tests/runtime/tests.c.dbg.obj | Bin 0 -> 5456 bytes Lab4/kernel/tests/runtime/tests.c.obj | Bin 0 -> 5072 bytes Lab4/kernel/tests/runtime/tests.h | 27 ++++-------------- 11 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 Lab4/kernel/tests/runtime/lab4.c.obj create mode 100644 Lab4/kernel/tests/runtime/tests.c.dbg.obj create mode 100644 Lab4/kernel/tests/runtime/tests.c.obj diff --git a/Lab4/kernel/arch/aarch64/main.c.dbg.obj b/Lab4/kernel/arch/aarch64/main.c.dbg.obj index e4a1aa59864a4b7f0508450bbcddea19af25ea90..120a2a8457e2bb6b21f0b7f297c22d84fded00b8 100644 GIT binary patch literal 18392 zcmeI3Uu+yl9mnUqPH~f9LQ@GuRSOT6)cm3ae9=7q@LgM8sbOFSmmCm$5wLM}5QW}j18 z%X$cP6gx4$EzzCtg1jVVZ&~7}w}icNYgmY%{q6dtw_48mw-%vHZLz(oq1M~Jf~{O$ zXjyyGd`Q!zb};5{9QTv&bH5q#m*c^HeRX#{=6TKahtL-b+7@~~-tJ-B`V-iGqSO7W zzfac5j(CmWdWh!$=hA(8&)LEY(YwIn7~(vt^V))WJqSEy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gWWV37SkU^5x{|hYof+7F_ diff --git a/Lab4/kernel/arch/aarch64/main.c.obj b/Lab4/kernel/arch/aarch64/main.c.obj index 58b7e46a9f714a035dd96c736a39e28ff05b6934..3c731cf65c290d8f5fc85da939dac9bf4b7b7060 100644 GIT binary patch literal 18560 zcmeI3U2I%O6@X{GPH>wjxQUUXCNwuF0T+^Gowy_oEnTneBtX_pENGmxKQ90+{ zb2i7bcM!Z4X-3|iGvAy!=ghf3dv`p0W%AVVzEnzaNvU6{M=hpG^PHBxd+Nwz5N5I^D6a5Ua2?!dga0| zJdjIj{&re@?{-J2-_zJ={9ZMG8oWM8ojiP0@Td=Y^yUxDn zBXnx*YFH^kp0(sA_%8;&7y6OmidS{QGPFxhsZsai6qEhQI^=)G`KBM#{i-uw_KUO4 z2F$gE2M0C9aXNQ=?B%gj=bbai)OkNINEnFYMwV*uM#Py*4Q1d!bXXDzC=4YdijWNi0)Y4jdM~{DsN4H7yfb}J@#uUW~ zvF?rLjcZSlZydYCeV^Mte>$Om2>a7GPk0puVx3~IogwJ|M3D9Gl2bP98U^*bbWkn*o~vn*o~vn*o~vn*o~vn*o~v zn*o~vn}PrL44fDrKjsXdEwt-l+j%xKn#mp*Va91H?W<==iwinYHVBf?al9O8h@*QDLwI{J_itP;>UvjEQNmO?f!St`M3JK zzx?_AZHWF;NhkgyL8-Lb)H4j-s|1cTtu|w|p}_AHp!D+C&Sn+OM~q;;5DVQN=J?NS zS(sln@Q#5m8~BQW-!Sl11HWnDw+#G_fv*|(T?4;o;OhpiV1s}xvD#)eVBmuWzEk7z zao3!JqnM=BRq0glj)CJ3Ph?>`D-x2NRs%gW*6-z?0?m}r=QBRmk7pr`#r!deB01(; zRni87G+Y@;C9Qhxqh4C|+K)MHBGHVc)fSD!&9vIu!#@LLySN_b-I2kkTP zFBv#)R7tXP!oXiL@QQ(d$G{g1{7nP@iGjas;O`mu2L}Fk1OM2-x505p%G+lR{0qRJ zQ2+dx&uFfX5bxT`fkP;HgPkb@haZ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Z!d3S|H^e%|@I*7N2#6`%o%V#bjUx(9+IB$XB%ZOiN zdL_j33@^fByM#h}z+OV8NmUre)$2nMw%esBxh~#j)z(pUnc?K(7OO@sZZmuxGLLvJ z9AvnQk6jmcvyHNPMr8Opn;{yL^KGmS>BSg+3;Q2uIQdE=&VBX4p7K$QgX3^ZM2^X^Ym6lq zud-@1tH5vvB9D14t|P-;lw23ftPbhjgo<);i?QTlg;k?jA2NImD(GSj8Sdha>*7;Z zhxF7Ptz2v}mRx+ps?n^w40m9$!|TO8WVnlc?c$1s_Z~e9q~~Y&7LEf9CtqR2`91m| z!%3&v!(lESgsFJIZpA$AvJJL7GtXpGTg<2c2S#0R;XWqC*gRfgxSte zq-db}XMPmsJL}+8#gGr3ubEa@RCAopKxBo@$-=5)b``V6m^|z$rnM^&*RBTvjyScYfNe=5PHiE493m+xCLwu3!hW*R zo?&?z zN>1z`$KCES7v$DLH+t2x#;W}=e?r=A$dVd)kHM;1UExIIL>e=w3zX5v@LM<@W%x3V zPeC*-C&qE4-HaG+rV!^orWwA1;~7{~?z1@J-p<0FV$U;{oLtaOhAtw@ov54N{piR3 zIm03KQ{&U{P`8B1?ofofq0vsA4VmsbSm+Mf)DQal2&fGGS%Dkfa^j9r-F!sX5vM*l zxFOg?oK{M>A4HE7jXK(K%+)K(y0yHJaC1&UvPaI3V-D%B;dl~{q)+&)p=sVdSpz>~ z)Vko-%E6v;bN@*#^xY8AnjJHwa?f* zWCo;IgFg&>F2XQ2*c-gm;<;OaR|b2<6nro^;yZH~Dm4ud9*T)9oE#bvt?;snPr(O6 xBfhI)j~tGvo%6}z5s`qGhev|W1D?(XtPb}Ei_PBXD-a{S!B%`w)H5~I@_#66DhvPs diff --git a/Lab4/kernel/sched/policy_rr.c b/Lab4/kernel/sched/policy_rr.c index 3b8f9151..ab070876 100644 --- a/Lab4/kernel/sched/policy_rr.c +++ b/Lab4/kernel/sched/policy_rr.c @@ -292,7 +292,7 @@ int rr_sched_init(void) /* LAB 4 TODO END (exercise 1) */ - test_scheduler_meta(); + lab4_test_scheduler_meta(); return 0; } diff --git a/Lab4/kernel/tests/runtime/CMakeLists.txt b/Lab4/kernel/tests/runtime/CMakeLists.txt index 8b168868..eaa8634e 100644 --- a/Lab4/kernel/tests/runtime/CMakeLists.txt +++ b/Lab4/kernel/tests/runtime/CMakeLists.txt @@ -8,5 +8,5 @@ # PURPOSE. # See the Mulan PSL v2 for more details. -target_sources(${kernel_target} PRIVATE lab4.c.obj) +chcore_target_precompile(${kernel_target} PRIVATE tests.c) target_include_directories(${kernel_target} PRIVATE ../) diff --git a/Lab4/kernel/tests/runtime/lab4.c.obj b/Lab4/kernel/tests/runtime/lab4.c.obj deleted file mode 100644 index fc5fd27af504fefc8a542ffdd0646531c7e78b55..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5120 zcmbW5T}%{L6vxl(qM}f`wI(HMWH8!dA`4hasM)_Q6L}H1WYU)c8O`AE^2Ojg+1Bkac9)G#LF z#l+FpCQx5P->1e9w(DWc7`lx0^r@SJG&hBmi^zc3OD_C%i`zuj*HLgRf z2#y&5?dZ6y64wt5z&v66%*+h2+3^eMO`rPl8m;}45}+IhNH?^&x9v^Zi_;&ER2q6; zyiDtZma7*?n{+#9{^&=(r2q4x-nJ(t#?Emk13QVj#IE`qnl}sc#g(Y1@1lN2hiJA`Ec{S3V>sJdE?(VL%2_zuYW9;6+_>{ zsY|~S@BHw_W0>4Fa@84m{8{;<$FA?`TNk!QjPcRezFqFu?46#Ovkspx>1``8|AKi3 z!GpW^H19p6?@Of2WIkhB`mwy3H}x*li6`SuTt9B*vPYHx%=4S|NZY!dPb5s+KAg{F zPUz`u+DXSV>62!%a>;C*-^0v$gIKwoqdO_fj3;pfuQ;ad#B9zcmNZ>Y>^j)KV_*9r zeXYGo-}^3l*Q9b?X3g=FJvE6`B4?S^nRsW--hI_gxx8hY)h*aMYFb${Q$vb&jg`+j zX^cR(jnTv$z2?TRG)>hZ$-B#Tv8)~D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AV^w-t?%HTKDp3)w1p#R3;&`&Ej&*wYkSoe{zIz6zQH?{BQN3pIxhI)%k_{@dr^Cw4}OR4E60Aphd8b@ z=y7ok8yvq+hm|7^^zt$&4IKIr<>vYPV#LSq+=9Uo|DM6|`?shZ>mts5gCouZgCou# z%FR4+PG%hu5A{lWyC=fF!BI!#W!4evLytQ4=uM8gOsSpF9{U9!GxXDH=L|lhc3ykL zfquf^(7Vdb^QkIFo|n}=WpKo=8GKglbJ`;x#5r$p#QDtNh%>3&%oFD%=e$*GB^~17 z{Hr>LeS@Qp$V<5Ye#H9FqmD0Wyfv)XOUxsf2d}AapP|S7JYw*e?vvu>lLa@E<=!nd z`W!|jC!dMCPSvIOScd<;iD%1YikFUyA@aWX4vLQ+FBF_2ONz%`Cw}nFqua`EX7m{A z#M{ZGJ}6}hj;{XiyBNF5{>?Wzo0+tE?5AN;hxX_;@*u(=8$kOR6~^>cQ2y+bb>NS> z$@`q}mN(B9z#?w`T8S<1AriAi-U3A3>ffiV-<$P)ssDK&k|FX(9yT)> Date: Sat, 12 Oct 2024 16:25:32 +0800 Subject: [PATCH 3/4] feat(lab4): add scoring Signed-off-by: Yiyang Wu --- Lab4/scores.json | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Lab4/scores.json diff --git a/Lab4/scores.json b/Lab4/scores.json new file mode 100644 index 00000000..63aca615 --- /dev/null +++ b/Lab4/scores.json @@ -0,0 +1,35 @@ +[ + { + "capture": "test_scheduler_meta: OK", + "msg": "Scheduler Initialization", + "proposed": 10 + }, + { + "capture": "test_sched_enqueue: OK", + "msg": "Scheduler Enqueue", + "proposed": 10 + }, + { + "capture": "test_sched_dequeue: OK", + "msg": "Scheduler Dequeue", + "proposed": 10 + }, + { + "capture": "Cooperative Scheduling Test Done!", + "msg": "Cooperative Scheduling", + "proposed": 20, + "userland": true + }, + { + "capture": "Preemptive Scheduling Test Done!", + "msg": "Preemptive Scheduling", + "proposed": 20, + "userland": true + }, + { + "capture": "Test IPC finished!", + "msg": "Test IPC", + "proposed": 30, + "userland": true + } +] From 6bb20b946c0dc48b80e943b745b8fdb900b11c0c Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Sat, 12 Oct 2024 17:00:29 +0800 Subject: [PATCH 4/4] feat: add alternative images and download links Signed-off-by: Yiyang Wu --- .devcontainer/Dockerfile | 67 +--------------------------------------- Pages/Getting-started.md | 11 ++++++- Scripts/chbuild | 2 +- 3 files changed, 12 insertions(+), 68 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 435bb977..639a8044 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,72 +1,7 @@ -FROM ipads/chcore_builder:v1.9.0 +FROM ipads/oslab:24.09 ARG USERNAME=stu ARG USER_UID=1000 ARG USER_GID=$USER_UID -RUN sed -i "s/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list -RUN apt-get update && apt-get upgrade -y -RUN apt-get install -y sudo \ - binutils-dev \ - libgmp-dev \ - libmpfr-dev \ - curl \ - meson \ - python3 \ - python3-pip \ - python3-psutil \ - bear \ - cmake \ - git \ - pkgconf \ - clangd - -# We need to install a latest gdb to support cppdbg. -RUN curl -SLO https://ftp.gnu.org/gnu/gdb/gdb-13.2.tar.xz && \ - tar -xf gdb-13.2.tar.xz && \ - cd gdb-13.2 && \ - ./configure --prefix=/usr/local \ - --enable-targets=aarch64-linux-gnu,x86_64-linux-gnu \ - --enable-tui \ - --disable-sim \ - && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf gdb-13.2 gdb-13.2.tar.xz - -# install tomli for .toml file required by qemu 9.1.x -RUN pip install tomli - -# we need to install >=glib-2.66.8 to support qemu 9.1.x -RUN curl -SLO https://download.gnome.org/sources/glib/2.66/glib-2.66.8.tar.xz && \ - tar -xvf glib-2.66.8.tar.xz && \ - cd glib-2.66.8 && \ - meson build --prefix /usr/local && \ - ninja -C build && \ - ninja -C build install && \ - cd .. && \ - rm -rf glib-2.66.8 glib-2.66.8.tar.xz - -# install latest supported qemu supported by ubuntu-20.04. -RUN curl -SLO https://download.qemu.org/qemu-9.1.0.tar.xz && \ - tar -xf qemu-9.1.0.tar.xz && \ - cd qemu-9.1.0 && \ - ./configure --prefix=/usr/local \ - --target-list=aarch64-softmmu,aarch64-linux-user && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf qemu-9.1.0 qemu-9.1.0.tar.xz - -RUN apt-get install -y libglib2.0-dev -RUN apt-get clean - -# install repo -RUN curl -SL https://storage.googleapis.com/git-repo-downloads/repo -o /usr/local/bin/repo && \ - chmod +x /usr/local/bin/repo -RUN useradd -m -u $USER_UID -U -s /bin/bash stu -RUN usermod -aG sudo stu -RUN passwd -d stu -USER $USERNAME CMD ["/bin/bash"] diff --git a/Pages/Getting-started.md b/Pages/Getting-started.md index d935bfd2..c7011be6 100644 --- a/Pages/Getting-started.md +++ b/Pages/Getting-started.md @@ -8,7 +8,16 @@ 请按照Docker官方指示为你运行的操作系统安装对应的Docker发行版。 > [!IMPORTANT] 关于Docker -> 由于中国大陆地区的网络限制,请确保你的docker能够连接到docker-hub,测试方法可以使用 `docker pull nginx:latest`,如果无法访问,您可以依照[该文档](https://docs.docker.com/engine/daemon/)为你的docker daemon添加代理规则。 +> 由于中国大陆地区的网络限制,请确保你的docker能够连接到docker-hub,测试方法可以使用 `docker pull nginx:latest`,如果无法访问,您可以依照[该文档](https://docs.docker.com/engine/daemon/)为你的docker daemon添加代理规则。 +> 如果你缺少代理,你可以使用这个[链接(提取uwuv)](https://pan.baidu.com/s/1ipbMZ-C1Qk0S9PGDDMMy6w)下载压缩好的Docker镜像,镜像使用`zstd`进行压缩。你可以使用以下的命令解压后,再使用`docker`进行导入。 +> +> ``` +> zstd -d docker.ipads.oslab.yy.mm.tar.zstd +> docker load -i docker.ipads.oslab.yy.mm.tar +> ``` + +> [!IMPORTANT] 关于虚拟机 +> 如果你使用的是Windows/MacOS系统,如果不想手动安装docker以及下载镜像,我们也准备了基于VMWare 17的虚拟机镜像,你可以在这个[链接(提取uwuv)](https://pan.baidu.com/s/1ipbMZ-C1Qk0S9PGDDMMy6w)找到,你可以在解压之后导入vmware即可使用。用户stu 密码为123456 ### 使用Dev-Container (推荐) diff --git a/Scripts/chbuild b/Scripts/chbuild index 6949a8bd..4f9d859a 100755 --- a/Scripts/chbuild +++ b/Scripts/chbuild @@ -279,7 +279,7 @@ _docker_run() { -u $(id -u ${USER}):$(id -g ${USER}) \ -v ${LABROOT}:${LABROOT} -w $(pwd) \ --security-opt=seccomp:unconfined \ - ipads/chcore_builder:v1.9.0 \ + ipads/oslab:24.09 \ $self $@ fi }