#uACPI - a portable and easy-to-integrate ACPI implementation

1 messages · Page 59 of 1

fiery turtle
#

ah right nvm

flat badge
#

EAGAIN means that a (usually non-blocking) operation failed to make progress

hallow marten
#

I think it was pretty tricky in managarm to do it right?

fiery turtle
#

wdym?

dusky glade
flat badge
dusky glade
#

and u said

flat badge
#

yeah

dusky glade
#

^

fiery turtle
#

u need syscall cancellation so u can canel e.g. huge writes

#

but its optional

#

u dont have to implement that

dusky glade
#

okay

#

thats good then

fiery turtle
#

or if u have a blocking read that hangs

dusky glade
#

makes things SLIGHTLY easier ™️

flat badge
#

It's not really optional

fiery turtle
#

for a production os

dusky glade
fiery turtle
#

no

dusky glade
#

oh

flat badge
#

you can get pretty far w/o EINTR support as Managarm demonstrates but it's pretty much needed for process management to work properly

fiery turtle
#

like u cant cancel blocking reads otherwise for example

#

wait managarm doesnt have EINTR?

dusky glade
fiery turtle
#

i mean what do u do if bash is doing a poll syscall

#

without user input

#

and u want to kill it

#

u cant because its in a syscall

dusky glade
#

fuck

#

well guess nyaux needs interruptable syscalls

fiery turtle
#

id say its not high on the priority list

#

at least get basic signals working

dusky glade
fiery turtle
#

well if u dont have signals wtf are u going to use to interrupt them

dusky glade
#

idk timer interrupt?

fiery turtle
#

timer interrupts dont cancel syscalls lol

#

a signal is a software concept

dusky glade
#

right

gentle peak
hallow marten
#

bruh no way

#

im compiling linux atm

gentle peak
#

output is sent to serial on this image, kernel is x86_64 defconfig 2c4a1f3fe03edab80db66688360685031802160a

fiery turtle
#

wait why do u need this lol

gentle peak
#

they asked for it idk

hallow marten
#

idk I'm gonna play with it

#

see if I was right

fiery turtle
#

you're gonna make a jit for uacpi-linux?

gentle peak
#

also note that uacpi-linux doesn't work on efi systems because it finds rsdp by searching low memory

hallow marten
#

maybe eventually I'll try jitting it just to optimize the qemu stuff but now I'm just going to try mimalloc

fiery turtle
#

ah

flat badge
gentle peak
#

idea: AOT compile the qemu blob

fiery turtle
#

to see pure perf gain u could AOT the simple math test i have

#

that would give u the perfect world speed up

#

where it doesnt do hw io

hallow marten
#

pretty good

flat badge
#

JITing AML sounds pretty stupid tbh

fiery turtle
#

bragging rights

flat badge
#

i doubt that you'll get a huge speedup

fiery turtle
#

very important imo

flat badge
#

on real AML

#

unless you ignore the compilation time

gentle peak
#

i just make it so sched_perform_wait returns EINTR when the wait is interrupted (unless it's a non-interruptible wait ofc) and that error is propagated to the syscall boundary

fiery turtle
#

true

flat badge
#

which sounds like cheating

fiery turtle
#

well there are methods u call all the time at runtime

#

e.g. battery stats

#

if u aot those u save tons of cycles in the long run

hallow marten
flat badge
#

that's true

#

because the compilation is not for free and 95% of the AML only runs once

fiery turtle
#

for a produciton env i'd probably have a uacpi_eval_compile or something

#

thats used for methods called frequently

#

and it would recursively compile everything called by the method

#

including EC queries etc

#

like for example for monkuous' old laptop that does calls to a GPE AML handler with an absolutely gigantic while loop it could save tons of cycles and power

dusky glade
#

aml firmware devs after writing the most shit aml known to man

calm latch
#

It wasn't very difficult with my kernel

fiery turtle
#

@gentle peak did u get ACPICA working?

gentle peak
#

i just did like 30s ago yeah

fiery turtle
#

ah

gentle peak
#

where do i add the timing stuff?

fiery turtle
#

what was the issue?

gentle peak
#

i was unfortunately looking at those places

dusky glade
#

to get sized frees

gentle peak
#

specifically i was missing AcpiInitializeTables

fiery turtle
#

ah

gentle peak
#

just to confirm this is the right init sequence right ```c
ACPI_STATUS status = AcpiInitializeSubsystem();
if (ACPI_FAILURE(status)) {
fprintf(stderr, "devicesd: failed to initialize subsystem: %s\n", AcpiFormatException(status));
exit(EXIT_FAILURE);
}

status = AcpiInitializeTables(NULL, 16, FALSE);
if (ACPI_FAILURE(status)) {
    fprintf(stderr, "devicesd: failed to initialize tables: %s\n", AcpiFormatException(status));
    exit(EXIT_FAILURE);
}

status = AcpiLoadTables();
if (ACPI_FAILURE(status)) {
    fprintf(stderr, "devicesd: failed to load tables: %s\n", AcpiFormatException(status));
    exit(EXIT_FAILURE);
}

pci_init_acpi_tables();

status = AcpiEnableSubsystem(ACPI_FULL_INITIALIZATION);
if (ACPI_FAILURE(status)) {
    fprintf(stderr, "devicesd: failed to enable subsystem: %s\n", AcpiFormatException(status));
    exit(EXIT_FAILURE);
}

status = AcpiInitializeObjects(ACPI_FULL_INITIALIZATION);
if (ACPI_FAILURE(status)) {
    fprintf(stderr, "devicesd: failed to initialize objects: %s\n", AcpiFormatException(status));
    exit(EXIT_FAILURE);
}```
fiery turtle
#

i think so?

#

so basically

#

I think AcpiLoadTables is the uacpi benchmark

#

yeah

#

slap a timer around the call to that

gentle peak
#

right so i should probably move pci_init_acpi_tables() to above that lol

fiery turtle
#

yeah

#

I think AcpiInitializeTables is like early table access

#

maybe

gentle peak
#

AcpiLoadTables took 0.000832993 seconds

#

now i have to modify uacpi to output with that much precision ig

fiery turtle
#

can u just output nanosconds?

gentle peak
#

if you mentally block the decimal point that is nanoseconds

fiery turtle
#

btw

#

technically this is not entirely fair

#

u want to put the start here

left orbit
#

what the

fiery turtle
#

and the end at the very bottom of the function

gentle peak
#

ah ok

fiery turtle
#

lets give acpica a completely fair treatment trl

gentle peak
#

alright with that it seems to be 683,482 nanoseconds

fiery turtle
# gentle peak ah ok

in uacpi i did this previously uacpi_info("elapsed nanoseconds %" UACPI_PRIu64 " (%"UACPI_PRIu64" ms)\n", UACPI_FMT64(end_ts - begin_ts), UACPI_FMT64(elapsed_ms(begin_ts, end_ts)));

gentle peak
#

uacpi is consistently around 217,999 nanoseconds

hallow marten
#

yeah nvm my experiments its too annoying to setup for now

fiery turtle
hallow marten
#

I was just gonna try it if it wouldnt take a while

gentle peak
fiery turtle
#

ah yeah

gentle peak
#

luckily unless some catastrophic bug has been introduced in the past week or so this image should already be real hw capable

fiery turtle
#

how do u print uacpi's score btw?

gentle peak
#
diff --git a/source/uacpi.c b/source/uacpi.c
index c6c569f..db05e4f 100644
--- a/source/uacpi.c
+++ b/source/uacpi.c
@@ -492,10 +492,10 @@ uacpi_status uacpi_namespace_load(void)
 
         uacpi_info(
             "successfully loaded %u AML blob%s, %"UACPI_PRIu64" ops in "
-            "%"UACPI_PRIu64"ms (avg %"UACPI_PRIu64"/s)\n",
+            "%"UACPI_PRIu64"ms (avg %"UACPI_PRIu64"/s) %lu nanoseconds\n",
             st.load_counter, st.load_counter > 1 ? "s" : "",
             UACPI_FMT64(ops), UACPI_FMT64(elapsed_ms(begin_ts, end_ts)),
-            UACPI_FMT64(ops_per_sec)
+            UACPI_FMT64(ops_per_sec), end_ts - begin_ts
         );
     }
 
