aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/vmem.c
AgeCommit message (Collapse)Author
2024-11-01use correct sfence.vmaKimplul
2024-11-01calculate rpc stack top slightly differentlyKimplul
+ Saves a multiplication, very minor
2024-11-01mark some hot path functions inlineKimplul
+ Gives a hint to the LTO optimizer to more agressively inline the functions, seems to bring a slight performance increase
2024-11-01copy rpc stacks directlyKimplul
+ Speeds up fork a little bit
2024-11-01move stack modifications to be earlier in rpcKimplul
2024-11-01speed up creating threads quite a bitKimplul
2024-11-01test all ipc variants more-or-less properlyKimplul
2024-11-01remember to set regs to some valid addressKimplul
+ Worked in qemu, failed in visionfive2, fixed.
2024-11-01rpc actually marks and unmarks stack regionsKimplul
+ Processes won't be able to read previous stack frames etc
2024-10-30bookkeepingKimplul
2024-10-30tests passKimplul
2024-10-30most of the way to passing testsKimplul
2024-10-29start moving towards threads always being in rpcKimplul
2024-08-26fix memory leaks destroying threadsKimplul
2024-08-26don't free the physical address of page tablesKimplul
2024-08-22add basic ipc-req testKimplul
2024-07-08fix LLVMKimplul
+ Anything extern is right out as LLVM doesn't produce correct code for them. Maybe if I added some extra attributes but I'm skeptical. Replaced with static variables and getters/setters. + Inline ASM is apparently a bit buggy, so use an assembly stub when jumping to init. + Minimize work done in main() to minimize chance of LLVM doing something silly. Still not 100% certain that I shouldn't just write the main() as an assembly stub in arch/riscv64 to be absolutely sure everything works as intended. + Make .kernel.start section SHF_ALLOC, otherwise lld complains about pc-relative addressing Probably some other stuff as well that I'm forgetting right now. But at least with LLVM14 LTO seems to work, which is pretty cool?
2024-07-07misc fixesKimplul
+ Align kernel to 2MiB boundary in u-boot + Optimize alignment functions a little bit, should still have to check on real hardware but 'feels' more clean + Add early boot debugging + Put extra cores we aren't ready to account for to sleep if/when they boot. + Make BASE_PAGE_SIZE constant on riscv64/32, helps the compiler with some alignment checks among other things.
2024-07-07add small note about new booting methodKimplul
2024-07-07simplify assertionsKimplul
+ No real point having multiple different levels of assertions, just say you assert something and be done with it
2024-07-07smp now seems to workKimplul
+ Had some minor issues with a wraparound of size_t that effectively meant that some regions were allocated twice. Also, booting should be a bit more reliable now, turned out that the previous iteration of the booting was just accidentally working due to the kernel being placed 'close enough' in RAM to where it was linked to. Fixed by allocating a vmem of O1 that maps the kernel to a 2MiB boundary at boot, pretty nifty.
2024-07-06core bringup + various warningsKimplul
+ dbg_fdt() is apparently broken, possibly due to UB or something, but it causes some issues with optimizations enabled. Remove it temporarily
2024-07-06adjust stack handlingKimplul
2024-07-06pretty massive virtual memory rewriteKimplul
+ The system is now a bit simpler and hopefully easier to understand, while also extending the shared memory to be 1:N, where there is one owner who may become a zombie while waiting for the N to die.
2024-07-05formatting and documentationKimplul
2024-07-05allow booting with Qemu's -kernel flag directlyKimplul
+ Took some fairly significant changes, for one the kernel is no longer relocated at the start of a boot, instead it sits wherever the user decides the kernel should sit. Similarly, the initial kernel stack and page table are stored within the binary, slightly bloating the size but making it much safer to boot since there's really no chance of us overwriting the fdt or initrd in memory.
2024-07-04use notification framework for orphanizing threadsKimplul
2024-07-04generalize orphantsKimplul
+ Allow threads to make themselves become orphants
2024-07-04add zombie and orphan threadsKimplul
+ Should write this down somewhere but the idea is that when a process gets killed, it frees all the memory it can, making all threads within that process orphans. Orphaned threads are assigned to the init process, which will generally call exit() on each one. Zombie threads are threads that own some bit of shared data, and whose reference count is above zero. They may not be swapped to or called, even though they take up space in thread map and reserve their thread ID.
2024-05-10update formatting configKimplul
2024-01-10some kmx alleviationsKimplul
2023-10-09experimenting with removing lists threads per procKimplul
+ Gives a very slight improvement to RPC speeds, but mostly cleans up code a little bit.
2023-10-09move rpc stack handling to arch-specific codeKimplul
+ Fairly considerable speedup, as we don't have to look up the rpc pte every time separately, instead cacheing them. Adds an architecture specific limitation to total rpc stack size, though.
2023-08-04add initial smp bringupKimplul
2023-06-04slight optimization and brainfart fixKimplul
2023-06-04visionfive2 bootsKimplul
+ Make 8250 serial driver more generic + Still TODO: write a tutorial on how to boot on the visionfive2
2023-06-04visionfive2 boots until debugging is initializedKimplul
2023-05-29start trying to boot on visionfive 2Kimplul
+ Not bootable quite yet. Among other things, I couldn't get the current starfive u-boot fork to boot, so try adding support for booting with precompiled u-boot via the `go` command. Initial testing with qemu shows that this should be possible, and if it works, might be useful in the (far) future with other slightly janky SBCs. Also, NS16550 is 8250-based, and I'm really only using the base 8250, so rename and add visionfive 2 uart to list of compatibles. Visionfive 2 is still completely untested.
2023-05-11arbitrary load address and RAM base detectionKimplul
+ Both kind of go hand in hand, made sense to do both at the same time. Some parts feel slightly hacky, the loader works by placing everything on the stack and avoiding global values. Still, seems to work?
2023-05-01update license stuffKimplul
2023-04-30rename to kmiKimplul
2022-11-21possible optimisationsKimplul
2022-11-13improve documentation on new featuresKimplul
2022-11-13~1.3M ipc requestsKimplul
+ The secret is using gravestones. I'll have to write up full documentation for the feature but essentially riscv lets us encode whatever we want into page table entries, as long as they're not active. We use this to encode highest user address that is not a zero, in that all entries in the top level are either active or gravestones. When an active entry is removed, it is either a gravestone (if there are other active entries above it) or it starts a cascade of removing entries that have been previously removed Slight runtime overhead to page mapping, pretty major advantage in rpc calls. Feature will need to be tested more thorougly, and the init program is sort of a best scenario with just one top level userspace page table entry active at a time, leading to incredibly fast context switches. Current implementation limits a process' max virtual memory to 248 GiB (in Sv39), but I don't think the missing 8 GiB is that big of a deal.
2022-11-13give uvmem_map more fitting nameKimplul
+ It really only works with Sv39, I suppose similar structures should be added for Sv4} etc. if I ever get around to it.
2022-11-13write init more sensiblyKimplul
+ Both easier to look at and now the userspace doesn't play as big of a role in the 'benchmarking' with optimizations turned on.
2022-11-12release mode, ~600k requestsKimplul
2022-11-12slight optimizationKimplul
2022-11-12initial rpc implementationsKimplul
2022-10-29rewrite pmemKimplul