#Astral

1 messages ยท Page 23 of 1

wraith surge
#
  • fps too
grand shadow
#

I have only booted 2.8 like once so I dont remember that

wraith surge
#

also, now there is 2.8.1 too

grand shadow
#

I should make my bf go back to playing it with me

#

we stopped early EV

analog berry
#

Yeah ev is where the fun starts

#

With autocrafts

sharp carbon
#

i must confess this is the first time in my life i have touched gtnh

grand shadow
#

monkuous on their way to vanish for a year the moment they start playing gtnh

#

its a fun modpack

analog berry
sharp carbon
#

can't wait to start my first ever gtnh playthrough and do it all on astral

analog berry
#

Yess

gritty shore
#

i have never played minecraft with mods

#

only optifine

#

/sodium

#

am i missing stuff

analog berry
#

Depends on the level of complexity you enjoy

harsh echo
#

Are you sure that the cache manager ever unmaps the cached MFT views?

wraith surge
#

omg i hated fusion and waterline

#
  • monaline
grand shadow
#

gtnh is the insane man's modpack

analog berry
grand shadow
#

bonus points if gog

wraith surge
#

i'm in UHV rn

analog berry
#

Damn

#

How many hours

wraith surge
wraith surge
#

this run

grand shadow
wraith surge
#

last run was like 1k

grand shadow
#

or rather

#

goose

harsh echo
#

The process that mapped a specific MFT view may have closed, leaving some MFT views still mapped

wraith surge
#

but stopped at UV

analog berry
prime mulch
wraith surge
#

didn't want to change everything

#

lol

analog berry
#

Lol

wraith surge
#

also, they doing a multiblock change now

analog berry
#

Should've just finished on the old one

wraith surge
#

they are changing basically all the structures

analog berry
#

Yep

grand shadow
#

oh wtf

analog berry
#

That's good

grand shadow
#

damn

wraith surge
#

(i was also working on a new multiblock)

analog berry
grand shadow
#

oh true lmao

analog berry
#

Or a lot of them

grand shadow
#

centrigure ebf turbines etc

analog berry
#

Yep

blazing ingot
analog berry
#

Also I unironically learned some chemistry from gtnh, I knew literally nothing

#

Since a lot of recipes and alloys are literally exactly as irl

#

Even like the way u get titanium via ebf with magnesium and stuff

wild marsh
#

mm greg petrochem

analog berry
#

Lmao

bronze nexus
#

NO FUCKING WAY

grand shadow
#

@sharp carbon that EMFILE error earlier could have been some dns bullshit

#

mlibc was leaking fds when a dns error happened

sharp carbon
#

oh possibly

grand shadow
#

I'm gonna test rq if the timeout code works and then upstream the patch to astral + open a mlibc pr

#

and that fixes the fd leaking as well

#

seems to be working

#

dns patches are up

grand shadow
#

any news?

#

inb4 monkuous doing stargate speedrun

sharp carbon
#

I have gone to bed

grand shadow
#

or that too meme

#

sleep well

prime mulch
#

im enjoying monkuous' role as an angel going around doing miracles for our projects randomly

neon crane
#

it's honestly kinda funny

#

my favorite kind of person is the anonymous green discord profile picture person with an uncanny amount of knowledge in a topic

#

and by anonymous i mean they don't have many connections on other platforms

viscid flame
#

actually it can help for cpu rendering

#

it increased 10-20 fps on my raspberry pi when it was doing cpu rendering

grand shadow
#

yeah it could be that the missing shared memory stuff is making it slower to a point where sodium doesnt have much of an impact(?)

grand shadow
#

and about the xorg shared memory stuff, it seems like it can use /dev/shm and mkstemp

#

which might not be the best option but works lol

#

or rather, /run/shm

#

hm

#

    const char *shmdirs[] = {
        "/run/shm",
        "/var/tmp",
        "/tmp",
    };
#

one of these

#

/tmp is already mounted as a tmpfs

#

but I would muuch rather it use /dev/shm

grand shadow
#

well it seems to be enabled now

#

that is pushed as well

#

didnt seem to make that much of a difference on my laptop but I am also missing a lot of perf work monkuous did

#

plus running under wsl

#

I changed the xorg patch so you'll have to rm rf the xorg-server sources btw

#

and rebuild for the shm extension

marsh sparrow
analog berry
#

huh lol

#

which minecraft mechanic is complex

#

the base game is piss easy

#

if you think its complex gtnh is definitely not for you

#

it has processing lines needing hundreds of machines

#

like kevlar etc

sharp carbon
#

are you sure that log message indicates that SHM is actually used rather than just the extension being enabled? because that message was there before i applied the patch too

marsh sparrow
#

You can do a lot with base game mechanics

analog berry
#

Well okay I guess were talking about different types of complexity

#

If you wanna beat Minecraft base game you dont need any of these things

sharp carbon
#

@grand shadow I looked into it and using X11 SHM with Mesa requires shm* syscalls

#

this is in mesa

#

it has no fallback methods

#

if this function fails it disables shm use

robust geyser
#

would you look at that

#

what the heck is a shmget meme

#

why do you need shm anyway

#

is it that important for x11 performance?

sharp carbon
#

yeah

robust geyser
#

what is done differently if you don't provide shm?

sharp carbon
#

presumably it sends the image data over the socket to xorg

#

idk the details I just know it's very inefficient

robust geyser
#

oh like that

#

yeah that sounds suboptimal indeed

analog berry
#

otherwise it has to memcpy every frame

robust geyser
#

yeah that somehow did not cross my mind immediately

marsh sparrow
#

shmget is probably the worst shared memory interface on Linux though

#

files on tmpfs are literally better

sharp carbon
#

yeah but that doesn't change that mesa seems to require it

analog berry
marsh sparrow
#

iirc it's a syscall on linux, let me check

#

yes, it is

sharp carbon
#

i don't think it's possible to implement shm* as an abstraction

#

not without a central server at least

analog berry
#

hmm yeah it is

