Commit Graph

695 Commits

Author SHA1 Message Date
Ruihan Li e6c613f538 Rename `(Posix)ThreadExt` to `As(Posix)Thread` 2024-11-13 21:44:37 +08:00
Ruihan Li 9233d1cdbb Add `ThreadExt` and clean up `PosixThreadExt` 2024-11-13 21:44:37 +08:00
Ruihan Li a4a8807a20 Remove `KernelThreadExt` 2024-11-13 21:44:37 +08:00
Ruihan Li 7850f7e60a Resolve `borrowed_box` lint 2024-11-13 21:44:37 +08:00
Marsman1996 c200997c9a Avoid init stack top at `MAX_USERSPACE_VADDR` 2024-11-13 21:43:28 +08:00
Ruize Tang 85d2c9634f Fix non-atomic write for PIPEs with data up to PIPE_BUF 2024-11-13 17:32:39 +08:00
Wang Siyuan 4ea3e49788 Refactor `Vmar` and `VmMapping`.
Co-authored-by: Zhang Junyang <junyang@stu.pku.edu.cn>
2024-11-13 17:29:57 +08:00
Shaowei Song e453649d78 Correct the behavior when operating the root directory 2024-11-13 16:55:37 +08:00
Ruihan Li ac71234b89 Remove `{,un}register_observer` 2024-11-13 14:15:44 +08:00
Ruihan Li 054c64542b Use `PollAdaptor` to signal `SIGIO` 2024-11-13 14:15:44 +08:00
Ruihan Li 27ae4cb9e7 Use `PollAdaptor` in `EpollFile` 2024-11-13 14:15:44 +08:00
Ruihan Li e32fb2f91b Introduce `PollAdaptor` and `Poller` 2024-11-13 14:15:44 +08:00
Ruihan Li f12e502ab0 Rename `Poller` to `PollHandle` 2024-11-13 14:15:44 +08:00
Ruihan Li 44b55f2ccf Revise the `poll()` method 2024-11-13 14:15:44 +08:00
jiangjianfeng 38682e3ed9 Assign callback to shared irq if there's no single irq line 2024-11-12 17:47:40 +08:00
jiangjianfeng 9965802f65 Disable send callback if sendqueue is not full 2024-11-12 17:47:40 +08:00
Marsman1996 54e2ffbb71 Add check for `argc`, `arg_ptr` and `env_ptr` in `InitStackReader` 2024-11-12 11:35:46 +08:00
Ruize Tang 7fbe997bb3 Fix range_lock and flock to support signal interrupts and comply with wait API design 2024-11-12 11:33:44 +08:00
Ruihan Li 0ef55a396f Add a note about the FIXME 2024-11-09 17:09:41 +08:00
Ruihan Li 0c114e911b Revert "Make `pause_timeout` return `EINTR`"
This reverts commit 6421fd0b36.
2024-11-09 17:09:41 +08:00
Ruihan Li 6421fd0b36 Make `pause_timeout` return `EINTR` 2024-11-09 10:25:24 +08:00
Ruihan Li b563fb639f Revise documentations 2024-11-09 10:25:24 +08:00
Ruihan Li 32b8e05cc3 Make `*_or_timeout` APIs concise 2024-11-09 10:25:24 +08:00
ZephyrZhang 10cc85d588 Add syscall `getpgid` 2024-11-09 10:20:57 +08:00
Marsman1996 f287110001 Fix `InitStackReader` to access given stack instead of current task 2024-11-09 10:06:45 +08:00
jiangjianfeng 4c80367bc8 Fix CI lint error 2024-11-08 10:53:30 +08:00
Ruihan Li 9707b46c7f Bump smoltcp version 2024-11-08 10:49:02 +08:00
Zhang Junyang 25a918d132 Print who and on which CPU the kernel panics 2024-11-07 16:39:47 +08:00
Jianfeng Jiang c1fd09fd41 Remove TimeWait socket if a new Syn is received 2024-11-07 14:21:52 +08:00
Ruihan Li 5233827160 Don't preempt without good reason 2024-11-06 21:53:55 +08:00
Ruihan Li 19b13d88e2 Fix `clone_exit_signal` test 2024-11-06 21:53:55 +08:00
Ruihan Li 768b182aba Make the code a bit cleaner 2024-11-06 21:53:55 +08:00
Fabing Li 1fe74c9c92 Add sys_getrlimit and sys_setrlimit 2024-11-06 21:53:31 +08:00
Zhang Junyang c34706603a Special treat VM Space clearing 2024-11-06 21:52:53 +08:00
Fabing Li 7a08d9a660 Support other SigStackFlags 2024-11-06 15:00:01 +08:00
Fabing Li 561516df98 Export /proc/cpuinfo 2024-11-06 14:54:28 +08:00
Shaowei Song aa52e3980e Minor fix on virtio-blk's config 2024-11-06 11:00:43 +08:00
Hsy-Intel a0a8493f98 Add TDX compilation test 2024-11-05 14:57:03 +08:00
Champii1 4701eaf0cb Implementation of load average calculation and corresponding /proc entry
Moved everything into the kernel side. Add a SchedulerStats trait

