#uACPI - a portable and easy-to-integrate ACPI implementation
1 messages ยท Page 32 of 1
Defer in Go just calls a function
still better than nothing (and arguably better than defer)
if you want fancy features like this in C, imo it might be best to switch to C++
yeah there isn't much point in using c
c++ is supported basically everywhere where c is
afaik Linux nowadays has some weird "scope guards" implemented using __attribute__((cleanup))--although I'm not sure how widely used they are
It's not fancy, error hanging sucks in C
You've got to use different atrocities all the time
Linux uses GNU features a lot
In the sense that it can be compiled with few compilers, and you as compiler dev would add missing function for Linux
hey can someone pass the github for this project?
i do not want to scroll on 30000 mesages
nice!
yeah im starting to look at AML and i dont want to parse it
uACPI had one skill issue vs ACPICA as I realized from @ marvin's AML blob
If there was an undefined AML reference in an IfOp or WhileOp the entire table load would get aborted
whereas ACPICA knows how to skip them cleanly
uACPI could only skip methods/devices etc
[uACPI][WARN] unable to lookup named object 'DTFS' within (or above) scope '\': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object 'DTFS' within (or above) scope '\': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object 'DTFS' within (or above) scope '\': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object 'DTFS' within (or above) scope '\': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object 'DTFS' within (or above) scope '\': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object 'DTFS' within (or above) scope '\': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object '\_SB_.PC02.GBES': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object '\_SB_.PC02.HDAS.VDID': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object '\_SB_.PC02.I2C1': not found
[uACPI][WARN] Op 0x0010 ('ScopeOp'): skipping due to previous errors
[uACPI][WARN] unable to lookup named object '\_SB_.PC02.I2C5': not found
[uACPI][WARN] Op 0x0010 ('ScopeOp'): skipping due to previous errors
Well not anymore 
so an undefined reference evals to false?
Previous output:
[uACPI][ERROR] unable to lookup named object 'DTFS' within (or above) scope '\': not found
[uACPI][ERROR] aborting table load due to previous error: AML referenced an undefined object
[uACPI][ERROR] #0 in \()
neither, the entire if block is skipped
technically false yes
honestly feels kinda like lua
this is more of a workaround for braindead firmware devs
that dont test their own code
Cc @mortal yoke 
new test coming soon
that same thing would happen in qacpi if it's at the top level
get to work 
they literally had one under a CondRefOf check, but the other SSDT decided to not do that
I guess I could just make the unwind function unwind individual frames if at the top level though that might create some interesting errors later on
i had to make it sort of hackish as well
basically it unwinds only pending ops but not the top one (which is the If/While)
which are skipped if the OPERAND ends up being NULL
boo
?
๐ป
dies of scaredness
infy was right
amd did favor menix
on my 265kf i now only get 3.2mil
on my 7700X i got 3.9
time to optimise :^)
it should print the speed once you load the namespace
how I should start qemu
with -q35 and kvm args ?
yes
-M q35 -enable-kvm
ok
is it allowed to just toss absurd amounts of memory to the VM? like qemu-system-x86_64 -m 48G?
qemu will return allocate error
not if you have 64GiB of RAM
yes
yes, but why would you want to do that
if you have 64G yes
idk, just bump allocate literally everything maybe
although it'd probably perform worse tbh, because of cache behavior
is that allowed? 
yeah no, I think it has to be like an actually usable one
that's not very usable in the long term
it goes against the spirit of the competition
My score was with everything enabled
like mutexes, proper memory allocation and so on
and userspace since it's where uACPI ran
I don't even have any options to disable any of that :p
ryzen 5 3600
bruh i can't read
we should really do something where the competition benchmarks are performed on a "standardised" set of machines; you send a .iso to some people who are responsible for running the benchmark, and they run it. that way, everyone's code runs on the same machines
just ask someone with a fast CPU 
but yeah i think it's kinda slow...
can you send the iso?
yes