fiery turtle
#

ah

#

are u gonna test on your toshiba

gentle peak
#

yea

#

don't feel like rebooting my main pc

fiery turtle
#

it has some insane handcrafted aml so should be a good test

#

i wonder if its gonna be an even bigger difference because acpica has to do a two pass thing

#

and real hw has more things to two pass over

gentle peak
#

i should really look into setting up pxe this is painful

fiery turtle
#

btw make sure u have slack mode enabled in acpica

#

or real hw might not work

#

and this is -O3 -flto right?

gentle peak
#

yeah

fiery turtle
#

ok nice

gentle peak
fiery turtle
#

it would fail loudly dw

#

if slack mode is off it acts more like spec and less like nt

gentle peak
#

alr just checking, never know with acpica

fiery turtle
#

linux has slack mode on by default i think

gentle peak
#

with acpica i do get ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - \_SB_.PCI0.EHC1.HUB0.RMH0.PRT6 (20250404/dspkginit-497)

#

this is expected, i also get it in linux

#

however it does make the benchmark unfair because it now includes printing to fb

fiery turtle
#

if lvl == err: return?

gentle peak
#

what

fiery turtle
#

like if it logs an error

#

just dont log it

gentle peak
#

ah good point

#

oh wait acpica doesn't pass log level to osl

fiery turtle
#

ah fuck

#

strcmp time

#

this error is because it resolves packages that have no reason to be resolved

#

because of its two pass thing

gentle peak
#

well it politely printed the location of the message for me so here we go again

fiery turtle
#

lol

gentle peak
#

acpica: ```
10,902,209 nanoseconds
10,899,233 nanoseconds
10,910,798 nanoseconds

uacpi: ```
6,227,036 nanoseconds
6,240,330 nanoseconds
6,239,922 nanoseconds
fiery turtle
#

oh well

#

still not too bad

#

almost 2x

gentle peak
#

yeah

fiery turtle
#

main pc test? trl

#

how many ops btw

gentle peak
#

i'm also curious how the performance differs outside init when everything is already mapped and caches are hot and such but i feel like that's much harder to benchmark

fiery turtle
#

yeah

gentle peak
#

even though it's what matters more

gentle peak
fiery turtle
#

nice

gentle peak
#

main pc (Gigabyte B550M S2H, Ryzen 5800X, 64G RAM, 10097 ops)
acpica: ```
3,936,953 nanoseconds
3,951,551 nanoseconds
3,950,898 nanoseconds

uacpi: ```
1,903,459 nanoseconds
1,906,726 nanoseconds
1,902,077 nanoseconds
fiery turtle
#

nice

#

so looks like it's consistently at least 2x

gentle peak
#

Toshiba was 4962 ops

fiery turtle
#

pretty smol

gentle peak
#

What matters is the runtime performance but that's harder to test

fiery turtle
#

yeah its kinda hard to test that

#

so Im adding it to the readme

#

@gentle peak can u give the actual model for this toshiba laptop?

gentle peak
#

Toshiba Portege R30-A, Intel Core i5-4200M, 4GB RAM

fiery turtle
#

nice

#

thanks

gentle peak
#

oh and uhh firmware versions

fiery turtle
#

right..

#

technically this should be included

gentle peak
#

toshiba is 4.40
main pc is F19d

fiery turtle
#

nice

gentle peak
#

also unrelated but recursive paging has a surprisingly significant positive impact on uacpi score

#

went from 7.5-8.0M to 8.0-8.5M

#

all i did was replace the manual page table walking in the page fault handler with recursive paging

fiery turtle
#

