#Astral
1 messages · Page 19 of 1
alright now its as fast as before singlecore
aaaaanddd
using the new queues and interactivity and stuff
I could already see an improvement in how responsive it is now under load
I need to get a before vs after
still missing smp stuff in the scheduler though
that will be the next things that will be done

Are you real
Is this ULE
ya
Siiiick
I remember talking to you about it like a year ago and I've been meaning to do that since
finally getting around to it
Oh god don't tell me it's been a year
Bruh
when I first saw mlibc didnt have sys_nice implemented I was surprised that no other os bothered with that, its such a simple syscall
and sudo needed it to at least return an error to work (mlibc outright panics, I have it stubbed out in a local patch)
but I will implement it fully for astral and upstream is soon
I also should implement magazines in my slab allocator since I am also doing all this smp work
This will be later tho
Cant do multiple things at once
Hire hyena to do stuff for you 
Hirena
I'm bad and not useful even if paid money
Doubt
HUGE doubt
Worked a bit more on picking a cpu to run a waking thread, should have that done today if I end up having time
My ultimate goal with this will probably be a multicore build of gcc
If it does that it would most definetily be stable
your weren't building gcc on multicore already?
That was single core, multicore made it slower cuz of the scheduler nuking the caches
But with the new scheduler that shouldnt be an issue anymore
right, I was implementing SMP as an attempt to be faster precisely for building gcc but I see I'll have to worry about the cache 
why was it nuking the cache?
Constantly switching a thread back and forth between two cpus
Cuz of single queue
you didn't have a per-cpu queue?
it indeed sounds like an issue
My per cpu queues are already done and upstream, I just need to do the cpu migration stuff and I think Im golden
cpu migration is the next step for me after tlb shootdown
Im doing the "pick what cpu after waking up a thread" part atm and after that Ill make idle cpus try to pull some work from overworked ones and after that I add a load balancing that happers every second and then thsts it I think
What Im doing there is just
Thread has hard target on cpu > walk back topology until root (at some point I can add a flag for the architecture to define the limit) searching for a close idle cpu that can immediatelly run the thread > search for an idle cpu system wide using a bitmap > search for the least loaded cpu that can immediatelly run it > search for the least loaded cpu
From most preferential to least
Aka what ule does lol
The freebsd scheduler
I'll have to figure out how to explore the CPU topology at some point
I just use cpuid to find that
Its in arch/x86-64/cpu.c if you want to take a peek at some point
thanks!
Its not old astral code so it should be mostly readable
If you have any questions lmk
Oh yeah the code for inserting nodes into the topology tree in the end is a bit wrong but I should push the new fixed code today
I'll have a look in approx 3 or 4 hours
what does "immediatelly run it" mean? isn't it equivalent to being idle?
well that's what they said, an idle cpu
If the thread would be able to run there immediatelly, either the cpu being idle or the thread being inserted having a higher priority and being able to preempt the running thread in that cpu
(which is effectively the check since a cpu will always be running a thread, cuz it has the idle thread with idle class and nice 100)
thanks
That idle shouldnt be there in the walk back I did a brainfart
The only time itd search explicitly for a cpu being idle is using the bitmap
well that indeed looks easy to implement
Yeah it was mostly just annoying cuz each cpu manufacturer has a different way of doing it
there's only two vendors you have to worry about anyway :^)
Why do you need a bitmap
cpu being idle = cpu can get preempted immediately
So there's no special treatment for it
Mhm well I guess it's better to favor idle cpus vs ones that have low priority workers, as you can avoid a cache flushing
Yeah
yeah, I ain't supporting random chinese x86 manufacturers
@grand shadow why is rewrite your default branch on github instead of main?
probably didn't bother to change it after a rewrite
Yeah
@grand shadow is there a reason why you have a different structure for CPU topology instead of using the per-cpu structure for that?
To allocate the non cpu levels
oh yeah
alright I can see an improvement in glxgears fps from smp 1 to smp 2
compared to before starting the rework where it actually slowed down
and thats without actually implementing the thing that tells userspace theres more cores
so glxgears still runs single thread, the improvement is just from being able to run more things
nice
certainly a big improvement compared to... whatever the fuck that was
how come?
does glxgears use more than 1 thread
other programs use threads too
distributing them on multiple cores improves performance
fair fair
glxgears uses opengl I believe? which likely wants to distribute computation across cores
depends on the specific implementation
llvmpipe will definitely benefit from parallelizing the software rendering
"llvmpipe" sounds like something that belongs in clang
yeah somwehere in there
i believe it's part of mesa
uses llvm for codegen i believe?
Theres so many places I can improve scalability in astral that I feel like the scheduler rewrite is just the beggining of it
kernel of theseus, if I rewrite enough components is it still the same kernel as before? 
erm, thats easy
Since I started mine in C and it's now in Rust, I have the same question 
Hello, I too join the kernel of theseus party
food for thought: it never is
each new commit is a new kernel
currently having a very fun bug where 4 bytes of the stack randomly get set to 0
could it be due to corruption of the stack frame due to reception of an exception/interrupt
What is int_no in your stack frame when that happenss
Maybe idk
yeah I'm thinking of that, it cannot be scheduling related since IPL_DPC
confirm you're actually masking off scheduling with this lol
it'd be unfortunate if you're not
and you didn't realize
@grand shadow astral running minecraft when
its not any interrupt funkiness either, the rip of the last interrupt before dying where it does is in the idle thread
when I fight off my demons and come victorious
Justâ„¢ port OpenJDK 
the demons he's talking about:
can't be that hard
well there is one
its just runs horribly
and never bothered to figure out why
how horribly is horribly
qwinci managed to connect to a minecraft server running in astral for like 5 seconds
before it lockede up
no idea
and/or to start up
@carmine swallow
I think the lockup might be in my tcp code since I know there is a deadlock there somewhere I just havent gotten around to fixing it
maybe
idr exactly but I am pretty sure it wasn't that bad (though it might have taken a while to start)
The only thing I can think of is that another core is writing into this core's running thread stack
uh what
pushlock_wait_block_t a;
memcpy(&a, last, sizeof(pushlock_wait_block_t));
__assert(last->funny == 0xdeafbeef);```
this assert trips but when I look at it in gdb both the copy and the original are completely normal
with the right value in funny
I have been stuck in this stupid fucking bug for 3 days now and I dont even have a direction on how to fix it
pushlock bug?
still not sure, that stack corruption made me look to the only place where another thread would be able to change values in another one's stack which would be in the pushlock implementation, and adding a few asserts around does show stupid stuff like this happening but then it has weird behaviour like the assert failing but then I look at both the copy and original pointer and funny (temporary thing for debugging where it starts as 0xdeadbeef and ends up as 0xc0ffee after the thread wakes up) is the value assert expects
I ran without pushlocks and it worked fine and ran into some other bug but now I dont know if the pushlock issue and that are symptoms of another bug or what
Btw if its really undebuggable maybe consider implementing asan
It's not undebuggable
I think it might be something tlb related?
always doing a full tlb flush instead of invlpging when below a certain number of pages made it so in 10 tries the bug didnt happen a single time but with the invlpg stuff on 3 bugs on 10 runs
how are you doing your full tlb flush
@grand shadow
this is extremely relevant
are you reloading cr3
yes
no
they do not I never bothered to do that
nvm then
reloading cr3 doesnt flush global pages so i thought i had ur answer
youre supposed to toggle cr4.pge
to flush all including global
considering the problem seems to get better when I do a full flush I'm probably forgetting a invalidate somewhere
though yeah I should make the kernel pages global at some point
I even had a TODO warning me about the cr3 flush thing about global pages
it still seems to happen
ok nvm I dont think it makes it any bettetr
but the only thing I can see explaining this weird behaviour is that
by forcing an invalidate on every mmu_unmap and mmu_remap it seems like the bug is gone?
I dont think thats it
I dont know anymore
cant wait for me to find the bug after like 4 more days of debugging and for it to be the silliest fucjking thing imaginable
considering it only affects the upper 32 bits of stuff and x86 is little endian, this might be either a packed struct, a fucked up memset/memcpy or a bitmask thing
since thats not aligned on 8 bytes
just impelement kasan, you'll find a lot more than just this almost certainly 
well.... Justâ„¢ implement it
it's not quite that easy 
Ig I can look inti that
Idk how to implement it
At least thatd be something better than banging my head against the wall for hours on end trying to figure out wtf is going on
have you considered that you are mallocing with the wrong sizeof for something?
Its corrupting the stack so I dont think thatd be it
It only seems to happen on multicore too so its probably some super stupid race somewhere
using relacy with the push lock impl from astral gives some data race error when there are 2 shared acquires along with an exclusive one, though I am not sure whether it is relevant to the current bug as it also takes into account possible reorderings + other stuff like that
I dont do any shared acquires anywhere so I dont think thatd be relevant, though still good to keep in mind ty
with only exclusive ones it doesn't give any errors even when there are 30 threads (though I don't want to run the full set of reorderings with that, its slow when the number of threads is > 2)
idk how accurate it is though
I guess thatd mean the pushlocks are fine and the issue is something else?
If I cant find a solution I will just go do something else so I dont burn myself out
use the monkuous card 
@grand shadow sry for ping but can you help me get started in os dev?
@sharp carbon 
hello
can u help mathew debug a skill issue
what is the issue
random variable corruption, right @grand shadow ?
lol mathew is gone
Random stack corruption
I am at class sorry lmao
Randomly itll just have some value on the stack overwritten
When running with 4 cores
Even with irqs disabled
Most of the time it happens on my tlb invalidate code but thats just a symptom since it happens elsewhere as well
how to reproduce
Just run with -smp 4 in qemu many times and itll happen
Using the xorg boot option (first one)
Remove the nosmp argument from the limine.cfg too
Itll take a while for everything to build so take your timme
oh god xorg?
how many hours of compile time am I about to wait
also does it happen during boot or after x amount of idle time or what
While its booting up userspace stuff like xorg
It’s always the fucking tlb shootdown bruh
I’ve been getting fucked by that too in my kernel
@grand shadow unrelated to the issue but i would recommend changing all ftp.gnu.org links to ftpmirror.gnu.org
this is one of the first times in my life i've seen wget report download speed in bytes per second
True
why is it trying to compile a test
I guess it worked previously because the tests were in c++
Oh I forgot to upstream the fix
Yeah
Any luck?
yeah there are a lot of ports
currently seems to be compiling wine
even if it's almost finished i don't have time to debug anymore so that'll have to wait until tomorrow
at least i'll be able to power down my pc instead of leaving it on
does seem to be alphabetical yeah, moved on to xauth immediately after
np
I have been banging my head against the wall for the past 4 days
wait where did kernec go
its still there
alr i'll do the actual debugging tomorrow because it's 11pm here
this just hit a different step in vmm_fault lol
i go to bed at 4 am 
my bedtime is usually around midnight
except when I'm with my bf we stay awake until like 4 am playing games
it should be 10 pm since I wake up 6 am but I cba
gn sleep well
It has been brought to my attention that I was checking for deafbeef instead of deadbeef here and I feel extremely stupid
deaf beef

couldn't figure anything out
Indeed
time for rewrite
Ultimate truth
He’s the ultimate debugger
Have you tried using GitHub CI?
It’s good at catching bullshit like that
Like stupid small bugs that are hard to reproduce
Its not hard to reproduce, its hard to debug
Have you tried git bisect to at least find what introduced the bug?
Yeah, I would probably do something like Infy said or try to test all versions until the issue comes up and figure it out from there
I could yeah its just that other smp stuff might appear first lmao but Ill try it, not much I can do
I still suspect it might be the pushlocks but atp Im not really sure
Nt pushlocks?
Yeah
Damn.. where did you even read up about those
I can’t find any good papers on the topic
Gotcha
the fucked up thing is that like
it only happens on some boots
and when it does boot
it can just work normally without any issues
running 6 glxgears with -smp 4
for like a few minutes now
with no crashes
I switched the ext2 dir functions from using vmm_map/unmapto alloc/free temporarily (I gotta rewrite them properly) and the bug is just gone?
cant tell if its because of that or because there are less shutdowns or just the bug doesnt get the timing to happen anymore
could it be vmm bug?
have you done a bisect to see when the bug appear
not yet
That's the first thing to do when you run into an evil bug
I doubt any commit before the scheduler rewriet is even gonna be able to reproduce it
because of how abysmal the old scheduler was with smp
lol I'm having to fix like 3 different files to get it to not deadlock from fixes I've already done and I made kvm panic
bisecting would be even more annoying than just trying to debug it
ok its not reproducible before the scheduler rework started
whether that is because old scheduler too bad or new scheduler caused the buggy is to be discovered
yeah no this is likely added before the scheduler rewrite and smp getting better just made it have the right timining to happen
is there no way of making qemu log like the last 100 writes for every cpu or something
With kvm off I was able to get it into a panic with another cpu doing a memset 0 after a vmm_map
It did not write to the same virtual address as the stack of the fucked up core though
So either its the same physical address or its unrelated
Time to delve into the page tables
nvm it is not
POV menix devlog:
hmmmm, making the pushlock wait block be in the thread struct instead of on the stack makes the bug go away
without any big timing changes
then consider checking if the pushlock wait block's pointer doesn't stick around after the wait exits
Didn't you already determine it's not the pushlocks
im saying this because i had a bug where i was using a timer on the stack and the thread was being terminated yet the timer wasnt being dequeued
so it was using a stale pointer
I still am not really sure what it is
Ive already checked the impl many times but I can do it again
CAN YOU REPRODUCE the bug without pushlock code ever being CALLED
The impl, sure, but what about all the things that use the impl
The impl of my timers was also fine but what was messed up was how I was managing them
No but it could be timing
Oh your pushlock is broken
I just looked
The way you traverse the wait blocks is wrong
You should be atomically popping the entire wait block list off the pushlock and resetting the pushlock word to 0 or whatever when you release it and only then do you walk the wait block list
Looks like you're traversing them while they're still linked to by the pushlock which is menacing unless im reading it wrong
You should also be waking all the waiters
That's the easiest way to do it race free
Your way is incredibly racy and could be causing the memory corruption you're seeing
Potentially
Is that how other implementations do it
This part is mandatory to avoid races, popping the entire list off and setting the pushlock free before traversing the wait blocks, and it implies that you have to wake all the waiters since you popped them all off the pushlock at once
If you only woke one and then put the rest back on or something then you have crazy races again and ABA problem
I only pop the last one of the back of the list and wake it up
Yeah that's bad
So you would then do an atomic exchange to set it to 0 and get the old value with the top wait block pointer and go waking these up?
Seems simple enough
In the future I might look into them but I currently have bigger issues
Thank you hyena man I will change this later
If im right then your bug may disappear
after you change this
This was literally the first thing I thought to check when I decided to take a look so I might have saved you some time if I just looked earlier
soz
Could also be wrong though I just skimmed it on my phone in bed but it's worth trying at least
Did you push
not yet I'll send it here
saved_value = __atomic_exchange_n(pushlock, 0, __ATOMIC_SEQ_CST);
__assert(saved_value & PUSHLOCK_FLAGS_ACQUIRED);
__assert(saved_value & PUSHLOCK_FLAGS_EXCLUSIVE);
pushlock_wait_block_t *wait_block = PUSHLOCK_GET_POINTER(saved_value);
while (wait_block) {
pushlock_wait_block_t *to_wake = wait_block;
wait_block = wait_block->next;
semaphore_signal(&to_wake->semaphore);
}
this is the exclusive unlock code
wait
WAIT
WAIT
OH
OHHHHH
ohh
there is a race in my semaphore code
when it comes to using it in the stack of another thread
I still think the pushlock thing I noticed was racey and broken as well
It just wasn't THE broken thing
What is the race
it unlocks a semaphore spinlock after waking up the thread, which if it is running on another cpu can do it when it really should not do that
fml
I only ever want wingstop at weird moments like when im in bed at 10am after being awake for like 30 hours straight
Can you relate
we dont have wingstop here but I do love some wings
thank you hyenaman me rewriting that code gave me an epiphany
mostly cuz I had to think of the placement of that semaphore_signal in the while loop
Plus I think you would have noticed weird symptoms from the pushlock thing
I'm like 80% sure there were races where ther could be lost wakeups at least
It just might not have run long enough for you to notice
holy fuck yeah it makes sense why the upper 32 bits of stuff would be randomly gone then, it was setting it to 0 and the spinlock is the second entry in the semaphore
how does it handle stuff like the shared holder count then, does it store it on the one pointed to by the pushlock always?
Looks like it stores it on the final wait block (that is, the first one to be added to the chain)
and uses a "multiple shared" flag in the pushlock for something
the reactos comments aren't helpful because they didn't understand it either
@grand shadow it also makes sense now why things werent happening if the pushlock waitblock was in the thread struct and not on the stack
the bug will mentioned caused stale pointers to be used
How did you do it in mintia
It was another bug that caused it but related to that
Semaphore was doing wake up -> unlock when it should be unlock -> wake up to prevent stack corruption
looks like it exists because on contention the pushlock structure changes
and it indicates that multiple threads acquired the pushlock and the releaser needs to traverse the wait blocks
real
didnyt you do it before taking the turnstyle path
yeah i just copied the reactos ones
oh I see
Well I have been slowly fixing the rough edges of smp and I was able to compile the astral source code with make -j5 on -smp 4 without it crashing
Still a lot of work to do for it to be quicker
compiling astral source:
time CC=gcc LD=gcc make with -smp4: real 0m53.783s
time CC=gcc LD=gcc make -j5 with -smp4: real 0m44.550s
time CC=gcc LD=gcc make with -smp 1: 1m58.443s
crazy
that -smp 1 time scares me, maybe I messed up somewhere and singlecore now is slow
hm glxgears is the same speed as before, maybe it was that slow to compile astral and I just forgor
there is still a lot of contention going on but I will sort that out soon enough
happy with the progress :)
before all this work smp would've been slower
LP_NUM_THREADS=4 tyr-glquake is also pretty good
no it makes sense, the children gcc spawns can initialize themselves while gcc is still running
and it spawns quite a few of them, so it adds up
Why is the difference with multiple jobs so tiny?
probably crazy contention somewhere
probably the page cache (I implemented it super stupidly like a year ago) and allocators
I plan on redoing it to make it a tree of pages per vnode instead of... whatever the fuck I do right now
its like a hash table of <vnode, offset> 
evil
and for allocators I will implement magazines
and at some point in the future rework the vmm as well
me when linked list vmm
you say that like thats not what everybody was doing for like 20 yrs and might still be in some cases
oh really?
still sounds super not scalable
yeah its been a not uncommon way to do it
you can do per bucket locking
of the hash table
true
what is the pros and cons of doing it when compared to something like a balanced bst for every vnode
idk i did a per-vnode avl tree
well gnu hello configures, compiles and installs with -smp 4 and -j5
pretty quick too
think I have smp finally at an okay state
sooner or later I will throw a nuclear bomb at this (compile gcc
can asstroll survive a forkbomb
fucked up
oh a page fault
I probably forget alloc somewhere and send a null to free
since it was on free()
vmm: out of me-mobrya tso hdo: c opfy oonr wkri:t Out of memory (ENOeM oEn M)a
ddress space (sending SIGBUS)
I'm gonna leave gcc building with 4 cores and j5 while I sleep
alright it is going
its running like 5 configures at the same time if this doesnt kill it idk what will
oh it died for like a stupid reason
out of disk space :^)
oh wait I see these ext2 fails I need to look into that later, seems like its not super safe in low disk space conditions
no
alright gcc build going again
this time I gave it 16 gbs of disk space compared to the 4 gb from before
oh fuck off I didnt give the vm enough memory
alright giving it 10 gb of memory third time is the charm
makes sense it would die I gave it 2 gb to do a gcc build with 5 jobs 💀
Seems to still be going
Although really slow, wonder why
Maybe its just using too much memory and the page cache is empty or something
Seems to be going at a ok time, its probably just slow to compile cuz unrelated things
if this compiles will I be a part of the cool smp kids
still didnt crash but I got tired of waiting
@grand shadow why do you lock here? Isn't the tree read only after boot?
https://github.com/Mathewnd/Astral/blob/6050ed1fc66a63d5c3b83602658be870525491e4/kernel-src/sys/topology.c#L93
true actually
Making Astral slightly faster 
soon I'm gonna add magazines and break down the page cache lock so it should scale better as well
magazines are really simple, damn
I should have done this from the start
the most complicated part is probably dynamically updating the magazine capacity when the depot gets too contended
the fast path is so simple I wonder if this will affect the uacpi score in a significant way
in the bonwick paper it said it halved the latency
I just skipped that part 
I was gonna ask you how you did it since ik you did magazines 💀
What are those?
Ik in a slab allocator it’s a per cpu slab cache
Right
Small per-cpu list of ready-to-be-allocated slab objects
So the fast path is just popping from the list
I got it to boot with magazines and stuff but I still got some more work to do before its upstream
I don't even have a slab allocator anymore. I had implemented it a very long time ago when my kernel was in C and when I switched to Rust I didn't translate it out of laziness
Ive had slabs since like the beggijing
the beijing
uacpi score seems to be lower with magazines than without, fucked up
maybe I did somethng horribly wrong
I mena I guess it also makes sense, since theres more ifs for it to go through before falling back into the slab compared to just using the slab, and the mags are gonna be mostly empty
I think monkuous got a similar result iirc? @sharp carbon right?
How do you allocate objects below page size?
malloc
Do you just create a free list of a certain size and combine them
Your own?
yes
I’m pretty sure @prime mulch does something like this
and thus to make my uacpi score better I should preload 32 rounds for every cache right before initing uacpi

So like a list of 32 byte objects, and if a 128byte object is allocated, it just combines 4 of the 32 byte objects or something like that
Rather than having a list for each object size
Seeing a high resolution troll face here is weird lol
I have eye cancer now, Thank you for that
I think the point of the slab allocator is also to have elements of the same type lying in the same pages so that if you have a tree (for example) of those elements, then they are all in cache
a correct implementation of slabs would use them in a lot of places directly
it is an object cache after all, you can make an object caches of say a vnode
so instead of going through the generic allocator you allocate through the vnode slab
and at this point I am just rewriting my slab implementation pretty much entirely, I wrote it like 2 years ago and it shows its age
most times magazines are full
i think
I mean like when doing uacpi init
ah
since its during boot
i mean yeah monkuous tried doing uacpi init like 5 times in a row and its way faster later on with hot caches and full magazines
like uacpi_init() + uacpi_state_reset() 5 times
Yeah I started creating slabs for certain subsystems
I reworked the slab list to be more like how bonwick dissertated about and it worked first try no problems somehow
are you caching constructed objects? or do you just hand out memory from a bucket by allocation size?
caching constructed objects
the old implementation does it wrongly but in this one I am going to do it properly
in this example, would the vnode slab also have like multiple caches? or would it just be the cache for the vnode size?
I think that's what I got wrong in my understanding of when to use it
in my case you would have many caches for the different filesystems as I keep the vnode struct as the first member of any other filesystem struct to be able to do a pointer cast
oh, and you also use that slab to allocate the vnodes for that fs?
so that if u free the fs u also free every node within it
or is that done by another slab
that sounds like a good idea
keeping that somewhere in my head
thank you!
thats what I might do in my OS, I was thinking about it today while having lunch
maybe having a slab in each fs to allocate everything that fs might need
like vnodes
@grand shadow https://github.com/Mathewnd/Astral/blob/8cba07f65ce63ed980fe45943d31f1404935fa98/kernel-src/include/kernel/proc.h#L16
Since your process have only two states, how do you put a process to sleep when you are waiting for a resource? (you don't?
)
that's a thread thing, not a process thing
ah, thanks
Sleeping is for kids, we do the grown up thing and just spin
But yeah it is a thread thing
The inly time a while process goes to sleep is a SIGSTOP and even that just tells every thread to do that
Think the slab rewrite is almost done, just gotta make some more final touches in the kernel
@prime mulch you said it was like super racey to go through the wait blocks when waking up a thread, does the same hold when traversing it to release a shared lock (so decrement the shared count of the last one)
I am rewriting the pushlocks to account for that (and it also allows me to make the fast case faster) and I need to know that to see how I am doing the shared part of the lock
I still dont see how traaversing the list was racey anyways
Can't the head change while you're traversing it?
Which is why you should pop it first then traverse it?
idk I'm just guessing from half reading the messages
if it does (and that would only matter if its the only wait block in the pushlock), the compare exchange would fail
Yea but that was before you added that no?
no that was always there
the old version is still pushed
the issue was with unrelated code
with magazines the make -j5 time has been brought down to 0m36.835s
niice
once I break down the page cache lock it should be better, I imagine that should be the biggest point of contention at the moment
just profile it :^)
@pine ledge dam
Wait why the hell did it ping some random person
Sorry lol
My phone is strange
Real
I expect it to go down further once I break down the page cache lock
Astral is no longer shit on smp
didnt expect it to matter that much
I mean it makes sense, it both gives it a faster fast case and reduces the contention on allocators
But it reduces uacpi score which is the only real metric of kernel speed 
Something uses it a lot ig
Could also be my staged pushlock changes which made the fast case faster than before
real
I still need to implement slab coloring, but that should not be too difficult I dont think
im kinda curious if it will make any difference at all
Probably does on some specific cases
This is very easy
You just add a number and increase that number lol
Yeah
Pretty sure there's a bug in there somewhere that i fixed recently and forgot to push tho so be careful
does it matter on newer cpus?
Oooh thats a nice repo
Is it hard to add another allocator?
Also damn friggs allocator just dies with more threads
Nah
It's a very heuristical benchmark tho idk if that makes sense
It's not great
But it's good enough
Frigg is better single core iirc
page cache lock? wdym
was there a global page cache lock that youre breaking down to per-file or was it a per-file lock that youre breaking down further
Global lock (I do a intrusive hashtable page cache)
So Im ginna break thst down to per bucket
shouldn't you have one page cache per vnode?
I wanna do a bst for each vnode eventually but considering some other kernels also did a hash table page cache according to will "vmm" hyenasky I will just keep it this way until then
Just a subtle way to get more people into the thread, I see what you’re doing 
mathew, im afraid we have been uncovered 
Just ping everyone 
Force new people to join this server while you're at it 
I don't believe that gets people in the thread
Sad
Also wouldnt waking everyone at once suffer from a thundering herd problem
I mean ig if too many threads are waiting on a lock then there are huge contention problems or something
No it’s okay this was important to me anyways ðŸ˜
I also probably should enabe global pages in the kernel 😠idk why I still havent done that
not using that might be impacting the performance significantly when theres a lot of switching around
thats after I finish this page cache stuff
I also might look into redoing how I handle command line arguments, since I want access to parameters early
I might do something like what @analog berry said
section with parameters so I can fill it during boot
like before even doing early init stuff
good call
i should do that too
I did it a while ago
did not do any noticeable changes in performance but still good to have
apparently the qemu port is working now, I probably fixed something that made it work
thats nice
its not as slow as I wouldve thought too
wonder if it was the same but that made factorio on wine not work
Damn
probably not
lets see if wine still opens notepad
ignore it screaming in the background
still cant open the save as menu :p
Damn even notepad calls unimplemented win32?
could be astral funnies makng it think something is unimplemented
there is so much going on in that picture
xfishtank from a serial session running as user astral and spiiiin cubes ran from xterm as user root
xfishtank is goated any serious hobby os should have a fishtank application
oh and all of that running with -smp 4
:D
wonder how close astral is to being fully self hosting
whats the status of astral on rh?
maybe by then you can do some astral development on astral booted on a physical computer 
it boots on most hardware from my experience (new and old), but keyboard support is near-0
somehow it's PS/2 impl is fucked on every single 1 of my machines
I have never gotten around to unfucking the ps/2 driver and I have other worries
you would honestly be better off writing a nic driver and sshing into astral
or using serial
kind of funny to say that
'least it boots!
better than nothing
ps/2 keyboard is one of the most basic things people do but you can ssh into it instad
right now I am trying to do something extremely funny
ooh?
he's about to run silksong on astral
I yearn for the days we wont have to imagine it 
lol
well nvm I wasnt even able to get it to run on linux 💀
what were u trying to run?
a game
I really need to do some userspace maintenance work but I also do not feel like babysitting a build for 5 hours
Got the new argument system almost done
Its quite simple you just
DEFINE_KERNEL_ARGUMENT(name, KERNEL_ARGUMENT_TYPE_STR/INT/BOOL)
GET_KERNEL_ARGUMENT_STR(name)
Use _Generic like me to automatically deduce the type
Just parse the parameters where you use them like I do 
#define PARAM_TYPE_OPS(value) _Generic((value), \
i8: g_param_i8_ops, \
u8: g_param_u8_ops, \
i16: g_param_i16_ops, \
u16: g_param_u16_ops, \
i32: g_param_i32_ops, \
u32: g_param_u32_ops, \
i64: g_param_i64_ops, \
u64: g_param_u64_ops, \
struct string: g_param_string_ops, \
bool: g_param_bool_ops \
)
I do this basically
huh does this work
yep
i just make it invoke a function when the arg is passed and that function gets passed the param as a string
alright, time to run a make clean and bash my head at the wall until I can make it compile with updated jinx
then with updated mlibc + some more gcc patches
then upstream some stuff I have to do for mlibc
think I will also implement sysinfo to get all of that done in one go
so that userspace can make better use of multicore
I know java checks for the number of online cpus
and I think mesa llvmpipe does too
wtf now it needs to be ran as ./jinx init???
and nothing in the docs talks about that
and wtf is a jinxfile
oh just renamed jinx-config
why tho
what
@sage locust is there any place with like updated jinx documentation or is it just read ironclad
ok so I had to make a new folder and add the jinxfile there and then init it with the jinxfile there
good to know
yeah it is doing stuff now
basically read Gloire
i did not update the documentation yet
np
Has anyone compiled mlibc in their os yet
I might port meson and ninja and try that
I think it should work? I have working python
But I need to first get all this userspace bs figured out
So my todo list for now is:
Update jinx and do a full rebuild for trsting
Update gcc patch and do a full rebuild for testing
Update mlibc and do a full rebuild for testing
Hook up some more functions related to scheduling into sysdeps and do a basic sysinfo implementation
Upstream it into mlibc alongside some other local patches
Finish pushlock rewrite (related: does anyone know the optimal number of times to spin before going to sleep? My old pushlock didnt have that but I will implement it in the new version)
Change my ipi send so that I do other work while the ipi is sending instead of waiting for that one lapic status register to change, which might save some time on stuff like sending a reschedule ipi
I think these last two might help increase smp performance a bit more as well
@grand shadow you have a somewhat stable OS that can run gcc right? So you're the perfect ask for this. Can you try to compile zlib on Astral? Trying to rule out of the ar failure is a skill issue on Managarm's side or if it's a bug that others using mlibc also run into
Will do when home
That is if the disk image and iso survived the make clean
Otherwise only after I get jinx to work and do the full build
No hurry, thanks for testing!
What is the issue, btw?
Is it only failing in zlib or does it fail in general? Gnu hello and gcc builds work and they call ar
untested on gnu hello and friends as configure on gnu hello doesn't pass on managarm 
Damn
Will test when I get the chance
in exchange I want you to port webkitgtk to astral
/j
How about there’s a small chance it’s a mlibc bug that you can also run into for self hosting. Best I can do 
What if you wanted to self host but mlibc said no
Happens
If I can build mlibc in astral I will have built binutils, gcc and the libc in my own kernel
Which would be super damn close to filly self hosting
Indeed
Works fine on jinix
this is still mlibc under it right?
Yeah
what is jinix
Linux with mlibc built with jinx
interesting
iretq made literally everything it seems
Worth noting that jinix was last updated 4 months ago so it could be a recent regression in mlibc
mlibc is probably a little bit more behind than 4 months as well
i really want to get back to jinix though :^)
thanks for the reminder that this project exists
Updated mlibc and it's still fine so nope
Then it is a managarm skill issue, damn
Well I'm doing a full world rebuild with the updated mlibc now to be sure
But yes most likely
i will backport as much as i can from Gloire
no one seemed to want to work on Jinix so i kind of just stopped updating it
yeah thats fair
util-linux fails to compile CC lsfd-cmd/lsfd-file.o /base_dir/sources/util-linux/lsfd-cmd/file.c: In function 'get_minor_for_mqueue': /base_dir/sources/util-linux/lsfd-cmd/file.c:664:17: error: implicit declaration of function 'mq_close'; did you mean 'pclose'? [-Wimplicit-function-declaration] 664 | mq_close(mq); | ^~~~~~~~ | pclose /base_dir/sources/util-linux/lsfd-cmd/file.c:664:17: warning: nested extern declaration of 'mq_close' [-Wnested-externs]
ah that's one of the things added by the jinix mlibc patch i disabled
Okay yeah it's a managarm skill issue
only so much time and so much to do I'm afraid
(and was on laptop only which slowed work significantly)

seems like the disk image and iso are still there, will do a double check if it works now
@prime juniper works in astral
so it really is managarm
Fuck
Last hope, I see a newer version of zlib (but likely a bug somewhere with us)
Thanks for testing everyone!
say version and I will wget it and build it 
me before the end of the year hopefully
honestly its not even that hard you just need to be a bit stable and implement enough syscalls for configure and make to run
now that I have SMP implemented, the next step is precisely having configure and make running
You got all the way into making userspace stuff without SMP?
yeah
Damn
that was a big missing piece, but now it's there 🎉
it will be a good test for the stability
and then when you know it works you start a gcc build and fix any stability bugts that show up 
#1191856876787335268 message
astral has been... surprisingly stable
yeah, I've been waiting so long for this moment
only deadlock I know exists is somewhere in tcp code I think
happons when downloading a big file randomly
not sure whats up, never looked into it
but will have to at one point
it is super exciting
ngl I get kinda jealous of your progress sometimes
such progress comes at the cost of long hours of despair and loss of the will to live (in Minecraft)
I know 
tfw you spend several hours per day over a week debugging a bug and the problem was in code you didnt even check 
I have, multiple times, had difficult to find bugs, be single-character typos.
It also comes with great moments of joy btw. I remember a few times, after more than 16 hours of debug without any pauses, figuring out where the issue comes from, and starting to dance alone at 4am
and then finally take a shower and have a meal 
Definitely. Mounting and at least reading (write is WIP) Ext2 with no manual intervention was a recent milestone I'm really proud of. It required a lot of subsystems to work properly to do so. #1153085124959809616 message
frfrfr
The next milestone I'm aiming for is even better: A little demo of BadgerOS installing itself from a USB stick. That requires a bunch of VMM refactors, and syscall re-thinking, and the start of an actual distro for it.
But if you want to hear more we should move that convo to #1153085124959809616
I did 1.2.12, downloaded from the Git tag, so should be the exact same as specified in the managarm recipe
Sadge
Similar tales here. I distinctly remember spending 2 weeks looking at X11 code and raw Unix socket dumps to figure out why it was shit, we found the bug, stubbed a function and got glxgears. Felt really good after two weeks
@sage locust do you know what is going on here
mount: /home/mathewnd/blehh/astral/.jinx-cache/sets/gcc/.image/usr/local: mount point does not exist.
oh you seem to have updated jinx between then, updating to see if that fixes it
still happens
ugh
does it not work with wsl or something
local does not exist in usr
rm ~/bleh/astral/.jinx-cache/sets/gcc/.image/.jinx-set-valid
that should make jinx recreate that image set
does sets/gcc/.image contain anything?
oh wait
sorry
scratch that, my bad
it does, it just does not have local in /usr
gonna try adding this mkdir to see if that hacky thing fixes it
if ( [ "$JINX_NATIVE_MODE" = "yes" ] && [ "$cross_compile" = "yes" ] ) || ( ! [ "$JINX_NATIVE_MODE" = "yes" ] ); then
mkdir -p "${imgroot}/sysroot"
mkdir -p "${imgroot}/usr/local" #<-----------
container_pkgs_native_mount="mount -o ro --bind '${container_pkgs}' '${imgroot}/usr/local'"
sysroot_native_mount="mount -o ro --bind '${sysroot_dir}' '${imgroot}/sysroot'"
run_in_cont_lang=en_US.UTF-8
else
well at least dies somewhere else
with that mkdir it dies here
/home/mathewnd/blehh/astral/jinx: 341: cd: can't cd to /home/mathewnd/blehh/astral/build-x86_64/host-pkgs/autoconf/usr/local
cp: cannot stat '/home/mathewnd/blehh/astral/build-x86_64/host-pkgs/autoconf/usr/local/.': No such file or directory
I'm not sure if I configured something wrong, or its a wsl skill issue or jinx bug
it's either a messed up build, jinx bug or a skill issue (which could be merged with #1)
wsl2 is perfectly capable of running jinx
it's basically a linux vm
so for all intents and purposes it's linux :^)
jinx:
curl https://codeberg.org/Mintsuki/jinx/raw/commit/4bf3b28e2ed064dcfa2a24f7faed3bc5ec2ff9b8/jinx > jinx
chmod +x jinx
$(JINX_DIR)/.astral_ok: jinx
mkdir -p $(JINX_DIR)
cd $(JINX_DIR) && \
../jinx init .. ARCH=$(JINX_ARCH) && \
touch .astral_ok
kernel:
cd $(JINX_DIR) && \
rm -f builds/astral.packaged && \
rm -f builds/astral.built && \
../jinx build astral
that is what is ran
JINX_ARCH=x86_64
JINX_DIR=$(shell pwd)/build-$(JINX_ARCH)
hmm using a commit before the rootfs changes seems to work
might as well find the last working commit while I commit mass murder in rainworld
killing scavs in ||metropolis|| is super fun
so true
ok bad commit is 5531eeb4152aef05af4171d9a74b0f79f04b494b
might as well use the one before it
aand now the autoconf source is not being found for some reason
oh ok I just had to nuke the sources dir which for some reason was not nuked before
wait but it doesnt even use that sources dir
it uses the one in the subdir
why would that even matter
wait no it does
I am confused
ok gonna try the latest commit again, maybe that was something I fucked up
yeah no even fully clean that commit is still broken
interesting
there should be no need to add that mkdir because the Debian rootfs should already have a /usr/local directory
ironclad jumpscare
for some reason libintl refuses to build because of a weird libtool error so I am now trying to update it
maybe its using the linux libtool somehow?
no wait what why does it think it is on libtool 2.4.7 when both the imagedep and hostdep are 2.5.4
insane
do you have the massive regex vomit in the Jinxfile used to patch in support for YourOS to libtool in each autotools package?
I do not
what did even change for that to break
since it used to work just fine
libtool: definition of this LT_INIT comes from libtool 2.5.4.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.7
libtool: and run autoconf again.```
VERSION=UNKNOWN
Configuring libtool UNKNOWN
insane
oh I fucking see
.tarball-version does not get copied over when copying the source to the build dir!
and it all explodes.