Use 'fixed' to represent fixed-point numbers

Make the loadavg calculation lazy
2024-11-05 11:46:23 +08:00
Ruihan Li efd49a96e3 Rename `cond()` to `try_op()` 2024-11-03 16:54:05 +08:00
Hsy-Intel 50773de35f Fix a TDX minor issue 2024-11-02 10:17:01 +08:00
Ruihan Li 7ddfd42baa Make `wait_events` support timeout 2024-11-01 13:00:40 +08:00
Ruihan Li f21394c679 Use more `wait_events` 2024-11-01 13:00:40 +08:00
Ruihan Li bbfc2cd12d Make `FileIo` pollable 2024-11-01 13:00:40 +08:00
Chen Chengjun 846b3ba169 Use LinkedList to store WorkItem to avoid additional heap allocation 2024-11-01 11:24:09 +08:00
Chen Chengjun 2ac6e0e126 Avoid adding worker during workqueue enqueueing 2024-11-01 11:24:09 +08:00
Shaowei Song 96a153dfc5 Implement dummy `metadata()` for epoll and socket files 2024-10-30 14:09:02 +08:00
Fabing Li 3461bd5de6 Add more boundary checks for epoll_wait 2024-10-30 10:42:16 +08:00
Jianfeng Jiang dc06d7c37d Support TCP sockets HUP&RDHUP events 2024-10-28 22:47:50 +08:00
Ruihan Li b5610f3034 Report `POLLNVAL` in `poll` for invalid FDs 2024-10-28 14:33:32 +08:00
Ruihan Li 390aa411bd Beautify the `poll()` system call 2024-10-28 14:33:32 +08:00
jellllly420 6ece48c095 Refactor process table 2024-10-28 13:00:13 +08:00
Zhang Junyang 1b23182dcc Fix the thread status ordering by limiting the API 2024-10-26 22:06:41 +08:00
Zhang Junyang e319641b4d Implement system call `sched_get/set_affinity` 2024-10-26 22:06:41 +08:00
Zhang Junyang 3468ec213b Use `CpuId` with validity ensurance rather than `u32` 2024-10-26 22:06:41 +08:00
Chen Chengjun e60b5b7649 Refine mapping-related locks 2024-10-26 21:55:48 +08:00
Ruize Tang 968389f550 Fix lost wakeup in `range_lock` caused by waiting on an outdated waitqueue 2024-10-26 21:44:03 +08:00
Ruize Tang e5fd8e7477 Fix flock lost-wakeup bugs, replace RwMutex -> Mutex 2024-10-26 21:23:50 +08:00
ZephyrZhang 885e4315e3 fix a comment typo at kernel/src/syscall/mod.rs 2024-10-25 13:26:45 +08:00
Fabing Li 9f188837ae Add /proc/[pid]/stat and /proc/[pid]/status 2024-10-24 19:17:20 +08:00
Zhang Junyang 4658b62f90 Treat thread oops with better care to avoid silent panics 2024-10-22 10:08:24 +08:00
Hsy-Intel b7d101b98c Fix MMIO read issue 2024-10-21 17:49:56 +08:00
Wang Siyuan 998869d57e Refactor kernel virtual memory allocation for kernel stack and I/O memory 2024-10-21 09:53:05 +08:00
Ni Shirong 29eb37c07c Introduce kernel virtual memory allocation for kernel stack 2024-10-21 09:53:05 +08:00
Wang Taojie 03906513aa Clear one bit instead 2024-10-21 09:43:43 +08:00
Wang Taojie 89d04ecf7d Implement ioctl() FIOCLEX command 2024-10-21 09:43:43 +08:00
Zhang Junyang 4823b82e41 Catch panics in threads as oops 2024-10-20 13:24:58 +08:00
Zhang Junyang a716763772 Remove the linkage feature usage for `ostd::main` 2024-10-20 13:24:58 +08:00
jellllly420 3c857d746e Clear TID before doing futex_wake when exiting a POSIX thread 2024-10-20 13:21:27 +08:00
Chen Chengjun 2f511069ee Move SoftIRQ implementations to softirq component 2024-10-18 09:35:40 +08:00
le-monde-bleu 54a807b5f7 Modify asterinas/kernel/src/process/posix_thread/mod.rs 2024-10-18 09:31:25 +08:00
Zhang Junyang 1fe0a138f9 `PROT_WRITE` implies `PROT_READ` on x86 2024-10-17 08:56:47 +08:00
Hsy-Intel c28cec2c6a Fix minor bugs in TDX env 2024-10-14 21:03:47 +08:00
jiangjianfeng 090149eed7 Add tcp latency test over virtio-net 2024-10-14 20:59:25 +08:00
jiangjianfeng 002a67451d Update line discipline pollee immediately 2024-10-14 16:39:34 +08:00
Marsman1996 e32687e6d5 do_exit: Ignore unwrap panic caused by munmap 2024-10-14 14:48:43 +08:00
Zhang Junyang 9e4257b655 Fix multiple issues pointed out by the new compiler 2024-10-13 22:32:05 +08:00
Shaowei Song ee33216875 Fix the incorrect range in `SegmentSlice` 2024-10-12 19:58:10 +08:00
Wang Taojie bdf89a5de3 Implement getcwd() 2024-10-12 09:58:45 +08:00
Shaowei Song ea489252f4 Refactor `Dentry` to optimize the vfs layer 2024-10-11 11:22:52 +08:00
Shaowei Song 271e893889 Revise `MountNode`'s lock usage 2024-10-11 11:22:52 +08:00
Ruihan Li 0415225c19 Fix IRQ-related socket locks 2024-10-10 20:36:22 +08:00
Ruihan Li 7e21e1e653 Revise socket option handling 2024-10-10 20:36:22 +08:00
Ruihan Li b9b09b8142 Don't lock `Mutex` in `EpollEntry::on_events` 2024-10-10 19:23:09 +08:00
Zhang Junyang 909639fd70 Separate `SegmentSlice` from `Segment` 2024-10-09 19:23:46 +08:00
Shaowei Song dad56e1664 Refactor the lock usages within `RamInode` 2024-10-08 16:56:02 +08:00
Ruihan Li 96efd62007 Use `LocalIrqDisable` in `Subject` 2024-10-04 21:55:48 +08:00
Yuke Peng 7d5a2b7a79 [VirtIO] Correct the error code when device not match 2024-10-04 10:28:59 +08:00
Ruihan Li 76d4b180d0 Increase the TCP socket buffer length 2024-09-30 20:37:57 +08:00
Marsman1996 44760eb5fa Return when sigset size error for rt_sigsuspend, rt_sigprocmask and rt_sigaction 2024-09-30 20:24:23 +08:00
Ruihan Li ee1656ba35 Move packet dispatch out of smoltcp 2024-09-30 16:00:51 +08:00
jiangjianfeng f793259512 Avoiding busy loop in sending packet and optimize device caps 2024-09-30 15:03:58 +08:00
Chen Chengjun 8f50391a4e Optimize the clear procedure of the page table 2024-09-30 10:46:30 +08:00
YanWQ-monad 4fa0e6334b Add RISC-V base support 2024-09-30 10:02:08 +08:00
YanWQ-monad 839c2a6689 Extract shared code from timer 2024-09-30 10:02:08 +08:00
jellllly420 5c8e369057 Enable scheduler to fetch scheduling information directly from Thread 2024-09-27 10:21:45 +08:00
jellllly420 9cc63149f1 Remove cpu_affinity field from OSTD Task struct 2024-09-27 10:21:45 +08:00
jellllly420 8927031426 Remove priority field from OSTD Task struct 2024-09-27 10:21:45 +08:00
Carlos López 0a36760f7a Respect user-defined exit signal in clone() and clone3()
When calling clone() and clone3(), the user is allowed to specify a
signal to be sent to the parent process on exit. Respect this value by
storing it in the Process struct and sending the signal on exit.