interesting

#

this is my current draft

gentle peak
#

lgtm apart from this leftover text

fiery turtle
#

yeah fixing this atm

gentle peak
#

also when you update os scores the description for proxima should probably be changed to mention it runs uacpi in userspace now

fiery turtle
#

yup will do

gentle peak
#

idk what term to use since it's not truly monolithic (drivers in userspace), not truly a microkernel (vfs and such in kernel), and hybrid means nothing

fiery turtle
#

lol true

#

doesnt matter that much

#

you should probably come up with a new description tho

gentle peak
#

i feel like making up my own new terminology is kinda counterproductive

#

if anything i'd call it a hybrid kernel but that term already exists and it's mostly marketing

vast kestrel
#

Tbh I would still call it microkernel probably

fiery turtle
#

@vast kestrel thoughts on the perf comparison docs?

vast kestrel
#

Will look at it once I get off the train

fiery turtle
#

nice

#

@gentle peak btw are you going to upstream ACPICA support as well?

#

could be nice to keep for the future

gentle peak
#

nah i already wiped it from my local tree

fiery turtle
#

damn lmfao

gentle peak
#

i don't think i'm gonna bother supporting multiple acpi implementations in the same source tree

fiery turtle
#

abstracting it might be a bit annoying

gentle peak
#

acpi is already gonna have to be abstracted because devicesd is a separate process from actual drivers but yeah adding another abstraction layer within devicesd itself is a bit excessive imo

fiery turtle
#

ah

gentle peak
#

at most i might make an acpica-based protocol-compatible devicesd reimplementation but even that's probably not gonna happen (simply not worth the effort)

fiery turtle
hallow marten
#

well ideally it would link with libc and stuff

#

and I didnt want to bother setting this all up for something I'll need in like a month or two

fiery turtle
#

isnt libc linked in by default

#

or am i missing something

gentle peak
hallow marten
#

yea I guess

#

ok sec

#

imma try again

#

also mounting is annoying but that I can work with

fiery turtle
#

couldnt u just do the shared drive thing

hallow marten
#

well I get 3710293/s

#

with a fresh build I just did

#

now imma try with mimalloc

fiery turtle
#

which cpu?

hallow marten
#

5 5600x

fiery turtle
#

ah

#

is this wsl or native kvm

hallow marten
#

native

#

wait this isnt q35

#

817666/s 💔

fiery turtle
#

yeah that has so few aml ops its basically a measurement error

#

how 💀

#

monkuous gets like 5x that with the same image

hallow marten
#

probs debug build?

#

idk

#

like

fiery turtle
#

ah yeah

hallow marten
#

thats rebuilt uacpi

#

locally

fiery turtle
#

if u didnt do -O3 -flto

#

etc

gentle peak
#

the image i sent used CMAKE_BUILD_TYPE=Release CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON

fiery turtle
#

btw what is this

lto-wrapper: warning: using serial compilation of 3 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
lto-wrapper: warning: using serial compilation of 11 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
#

how do i shut it up

hallow marten
#

wait

#

can I mount images

#

then write to them

#

and without unmounting them

#

I can run qemu

gentle peak
#

i don't think that's safe

hallow marten
#

cuz idk if what I'm doing is actually working

gentle peak
#

but you can always use vvfat

fiery turtle
#

like just vvfat yeah

#

just give it a directory

#

and it works automagically

hallow marten
#

ah good I get 4958701/s now

fiery turtle
#

i just added -flto directly to make and cmake

#

wait

#

apparently there's -flto=auto

fiery turtle
hallow marten
#

the release build

fiery turtle
#

ah

#

@gentle peak what shall I use for the description now

gentle peak
#

uhhh

#

Unix-like microkernel-based operating system with uACPI running in userspace

#

ig

fiery turtle
#

sure

#

sounds suspciously similar to pmos trl

gentle peak
#

with the intention of (Unix-like microkernel)-based operating system not (Unix-like) (microkernel-based) operating system

fiery turtle
#

#1217009725711847465 message do I use this score?

#

or was that the mtuned one idr

gentle peak
#

yea nothing relevant changed since then

#

uh

#

one sec

#

yeah thats mtuned

fiery turtle
#

yeah it is

#

this is the non mtuned one

gentle peak
#

this one is the clean #1217009725711847465 message

fiery turtle
#

yep

#

10.4M damn

#

if anyone else has images to update the score send them here

#

im going to update the leaderboard today

#

and thats gonna be it for a while

#

i also have imaginarum scores and ilobilix

#

but nothing else

#

also nyaux i think

gentle peak
#

theres a few issues open about scores isnt there

#

or prs?

fiery turtle
#

yeah those ill add as well

#

casually submitting a 200k score

fiery turtle
gentle peak
#

pretty sure you can

#

never tried but still

fiery turtle
#

interesting

hallow marten
#

huh mimalloc isnt that fast apparently

#

or rather

#

it doesnt matter much for uacpi

fiery turtle
#

what score did u get?

hallow marten
#

around 5mil

fiery turtle
#

well uacpi kinda is very much malloc bound so idk

#

maybe monkuous malloc is also fast

hallow marten
#

maybe mimalloc would be better in a multithreaded context

fiery turtle
#

yep

hallow marten
#

and JIT would probably slow it down like korona said

gentle peak
#

I believe the malloc used in uacpi-linux is a variant of the proxima allocator, which is very fast for small objects but not super scalable and speed drops off quite a bit for every power of two you pass until you reach the page size

hallow marten
#

mimalloc seems to have a slight perf improvement but not that much

flat badge
#

mimalloc should be quite good as a general purpose allocator but it's of course not fine tuned to this workload

hallow marten
#

yeah

flat badge
#

iirc it's size classes are not only powers of two, so it will consume less memory than just using powers of 2

hallow marten
#

idk what else I could really experiment with without adding a JIT and rewriting most of the uacpi interpreter meme

fiery turtle
#