how much ram you give
to qemu
a
wait
why you paused
yeah that's what I were thinking about (it gets stuck when it tries to printf in some exception handler when locking a lock inside printf), Ill try with a higher amount
I testing with 1GB
I did qemu-system-x86_64 -enable-kvm -cpu host -M q35 -m 4G -no-reboot -drive file=/usr/share/edk2/x64/OVMF.4m.fd,if=pflash,index=0,read-only=on -debugcon stdio -nic none -cdrom output.iso on a 7950X3D and I get 1702 ops in 2ms (avg 834686/s)
A bump allocator actually performs quite terribly on this benchmark, because with a good allocator most are reused instantly and thus are still in cache
what exactly average speed checking
idk. that's what uACPI prints when I boot your ISO
is it just me, or does that have like ~20 less ops
probably because of -nic none
^
just sneakily memset(dsdt, 0, sizeof(dsdt)) before running the benchmark
Interpreter speed, aml ops per second
I'm not going to integrate uACPI into my kernel until I actually have userspace and drivers that would be able to make use of it.
yeah
I probably should do that
currently I have this: https://github.com/dbstream/davix/blob/master/acpi/tables.c
btw i think you could add some guards to turn the compilation of everything off and only leave table things in uACPI instead of making it a separate project (?)
I was never going to make a separate project
I get like 100k with this for some reason
what is your CPU?
I was going to introduce a bare bones mode
oh, i must have misunderstood it
i5 13600k, its certainly not the cpu because with eg. astral I get 2M
like #define UACPI_BARE_BONES and it doesn't compile any namespace management or AML interpreter?
Yup
well tbh, if that existed, I would probably still just stub out unimplemented APIs like ```c
uacpi_status_t
uacpi_os_do_something (...)
{
return UACPI_NOT_IMPLEMENTED;
}
Yeah that's why its not a priority
Its not exactly hard to stub out everything
And just use early table access
stop it I am getting ACPICA flashbacks
Lol
btw how's 1.0 going?

but the interest is also in it being very small
(although I guess lto takes care of that)
Yeah its especially nice for separating out built-in kernel driver vs modules
Or microkernel etc
i don't think you'd even need lto to make it small, just -fdata-sections -ffunction-sections combined with -Wl,--gc-sections should take care of that
Yep
I've had cases where I have some function that calls into another function that I have no implementation for, which would generate a linker error, were it not for the fact that that function is optimized out because it is never called.
I'm gonna test the latest uacpi commit (I don't want to debug stack corruption rn)
uACPI is gonna use semver right?
Yes
so is it gonna be 1.0 or 1.0.0?
The latter
I like semver
I tested both master and address-spaces-support
the latter worked
master also worked
@thorny orbit your get uacpi_get_ns_since_boot is broken, why do you read the raw hpet counter at 0xF0 and subtract whatever the current unix time in seconds was at the time of boot from that?
that doesn't make any sense
๐ฆ
boot time request giving time in seconds ???
just read the spec, its like the actual time date stamp in unix seconds and not how long the boot takes or anything
then do I need to convert cmos to unix subtract and convert result to nanoseconds ???
you don't need to use the boot time request at all for this
you need to figure out the hpet frequency by reading from the capabilities register and then use that to convert the hpet counter value you read to nanoseconds
Im gonna need some extensive testing before merging that as thats basically the 1.0 pr
And I have some changes that are local atm that are also semi dangerous
i fixed this
shit
nyaux is faster
why it so slow ๐ญ
for nyaux it was because allocator bug
yeah im gonna add a warning like "your clock source might be unstable"
i have some troubles with hpet
it slow

but ok
a
is uacpi_kernel_get_nanoseconds_since_boot also used for average speed ?
how else do u think it can get elapsed time
do i need to implement uacpi_kernel_install_interrupt_handler to handle power button event
yes..
more pain
current managarm score:
uacpi-info: successfully loaded 1 AML blob, 1747 ops in 0ms (avg 4644312/s)
which cpu?
14700K
2nd place
kms
right...
udrm got into your head

It's quite nice that Managarm's score got 25% faster just by uacpi improvements ๐ Good job optimizing uacpi
actually more like 40% faster
thanks
yea this
anyway I am fastest
If (PATH.THAT.DOES.NOT.EXIS.T) {
Debug = "???"
} Else {
Debug = "OK"
}
uACPI now skips the else block as well after an error like this
[uACPI][WARN] unable to lookup named object '\PATH.THAT.DOES.NOT_.EXIS.T___': not found
[uACPI][WARN] Op 0x00A0 ('IfOp'): skipping due to previous errors
[uACPI][WARN] Op 0x00A1 ('ElseOp'): skipping due to previous errors
[uACPI][INFO] successfully loaded 1 AML blob, 3 ops in 0ms (avg 10733/s)
ACPICA output:
Firmware Error (ACPI): Could not resolve symbol [\PATH.THAT.DOES.NOT.EXIS.T], AE_NOT_FOUND (20200925/psargs-395)
ACPI: Ignoring error and continuing table load
ACPI Error: Skipping While/If block (20200925/psloop-461)
ACPI Error: Skipping Else block (20200925/psloop-464)
question of the century
does NT skip stray ElseOp blocks without a previous If
have to disable secure boot to find out
you could rev acpi.sys
Ill bet it would as that's one of the simple ways to implement if
yet another acpica incompat? ๐คฏ
it aborts table load ๐คฏ
I did it like that in qacpi, basically for if when the condition is true it just falls through to the body and then if it encounters an elseop anywhere it just skips the body of it (and if the condition of the if was false it checks if there is an elseop following the if body and if there is it jumps to the else body)

i guess ill do that too then
it probably doesn't matter tbh
unless someone is using it for some kind of weird nt detection
i could see it break in various ways
Else {
// Do bogus crap
}
if bios patches the blob poorly
u could run bogus aml
that nt would never touch
yeah but if you just skip the body
just precompile the tables into your own bytecode which doesn't suck as hard 
Else {
}
// Do bogus crap

i like this more
i guess ill just skip the body if its stray
its easy to implement at least, though if you already create a new frame for the if body in uacpi then you could also just abort if you want to match the nt behaviour
yea
its not something ive ever encountered but who knows how braindead firmware aml patching code might be
im sure its great
lol
great at breaking shit at least lul
I'd suggest to add both nt and acpica compat modes for cases where they fundamentally disagree
NT support is not ubiquitous outside of consumer products
depends on if you consider enterprise hardware consumer or not i guess
maybe this compat could be like a quirk, so you pass acpi_compat=nt for NT compat and acpi_compat=acpica for ACPICA compat. this would be reflected as some sort of uacpi_set_compatibility_mode (UACPI_COMPAT_{NT,ACPICA})
yeah
although having options for compatibility with both NT and ACPICA would make maintenance harder
- more stuff to test
- more behaviors to implement
but for example, AWS graviton (by far the most widely deployed ARM server) uses ACPI but doesn't support windows
etc
i suspect those kinds of things are less likely to have broken acpi
I wouldn't count on that
AWS bare metal only supported bios boot until like 6months ago 
you cant BUY a graviton, right?
on x86
any problem with that? 
IMO it is better to aim for good consumer firmware support, and hope that enterprise firmware eventually gets its stuff together, than to attempt to tailor to both
I think uACPI will end up better that way
IMO a switch "nt compat / acpica compat" makes a lot of sense
yeah
Enterprise firmware is still going to be made by the "big 4" in bios dev anyway though
amazon didnt go with an inhouse solution for what is being brought up here either
and yall test on linux, right?
where compat != bug compat. if the behavior is considered to be a bug in e.g. acpica, there's no need to support it
well then hope that eventually, the "big 4" are practically required to test for uACPI
a man can dream
we test on the distros that pay us
sure, but amazon certainly never tested these machines with NT
considering that they cannot boot NT
I don't think you're correct on that
there are some cases that make ACPICA compat very expensive/inpractical to support
e.g. they allow buffer resizing via StoreOp
which means uacpi must have a mutex per object now
yeah
not necessarily, it could use hashed locks
or a global buffer access lock lul
and have the mutexes outside of the objects
hashed locks?
to not pessimize the NT mode
you have 32 global locks
ah lmfao
and you choose which one by doing global_locks[object addr % 32]
or whatever
its free inline
maybe at some point, if there's some firmware that breaks with NT compat
and still saves you from a lot of contention
object addr % 32 would probably not be very good, as object addr is likely to be aligned
but the idea is good
propose uACPI into linux kernel and then you wont need any compat mode other than what uACPI supports 
considering we already have uacpi linux 
linux ppl would 100% complain if it's not acpica compatible 
yeah ofc lmao
so far they have complained about the opposite
I think very few developers understand ACPI
like, I understand some parts of ACPI
but not the entire thing
That's because it's written by liars and implemented by idiots

I'm doing something like this for my VFS. Each object (a "vnode") is hashed based on its parent and name. Each hash bucket has a lock and a linked list.
we do
?
:p
there's https://github.com/UltraOS/uacpi-linux I think
oh god
lmfao
make it happen
in 2029 NT will switch to uacpi
no the monopoly is when nt switches 4head
We'll be using uACPI at CLT this year
but i wont be able to show the cool things like suspend
CLT?
its just going tobe powering the display laptops
ah cool
The reason im trying to speed run this before march
In all seriousness, I think it would be useful to (once uacpi-linux atleast somewhat proves its usability) propose the idea of uACPI in upstream to the linux-acpi mailing list. Even if nothing becomes of it, it is a first step.
there's a problem with this
there are thousands of call sites directly using acpica
its not abstracted away like NT
so u cant do it gradually
so step 1 abstract it away?
NT supermacy
maybe that can be a first step
you can
abstract away the old interfaces
if someone wants to do that work im totally down to help out where I can 
that probably won't be accepted unless you demonstrate added value
ACPI on linux has been proven to be completely broken
now its not broken
value
๐
lol
well first you need uACPI
"sorry suspend isnt something linux needs"
so... to unbreak it, you need uACPI. to get uACPI, you need abstraction. for abstraction, you need value. for value, you need to unbreak it
if we're being more serious, acpica is slower and dies on every possible aml edge case, while also being subject to a lot of race conditions uacpi protects against
that's true
These are the same people that basically told us to eff off when we asked them to stopped declaring themselves as the latest windows versions
so we will see
i think iretq measured uacpi time to load the namespace vs acpica (on linux) and it was like 5x difference
acpica was like 600k ops/s and uacpi was about 3M
that was older uacpi too (i think)
15M is the WR by monkuous
that's fast
with AVX2 in kernel
I can't beat it
that was stubbed mutexes + avx2 + o3 + lto
there was some other stuff too but i don't remember
that's the most important of it though
let me compile reactos with avx2
monkuous' mutexes take 8ns to acquire tho
actually i don't think i even can
and the allocator about 200ns per allocation avg
about 150ns now on the version on github
and iirc the one in that benchmark had a slightly less capable but faster allocator that could do 100ns
at least you can use sse/sse2 unlike some other kernels no?
doesn't windows save xmm0-xmm5 inside irqs and such?
just don't tell them 
avx512 kernel when? 
depends on what's going on
also that's a win10 22 trick
Anyway it could be RFC'ed into Linux with demonstrable value (at least in like a week with 1.0), but its just way way too much work atm for me to go through, so maybe if someone with a lot of free time comes along 
it would be pretty cool to participate in this effort
but time is a finite resource
its mostly tedious manual work
an abstraction layer is more work tho
which idk where to begin
I'm getting done with my exams in 3 days 
(though I have very little idea of how Linux works inside)
so idk
what does it depend on
though this isn't exactly related to uacpi lol
I don't know the details but the guy who was implementing these things in reactos went on quite a rant
id hvae to go hunt for the long rant
tbh u dont even need to, u just do code drivers/acpi/* and go through every acpi_* call and convert to the uacpi counterpart (a lot of apis are very very similar so it should be relatively easy)
but anyway thats more of a thought experiment for now
implementing the uacpiโkernel interfaces would probably be very easy on Linux
thats already done so yeah
its just stuff copypasted from acpica
but yeah they definitely won't accept a direct replacement, it would have to be configurable, at which point u need a unified abstraction
fwiw this is graviton OS support: https://github.com/aws/aws-graviton-getting-started/blob/main/os.md
so it's certainly not tested with NT
Helping developers to use AWS Graviton2, Graviton3, and Graviton4 processors which power the 6th, 7th, and 8th generation of Amazon EC2 instances (C6g[d], M6g[d], R6g[d], T4g, X2gd, C6gn, I4g, Im4g...
which is probably also multiple years of work
would maybe be interesting to make managarm work + to test uacpi on it
true
and the story is probably similar on enterprise x86 servers
x86 server blobs i have do test for windows, at least via osi
for example on a random dell power edge that i just looked up, the OS support is:
VMware ESXi NFI (License Not Included)
SUSE Linux Enterprise, Non Factory Install, Requires License Selection
Ubuntu Server Non Factory Install, x64,Reqs Subscription Selection
Red Hat Enterprise Linux 9.4 Factory Install,x64,Requires Subscription Selection
ill get quite a few more for you
that would be cool
nice, would be curious to see how it behaves
ยฏ_(ใ)_/ยฏ
btw ACPICA on linux by default has the "slack" mode enabled
which basically violates both the spec and nt compatibility in many ways
Like it automatically pre-zeroes locals etc
whereas NT just aborts on uninitialized local use
and the spec obviously says they're uninitialized by default
ObjectType for predefined scopes is broken on ACPICA as well, whereas NT is spec compliant
the list is infinite
they dont give a shit basically
btw if anyone with a cpu faster than a 5800x wants to test, here's the latest proxima with all the (disqualifying) tricks that the WR ISO had
it's incompatible with smp mostly due to me not bothering to copy the xsave init asm to the smp entry point
on my cpu it gets ~12M
can u paste the command line also?
qemu-system-x86_64 -accel kvm -cpu host,migratable=off -M q35,smm=off -cdrom proxima.iso
may have to test it a few times because sometimes the host schedules it weirdly and the performance gets multiplied by 0.3
and for reference here's the latest normal build of proxima (aka the codebase that's going to be on git somewhat soon, built normally for x86-64-v0) which gets 7.2-7.6M on my cpu
same command line
7.6 on a non cheating build is insane
yep
it has some local changes but none in the code paths that the benchmark touches so theoretically this should be the exact same as the latest build on github actions
yea it definitely differs on a model-by-model basis
windows servers are not exactly uncommon either
it's just that in contrast to consumer devices, not every enterprise device supports windows
actually i wonder how acpi behaves on linux-based consumer devices
do chrome books for example even have acpi?
they do
did you ever test on them?
did it work?
yeah ofc, it's fairly carefully written aml too
it's only 3k lines of ASL
modern laptop x86 is like 300k loc sometimes
it says COREBOOT as OEM ID so I assume it's some open source stuff customized
tbh I'd assume a lot of them are likely some generic amls just modified for the specific machine too
perhaps
there's definitely a lot of dead code
do arm chrome books use acpi?
[uACPI][INFO] successfully loaded 2 AML blobs, 1431 ops in 8ms (avg 172183/s)
chromebook AML is smaller than base QEMU
that's how they get that sweet fast boot
that is very fast
but it's slower than the record, I think
the pci stuff indicates that you're not using -M q35
also performance seems to improve with less memory
so don't bother passing -m <whatever>
ok now it is more reasonable
though surprisingly slow, if the record is 15M
now I get avg 7011238/s
what cpu do you have?
Ryzen 9 7950X3D
my QEMU command line was this: qemu-system-x86_64 -M q35 -enable-kvm -cpu host,migratable=off -drive file=/usr/share/edk2/x64/OVMF.4m.fd,if=pflash,index=0,read-only=on -debugcon stdio -m 112M -cdrom proxima.iso
what's your qemu command line?
try just using this one
no idea what the issue there is but the performance is abnormally slow
also is that just the first result or did you run it multiple times? sometimes the vm gets scheduled weirdly and performance suffers because of it
it still hovers around 7M with some reruns
yeah i have no idea what the issue is here
this is the result i get with this command line
maybe my QEMU binary is different
ฮป qemu-system-x86_64 -version
QEMU emulator version 9.2.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
i'm on 9.1.2
so unless there's been some performance regression (highly unlikely), that's not the cause
might take a while to check
are you on WSL?
no
weird then
ฮป uname -a
Linux beast 6.12.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 02 Jan 2025 22:52:26 +0000 x86_64 GNU/Linux
oh yeah, slow internet sucks
๐
I have 250Mb internet, (mainly because my brother wouldn't stop screaming that his xbox was lagging
), but I can only really make use of 100Mb of it, because the cable that connects my computer with the router is actually bad and breaks down.
i wonder how much better/worse this would be with debugcon logging instead of fb
but like actually wth is this shit
I shouldn't really complain, 100Mb is great compared to some other internet speeds that people may have
but to be limited by the network cable, that's just sad
my internet speed is limited to 29Mb due to my ISP
meanwhile I have like
1gb/s
but I dont have a cable going through my wall
so
I'm using wifi
:p
at like 200mbps
gigabyte per second
yes
want to switch isps?
i mean, there isnt a real chromebook for it to do stuff with so

that's called a scam
not much I can do about it
its all open source afaik
It's in the works
overthrow the ISP
DOWN WITH THE ISP1!!
just do some l33t h4xx0r1ng to get yourself better internet
isorrowproductions
also turns out compiling gcc is quite slow on my laptop
It takes more than a half an hour on my pc
he means REDACTED
hack the isp to get yourself better internet (except don't do that because it is illegal)
Pwnd by 0b3rr0w
and internet stops when I disable remote control thingy
perchance
get a better ISP
there's only 2
do they force using a specific router?
with fredom
both are the same shit
yes
and it doesn't work on other ones?
clone the MAC address (except don't do it because it might be illegal)
get a better router, then make it spoof itself to impersonate
they supply their own and change it out once in a while
the ISP's router
I don't have many routers lying around lol
laughs in Romania's internet speed
afaik one way that accounting is done (how much internet has ilobilo used this month? etc..) is with the MAC address
good idea if it was worth it
except this is bad for many reasons
๐
why would they do that
idk
but I don't think it is that common
it's just a way that it might be done
it is extremely bad because of MAC spoofing
for example, if the only authentication was MAC address and I knew your MAC address, I could very easily pretend to be you, and thus freeload on your internet
I think this might be one reason that ISPs provide modems, so that they can authenticate that whoever is using the internet is a legitimate customer and not someone who is MAC spoofing
It's unlimited
unlimited* (until they decide "no more internet for you this month")
I have used a few hundred gibibytes and that hasn't happened yet
Maybe even a few thousand
how does one use that much
i dont think mac spoofing matters
(tbh idk how much I use)
downloading games
movies, or download dcs multiple times because you're a dumass
funnily enough, i can also run tcpdump on my router
is your router connected directly to an external cable or is there some kind of modem that it goes through?
and you can see some managment traffic for other customers ๐
a modem
because you need one
that's... potentially a privacy and security issue
because the thing on the wire is not ethernet
it's connected to something on the street with a fiber optic
i think its only managment traffic
then, authentication is probably done through that
yeah ofc
and if you dont have your own shit you can use it as a router as well
but its kinda shit anyway
anyway why tf are we discussing networking in this channel?
update finished, on qemu 9.2.0 i still get 12M/s
so it's a me skill issue
because uACPI thread is basically lounge 2 now lol

Is this with the single core or smp safe version of proxima?
bro what
it's with a bunch of unfeasible modifications: stubbed mutexes, stubbed spinlocks, simd in kernel, and initializing uacpi multiple times for better cache hit rates
but it's based on the smp safe version
(the single core version doesn't exist anymore)
the normal (smp-safe) version gets 7.2-7.6M
the context got a bit buried under all the networking talk
Does simd in the kernel actually improve perf for uacpi? I would have guessed that not a lot of acpi ops benefit from simd
it's not a huge impact but it's definitely there
just measured, 7.2-7.6 -> 7.5-8.0
Btw infy, is there some acpi implementation in a VM that is more involved than the qemu one? Asking because by now all (?) OSes in the top list finish init in 0ms 
it's a much less significant impact if i also restrict it to x86-64-v1 (aka SSE2 only): 7.2-7.6 -> 7.4-7.7
virtualbox isn't any more advanced ```
uacpi-info: successfully loaded 2 AML blobs, 2365 ops in 0ms (avg 3077535/s)
Perhaps VMware, but there's also a patch lying around by pitust to display load time in most applicable unit aka us/ns
2 blobs and 2k ops is quite more advanced than qemu tbh
qemu's also at ~2K ops?
1700
wasn't it 19xx?
Yeah but it's also possible that more interesting effects happen for longer aml execution times
1705 for base qemu iirc
the solution is to just have some baseline computer everyone tests boots their os on :^)
Yeah, for that I guess we'd have to have THE osdev computer to test against lol
yeah that'd be annoying
How is davids cpu so slow tho๐
86box doesn't have anything 64-bit iirc?
didn't think of that yeah
it goes up to P3 iirc
and they just don't think it makes sense to do anything more modern than that
You can add tons of pcie root ports and stuff to qemu
That will add extra aml objects
Same goes for CPUs, hotpluggable ram slots
with -smp 4 proxima gets ~6.3M/s
i wonder if that'd improve if i moved smp init to after acpi init
yes it does
i now have the same performance regardless of cpu count
interesting
(up to nproc/2 that is, because once i go above that one of the uninitialized aps gets scheduled onto the same physical core as the bsp)
APs (or qemu vcpus) that sleep shouldn't really impact perf though
i'm using limine for smp init so uninitialized aps are in a spin loop waiting for a field to be set
they're not really sleeping
i was curious, so uh...
this is the normal proxima image
x86-64-v0, no tricks
less time loss on all the one-time setup
since uacpi will be in L1 cache already for a greater fraction of the running time etc
can't really measure the one-time setup cost on qemu but if i simulate the cache part by initializing uacpi multiple times it only gets up to 8.0M
no idea mate. it's a good CPU, so I'm surprised the 5800X (or was it 5700X?) performs better
5800x yeah
probably tuning or interference (but lots of cores on the 7950X3D, so that is unlikely)
i've done like 0 tuning on this system
maybe the 5800X has better single-thread performance
but probably no
yeah sure 
there's only one performance-related thing that isn't default on my system and that's ram speed (it's set to the rated 3200MHz instead of the default 2133MHz)
let's start a laptop company and make firmware with huge aml blobs
the official OSDEVโข๏ธ laptop
the 7950X3D scores better than the 5800X on Geekbench 6 single-thread by 731 points
Is there a point to like femtobenchmarking uacpi like this
it's fun
Fair
6k ops ๐
This is like close to a lot of real desktops
isn't this like the 10th time at least that either you or someone else has brought this up?
i will look into doing that
just rebooted and checked. it is 5200MHz. I thought that maybe it was misconfigured somehow and that causes the slower-than-expected benchmark results.
Isn't the extra cache only available to half of the cores on the 950x3d chips? You can get wonky performance characteristics depending on which cores you run on.
true
although I haven't noticed any wonky performance characteristics
maybe I should try running it with CPU pinning
(however one would set that up)
Disable some cores in firmware 
I don't know if that's the issue, just something that came to mind
afaik there are two 'core complexes' (abbreviated as CCX iirc), each with 8 physical cores giving 16 threads per CCX, for 32 in total. L3 cache is per CCX, and only one CCX has the extra cache.
Yeah that was my understanding
inb4 accidentally disables the 3D V-cacheโข๏ธ cores
no but in all seriousness, I don't think it matters. like at all.
Fair enough
I think 3D cache cores run on a slower clock though
(next step: hobby OSes casually getting heterogenous multi-core support because of uACPI benchmark
)
wouldn't matter for uacpi benchmark since it's done in qemu and when in a vm it's all transparent to the guest
Didn't Windows have some drama with its scheduler?
wtf... I've never heard of such a thing
why would they do that?
Because Zen 4 cache impedes cooling
So the cores have to run slower
I think it was changed with Zen 5, where they flipped the chips
So you have 8 cores with fast clock and 8 cores with a lot of cache
And they were doing some weirdness, like disabling half the cores in games
Because Windows' scheduler was dumb
I think it was improved in 24h2?
I hardly ever reach top clock speeds anyways, unless I am compiling something :^)
There's no excuse now that both Intel and AMD use it 
But idk Windows might be doing something dumb vs. Linux, and having 2 heterogenous CCDs might be hurting the performance a lot
idk
I have a dual-boot setup (although it's been a while since I last booted windows)
I've never noticed any issues
Like my PC ramps the fans up when I open vscode, even though it's mostly single-threaded, because it boosts one core
uACPI previously had slightly hacky if (ctx->skip_else) in order to detect whether it should skip an arbitrary ElseOpblock.
In order to make IfOp skipping during table loads and stuff more nice (+ skipping stray ElseOp) i microcoded both to no longer depend on global ctx state:
UACPI_OP(
IfOp, 0xA0,
{
UACPI_PARSE_OP_TRACKED_PKGLEN,
UACPI_PARSE_OP_OPERAND,
UACPI_PARSE_OP_IF_NULL, 1, 4,
UACPI_PARSE_OP_EMIT_SKIP_WARN,
UACPI_PARSE_OP_SWITCH_TO_NEXT_IF_EQUALS, 0xA1,
UACPI_PARSE_OP_END,
UACPI_PARSE_OP_IF_FALSE_OBJECT, 1, 3,
UACPI_PARSE_OP_SWITCH_TO_NEXT_IF_EQUALS, 0xA1,
UACPI_PARSE_OP_END,
UACPI_PARSE_OP_INVOKE_HANDLER,
}
)
UACPI_OP(
ElseOp, 0xA1,
{
UACPI_PARSE_OP_TRACKED_PKGLEN,
UACPI_PARSE_OP_IF_SWITCHED_FROM, 0xA0, 0x00, 3,
UACPI_PARSE_OP_SKIP_WITH_WARN_IF_NULL, 1,
UACPI_PARSE_OP_INVOKE_HANDLER,
}
)
instead IfOp now just skips directly to ElseOp if it exists after the If block, and Else on its own skips itself by default unless it was invoked via If
AML microcode???????
its actually a nice way to parse aml, I also stole that idea from uacpi to my aml interpreter
c preprocessor my beloved
res[LoadTableOp] = {7, {
Op::TermArg,
Op::TermArg,
Op::TermArg,
Op::TermArg,
Op::TermArg,
Op::TermArg,
Op::CallHandler
}, OpHandler::LoadTable};
res[BankFieldOp] = {8, {
Op::PkgLength,
Op::NameString,
Op::NameString,
Op::TermArg,
Op::Byte,
Op::StartFieldList,
Op::FieldList,
Op::CallHandler
}, OpHandler::BankField};
yours are kinda more high level i guess, because for uACPI FieldList is implemented in microcode too
yeah I don't really have any kind of control flow or anything
i wonder what's the performance penalty for this microcode
the fields are slightly weird with how I did them, basically the StartFieldList pushes a fieldlist object to the object stack that contains the frame that the fields are within and then the FieldList op parses one field from the frame at a time until the frame is consumed (and sets the op block context's processed flag to false which makes it return keep processing that same FieldList op instead of continuing to verify it and get the next op, though in case of connectfield it actually parses the buffer/object in the middle on a new ctx before returning back to parsing the fields)
5681
damn
uACPI's was smaller before I added esoteric field stuff
rn its at 6000
at least my local copy
to be fair things like this add a lot of lines
reminds me that I should really refactor that ObjectRef to instead default construct as empty, its kinda weird to use if it by allocates by default and then you have to check if it failed (and if you want to construct an empty non-allocated one then you have to use ::empty()) 
its just another huge painful thing to do because it has billions of uses
lol
sometimes I wonder how a fully zig acpi library would be and then I'm like heck no I don't actually want to have to make that to find out
zig has good enough c interop that uacpi is painless enough that it wouldn't be worth
lol
i mean u can give it a try for some tiny aml subset
like math stuff
AML is simple: 0 + 1 is encoded as AddOp 0x00 0x01 
trust
the rest is this ez too
I mean most of it is not that bad
lol
I was actually in the middle of starting one when I found out about uacpi
might revisit at some point
lol
yeah the semantics are something I don't really understand to this day lol
and specifically the nt compatible ones
I just looked at uacpi and twiddled with it enough so it passes the tests
I did understand it entirely while implementing it but I no longer remember anything becaues its very counterintuitive
the actual spec being a partial lie because of nt compat is what disillusioned me from the whole doing it in zig project
yeah acpica violates it quite a lot too
so the truth is somewhere in the subset of both
tbh playing with nt giving it different kinds of cases could help understanding them but idk how exactly do I even pass aml blobs to nt lol
i had to do sooo much of that
- install com0com (virtual com driver)
- install comByTCP
- start comByTCP at COM3
- run
windbg -k com:port=com4,baud=115200 qemu-system-x86_64 -M q35 -hda windows.qcow2 -serial tcp::4445,server,nowait -m 4G -smp 8 -acpitable file="..\..\uACPI\tests\reftest.aml" -accel whpx -L "C:\Program Files\qemu\share"- connect to the debugger with windbg
!amli set traceon dbgbrkon errbrkon spewon;g- wait for Acpi.sys to get to your AML
idk if u can do that on windows
I'm pretty sure you can
thanks, maybe Ill try it with something
i've tried just TCP and online guides suggested running two vms and stuff
i couldnt get anything to work but this
and it was very very painful to do
oof
this requires disabling secure boot
because com0com isnt signed for secure boot
but it works on normal windows tho
my instinct would def be named pipes but something working is better than trying other things
aint broke dont fix and all that
if you could show me how to do it with pipes id give it a try too
im not sure if windbg has a mode like that tho
iirc on windows you have to use a path like \\.\pipe\<name>
yep
QEMU crashes on windows when you conntect windbg via pipes
but I don't know the specifics of how to set it up with qemu
that exact path actually
when you use the qemu support?
or when you pass pipe through to a guest serial
because the latter is whats used here
qemu's chardev in theory does named pipes
this is a very old issue
Official QEMU mirror. Please see http://wiki.qemu.org/Contribute/SubmitAPatch for how to submit changes to QEMU. Pull Requests are ignored. Please only use release tarballs from the QEMU website. -...
why not upstream it?
๐
again is this for the qemu built in debug or for the named pipe serial/chardev?
is there a difference?
this is for pipe serial/chardev
RIP
The issue is how Windbg handles its pipe communication
qemu just explodes
works with putty though
ah that sounds about right then lmao
wouldn't you be able to work around the issue by using -serial stdio and redirecting stdin and stdout to the pipe
damn
that's annoying
yeah that really sucks
The proper solution would be rewriting that file a bit to use OS specific events
I;m lazy though
Ah anyway;
if you grab that hack and recompile qemu itll work fine but I feel like that's a pain and what @fiery turtle does now is far better and more stable
yeah if you can just make something other than qemu handle the serial port then its fine
oh god i went to read the source for combytcp and that was a fuckin mistake
why is this visual basic written like its 3-5 years older than it is
(well ig it probably actually is tbh)
but dear lord
anyway i could probably make a tcp-named pipe adapter in less than an hour to save having to do the com0com bit
might even do that after breakfast, take a refresher from all this osdev with some nice high-level c#
I think I managed to get windbg working on linux with two vm's, though its painfully slow (and prints like 3 asl lines in a second in windbg) ```
host (used to run windbg connected to com1)
qemu-system-x86_64 -m 6G -M q35 -cpu qemu64 -smp 4 -drive file=win10-main.qcow2,media=disk,if=none,id=ide-disk -device piix4-ide,id=ide -device ide-hd,drive=ide-disk,bus=ide.0 -enable-kvm -serial tcp::4445,server,nowait -name WinMain -vga virtio
debuggee (configured with bcdedit /debug on; bcdedit /dbgsettings serial debugport:1 baudrate:115200):
qemu-system-x86_64 -m 6G -M q35 -cpu qemu64 -smp 4 -drive file=win10-debug.qcow2,media=disk,if=none,id=ide-disk -device piix4-ide,id=ide -device ide-hd,drive=ide-disk,bus=ide.0 -enable-kvm -serial tcp:127.0.0.1:4445 -name WinDebug -acpitable file=~/Projects/uACPI/tests/bin/to-integer.aml
nice, its painfully slow for me as well
is it also supposed to have some extra stuff printed? because I don't think a lot of the stuff its printing was within the to integer table that I tried to give it
like pci stuff and whatever
i mean it first loads qemus dsdt
and only then this thing
maybe its even slower for u than it is for me
mine takes maybe a minute to get to my tables
acpi.sys is slow af i guess lol
the dbg might slow it down too
yeah all the printing and decompilation probably does
especially as with two vm's as it has to first go to the host from the first qemu then from there to the second qemu over tcp and from there qemu feeds it to the guest
yeah i mean makes sense
well it took slightly longer than an hour to make a named-pipe/tcp bridge because i kept getting interrupted and im too lazy to test it in general but upsides it might actually work on non-windows ig lmao
we need to make like a guide for both approaches because its very easy to forget, and your option might be better because secure boot can still be on
https://github.com/Khitiara/PipeByTcp/releases/tag/v0.1 well if anyone wants it heres a download and you can read the source yourself (it also prints out usage)
passing --pipe:xyz means giving windbg com:pipe,port=\\.\pipe\xyz
Wtf you actually made one from scratch?
Damn
took around an hour ish
Well done
ive been using c#/dotnet for over half my life i can almost do it in my sleep now lmao
and as i said untested
Need to test if it works ig

the idea is qemu still does tcp and you just use this and a named pipe on windbg instead of com ports and com0com/combytcp
thank goodness for dotnet having "copytoasync" for streams lol, def made this easier
can just tell the tcp socket and named pipe to copy to each other and be set
oh wait fuck im stupid hang on
rn its copying the same direction twice instead of both directions
i dont have a windows virtual machine or windbg set up rn or id try it directly lol
it even handles ctrl-c to exit gracefully (lets ctrl-break through to just have the os kill it though)
(and a second ctrl-c will get passed through to the os to kill it too)
Nice
c# โค๏ธ
its a good language for high-level things
idk if yall know cosmos but thats how i got into osdev even
jankest thing ever though
much prefer doing it all manually now
anyway please do let me know if the PipeByTcp thing works out if any of yall try it, hopefully it does so figuring out how winnt does acpi is a bit easier
Come and help with tomatos then 
ive done low-ish level interop in c# before even recently i have no more interest in using it in osdev lol
FYI: I've made a separate org for uACPI and transferred uACPI and all related repos there: https://github.com/uACPI/uACPI
only chosen ones will remember it was born as an acpi library for the ultra os
great, now prune all references to UltraOS from history and you are done
i dont think there were any 
There are some
really?
F
Maybe we should move that there too
yeah im not sure how long that redirect is going to work for
Also I mean that we could move uacpi-rs to uacpi/
So that that rs version is by definition the only true api wrapper
once
how much is there left 

lol
Types.h mostly done
Most other stuff is done fast, but the types things was annoying sometimes
makes sense
Did a few type safety crimes
Also I will update to your newest commit to see if they break win clang
i'm pretty sure the answer is "undefinitely"
unless you make another repo with the same name as the old one
then it's gone
ah cool
lol
@fiery turtle the acpi memes continue
iASL Warning: There were 155 external control methods found during disassembly, but only 667 were resolved (4294966784 unresolved).
iasl bug i guess
Least retarded uACPI bug
(this is in my WIP PR dw)
yeah, doing it on one line is unspecified because the order of evaluation is not defined
yeah idk what i was thinking
thanks to asan for breaking this order
because it was working without it
ooooor buggy bios -> buggy decomp
nahh
no broken aml should break the disassembler
it's tricky to know when it is and isn't allowed to depend on evaluation order
I tend to only depend on evaluation order in cases like ```c
if (obj && obj->somebool) {
// ...
}
well that eval order is defined i think?
re-read their msg lol
yeah that case is defined
and if your compiler says otherwise, go shopping for a new compiler
true
can i load patched dsdts outside of the initrd
i kinda don't want to have to regenerate my initrd on every update
No idea
like, on linux? unlikely, given that the kernel's view of the ACPI tables is populated prior to any userspace execution.
so you don't have filesystems yet
Why did you comment it out instead of replacing lmao
Lol
anyway gtg make me NIC driver support receiving packets
Yeah no
I'm sure it'll be fine 
if I end up not being able to understand anything, I will use lwIP
Full TCP impl is like 10k loc probably
Does it require much to port?
I don't believe it's too hard to port
lwIP mirror from http://git.savannah.gnu.org/cgit/lwip.git - lwip-tcpip/lwip
Yeah idk which parts here are lwip
neither do I
|| and && do, | and & don't
yeah, I've done a fair bit of C and C++
but in some cases,
it is better to be safe than to be sorry
@fiery turtle btw remember to update the copyright date to 2025 before 1.0
in LICENSE
np
well looks like i might actually be able to test the PipeByTcp thing myself at some point given i need to install windbg to figure out this dang bugcheck my laptop keeps doing lmao
probably gonna be too lazy still though
A simple but compliant tcp implementation is not that big
It becomes more messy if you want to support difficult congestion control algorithms and all the TCP options etc
you only really need one congestion control algorithm
Right, but a generic tcp implementation will probably give you more than one to chose from and hence it'll be larger than a simple implementation
yeah
One thing that's also more complicated than a basic implementation is a proper SACK implementation
how hard is SACK, really
bad for performance
i will have CUBIC in my bootloader.
or maybe not idk
probably will tho
by stealing a rust ip library which does it all already
That's not true, is it?
it is
when you want to read more bytes, you wait for a tcp packet that contains the next frame
and ack it immediatly
if you want to write more bytes, you send the frame every 1ms until you get an ACK back
congestion control is boring anyway 
okay, but that is extremely stupid and relies on retransmission