wait no
wait yes
there we fucking go
this was stupid

libintl compiled, time to see what blows up next
xbps-create: ERROR: invalid pkgver! got `base-_1' expected `foo-1.0_1'
version=4.4.36
source_method=tarball```
what is it even yapping about
ohh wait
nvm I'm dumb
wrong package
so much has changed I need to get used to new jinx
I do like that it makes .xbps packages... will make life easier when I need a package manager
I mean I could look into porting it
would be an excuse to fix that tcp bug as well
okayy the minimal distro built with new jinx
and it boots
time for the full build
Trust me xbps is an easy port. Just grab OpenSSL and libarchive and you’re basically set (well you need some CA certificates too but details)
you need those for curl too, which astral has
i believe there was a demo of fetching and building gnu hello :^)
Oh bruh
Then easy
(Technically all are optional if you fetch over insecure connections and curl doesn’t depend on libarchive)
Yeah funny. Astral installs the make-ca program. But not the actual certs
Will fix
oh very good to know
wait huh
fucked up
Yes
I don’t see you installing the certs as a port unless you do that somewhere I haven’t looked
It all builds fine with new jinx now but xorg breaks cuz /usr/var/log is not getting created
I do it in the make-ca recipe
That path looks scuffed anyway
Shouldn’t that use /var/log?
Maybe
No idea why it wants to use /usr/var/log
Maybe its the prefix?
But it used to work fine!!!
even removing the --prefix keeps it there
by default localstatedir is prefix/var
so I guess I just set that to /var
yeah
even setting it to var it still keeps wanting to open /usr/var/log
DEFAULT_LOGDIR='/var/log'
???
ohhh I see I have to do ./jinx REINSTALL now
there we go Ijust gotta mkdir /var/log now somehwere
since xorg does not create that dir for some reason
does jinx not install empty dirs?
ah fuck this I am just mkdiring it on /etc/rc
and now it dies because it cannot find any screen
how did updating jinx fuck everything up so hard ðŸ˜
oh right I removed the --prefix
that waws on me
THERE WE GO
xorg with keyboard and mouse working
tonight I will see if no other packages broke
xbps does not keep empty dirs around
so you add .keep files 
or, if you're managarm and tired of doing that (hicolor-icon-theme installs a fair amount of empty directories, typing that out is pain)
you're welcome
Good to know
- args: ['@SOURCE_ROOT@/scripts/keep-empty-directories.py', '@THIS_COLLECT_DIR@'] in xbstrap language is the invocation
so basically same for jinx but shell and collect dir becomes dest dir
Probably gonna add a shell version of that to the jinxfile
either that or ship the python script in build-support or whatever
@sage locust jinx should possibly check for that before calling xbps-create
to prevent creating packages that are half broken
One could integrate it yes. So far the only package that might dislike it is hicolor-icon-theme but skill issue install an actual icon theme then
@analog berry you wanted the iso so here you go
qemu-system-x86_64 -smp 1 -m 512m -cdrom astral.iso -M q35 -enable-kvm -cpu host,migratable=off -debugcon stdio
acpi: [info] successfully loaded 1 AML blob, 1705 ops in 0ms (avg 3730853/s)
on my 13700k
profile it :^)
I implemented slab just like the paper said and my mutex is just a cas
some other time I will
this doesn't work for me
huh nvm a reboot fixed
well yeah it tries to mount a filesystem on a disk that doesnt exist
wtf
ah
acpi: [info] successfully loaded 1 AML blob, 1705 ops in 0ms (avg 3323586/s)
on 265KF
i think that mint did say that ARL was worse at the uacpi benchmark :^)
yeah
my clock might be fucked because i use tsc
ugh
this might be qemu being inaccurate for some reason
because before i haven't had scores on this level
only ~4-5M
meh this is stupid and doesnt really matter
gotta continue the distro work
ok most ports seem to be working fine
Arl?
arrow lake
Ah
Not a real OS without triggering the antivirus 
now it is time to do a full clean build again with some changes to the gcc patch
Thank you for showing me this img, I will now steal it