btw @mortal yoke give this a try in qacpi

#

or if u give me the binary i could try myself

#

(or instructions on how to get one)

fiery turtle
hallow marten
#

just for the benchmark

fiery turtle
#

compiling the DSDT would probably be slower than just running it directly lol

hallow marten
#

for uacpi-linux I could cheat and just compile it once

fiery turtle
#

because its so small

hallow marten
#

and since the test is run like 10 times

#

itd work

fiery turtle
#

yeah

hallow marten
#

but that's cheating

fiery turtle
#

like it would be interesting to see just the raw speedup as if compilation was free

#

because technically it would only be used for methods that u run a lot

hallow marten
#

there must be another way to improve speeds of interpreters right

fiery turtle
#

true

#

but orders of magintude gains are only possible if u jit unfortunately

#

like if u optimize uacpi's interpreter for like a year u could maybe squeeze out like a 1.2-1.5 gain

#

but much higher than that i kinda doubt

flat badge
#

aml evaluation perf is not that important anyway

fiery turtle
#

only during interrupt storms trl

hallow marten
#

it is

kindred beacon
#

catering to shit hardware is definitely a good idea troll

hallow marten
#

of the utmost improtance

fiery turtle
#

imagine optimizing any part of the os besides aml eval speed

hallow marten
#

yes

kindred beacon
#

uACPI doesn't create .pc files, right?

#

I'll prob just add that to the meson.build so managarm can stop symlinking stuff into subprojects

dense steppe
#

one alternative might be to write an "ACPICA compatibility layer" AKA what you would need anyways for Linux people to be happy. then you get this basically for free.

#

oh, I should've read further down before I wrote that.

#

but yeah...

fiery turtle
#

Yeah I figure out a way to make a fair test, I forgot aml had a way to get ticks

vast kestrel
#

I think for a long time in acpica timer returned an incrementing number (and not ticks)

#

Or well, at least Linux did it, idk if acpica did

fiery turtle
#

Lol

#

Why

#

well in userspace

frank canopy
#

btw @fiery turtle, does uacpi_initialize do anything other than tables?

fiery turtle
#

yes

#

i mean just open it

#

they finally attached a dump

frank canopy
#

also continuing to be sad about the for_each methods just because that pattern doesnt mesh well with language interop so i still effectively need to use the ones that allocate an array for resources

fiery turtle
#

wdym?

frank canopy
#

zig's got a couple of language features that are straight up not compatible with c calling conventions (most notable error returns, which involve two-register returns and an extra ghost parameter)

#

so if i need to pass a callback im locked out of error returns, and error return tracing

fiery turtle
#

I mean cant u just iterate the array manually?

frank canopy
#

yeah no it works

#

just means cant benefit from any possible memory savings from using for_each methods

#

if there are any

fiery turtle
#

U mean for_each_device thing?

#

The one where u don't need the array

frank canopy
#

for_each_resource is the main one that actually matters here, and idk how memory compares either way

fiery turtle
#

That one is just a simple wrapper, it still allocates internally, so no memory losses there

frank canopy
#

ah ok cool

#

then no issues

fiery turtle
#

And for each just iterates an existing array so it doesn't really need to allocate

#

One previously acquired from get current resources etc

frank canopy
#

👍

fiery turtle
#

Btw couldn't u propagate the error via a struct pointed to by the user pointer?

frank canopy
#

yes but you still lose the error return trace

#

i looked into it before

#

the advent of the function to get the next device rendered the callbacks entirely unneeded

#

just saw the comment added here about using for_each_device_resource and thought id ask if there were actual memory savings or if its just a convenience thing

fiery turtle
#

yeah no just convenience

fiery turtle
#

can u send over the binary

#

so i can test on my cpu

#

or wel

#

how do i build it

mortal yoke
#

the repo has your test runner py that should build the runner (though the default timeout of 2s is not sufficient for this)

fiery turtle
#

ill build it myself, ill also tune for my cpu

mortal yoke
fiery turtle
#

aml debug: 10,000,000 additions took 6486 ms

#

slightly behind uacpi

#

i get 4.7

#

acpcia gets 16.7

mortal yoke
#

nice

fiery turtle
#

Yeah well done

fierce kiln
#

no aml syntax highlighting... discord L

kindred beacon
hollow elm
woeful rock
frank canopy
#

nice

woeful rock
#

I think this test case is just a happy path in my parser. I store locals in a preallocated array so the tight loop doesn't trigger much memory allocation.

hallow marten
#

Is that your own interpreter?

#

Nice

fiery turtle
#

Nice

fiery turtle
#

Also is it public?

woeful rock
#

There are several annoying situations where I need to "promote" values from locals onto the heap. That would be one of them, though I'm not sure if I actually handle it or not. May just error out. I'll test it sometime 🙂

fiery turtle
#

ah ok

#

i can test on my cpu if u want, should be faster

#

how do u process aml in general?

#

and how complete is it

fiery turtle
#

the current imaginarium score is bigger than that, do u want me to update to this?

#

i've updated the leaderboard pls take a look

#

going to merge very very soon

#

ilobilix is now top 2 lol

surreal current
#

i pronounce uacpi as wack pee

fiery turtle
surreal current
#

but its not wack pee at all i consider it more along the lines of cool shit

fiery turtle
#

well thanks

north hull
#

oof I should've updated

fiery turtle
#

alright

fiery turtle
#

1000 commits passed

torpid root
#

yooo

#

nice

fiery turtle
fiery turtle
#

why the hell is this only under ifdef x86_32

#

like is this not an issue on 64 bit somehow

fiery turtle
#

bruh its impossible to compile linux with O0

median crest
#

Ub jumpscare

fiery turtle
#

it's not even that, the code is uncompilable

#

u get random errors and warnings

dense steppe
fiery turtle
dense steppe
#
switch(sizeof foo) {
case 1: asm("movb ...");
case 2: asm("movw ...");
case 4: asm("movl ...");
case 8: asm("movq ...");
};
fiery turtle
#