Add a test as well to verify that the signal is properly delivered to
the parent.
2024-09-26 20:07:43 +08:00
Carlos López 130a0f7030 Homogenize arguments for clone() and clone3()
The arguments for both syscalls follow different formats. Rewrite the
CloneArgs struct to homogenize both formats into one.
2024-09-26 20:07:43 +08:00
Zhang Junyang fad39fdf7a Make TLB flush policy relaxed 2024-09-26 19:29:59 +08:00
Zhang Junyang 52f1787d35 Remove syncronizations for the `VmSpace` PF handler 2024-09-26 19:29:59 +08:00
Zhang Junyang 7407cc8091 Remove some repetitive locks forking `Vmar` 2024-09-26 19:29:59 +08:00
Zhang Junyang ac6d9256ef Improve the `VmSpace` forking API 2024-09-26 19:29:59 +08:00
Marsman1996 d4036d1e9d Handle error in `FsResolver::create_new_file()` 2024-09-26 17:45:00 +08:00
Shaowei Song f2af6136da Minor optimizations on both `lat-syscall-stat` and `lat-syscall-open` 2024-09-26 15:25:49 +08:00
Ruihan Li fc77c474db Move and group methods 2024-09-26 15:22:16 +08:00
Ruihan Li 3fc396f5f1 Adjust the ephemeral port 2024-09-26 15:22:16 +08:00
Ruihan Li eb3a033496 Refine some lock usages 2024-09-26 15:22:16 +08:00
Ruihan Li b13a82dc61 Bump smoltcp version 2024-09-26 15:22:16 +08:00
Ruihan Li 51334c4a36 Clean up smoltcp dependencies 2024-09-26 15:22:16 +08:00
Ruihan Li d62bb1ca76 Use static IP addresses 2024-09-26 15:22:16 +08:00
Jianfeng Jiang fb718fd440 Optimize the latency of lat-sig-install 2024-09-25 17:29:20 +08:00
jellllly420 21fedd1b60 Implement atomic wrapper for integer-like type 2024-09-25 14:47:37 +08:00
Shaowei Song ae4ac38471 Optimize the cache and lock parts in `MountNode` 2024-09-25 11:22:24 +08:00
Shaowei Song 791c566b71 Optimize the cache and lock parts in `Dentry` 2024-09-25 11:22:24 +08:00
Shaowei Song 2c6dd074d1 Refactor the path lookup in `FsResolver` 2024-09-25 11:22:24 +08:00
Ruihan Li 1aa8b0abc6 Correct lock usages in UNIX sockets 2024-09-24 20:49:48 +08:00
Marsman1996 cbe85a1878 Add check for negative `timeval_t.sec` in `do_futimesat` 2024-09-24 20:36:29 +08:00
Ruihan Li 179705a3fc Fix RamFS readahead 2024-09-24 20:34:19 +08:00
YanWQ-monad 4d36dd541f Extract x86-specific exception handling in aster-nix 2024-09-23 19:39:45 +08:00
Yuke Peng 46708f84bc Implement futex private flag 2024-09-22 16:00:56 +08:00
Yuke Peng 228cfe2262 Preallocate some space when expanding size in ext2 2024-09-21 20:22:39 +08:00
Yuke Peng 550eafcb79 Preallocate some space when expanding size in ramfs 2024-09-21 20:22:39 +08:00
Zhang Junyang 9a79ecbcbe Clean up the frame buffer state in `ostd::mm` 2024-09-21 15:38:15 +08:00
YanWQ-monad 2a6733579d Refactor architecture-specific page fault handling 2024-09-20 10:56:13 +08:00
Jianfeng Jiang c5009e38f1 Add pipe/short_rw test
Co-authored-by: Ruihan Li <lrh2000@pku.edu.cn>
2024-09-20 10:37:20 +08:00
Jianfeng Jiang 985813c7f9 Use IoVec-based reader/writer to refactor network APIs 2024-09-20 10:37:20 +08:00
Marsman1996 b4003b8aeb Add normalize for `timeval_t` and const value for time 2024-09-20 10:35:03 +08:00
Marsman1996 4fa4e5ef2a Add check during the conversion from `timeval_t` to `Duration` 2024-09-20 10:35:03 +08:00
Jianfeng Jiang 70505ff4f8 Support futex wait timeout 2024-09-19 22:42:13 +08:00
Qingsong Chen c2f7a10b84 Implement cpu_local with GS and ensure GS points to TSS 2024-09-19 13:00:36 +08:00
Jianfeng Jiang f159b42b61 Fix the condition in is_last_thread 2024-09-18 16:59:17 +08:00
Ruihan Li 2bda8d17c4 Rename some misleading method names 2024-09-17 17:46:56 +08:00
Ruihan Li cefeea7b50 Revise `IoMem::resize` into `IoMem::slice` 2024-09-17 17:46:56 +08:00
Ruihan Li c8ba695c85 Implement `VmIoOnce` for `IoMem` 2024-09-17 17:46:56 +08:00
Ruihan Li aa62f0a4e6 Make `field_ptr!` accept `VmIoOnce` 2024-09-17 17:46:56 +08:00
Shaowei Song 22b04ceae4 Optimize the `DirEntry` of `RamInode` 2024-09-16 15:59:59 +08:00
Shaowei Song f194514100 Optimize the page cache within a `RamInode` 2024-09-16 15:59:59 +08:00
Marsman1996 44629e4627 Fix panic in FutexKey::load_val when no read access 2024-09-14 22:45:59 +08:00
Jianfeng Jiang f3174dbbbc Make task store Arc<Thread> and process store Arc<Task> 2024-09-14 17:34:14 +08:00
Jianfeng Jiang 81b0f265b5 Move Tid from Thread to PosixThread 2024-09-14 17:34:14 +08:00
Zhang Junyang 195fe855a1 Mark all surrounding pages accessed on page fault 2024-09-14 17:29:39 +08:00
Chen Chengjun 42e28763c5 Replace the Pausers' usage with Waiter/WaitQueue 2024-09-14 13:59:07 +08:00
Chen Chengjun 822caf34f4 Move Pauser's functionality to Waiter/WaiterQueue and add the per-thread signalled waker 2024-09-14 13:59:07 +08:00
Chen Chengjun 1873bb7a3f Add wait_until_* functionality to Waiter 2024-09-14 13:59:07 +08:00
Chen Chengjun 6a5a5b4d3d Add a fast path to has_pending 2024-09-14 13:59:07 +08:00
Marsman1996 fc895c5697 Fix panic in `mmap` by invalid `perms` 2024-09-13 23:42:37 +08:00
Marsman1996 8421046dba Return when sigset size error 2024-09-13 22:12:50 +08:00
Ruihan Li 320092eda2 Implement blocking `connect` properly 2024-09-13 22:09:46 +08:00