marsh sparrow
#

and the semantics are incredibly stupid (not linux's fault) since it uses a single global space for shm names

analog berry
#

so it requires some private instance of ramfs or something

prime mulch
#

imagine using a namespace for something like that and having it be a global flat namespace and not just using the filesystem you already organized everything else around

#

someone was lazy

analog berry
#

it calls it sprintf(name, "SYSV%08x", key);

#

should've been a libc function

marsh sparrow
#

i don't think you can implement it as a libc function

analog berry
#

hmm why?

#

the only issue i guess is it may collid with some existing file in tmpfs but other than that seems doable

marsh sparrow
#

the value returned by shmget is not an FD

#

it's really a globally valid number

prime mulch
#

who came up with that

marsh sparrow
#

unix system v apparently

deft oak
prime mulch
#

younguns always dunk on certain mainframe/minicomputer boomers like the VMS guys for hating on Unix back in the day

#

they have to remember

#

this is the unix they were hating on

#

it deserved hatred in the 80s

analog berry
#

As long as your shmat can find it

marsh sparrow
#

and on old ones you can use O_TMPFILE

#

and if you don't even have that, you can fall back to a file in /tmp

marsh sparrow
#

see discussion above

#

There are other subtleties, for example shmdt cannot be implemented just on top of munmap

sharp carbon
#

i implemented shm* to the extent that is necessary for x11 shm to function but the improvement is much worse than i expected

#

glxgears fps went from 1400-1500 FPS to 1800-1900 FPS (on my host with llvmpipe it's 3500-3600)

#

in minecraft the improvement was unnoticeable

prime geyser
#

i wonder if astral can run xmrig

#

i should try that

analog berry
#

What could be bottle necking it so much

sharp carbon
#

i've done some more testing and the mc improvement seems highly situational instead of just all out unnoticeable

deft oak
sharp carbon
#

when there's a lot of non-full blocks around (like in the overworld where i initially assessed the impact) it's unnoticeable

deft oak
#

idk what caused it

sharp carbon
#

but in the end where there's basically only full blocks it went from 10-15 to 45-60

#

nearly 60 FPS in minecraft on astral

neon crane
analog berry
analog berry
#

btw whats the state of gtnh starting a game?

sharp carbon
#

still the same error with gadomancy

analog berry
#

some internal object being null?

sharp carbon
#

i tracked it down to a gadomancy research item not being registered with thaumcraft for some reason

#

but i haven't investigated further than that

analog berry
#

interesting

#

that sounds hard to debug

sharp carbon
#

might just be mlibc perf issues then

marsh sparrow
sharp carbon
#

memcpy maybe?

deft oak
#

yea thats what confuses me too

#

is mlibc memcpy not optimized lol

analog berry
sharp carbon
#

iirc mlibc memcpy is about as optimized as you can get while still having it be written in c++ but it is c++

analog berry
#

it uses avx for that

sharp carbon
#

whereas glibc uses handwritten asm that takes advantage of whatever features the actual running cpu has

analog berry
#

^

robust geyser
#

40 fps in minecraft is still insane

#

and definitely not a memcpy problem

analog berry
#

well it is a tiny res

#

its impresive im just curious whats bottlenecking it

robust geyser
#

oh yeah i'm not saying it's not impressive, sorry

marsh sparrow
robust geyser
#

it's just that memcpy probably is insignificant in this case

analog berry
#

who knows

#

we need a flamegraph meme

sharp carbon
#

i think to go further a proper profile is needed yeah

#

and i don't think astral has anything near the needed infrastructure for that

analog berry
#

yeah

#

u need kernel support for profiling like that right

deft oak
#

wasnt there a way to profile the entire vm

analog berry
#

it sucked iirc

sharp carbon
#

sampling yeah

#

but for stuff like this where sub-millisecond stuff matters it's not that great

marsh sparrow
#

A 2x improvement would mean that even if glibc memcpy was 4x as fast (it isn't), the overall time in memcpy would need to be way > 50%

#

So I'm skeptical that these numbers are correct (and attributed to mlibc) unless somebody does an apples to apples comparison

#

i.e. linux glibc vs. linux mlibc

#

A program can also be sped up significantly by libc improvements if it already spends a lot of time in libc which sounds unlikely for this workload

grand shadow
sharp carbon
#

huh, that's... interesting

robust geyser
#

me when smpn't

#

maybe the qemu profiler could be useful after all

grand shadow
#

I mean when its single threaded it doesnt have to send tlb shootdowns

marsh sparrow
#

how many threads does it use w/o an explicit setting?

analog berry
#

1

robust geyser
#

probably however many it queries from sysconf

#

_SC_NPROC something something

grand shadow
#

Yeah and I dont have sysconf so 1

robust geyser
#

makes perfect sense

grand shadow
#

But yeah I think thats mostly tlb shootdown overhead

#

Since I only send shootdowns on userspace when theres >1 thread

deft oak
analog berry
#

why does it do that?

grand shadow
#

I remembered testing that on linux as well and when setting lp num threads it also slowed down

marsh sparrow
#

It probably allocates / deallocates frame buffers

analog berry
#

having a set number of framebuffers is alien technology

sharp carbon
# grand shadow I remembered testing that on linux as well and when setting lp num threads it al...

for me on linux it definitely helps $ LIBGL_ALWAYS_SOFTWARE=true LP_NUM_THREADS=1 glxgears 11824 frames in 5.0 seconds = 2364.768 FPS 12447 frames in 5.0 seconds = 2489.235 FPS Terminated LIBGL_ALWAYS_SOFTWARE=true LP_NUM_THREADS=1 glxgears $ LIBGL_ALWAYS_SOFTWARE=true LP_NUM_THREADS=8 glxgears 20418 frames in 5.0 seconds = 4083.596 FPS 20365 frames in 5.0 seconds = 4072.906 FPS Terminated LIBGL_ALWAYS_SOFTWARE=true LP_NUM_THREADS=8 glxgears

grand shadow
#

Weird

#

maybe it was wsl being funky

#

cant even repro it because LIBGL_ALWAYS_SOFTWARE doesnt work with wsl for some reason without passing some more envs which I forgor ๐Ÿ’€

#

and I changed it to use proper gpu a while back

deft oak
#

why do you use wsl anyways ๐Ÿ’€

analog berry
#

r/linuxsucks KEKW

grand shadow
#

cba to install linux

bronze nexus
grand shadow
#

maybe the reason I got so far with astral is because I didnt install linux who knows troll

bronze nexus
#

Wait you're actually developing Astral from Windows?

#

Why hurt yourself like that ร–

grand shadow
#

wsl

#

so its still linux

bronze nexus
#

but still

robust geyser
#
[iretq@DESKTOP-TAQSOFJ ~]$ LIBGL_ALWAYS_SOFTWARE=1 LP_NUM_THREADS=1 glxgears -info | grep -E 'GL_RENDERER|frames in'
GL_RENDERER   = llvmpipe (LLVM 21.1.5, 256 bits)
14234 frames in 5.0 seconds = 2846.708 FPS
14279 frames in 5.0 seconds = 2855.724 FPS
14534 frames in 5.0 seconds = 2906.710 FPS
[iretq@DESKTOP-TAQSOFJ ~]$ LIBGL_ALWAYS_SOFTWARE=1 LP_NUM_THREADS=8 glxgears -info | grep -E 'GL_RENDERER|frames in'
GL_RENDERER   = llvmpipe (LLVM 21.1.5, 256 bits)
14954 frames in 5.0 seconds = 2990.709 FPS
15041 frames in 5.0 seconds = 3008.050 FPS
15133 frames in 5.0 seconds = 3026.420 FPS
[iretq@DESKTOP-TAQSOFJ ~]$ LIBGL_ALWAYS_SOFTWARE=1 LP_NUM_THREADS=24 glxgears -info | grep -E 'GL_RENDERER|frames in'
GL_RENDERER   = llvmpipe (LLVM 21.1.5, 256 bits)
9761 frames in 5.0 seconds = 1952.070 FPS
9759 frames in 5.0 seconds = 1951.615 FPS
9772 frames in 5.0 seconds = 1954.358 FPS```
#

lol

#

probably because the other cpus are being shared with windows

#

but 1 to 8 is negligible for me

grand shadow
#

well you have a trillion cores I have 8 cores on my laptop

#

so even less cores makes it slow down ๐Ÿ’€

#

but yeah there is defo something bottlenecking smp in astral

#

and since it seems to slow down when running with >1 thread on glxgears it seems to be tlb shootdown?

#

I already only send that shit only to cpus that are running in the same address space and once per munmap so I'm not sure what more can be done on the userspace side

#

I know kernelspace I still dont do that lazy shootdown thing

deft oak
#

(i dont do smp at all so i might say something stupid)

analog berry
#

well with RCU u kinda do that

bronze nexus
deft oak
#

yea

bronze nexus
#

Not that I should be discussing any of this w/ my kernel that doesn't shoot down tlbs KEKW

prime mulch
prime mulch
#

(so yes you can do that)

bronze nexus
#

That's cool

analog berry
#

because managarm kernel is coroutine driven

robust geyser
#

does that really matter

analog berry
#

makes it very easy

bronze nexus
#

You can still do this is a kernel that isn't inherently coroutine based

analog berry
#

but u can make a completion callback when all cores finish the ipi

grand shadow
#

well astral having proper profiling infrastructure is way overdue at this point and I can look into how to do it later unless monkuous wants to do it

sharp carbon
#

nah i'm probably gonna move on to non-astral stuff

bronze nexus
#

monkuous just going around randomly helping projects chad

analog berry
sharp carbon
#

not sure yet

#

probably just gonna work on my own kernel

analog berry
#

nice

bronze nexus
#

Do you have a post for that I can follow?

analog berry
#

whats the current state of xarch btw

sharp carbon
bronze nexus
#

I need to grow my followed post list to take up more space than actual channels

sharp carbon
analog berry
#

nice

analog berry
sharp carbon
#

the "i want to support everything from i486 to zen 5" one

#

which isn't public atm

bronze nexus
#

That sounds like pain

analog berry
#

wait a NEW kernel??

#

is it gonna be called hydrogen

sharp carbon
#

as always

analog berry
#

pls dont delete the current branch

sharp carbon
#

i won't dw

grand shadow
#

name it after a different hydrogen isotope every rewrite

bronze nexus
#

Deuterium

sharp carbon
bronze nexus
#

Tritium

#

you have THAT many kernels? KEKW

analog berry
#

add a new component every time, so hydrochloric acid this time

bronze nexus
#

H2SO4

#

(Don't breathe that if you don't feel like dying)

grand shadow
#

gregtech refenrencencnecne

prime mulch
#

i might put it up on the demo web page

analog berry
bronze nexus
analog berry
#

thats the joke lmao

bronze nexus
#

It's like one of the big dangers they have shittons of sensors for.

grand shadow
#

no... reality copied gregtech....

deft oak
#

no stupid its a factorio reference

analog berry
#

lolol just electrolyze it for free sulfur and hydrogen duh

bronze nexus
#

The most you get is U-235 and U-238

#

And maybe sulfuric acid

grand shadow
analog berry
#

u breathe it in while doing the thing

#

duh

grand shadow
#

real

sharp carbon
#

it has bash and coreutils installed

prime mulch
#

actually

#

can you do that and make the disk /dev/xrdisk3p1

#

so i can attach it as dks3 in the web demo

sharp carbon
#

sure

#

do you want me to put a monochrome tux in as the a4x logo

prime mulch
#

that would be sick

#

it is panicking for me

sharp carbon
#

as i said it's unstable

#

sometimes it works sometimes it doesn't

prime mulch
#

do i just have to try over and over til it boots

#

ah

sharp carbon
#

for me it works more often than not

prime mulch
#

it works if i crank up the cpu speed crazy high

#

it consistently crashes with a lower speed

#

i dont think i will put this up as a web demo yet bc it will just demo that xrstation crashes a lot

#

maybe on its own sub-page

sharp carbon
#

understandable

robust geyser
#

i didn't know it got that far

grand shadow
#

so profiling basically boils down to:
set up a ring buffer
set up a pmc
set up a nmi handler for it that writes to that ring buffer
expose that via a device or some other way

robust geyser
#

pretty much, yes

grand shadow
#

seems simple enough

analog berry
#

nmis in astral letsgo

sharp carbon
grand shadow
#

probably just gonna expose that via a /dev/prof or something and have some application be able to attach to it

prime mulch
#

i moved cuz mathewnd came back

sharp carbon
#

ah

grand shadow
#

hmm and I could make it so that profiling is disabled/enabled by writing into it

#

@marsh sparrow in managarm, do you add any more info like pid/tid and do you only log instructions in the kernel

marsh sparrow
#

For profiling?

#

We only use the kernel profiler to profile the kernel

grand shadow
#

Alright

neon crane
prime mulch
bronze nexus
#

ASIDs only make a TLB invalidation less expensive

#

They're not magic (i.e. if the process had filled the entire TLB then it wouldn't do anything)

gritty shore
#

they only make switching address spaces cheaper

grand shadow
#

Yes I am gonna shamelessly steal managarms profiling :p

#

Its simple and seems to work well enough for managarm

prime mulch
#

Pentucky mried chicken

robust geyser
#

performance monitoring counter

winged basin
grand shadow
#

did some mlibc stuff now starting the profiling stuff

#

at one point I also should create a python script that generates a graph of the init dependencies in the kernel

#

shouldn't be that complicated since dependencies get defined on the same macro as the routine is defined

#

the macro soup is worth

grand shadow
#

instead of doing profiling I do this :P

grand shadow
grand shadow
#

damn this pmc shit crazy wtf was intel cooking

#

thats gonna take a while to learn how to do

analog berry
grand shadow
#

its upstream

#

its a really hacked together thing but it works lmao

analog berry
#

init routine defines?

#

didnt know u had anything like that

grand shadow
#

bro I have had that for monmths

analog berry
#

oh i missed that rework

grand shadow
#

yeah it was one of the first things I did when I woke up from my slumber

#

anihilate all _init from main

analog berry
#

ahh

grand shadow
#

now I have an init system fueled by macro soup

analog berry
#

managarm larp

grand shadow
#

real

#

unlike managarm's this is 100% organic macro soup

#

no industrialized goods here!

surreal wraith
#

How can I run Astral on the real hardware with all pre-installed programs and games?

robust geyser
grand shadow
prime geyser
#

where do astral packages come from

#

are you hosting them somewhere

grand shadow
#

Maybe next year Ill add more driver support, I have much more important stuff to do in the kernel than write more drivers

#

Prs always welcome :)

willow rapids
#

dang that's a lot of packages

prime geyser
#

ah

analog berry
grand shadow
analog berry
#

Ah

proper meteor
grand shadow
proper meteor
#

virtio ain't enough?

grand shadow
#

Idk if they expose virito

#

I could run lspci to see

#

But they do allow you to run your custom os image

#

๐Ÿฅ€

proper meteor
#

Terrible

prime geyser
#

would astral as a container os have the same performance issues when used to host a Minecraft server without graphics?

willow rapids
grand shadow
#

and worst case I finish the profiler and profile it

#

I already have the architecture independent side of it done

#

its just that the architecture dependent part differts between amd and intel and sucks

marsh sparrow
#

The AMD one is quite sane

#

The Intel one not so much

#

On intel, don't forget to unmask the PMI in the lapic LVT since it auto masks itself halfmemeleft

#

It's very intuitive because no other lapic LVT irq does that halfmemeright

#

Consistency is key at intel

proper meteor
#

intel and amd have builtin stuff for profiling?

marsh sparrow
#

they have performance monitoring features

#

with performance monitoring counters you can get an interrupt on every X instructions / cache misses / branch mispredicts or similar metrics

prime juniper
willow rapids
#

jeeeeesus

prime juniper
#

We keep every version ever around (for now)

#

But the total amount of unique packages registered in the repo is 448 last I checked

marsh sparrow
#

we can potentially put it onto cheaper storage though if needed

#

but for now it's not a problem

prime juniper
#

Yeah I have no plans to change it at this point. And it is useful so itโ€™s fine to keep around

formal patio
#

when astral os-test btw

grand shadow
#

Currently working on the mlibc demo os and book but when Im done with that and the profiling stuff I can pick between doing ostest or page cache work

formal patio
#

highly based

fleet grove
#

So the Awawi is still working on this sip

grand shadow
#

A lots been going on

fleet grove
grand shadow
#

Now I am working on profiling and a page cache rework

fleet grove
grand shadow
fleet grove
#

Damnnn

grand shadow
#

Speaking of, when do you think youll be able to upstream the work? @sharp carbon

sharp carbon
willow rapids
#

gnu mirrors trying to not be down 99% of the time (impossible challenge)

sharp carbon
#

for reference, these are the new commits

#

not included is the rtld mlibc pr that was upstreamed but that's only necessary for 1.13+

grand shadow
#

Good stuff, thanks

grand shadow
#

Maybe that gtnh issue was that?

carmine swallow
#

on managarm it ran to the zero-length truncation assert or whatever it was (and it did run into this first too but I already fixed this locally when I tried it)

grand shadow
carmine swallow
#

its probably that then if it happened very early

grand shadow
#

The game loaded but couldnt open a world because of gadomancy not loading properly

carmine swallow
#

ah then its likely not the same thing

sharp carbon
#

Yeah I doubt it's the same thing

sharp carbon
#

btw @grand shadow the kernel doesn't compile with a new copy of limine.h (like what gets downloaded by the recipe on a clean build), seems like some names have been changed since the code was written

neon crane
#

seems like they were removed

#

really i think astral should just have vendored limine.h

#

this specific header is bsd0 licensed

sharp carbon
#

yeah they were seemingly removed when the limine major version was increased

#

which, you know, fair enough since major version increases indicate breaking backwards compatibility

#

but annoying

grand shadow
#

damn thats annoying

#

if you can include fixing the header to an older version in the pr I'd be grateful

sharp carbon
#

4607d68cbdbe653885937fb3178449588addb799 is the last commit with the api revision thing, i'll fix it to that

grand shadow
#

thanks

sharp carbon
#

@grand shadow do you want me to make this one giant pr or should i split it up?

sharp carbon
#

alright

marsh sparrow
#

isn't the mlibc patch upstream?

grand shadow
sharp carbon
grand shadow
sharp carbon
#

astral is on an old commit of mlibc because updating needs a world rebuild

marsh sparrow
#

ah

grand shadow
#

I might update it either today or tomorrow if I feel like it

#

I am not sure if waiting for leo's locale pr would take too long

marsh sparrow
#

the locale PR will not break ABI

#

so updating past that should be easy

grand shadow
#

Oh thats good, I thought it would

#

Then I should update it soon

#

Maybe after I finish the mlibc guide thing

marsh sparrow
#

nice

bronze nexus
#

Or is it an ABI thing

sharp carbon
bronze nexus
#

(So yes, it's ABI)

sharp carbon
#

There's been an ABI break since the commit it's on right now, and since it's the libc, that affects literally everything

bronze nexus
#

I hope you have build scripts for everything in the distro

sharp carbon
#

Of course

#

It just takes a long time

bronze nexus
#

Fair

grand shadow
hearty fulcrum
#

'tism

grand shadow
#

:P

#

anyways, I am currently still mostly doing the mlibc demo os work and writing the guide but once I am done with the first part of it (at some point in the future I will implement the stuff needed for dynamic linking in that kernel) I will go back to working on astral

#

not yet dead project ๐Ÿ’”

#

plus intel pmcs are bullshit and I will have to implement a driver for that

#

but the drivers are the only thing left to do

#

aside from the userspace program which is simple and a python parser which is also simple

#

then I probably try profiling a bit and making astral faster and after that its back on the page cache grind

#

I still have the nvme prp work to finish

marsh sparrow
#

did you look at the Managarm code the intel pmcs?

formal patio
prime geyser
#

can i somehow change keyboard layouts

grand shadow
#

Not yet supported

#

I want to do that at some point since I also use a different one than en us

opal lotus
#

can you not change the xkb layout

grand shadow
#

Oh I thought he was talking about the console

opal lotus
#

idk if he is

prime geyser
#

i am

#

(german keyboard)

formal patio
#

btw does it sound plausible that handling of VMIN/VTIME et al messes with OpenSSH on managarm?

grand shadow
#

But idk if openssh passes there

#

These*

formal patio
#

it has this func, not sure if it gets called

#

probably only on the client afaict

sharp carbon
#

those settings for vmin/vtime seem like what any implementation that doesn't support them would comply with

#

allow read to unblock when 1 byte is available, no timeout

grand shadow
#

I am thinking of how I am going to handle NMIs

#

mostly the "before swapgs and after userspace irq/syscall" part

#

the only ideas I had so far were "checking if KERNEL_GSBASE points to a valid user address and swapping if not" and "checking if it happened on a specific range of instructions"

#

but both of these seem hacky

#

nmis are hacky grrr

#

or I ignore gsbase at all and use a combination of local apic id and iterating over every cpu struct troll

gritty shore
#

The solution is obviously to pretend NMIs never happen

grand shadow
#

and I have to access cpu local data for that

analog berry
tawny oak
#

ah I didnt mean to ping you for that, sorry

marsh sparrow
#

Managarm does it by storing kernel GS on the NMI stack

#

And then it's loaded into current GS

tawny oak
#

ah nice

#

I hadn't looked at how managarm handled that

marsh sparrow
#

And the previous GS is saved on the stack just like any other register

neon crane
#

who fires NMIs

marsh sparrow
#

Managarm uses NMIs for kernel profiling

neon crane
#

i guess those are software NMIs? and also, what about real hardware?

marsh sparrow
#

no, the local apic performance monitoring interrupt triggers these

#

this also works on real hw

analog berry
#

a lot of nmi events are used to notify the kernel about a corrected error

#

like memory/pci express

sharp carbon
#

usually hardware errors are reported as MC but some would say MCs are NMIs

neon crane
#

yes im counting MCs as NMIs

#

I don't know any other use of NMIs

sharp carbon
#

watchdog timers and profiling are big ones

neon crane
#

I don't support profiling in my OS

#

And I don't configure any watchdog timers

sharp carbon
#

well yeah other than MCs the only uses of NMIs that I'm aware of are software configured

#

so if your os doesn't configure anything that uses NMIs then the only ones applicable are MCs

analog berry
#

to detect lockups

neon crane
#

i see

grand shadow
opal lotus
analog berry
opal lotus
#

same shit

prime geyser
marsh sparrow
#

causing an nmi presumably

prime geyser
#

makes sense

marsh sparrow
#

some servers have this (or have ways to trigger that from a management interface) so that you can test whether the server is still responding or not

gritty shore
grand shadow
#

clearily that guy's os is better

gritty shore
#

ts pmo

hearty fulcrum
grand shadow
#

so I am now rewriting astral it will be a 16 bit 8086 os that will have tralarero tralala and a liriliri larila app

wild marsh
#

based

grand shadow
#

I am thinking of how I am going to implement that NMI stuff without having per cpu idts

#

as it currently is I have a per cpu array of isrs and a single idt used for every cpu

#

so far my only idea that might work is checking if EFLAGS has interrupts disabled and doing the gs stuff if so

marsh sparrow
#

why do you need per CPU idts?

grand shadow
#

I mostly need to figure out how to figure out I am running in a nmi before acessing per cpu data

#

and the only way I thought of was being interrupted with interrupts off

#

and the only places before swapgs have ints disabled anyways

marsh sparrow
#

i'm not sure if i understand the problem

#

in your NMI handler you obviously know that you're in an NMI

#

and you only need the load-gs-to-known-good logic in the NMI handler

grand shadow
#

yeah but that would need per cpu idts no? unless I have a fixed interrupt number in each cpu be the profiling nmi

#

since at start I set up each idt entry pointing to a small stub that saves one register and puts the int number there and then jumps into the rest of the interrupt ocde

#

and the per cpu interrupt stuff is handled in the architecture independent stuff

grand shadow
marsh sparrow
#

You can't select the NMI vector, it's fixed

#

It's always IDT vector 2

grand shadow
#

oh it is?

#

well TIL

#

so to figure out if a profiling irq is happening I gotta check some apic registers there

#

oh I am blind

#

I had the intel sdm open and didnt notice it said that

#

๐Ÿ’€

marsh sparrow
#

Also: #1061407633745125397 message

#

This is easy to miss in the SDM

analog berry
#

@grand shadow btw ^

grand shadow
#

Oh hmm

marsh sparrow
#

Hm? What's that

analog berry
#

builtin profiler

#

looks pretty good

#

saw it over at serenity os discord

#

looks pretty good

#

no need for any sort of kernel support

proper meteor
grand shadow
sharp carbon
grand shadow
#

WHAGTH JFSDIFDKFKDKHDFJHFDMGMFDJBJFD

#

HOYL SHIT

sharp carbon
#

turns out the issue wasn't in astral or mlibc or anywhere else

#

the mod in question was just badly written and expected process work dir == game dir

#

adjusting the launch script fixed it

grand shadow
#

@analog berry CHECK THIS OUT

sharp carbon
#

it is incredibly laggy even on minimum settings

#

as in 1-3 FPS

#

but it works!

grand shadow
#

gregtech is laggy even on my main computer sometimes ๐Ÿ’€

#

the gregtech is real

sharp carbon
#

yeah but 1-3 FPS on the literal lowest settings possible in a fresh world?

grand shadow
#

I mean yeah

#

I should get the kernel profiler finished already

#

or use the qemu one

sharp carbon
# grand shadow I mean yeah

i ran it on my host with the same settings as a comparison
radeon: 2800-3100 FPS
llvmpipe (16 threads): 100-110 FPS
llvmpipe (1 thread, aka same as astral): 20-40 FPS

grand shadow
#

hmm yeah something is defo messing it up

#

I plan on doing some profiling once all that infrastructure is done

#

but it might be memory stuff, my vmm is kinda shit

#

linked list vmm ๐Ÿฅ€ ๐Ÿ’”

analog berry
analog berry
analog berry
grand shadow
#

I plan on writing an iterative rbtree implementation at some point to use in the vmm

young chasm
sharp carbon
#

on astral llvmpipe gets slower with more threads

#

the theory is that it's caused by tlb shootdowns

young chasm
#

ah okay :D

grand shadow
#

I do one shootdown per munmap(), does linux do something else?

#

I know you can batch them kernel side but user side is not safe

#

and only on multithreaded processes and only when there are cpus running those threads etc

bronze nexus
young chasm
sharp carbon
deft oak
young chasm
#

i doubt its tlb shootdowns as i literally do one on all cores on all mmaps/munmaps and at least on halflife gets significant boost when multithreaded

grand shadow
#

ughh Id have to rebuild qemu to use that

grand shadow
#

I dont think I will have a lot of time this weekend

sharp carbon
#

looked at gtnh performance with mc's builtin profiler and it looks like ~70% of the frame time is journeymap and the hud text

viscid flame
sharp carbon
#

when hiding the hud with f1 i get what feels like 30-40 FPS

grand shadow
sharp carbon
#

minecraft does have a notoriously terrible font renderer

sharp carbon
viscid flame
analog berry
#

Check out the crafting recipes for each component

viscid flame
analog berry
#

Gnth galacticraft is basically rewritten from scratch

#

Every planet is useful since it contains new tier ores etc

grand shadow
#

Wonder if some of the lag could also be me missing something like sched_yield

#

Since I have seen mc complain a lot about it missing

#

At least a1.2.6

grand shadow
sharp carbon
#

but it shouldn't affect performance

#

well the removal of the error message would affect performance but i'm not sure by how much

analog berry
#

Probably not that much

#

Maybe grab a super quick profile with that qemu option?

sharp carbon
analog berry
#

Good question

grand shadow
#

Idk if distros ship that

analog berry
#

They dont seem to mention if its compatible with kvm I think

analog berry
#

Or wait

#

Yeah idk

marsh sparrow
#

it seems to be a plugin, not part of core qemu

analog berry
#

Yeah it needs building separately it seems

grand shadow
#

@sharp carbon are you running with the same amount of memory in xmx and xms?

#

When I ran it with the same it got much faster on alpha

#

Or at least felt like so

sharp carbon
#

I'm not explicitly passing either

#

it's auto detecting xmx as 8G (1/4th of total guest memory) but I'm not sure what it's using as xms

analog berry
#

Yeah xms does matter as well

#

But probably not that much

grand shadow
#

I wish I had more free time to work on stuff Im gonna be out until sunday ๐Ÿ’€

#

I can maybe get a thing or two done maybe

#

Since I still have to do more work on the mlibc demo os

#

I envy the kids who have 5 trillions hours of free time to do this shit

analog berry
grand shadow
#

I somehow got myself into maintaining an os written in a language I dont know for an architecture I dont know halfmemeleft

grand shadow
#

Just a basic super bare bones thing

#

Written in rust for rv64

marsh sparrow
analog berry
#

to be fair rv64 is way simpler than x86

bronze nexus
#

RV64 is way easier to deal with than x86

#

Its entire privilege model is so much simpler

sage locust
#

this is gold

analog berry
#

nice

sage locust
analog berry
#

can you find out why astral minecraft is so slow now KEKW

sage locust
#

this is so cool!!!

neon crane
analog berry
#

a flamegraph

sage locust
#

a flamegraph

neon crane
#

but what program visualizes and creates said flamegraph

sage locust
#

qemu/uftrace/perfetto

viscid flame
opal lotus
robust geyser
#

qemu samples the guest

#

and then creates a flamegraph

sharp carbon
#

or to call/ret instructions maybe

wraith surge
#

and send data via serial

opal lotus
#

i gotta try this

grand shadow
neon crane
hearty fulcrum
#

gigaseconds

grand shadow
#

Ms

viscid flame
grand shadow
#

But I dont think it matters unless java implements their own locks in userspace

#

Maybe

neon crane
#

i would try and reduce it

#

to 1 ms per thread for example

prime mulch
#

That sounds like it would make things worse

prime mulch
neon crane
#

I said I would try

#

doesn't mean it'll be any better

hearty fulcrum
#

5-6 is the sweet spot

neon crane
#

tbh 10ms means 100 threads can execute code. 1ms means 1000 threads can execute code, but they have less time per quantum which could affect performance

grand shadow
prime mulch
#

No scheduler is designed to deal with 1000 simultaneous ready threads with good responsiveness for all of them

#

You're not supposed to use the OS like that as an application programmer

neon crane
#

true

viscid flame
#

#nocputimewaste

prime mulch
#

You're supposed to have 1000 blocked threads and like, a couple dozen ready threads tops and that's on a system with lots of cores

neon crane
#

I agree

sharp carbon
#

it's not used for locks or anything

grand shadow
#

lol this worked

prime mulch
#

otherwise thyll just go

#

"but does it run minecraft? did you hear about the one that runs minerat?"

#

(thats a compliment, youve raised the bar from just having a pretty window server to running something grand like this)

formal patio
#

Kernel shells are not enough any more? That's news

#

Would be good news if true

#

But it isn't sadmeme

midnight stone
#

This chat feeling like accidentally entering nvidia instead of Microsoft

gritty shore
sage locust
gritty shore
sage locust
#

probably

neon crane
#

@grand shadow hey do you handle arrow keys in your kernel terminal? (so that you write to different positions within the line buffer)

grand shadow
#

at most it does cooked mode

neon crane
#

yeah, in cooked/canonical mode I mean

grand shadow
#

yeah in cooked mode you dont do that

#

you just handle at most like backspace

neon crane
#

i guess you only handle backspace/vkill/veol/veof

#

in canonical mode i believe you're supposed to implement the entire line reading logic including arrow keys and vkill/vwerase/verase

prime mulch
#

nope

#

type cat in a shell with no arguments, thatll give you a pure cooked mode input

#

type arrow keys and see what happens

neon crane
#

oh yes wtf

#

so im not supposed to handle arrow keys

prime mulch
#

the shell goes into raw mode and handles the arrow keys itself

neon crane
#

wow

prime mulch
#

implements its own line editing

neon crane
#

i actually didnt think it worked like that

#

so the normal canonical mode line buffering ONLY implements backspace/vwerase/vkill

#

what if i implement it anyway

#

(nah jk)

grand shadow
#

yeah its why libreadline exists meme

grand shadow
#

Wait does mlibc build with debug by default

#

If so I have been running on debug mlibc with O0 this whole time

sage locust
#

uh if you don't pass buildtype release, yes

#

gg lol

grand shadow
#

Maybe thats why some stuff was slow

sage locust
#

i actually wanted to make a PR to change that to debugoptimized by default

#

which is like -O2 -g

#

all of my meson projects (and autotools) default to that

wraith surge
grand shadow
#

No idea havent tested currently getting a riscv64 toolchain to build mlibc

#

Which is where I noticed the O0

grand shadow
sage locust
#

i am doing it rn

grand shadow
#

Oh I meant like on astral's meson recipes

sage locust
#

@grand shadow in your 1528 PR, is it actually related to the PR's aim to use sys_ioctl instead of ioctl, or is it just an optimisation?

sage locust
#

because i thought ioctl() was POSIX?

grand shadow
#

sys/ioctl.h is under the glibc option

sage locust
#

is it supposed to be? that's weird

grand shadow
#

and no, ioctl is not posix

#

they made like io_devctl or something which is posix

sage locust
#

wait what the fuck? ioctl() isn't POSIX? literally unironically unusable

grand shadow
#

posix_devctl

#

yeah it just so happens everyone implements ioctl() but its not standardized

fleet osprey
#

wait what

#

no way ๐Ÿ˜ญ

sage locust
#

what's the diff between mempcpy and memcpy again?

#

is it really just that mempcpy returns the end of the buffer?

#

what a useless function

wraith surge
#

wtf

#

just why

#

posix is strange AF

grand shadow
#
       dest it returns a pointer to the byte following the last written byte.```
fleet osprey
#

who unironically uses the return value of a memcpy anyways

grand shadow
#

mempcpy is a gnu extension

#

so not posix

fleet osprey
young chasm
#

or well it was an extension or whatever (OB XSR)

grand shadow
#

oh true they define what happens on ioctl on STREAMS

#

and anything else is undefined as usual meme

gritty shore
#

and not a lot of people implement STREAMS so galaxybrain

carmine swallow
fleet osprey
#

wtf

#

cursed

carmine swallow
#

well it kinda makes sense like if the variable is in rdi or whatever before then it gets clobbered by the call so then the compiler can just continue using the variable as rax without needing to save it to the stack

night trellis
#

why does astral need debootstrap to build

#

i dont want debian packages on my arch system

sage locust
#

the latest Jinx version fetches debootstrap on its own, and also, what's the issue? the packages are kept locally confined to a directory (usually inside the repo itself)

#

namely .jinx-cache

sage locust
#

no

night trellis
#

ah

sage locust
#

obviously not

#

it doesn't even have root permissions

#

it creates a container, kind of like Docker

night trellis
#

interesting

grand shadow
#

Last time I tried it just would not work

#

But its been a while so that weird bug might be fixed

grand shadow
#

I do wonder hiww much difference building with O2 will do compared with O0 ๐Ÿ’€

#

Insane that I never noticed that

sage locust
sharp carbon
opal lotus
#

posix_devctl can be made a wrapper around it with size = 0

#

i don't get it either

grand shadow
sharp carbon
#

My build.ninja lists every source file as being compiled with -O0 ... -O2 and checking the disassembly the O2 is what's actually being used

grand shadow
#

@sage locust this

grand shadow
#

Maybe I missed it then

sage locust
#

i mean if your CFLAGS have -O2, then that should override the -O0, yeah

grand shadow
#

I also should probably update my gcc I am still on 12.1 meme

#

hope eventually jumping to gcc 15 doesnt expose some evil ub in the kernel that gcc 12 did not catch

fleet osprey
#

bad news: GCC 15 starts building stuff with a newer C standard by default

#

everything breaks

#

(unless you specify -std= manually)

#

might not expose UB specifically, but likely stuff will break

young chasm
grand shadow
#

spooky

#

jumping to gcc 13 instead because thats the earliest one supported by mlibc meme

grand shadow
young chasm
#

internal compiler error on valid code

#

let me look it up

grand shadow
#

insane ๐Ÿ’€

neon crane
#

they removed it sometime between 12.1 and 13.1

grand shadow
#

hmm I know I have a lot of stuff to do but I should try tdoing something very funny

#

trying to compile binutils + gcc + mlibc + whatever other packages I want into a sysroot and see how far it gets

#

currently git cloned mlibc + astral and downloading gcc and binutils tarballk

grand shadow
#

it died while extracting the gcc tarball when syncing a page ๐Ÿฅ€

night trellis
#

Im tempted to port Qt to this

grand shadow
proper meteor
grand shadow
proper meteor
#

oh right

#

Maestro can extract it but slowly

grand shadow
#

It git cloned astral mlibc and downloaded and extracted bintuils and then died when extraccting the gcc tarball

grand shadow
#

I thought I had fixed it but doesnt seem like it

#

Gdb didnt help cuz it optimized it out

night trellis
prime juniper
#

Qt builds fine on mlibc and is portable (assuming Qt6, source: managarm has it)

grand shadow
#

Oh yeah if managarm has it astral can probably run it

viscid flame
prime juniper
#
- mlibc
      - zlib
      - zstd
      - pcre2
      - double-conversion
      - libiconv
      - icu
      - glib
      - libxkbcommon
      - libinput
      - libevdev
      - mtdev
      - mesa
      - freetype
      - fontconfig
      - libpng
      - harfbuzz
      - libx11
      - libjpeg-turbo
      - libsm
      - libice
      - libdrm
      - libxcb
      - xcb-util-image
      - xcb-util-keysyms
      - xcb-util-wm
      - xcb-util-render-util
      - xcb-util-cursor
      - openssl
      - wayland
      - wayland-protocols
      - libxcursor
      - libxinerama
      - libxrender
      - libxi
      - sqlite
      - brotli
      - dbus
      - at-spi2-core
#

and the transitive stuff

#

now the good part, big chunks are optional

#

so

viscid flame
prime juniper
#

dbus can be turned off, the entire X stack and graphics can be removed if not building GUI, same for wayland. sqlite is optional, glib and icu can be turned off, we dep on systemd for udev, but that can be turned off, so libinput, libevdev and mtdev likely have replacements / support replacing it, pcre2 is technically optional too, openssl is optional too

prime juniper
#

and this is only qtbase of course

#

so if you want qml and friends, you need qtdeclarative too

#

(which pulls in some more qt parts but not massive pain)

#

and maybe the deps have changed, this is accurate for Qt 6.8.1

grand shadow
#

dead project xd

#

(yesterday I wrote some more stuff for the profiling stuff)

#

since the mlibc demo pr is now in reviewing and I think I'm done with that until I want to add dynamic loading support

night trellis
#

i wanna make a package manager for astral

#

wait.

#

does astral even have networking

#

lmao

neon crane
night trellis
#

ig ill just make it then

#

the package manager

grand shadow
#

it also has a package manager :p

#

xbps

#

but yeah it does have networking

night trellis
#

/joke

#

can i build packages for it though

grand shadow
night trellis
#

like

#

port shit and then compile it for astral and then package it

grand shadow
#

sure thing

#

prs always welcome :3

night trellis
#

i kinda wanna port pipewire and pulseaudio to astral too

#

but since those rely on ALSA i think i may have to do workarounds

grand shadow
#

theres no working audio driver :P

#

qwinci was working on hda + oss at one point but I think that got lost in branch limbo

grand shadow
#

I've gotten the nmi out of intel pmcs and I just gotta finish the nmi logic (ist + shoving the cpu pointer there)

night trellis
#

ik ALSA's specifically for linux

#

ill port alsa and then miniaudio

#

then pipewire

#

and wyaland

#

im just obsessed with astral ig :3

grand shadow
#

I mean if u can make it work sure

night trellis
#

can i fork astral though because those 3 are gonna be tedious to port

#

might aswell test it on my own astral fork and then see if its cool to release to the main astral pkgs

grand shadow
#

yeah

#

Upstream the recipes if you do and I sort out the packaging stuff

dense valve
#

I think you should list all the required tools to build Astral in the README, such as building Astral requiring the host to have fakechroot and debootstrap. Not necessarily needed, but I think it's nice to have

grand shadow
#

Yeah, I should put a link to the jinx dependencies of the commit I use at one point

dense valve
#

๐Ÿ‘

carmine swallow
#

or well idk about miniaudio but alsa isn't bad, libpulse should require no porting and pipewire only light patching

marsh sparrow
grand shadow
#

@marsh sparrow on the managarm profiler, is there a reason other than simplicity as to why you chose to only trace the rip and not a full stack trace?

marsh sparrow
#

only simplicity. Taking a full stack trace would also be nice

grand shadow
#

Ahh I might just do a full trace then