Hm

dense steppe
#

Because Linux.

fiery turtle
#

Yeah there's even more shit not asm related

frank canopy
slim panther
#

that's crazy

dense steppe
#

there is if constexpr

#

why is there no switch constexpr?

slim panther
#

can't you just put the switch in a constexpr function?

frank canopy
dense steppe
frank canopy
#

see this shit is why i like zig comptime lol

slim panther
#

or any decent language for that matter

frank canopy
#

yeah

#

zig comptime is just the one i know thatd handle this case

fiery turtle
frank canopy
#

lol

#

i also just realised that ive not been using ReleaseFast optimization for the number getting

#

so ill blame that and not actually check it so i can keep using ReleaseSafe for debugging

fiery turtle
#

Ye

left orbit
#

ReleaseSafe is not actually that much slower

#

but the few extra debug checks probably still make a tiny difference

frank canopy
#

yeah thats why im not actually checking the speed differene here and just blaming it without evidence 😉

#

also why i use releasesafe and not debug because dear lord debug is so slow

median crest
fiery turtle
#
Even though the kernel never
generates memory accesses in that region, since the page tables mark
them incorrectly as being WB, our (AMD) processor ends up causing a MCE
while doing some memory bookkeeping/optimizations around that area.
#

huh?

#

how do u even pinpoint it to that if you just get a random MCE

dense steppe
#

test with WB page tables: generates MCE
test without them: doesn't generate MCE

fiery turtle
#

yeah but how like i wonder how they arrived at that initially

dense steppe
#

by thinking really hard about it

median crest
#

It came to them in a dream

dense steppe
frank canopy
#

same

fiery turtle
#

Ah yes

#

As you're falling asleep you're like hey maybe I should look into direct map generation

trim frost
#

@fiery turtle can you test this?

qemu-system-x86_64 \
    -M q35 \
    -cpu host \
    -display none \
    -debugcon stdio \
    -bios OVMF_x86_64.fd \
    -enable-kvm \
            -cdrom chronos-x86_64.iso
            -smp 4 -m 2G | grep 'avg'
#

I wanna see how it does on your cpu

tired temple
#

Why uploading ovmf? Think it would make it faster? It's the same 💩

slim panther
#

duh

frank canopy
#

i really need to get ovmf figured out tbh

#

and set up

trim frost
#

without the ovmf its slower

tired temple
# trim frost without the ovmf its slower

😁 I mean, these fw files come with the qemu distribution on the testing machine. Which, given, it's completed several such tests, does have it. You don't need to upload your copy. On arm eg they managed to make 64MB. only if you want to distribute a vm with your OS "installed" and if your installation involves storing fw variables (BootX), then you should provide your fw. For the purpose of this testing, it doesn't seem necessary.

slim panther
#

wtf

trim frost
slim panther
#

@trim frost are you still using talc?

trim frost
slim panther
#

ah

trim frost
#

did you switch?

slim panther
#

i'm using my own freelist impl now

trim frost
#

how fast is it

slim panther
trim frost
slim panther
#

depends

#

i wanna see what infy gets

trim frost
#

i wanna write my own allocator but im too lazy

slim panther
#
qemu-system-x86_64 -serial stdio -m 2G -drive if=pflash,unit=0,format=raw,file=ovmf-code-x86_64.fd,readonly=on -cpu host -accel kvm -machine q35 -cdrom menix.iso | grep 'avg'
#

@fiery turtle

flat badge
#

In C++ you could do it properly™️

fiery turtle
slim panther
#

neat

urban galleon
hollow scaffold
trim frost
hollow scaffold
#

AMD Ryzen 5 2600

fiery turtle
#

im so confused

#

how does this make sure the range of pages all belong to the same bottom most table

#

it just does ptep++ unconditionally and it somehow works??

dense steppe
#
 * Context: The caller holds the page table lock.  The pages all belong
 * to the same folio.  The PTEs are all in the same PMD.
hollow elm
#

