Spinlocks and hartlocks#87
Spinlocks and hartlocks#87auctumnus wants to merge 32 commits intoUMN-Kernel-Object:remexre/tasksfrom
Conversation
8dd242b to
1732f04
Compare
| // TODO: move this over to insns.h? | ||
| #define RISCV64_CSR_SSTATUS_SIE (1 << 1) | ||
|
|
||
| // TODO: consider making these common across architectures somehow? |
There was a problem hiding this comment.
i kinda want these to be private to hartlocks, but they'd still need to be per-arch...
tbh, could you prototype them in hartlock.c and implement them in arch/riscv64/hartlock.c or smth?
There was a problem hiding this comment.
private to hartlocks as in the spinlocks would take a hartlock instead?
There was a problem hiding this comment.
or, well, in addition to being a spinlock, they would also take the hartlock
src/kernel/spinlock.c
Outdated
| // Otherwise, we might get interrupted and then attempt to re-acquire the same | ||
| // spinlock, leading to a deadlock. |
There was a problem hiding this comment.
i'm missing what the problematic sequence of events here is; shouldn't the atomics make this not a problem?
There was a problem hiding this comment.
hmm .... i guess on second thought it shouldn't be a huge problem, i forgot that if we get interrupted we would end up dropping the lock before returning back
There was a problem hiding this comment.
(e.g. if we went
- loop trying to acquire it while it's locked
- get interrupted
- try to acquire the same lock
then this is fine, it's locked by a different hart which should eventually drop it)
| #include <insns.h> | ||
| #include <types.h> | ||
|
|
||
| // TODO: move this over to insns.h? |
There was a problem hiding this comment.
yes; make it an enum blah : u64 too, so we get warnings if we try to use it in a too-small type
There was a problem hiding this comment.
ig i didn't write down my problem here which is that nominally it's more of a struct than an enum; i.e. there are fields in sstatus that are more than 1 bit in size, and i'm unsure how to nicely represent that
9208837 to
4b5a80c
Compare
241654e to
cf06aaf
Compare
|
still todo:
|
ba047e3 to
e277ac4
Compare
Signed-off-by: Amy Ringo <me@remexre.com>
These functions are for mapping IO memory. Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Closes UMN-Kernel-Object#90. Note that this depends on GCC 15 (UMN-Kernel-Object#82) as well. GCC 16 will let us simplify the -march line to -march=rva23s64, but it's not released at the time of writing. Signed-off-by: Amy Ringo <me@remexre.com>
This makes it easier to test concurrency-related code. Signed-off-by: Amy Ringo <me@remexre.com>
This is used by make watch. Signed-off-by: Amy Ringo <me@remexre.com>
The {bytes:?} behavior doesn't match what Rust does, but it's a
useful behavior for "typically a string" fields.
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
0d69730 to
56e119a
Compare
We need to ensure that tasks are only scheduled on harts with the same register_save_area size, meaning we need to track which harts have which size. It's easiest to keep track of this if we hook that tracking into ordinary device detection, so this device class exists for that purpose. Because init_boothart_hart_locals_late panics if it cannot find the hart device for the boothart, this will not boot at the moment, though it will build. The next patch fixes this. Signed-off-by: Amy Ringo <me@remexre.com>
This restores the ability to boot, since the hart will now be properly detected. Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
Signed-off-by: Amy Ringo <me@remexre.com>
56e119a to
2b91acc
Compare
0811e54 to
21501b2
Compare
Signed-off-by: Autumn <auctumnus@pm.me>
Signed-off-by: Autumn <auctumnus@pm.me>
Signed-off-by: Autumn <auctumnus@pm.me>
Signed-off-by: Autumn <auctumnus@pm.me>
Co-authored-by: remexre <me@remexre.com> Signed-off-by: autumn <auctumnus@pm.me> Signed-off-by: Autumn <auctumnus@pm.me>
Signed-off-by: Autumn <auctumnus@pm.me>
Signed-off-by: Autumn <auctumnus@pm.me>
21501b2 to
c924289
Compare
|
responsible ai disclosure: i got claudeパイセン to thread |
c62a624 to
3709edb
Compare
This PR adds spinlock and hartlock functionality.
Somewhat supersedes part of #33.