comment above says ```

  • Context: The caller holds the page table lock. The pages all belong
  • to the same folio. The PTEs are all in the same PMD.
fiery turtle
#

PMD is the next level table

dense steppe
#

yeah

fiery turtle
#

it holds 512 pte_t tables

dense steppe
#

and the PTEs are contiguous within the PMD

fiery turtle
#

nah u misunderstood it

#

pte_t is also a table

#

of 512 entries

dense steppe
#

ah, Linux terminology being weird

fiery turtle
#

either the comment meant in the same PTE

dense steppe
#

yeah

fiery turtle
dense steppe
#

so my guess is that by "in the same PMD" they mean "in the same PMD entry"

fiery turtle
#

perhaps yeah

#

but looking at callsites i dont see anyone checking anything

hollow elm
#

actually isn't ptep the pointer to an array of ptes you want to write?

dense steppe
#

yes

#

precisely

hollow elm
#

and pte is the actual pte to write to

#

then what's the issue?

fiery turtle
#

pte_t is the first pfn u want to set

#

ptep is the first entry in the page table

dense steppe
fiery turtle
#

hmm maybe

fiery turtle
hollow elm
fiery turtle
#

pte is just an integer value to write

#

ptep is a pointer to continuous entries

#

but no one makes sure there's enough continuous entries

#

the pages could potentially belong to different PMD entries

#

maybe the idea is one folio is guaranteed to be contiguous in page tables

fiery turtle
#

yeah so basically i think folios can only be multi-page if they're from a huge page allocation

#

and huge page allocations have a different logic for pmd/pud

dusky glade
dire owl
#

compile time evaluation

dense steppe
dusky glade
#

crazy

fiery turtle
#

I have a really cursed idea for ultra, im gonna use Kconfig, but ill have cmake call something to parse the output .config and then use that output to make a series of set() calls

#

so basically cmake-compatible Kconfig

#

Kconfig because its simple and has tons of frontends

hallow marten
#

meson supports kconfig

#

switch to meson!

fiery turtle
#

too late now, sunk cost fallacy

#

ive invested too much time into cmake

kindred beacon
fiery turtle
#

but thats pretty cool yeah

kindred beacon
#

meson being based as always

fiery turtle
#

ikr

#

if id known that id probably use that from the get go

hallow marten
fiery turtle
#

cool

#

shouldn't be that hard to parse from cmake or a helper script but yeah

#

my main concern with meson is like

#

if i ever run into a missing feature i literally cant work around it

kindred beacon
fiery turtle
#

because theres no such thing as user functions etc

kindred beacon
#

you can do shit like custom targets et al

fiery turtle
#

yeah ig

kindred beacon
#

I do that for shader stuff for nvidia-open

fiery turtle
#

so u can call into a custom script still right

kindred beacon
#

I basically need to run them through a script, and two objcopy steps

fiery turtle
#

i see

#

btw any progress on nvidia stuff

kindred beacon
fiery turtle
#

almost thought that was mesa code

kindred beacon
#

nah I wrote that meme

fiery turtle
#

nice

kindred beacon
#

unless you do some specific GPGPU compute stuff

fiery turtle
#

is managarm missing stubs basically?

kindred beacon
#

I haven't ported the syncobj or dmabuf stuff to managarm yet

fiery turtle
#

ah

#

after thats done we can see a 3d accelerated cube?

kindred beacon
#

yeah that's the first thing I'll do

#

I'm testing with vkcube anyways

fiery turtle
#

letsgoo

slim panther
#

do not

fiery turtle
#

why

#

lol

kindred beacon
#

dmabuf should be fairly easy, wiring up the DRM ioctls for nvidia drivers will be fucking annoying tho

fiery turtle
#

true

slim panther
#

like overrides, defaults, etc

fiery turtle
#

yeah i can kinda see taht

#

since its annoying as is

slim panther
#

just use meson ™️

fiery turtle
#

no

#

just use the python build system

slim panther
fiery turtle
#

meson is more like scratch

frank canopy
#

just use zig build smh

calm latch
#

cargo

fiery turtle
#

hell nah

slim panther
#

i'm tempted to switch to meson with rust

#

because cargo is straight up ass

#

but crate management is mediocre

fiery turtle
#

just dont use crates

#

and go full nih

slim panther
#

real

calm latch
#

you need crates for nih

slim panther
calm latch
#

I forgot that I'm using Rust in userspace

frank canopy
#

i can never go back to anything else after using zig build and im a known cmake enjoyer lol

fiery turtle
#

tbh u kinda do enjoy cmake if u figure it out

#

but its a learning curve

frank canopy
#

yeah

#

cmake is pretty good

#

zig build is just too good to now use for me anymore

#

even has config header support tho idk if kconfig is one of the options

slim panther
fiery turtle
#

imo build systems that are literally turing complete and easy to abuse tend to become messy

slim panther
#

exactly

fiery turtle
#

like cmake is turing complete but

#

its hard to do meaningful stuff

slim panther
#

but stuff like cargo is just horribly unusable

calm latch
#

I need to fix the build system mess in pmOS

frank canopy
#

tbh zig cc is a bigger deal to me than the zig build even though i really like zig build

fiery turtle
#

what is that

fiery turtle
slim panther
#

duh

#

no this is the old C version

frank canopy
fiery turtle
#

ah lol

slim panther
#

what's the point of zigbuild in a c project

kindred beacon
frank canopy
kindred beacon
#

cc @lilac knoll

fiery turtle
#

cool project

slim panther
#

in a build system?

#

why would i care about that

dire owl
slim panther
#

meson and cmake can do that

frank canopy
#

yes they can

#

not as easily in my experience

#

but they can

slim panther
#

how easy are we talking

#

because in meson you can literally just use the env stuff as a variable

frank canopy
#

change one line or a cmdline arg

kindred beacon
#

I mean I can just point it to my cross file and I'm done?

frank canopy
#

zig build -Dtarget=whatever

slim panther
#

sounds like a gigantic skill issue

kindred beacon
#

and cross files can handle more stuff that's necessary for cross-compile like exe_wrapper

slim panther
#

meson is so easy to cross compile that they even print the env info during setup

#

it's almost as if it was made to do this

frank canopy
#

shrug

#

ive found zig build's cross-compilation support to be better than anything else ive tried but also meson didnt exist last time i used something else so the only comparison was cmake or full autoconf bs

#

or at least meson wasnt a thing anyone talked about or i ever saw anyone mention existing at the time

kindred beacon
dire owl
#

lmfao

slim panther
#

💀

#

meson > cmake > autoconf

kindred beacon
#

meson > cmake >>>>>>>>>>>>>>>> autoconf

fiery turtle
#

autoconf ill never understand lol

#

its gibberish

frank canopy
#

autoconf is awful yeah lol

#

at least we can all def agree there

slim panther
#

@lofty dragon when meson

#

would be funny for 10.x

fiery turtle
#

u mean based and not funny

frank canopy
#

maybe one of these days ill finally look into meson but meh

#

used cmake from 2012-2015ish and then didnt touch native code until like last year

slim panther
#

that's like saying you'll never buy a ryzen because amd made bulldozer once

frank canopy
#

around when silk.net started using zig build for its native libs, because being able to do zig build -Dtarget=whatever with ten different target triples and have the defaults be sane enough for everything to just work

slim panther
#

horrors

#

i'm having flashbacks

frank canopy
#

to which major version?

#

2.x is meh but has problems and 3.0 is wip to address a lot of the problems rn

slim panther
#

whatever was around for net 6

#

i think 2.x

frank canopy
#

yeah 2.x works but def has issues

lofty dragon
fiery turtle
#

Wait wdym go for C

slim panther
#

from what i can tell, everything you do now is possible to be done in meson

slim panther
fiery turtle
#

What would you change

#

Ultra proto support trl

slim panther
#

tech debt moment

lofty dragon
#

nothing really, i just want to remove technical debt, the protocol wouldn't change

frank canopy
#

id vote zig for that because zig is nice for osdev but its probably too niche for a big project like limine

fiery turtle
#

Which language did you want personally

lofty dragon
#

you're welcome to help out btw

#

if you want

#

may be a cool project to work on together from scratch

#

i could use your expertise

left orbit
#

collab i did not expect but i totally wanted

fiery turtle
#

We'll see but I'm kinda tired of getting side tracked, I just wanna focus on my kernel

slim panther
#

can we get ext* back

lofty dragon
#

no

#

i mean depends

slim panther
#

like

fiery turtle
slim panther
#

you can make abstractions to make it much easier to impl and maintain

lofty dragon
#

not only is it leading in the poll

#

but also

#

tooling is best for C and C++

#

and i hate C++

fiery turtle
#

True

#

And rust would mean giant binary and giant stacks

slim panther
#

"giant stacks"

lofty dragon
#

yeah that's true as well

calm latch
#

Ada also uses gcc trl

fiery turtle
#

Ada would be funny

lofty dragon
#

Ada only has GCC support

slim panther
#

ada is hard to maintain imo

#

lots of boilerplate

lofty dragon
#

i'd also like to use a language that has first class support from more than 1 compiler only

#

which C and C++ fulfill

#

but again, i hate C++

slim panther
#

yea that really narrows it down to c

fiery turtle
#

That's basically only those

lofty dragon
#

well there is D

fiery turtle
#

That would be fitting given you're sponsored by the creator

calm latch
#

The runtime seems insane

lofty dragon
#

betterC needs no runtime

calm latch
#

no goto trl

lofty dragon
calm latch
fiery turtle
#

Ah right

hollow elm
#

why even rewrite limine?

calm latch
#

ignore that

lofty dragon
#

D is an actual language

fiery turtle
#

If I were to write it from scratch id give zig a try tbh

calm latch
#

also 1 compiler

fiery turtle
#

Just to learn it idk

slim panther
#

someone explain to me the point of zig

fiery turtle
lofty dragon
#

Zig only has 1 compiler and the same tooling issues

left orbit
#

only sane person in here

#

zig trooling is AWESOME

lofty dragon
#

unless there is a Zig C backend?

slim panther
left orbit
#

yes there is a C backend but idk how user friendly it is

calm latch
#

it has defer

#

what else do you need

slim panther
#

no clue what that does

lofty dragon
#

i honestly couldn't care less about defer

fiery turtle
lofty dragon
#

goto is king

slim panther
#

hm

fiery turtle
lofty dragon
left orbit
#

i would love to make a zig bootloader

fiery turtle
#

And is it definitely happening

left orbit
#

but not enough experience myself

lofty dragon
fiery turtle
#

Just do it LETSFUCKINGGOOOOOO

lofty dragon
#

it may take 1 month, 1 year, 3 years or anything in between

left orbit
#

i replicated limine's decompressor yesterday using tinf

fiery turtle
#

Are you still working on vinix?

lofty dragon
#

no

fiery turtle
#

Damn

lofty dragon
#

well i'd be working on Vinix but i don't get paid (on time, or reliably)

left orbit
slim panther
fiery turtle
left orbit
#

but as i said, not enough experience

#
  • writing real mode code makes me miserable
slim panther
#

vro

fiery turtle
left orbit
#

if god exists why did he give us bios

lofty dragon
#

also i don't find kernel dev all that fun i'll be completely honest

left orbit
fiery turtle
#

Damn

left orbit
#

🙏

lofty dragon
#

i have been having way more fun playing with csmwrap than a lot of other things i've done lately

fiery turtle
calm latch
#

real mode is not that bad?

left orbit
#

i know

#

just annoying

fiery turtle
#

Ye

left orbit
#

and i would rather do nothing

#

than write real mode code

#

i just dont like it

#

like maybe at some point ill just force myself and do it

#

but until then it's the blocker, even if its easy

lofty dragon
#

i just go by phases

left orbit
#

but in the end i should end up with zimine trl

lofty dragon
#

that's a bad name

left orbit
#

i know

left orbit
#

i codenamed it zloader

lofty dragon
#

deezig nutzig

left orbit
#

qloader reference???

slim panther
#

zloader3

#

write it in reverse instruction set

lofty dragon
#

with all due respect

#

i did NOT need to see this

slim panther
#

i had to see it

#

you have to see it too

lofty dragon
#

i hate summer

left orbit
#

whjat he fuck is that

dire owl
#

I wish summer was edible

slim panther
#

bro it's a language for os dev

left orbit
#

PRN Loading kernel... >>
VAR kernel_loaded = 1

slim panther
#

worse move semantics than c++

#

that's crazy

lofty dragon
#

lmao

frank canopy
#

someday ill work on a zig bootloader tbh

#

been feeling that itch for a while

#

but limine exists and i havent felt the desire to figure out real mode stuff

left orbit
#

sadly zig can't generate good 16 bit code so you have to actually write the boot sector in assembly

#

it would be fun to actually build the boot sector from a .zig file

dire owl
#

16-bit assembly isn't that bad

#

I love writing it 😋

left orbit
#

ok local dos enjoyer

frank canopy
#

lol

dire owl
#

actually

#

have you considered writing the bootloader in Forth

frank canopy
#

i wouldnt write the boot sector in 16-bit c either tbh, iirc most c compilers arent great at 16-bit stuff

left orbit
#

have you?

dire owl
#

I mean, I do plan on writing a bootloader

#

with a small Forth

#

and then writing most of the stuff in Forth

#

such as protocol and file system support

slim panther
#

there's like 2 instructions iirc

lofty dragon
#

i like the part in that thread where that person is using an LLM as plain as it can possibly be seen, and you guys kept essentially arguing with the LLM, which kept spouting nonsense like LLMs do

#

like

#

idk if you guys were just fucking around knowingly

slim panther
#

i reacted with chatgpt

lofty dragon
#

yeah but like

slim panther
#

i was just trying to get him to admit he's bullshitting

lofty dragon
#

after MANY LLM messages

left orbit
slim panther
#

ah

left orbit
#

bootloader needs to do more stuff

#

not that much

slim panther
#

idk how bios boot works

dire owl
left orbit
#

ap trampoline just jumps to 32-bit code, enables some cpu features and jumps to kernel lol

dire owl
#

or I'm completely braindead

lofty dragon
#

you could see that he types like ass, broken grammar, no capitalisation, different wording, and then the LLM messages were the opposite of that

lofty dragon
#

it was way more than 2 messages

dire owl
#

three

lofty dragon
#

more

dire owl
#

three messages

frank canopy
#

there is one big downside to doing zig bootloader stuff, and thats that theres some bugs with uefi support that might be llvm issues actually we arent sure but you cant get stack traces on efi in zig

lofty dragon
#

do you want me to actually count them, because i can count them

left orbit
#

fastcall isn't actually fastcall

#

on windows it's supposed to pass 2 regs in ecx, edx but it does all on stack

frank canopy
slim panther
left orbit
slim panther
#

🔥

frank canopy
left orbit
#

vectorcall changes how float args are passed

dire owl
#

I count 7 now

left orbit
#

parameters aren't marked with inreg

dire owl
#

three in rapid succession

frank canopy
left orbit
#

yeah

#

and the fix is very simple

#

ion the CallingConv enum

#

just change x86_fastcall to use X86Regcall type

#

or something like that

#

i dont remember the actual type name

frank canopy
#

mhm

lofty dragon
#

@dire owl #1383345907143282708 message
#1383345907143282708 message
#1383345907143282708 message
#1383345907143282708 message
#1383345907143282708 message
#1383345907143282708 message
#1383345907143282708 message

#

7

dire owl
slim panther
#

some of those are even just copied from the website he made

lofty dragon
# dire owl .

yeah sorry that i was actually counting them myself as you asked me to

dire owl
#

yeah

#

maybe I'm actually stupid

lofty dragon
#

and like

#

i have started catching up to LLM-speak way more lately

#

i used to not be able to, or not think about it

#

now it sticks out like a sore thumb

#

most of the time

#

must be because i have actually tried to use LLMs

#

to do stuff

#

and failed most of the time

dire owl
slim panther
#

i'm happy i do work that's so mentally fucked that no ai can understand it

dire owl
#

I sometimes notice when grading homework

#

which is annoying

slim panther
#

just 0 points

#

ez

dire owl
#

I still need to read through all that LLM-generated bullshit

#

yeah

#

0 points if there's a smoking gun

#

like it being a screenshot from ChatGPT where the input text bar is still visible

lofty dragon
#

most of the time i asked info about shit i am working on to LLMs they just lie to me and invent stuff, so much so that i just don't bother asking anymore about anything but the most trivial shit that it copy pastes from some random stack overflow reply

#

for those i only ask because Google sucks now

#

they are a better search engine, but only for the simplest of things that have been asked a million times

#

idk why or how korona, with all his smarts, can say that LLMs are useful for any actual programming

dire owl
left orbit
#

it may be useful if you absolutely do not rely on it and use it purely as an intern throwing ideas at you

dire owl
#

and that he doesn't need as many bachelor students now thanks to ChatGPT

left orbit
#

but beyond that its useless

#

harmful even

slim panther
#

chatgpt is a virtual intern

dire owl
#

yeah

#

basically

slim panther
#

also, never let an llm make a meaningful decision

dire owl
slim panther
#

tbh google did something weird with their search engine because it fucking sucks now

#

it's so much harder to find answers to complicated questions

#

you only find really simple questions that are missing many keywords from the original source

#

i'm finding myself putting some keywords in quotes more often than before

#

just so they don't get naenaed

hallow marten
#

Google has significantly gotten worse and providing less quality content and reddit is kind of a filter since upvotes and stuff

lofty dragon
#

google was unironically better 15 years ago than it is now

#

not even close

surreal current
#

most of the "story" subreddits (r/relationships, r/amitheasshole, r/amioverreacting, etc) are completely overrun with ai-generated posts and nobody seems able to tell

#

and like half of the informative comments on any post on any subreddit with 500+ upvotes near the top of the comment section, are just chatgpt output

#

i dont even know what the motivation for this is

#

dead giveaway is an emdash

#

most likely ai-generated

hallow marten
#

also if OP actually responds lol

surreal current
#

i suspect a lot of these are actually real stories and people are just so lazy they summarized it to chatgpt and asked it to make it a well-written, fleshed out reddit post (or they fed their post to chatgpt and asked it to make it nicer or something and it added a bunch of emdashes and other chatgpt-isms in the process)

#

which they copypasted

hallow marten
#

yea that could be true too

calm latch
fiery turtle
#

Linux be like:

static pgprot_t protection_map[16] __ro_after_init = {
    [VM_NONE]                    = PAGE_NONE,
    [VM_READ]                    = PAGE_READONLY,
    [VM_WRITE]                   = PAGE_COPY,
#

VM_WRITE, looks inside: readonly page

dusky glade
#

why tf does linux do that

hallow marten
#

Copy on write

fiery turtle
#

well in this case its not for copy on write

#

it's for lazy allocation

#

the pf handler marks it as pte_mkwrite on a write fault

#

or just maps a shared zero page if its a read fault

fiery turtle
#

and the writable flag is set in the fault handler only

hallow marten
fiery turtle
#

who knows

calm latch
#

how does linux do physical to virtual translations?

fiery turtle
#

page + page_offset

surreal current
#

and not just cause degradation due to the extra COW fault when you inevitably write to that zero page

#

iirc for a long time the COW fault would actually copy the page of zeroes into the new page????? rather than just noticing it's the special zero page and memseting which is faster

#

and this didn't change until shockingly recently