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

1 messages · Page 56 of 1

fiery turtle
#

yeah i think that would be cool

gentle peak
#

alright sounds good

fiery turtle
#

thanks

gentle peak
#

it's a tiny pr

fiery turtle
#

lmao

gentle peak
#

oh wait i should change the error message for the pointer size thing

fiery turtle
#

any pr is tiny compared to that one

gentle peak
#

well yeah but this one is tiny compared to normal ones

#

+21 -15

fiery turtle
#

very nice, this fixes a lot of code style issues basically

gentle peak
#

yep

#

with owc c89 as a bonus

fiery turtle
#

yeah, pretty cool

gentle peak
#

decided to make that the subject of the pr anyway since there is one owc-exclusive change (the __386__ one)

fiery turtle
#

fair yeah

#

i should probably ping rdos in this pr lol

gentle peak
#

i'm diffing rdos's fork against upstream and wtf

#

at least change it in fucking config.h

fiery turtle
#

fuck config.h amirit

gentle peak
#

god windows ci is so slow

fiery turtle
#

yeah

fiery turtle
gentle peak
#

alright i rebased test-runner-rewrite on top of watcom-c90

#

and made it compile in c89 mode

fiery turtle
#

nice!

gentle peak
#

one thing that does leave a slightly bad taste in my mouth is that the resource tests will never get executed on owc because they're 64-bit only and owc is 32-bit only

#

like i'm sure it's fine since all the other test cases pass but i don't really like it

fiery turtle
#

hmm true thats kinda unfortunate

#

the only thing gating it is pointer offsets i guess, which is annoying

gentle peak
#

and due to the pointer size being different the native blobs have different sizes in 32 bit mode

fiery turtle
#

true

gentle peak
#

like i commented out the return; to see what would happen and even a bunch of resources without pointer offsets fail due to different sizes

fiery turtle
#

makes sense

gentle peak
#

in any case, this is a delight to see in upstream gh actions

fiery turtle
#

very cool

fiery turtle
#

i like how i can request review from iretq

#

should I do it trl

left orbit
#

wtf

calm latch
#

just some small pull request

fiery turtle
#

hmm

gentle peak
#

Weird that I didn't get those on CI since it's supposed to be on max warning level with warnings as errors

#

They might be getting disabled by the options I added to disable unused parameter warnings

#

I should probably remove those and use uacpi_unused() instead

fiery turtle
#

yeah i guess

gentle peak
#

right, when those ones are fixed you get the same for table_array_calloc, table_array_pop, and table_array_last

#

and i don't think UACPI_MAYBE_UNUSED can be implemented for owc

#

i could mark those inline as well but that's a bit ugly imo since they're in a .c file instead of a .h file

#

and they're not particularly small functions

gentle peak
#

that'd require refactoring every use of UACPI_MAYBE_UNUSED

fiery turtle
#

bruh

gentle peak
#

tbf i just looked and uacpi_maybe_unused is only used in dynamic_array.h

#

so it wouldn't be a huge change

fiery turtle
#

is this only for unused symbols or parameters?

#

maybe_unused is only used there iirc yeahy

gentle peak
#

uacpi_maybe_unused is only used for marking dynamic array functions as potentially unused

#

it's not used for parameters anywhere (which is good because with this change it wouldn't be possible to use it for that)

fiery turtle
#

for parameters i use UACPI_UNUSED

#

but yeah

gentle peak
#

i could also see UACPI_NO_UNUSED_PARAMETER_WARNINGS_BEGIN being an issue, there's no separate pragma for parameters and the pragma in question isn't on a stack

#

so it'd conflict with UACPI_MAYBE_UNUSED(...)

#

oh and it seems like the pragma doesn't even work lol

#

unreferenced warnings are still being emitted even with the pragma

fiery turtle
#

ffs lol

gentle peak
#

oh wait seems like there is a stack for it at least

#

not really useful given that the pragma appears to be a no-op, but still

#

i guess i could make UACPI_MAYBE_UNUSED expand to inline

#

it seems that's the only way to block unused warnings

fiery turtle
#

lol

gentle peak
#

there's also #pragma warning <num> <level> but that can't be pushed/popped

real jetty
#

Man supporting this compiler is such a chain around your neck

calm latch
#

uACPI 4.0.0: deprecate openwatcom galaxybrain

gentle peak
#

defining uacpi_maybe_unused as inline seems to work well enough

gentle peak
fiery turtle
#

nice, left a small nit

gentle peak
#

fixed

fiery turtle
#

alright will merge after ci

gentle peak
#

once it's merged i'll rebase the ci pr on top of this so that i can get rid of the warning suppression options

fiery turtle
#

yeah nice

fiery turtle
#

@trim frost hey I have your PR noted, I'll add you to the leaderboard a bit later when im doing readme changes or other leaderboard additions (since i try to batch them)

#

keep it open, ill close myself later

fiery turtle
#

@gentle peak i swear ill get to that pr, work has been a bit insane this week

gentle peak
#

dw about it lol

calm latch
#

Btw, what happened to ROS and Haiku?

#

Both guys seem to have disappeared again

fiery turtle
#

darkfire is taking a break from power managment

#

the haiku guy always disappears for a month after a bit of activity

trim frost
fiery turtle
#

whats the issue

torpid root
#

multithreading is asynchronous????

slim panther
#

but i thought rust was safe :(

trim frost
# fiery turtle whats the issue

no issue (well technically there is an issue as putting uacpi init on a thread makes the os hang in debug mode for some reason but i dont plan on doing that))

fiery turtle
#

it's a bit concerning to run SMP that early lol

#

I still dislike the limine smp feature because u have to do SMP yourself anyway if you wanna support CPU hotplugging or suspend

#

also for e.g. large systems linux recently did a big upgrade which improved smp startup speed by a ton

#

so it can be a bottle neck for large systems

#

id rather do it myself in this case

gentle peak
#

wow the GitHub mobile app's review stuff is horrible

fiery turtle
#

the mobile app is pretty crappy overall

gentle peak
#

you can't jump to the quoted code at all so all you get is the 3 or 4 lines of context

fiery turtle
#

lmao

#

Apparently win32 doesnt have a way to sleep for less than a millisecond

#

event their STL does milliseconds for the C++ stdlib api i've been using

lilac knoll
#

this can be quite unreliable

fiery turtle
#

it is reliable if you use the api correctly

#

it's not for precise waits, but rather specifying the minimum amount of time you want to sleep

lilac knoll
#

I mean the scheduler might not schedule you for a ms or two anyway

fiery turtle
#

sure, who cares, it's an implementation detail

#

if it can tho, thats still better than making it not schedule the thread because it thinks it wanted to sleep for a ms instead of say 500 us

#

POSIX has nanosleep and they survived

gentle peak
#

Yeah it's annoying

#

Although in this case the microsecond_sleep is only used by kernel_stall, kernel_sleep, and some lock/wait-with-timeout emulation that would still work if the sleep period was 1 ms

#

I might just increase said sleep periods to 1 ms and make stall actually stall instead of sleep

#

Then I don't have to do the waitable timer BS

fiery turtle
#

yeah I guess thats better, I was just too lazy to implement stalling initially

#

so i used the easy api

#

but now it doesnt exist

gentle peak
#

I think I addressed everything that can be addressed without changing code, I'll do the rest tomorrow

hollow crescent
#

It's easier to make an SMP kernel from the start than a single processor kernel that's then upgraded to SMP

gentle peak
#

Pretty sure he meant the point within the init sequence, not within development

fiery turtle
#

^

trim frost
gentle peak
#

addressed all the comments

vast kestrel
gentle peak
#

i do memory management, uacpi early table access, interrupts, timing, scheduler, vfs, smp, uacpi proper

flat badge
#

we just do dependency based init

gentle peak
#

i've been thinking of implementing something similar

fiery turtle
fiery turtle
flat badge
#

wdym by recursive dependencies?

#

The kernel will only run a step once all deps are done

fiery turtle
#

what if there's a dependency of a step that has depedencies that accidentally depend on this step

gentle peak
#

this is how i handle that (i just started implementing an init task thing)

fiery turtle
#

makes sense

flat badge
#

Cyclic deps are not allowed

trim frost
fiery turtle
#

@gentle peak LGTM as far as contents, but i think the per-commit split is broken atm

gentle peak
#

oh oops

#

forgot to put the ci and run_tests.py changes in the 2nd commit

fiery turtle
#

how do u usually add changes to commits?

gentle peak
#

normally an interactive rebase to the commit i want to edit and change pick to edit

#

but in this case my split was broken in a different way that i tried to fix

fiery turtle
#

i find that its easier to just do them on top of the last commit and name them as "fixup! <target-commit>" then just git rebase -i HEAD~N --autosquash and it automatically puts stuff where it needs to go

gentle peak
#

oo didn't know that existed

fiery turtle
#

yeah it really helps with this sort of stuff

mortal yoke
#

also you can make that a git fixup you can run with the changed added + an interactive thing using fzf where you can choose the target commit ```
[alias]
fixup = "!git log -n 50 --pretty=format:'%h %s' --no-merges | fzf | cut -c -7 | xargs -o git commit --fixup"

#

idr where I got this from but its nice

fiery turtle
#

damn, no idea what fzf is but thats interesting

mortal yoke
#

you get this kind of thing where you can select with arrow keys or mouse + enter to choose

fiery turtle
#

ohh damn

fiery turtle
mortal yoke
#

yes

fiery turtle
#

ill definitely try this

mortal yoke
gentle peak
#

alright fixed

fiery turtle
#

didnt know autosquash could be on by default

#

my fingers hurt from typing it all the time

fiery turtle
#

alright merged

#

I hope that completes the OpenWatcom journey lol

#

almost 1k commits now

gentle peak
fiery turtle
#

lol

#

well at least now we can see proxima in C89 openwatcom

gentle peak
#

"why do mutexes have timeouts" when aml literally exposes an acquire with timeout op

fiery turtle
#

like he has been using acpica previously and it literally has the same api

#

has that never occured or something

#

Somehow the uACPI thread has 250k views on osdev forums

#

wtf

#

lol

#

vibe coding acpica

kindred beacon
#

holy shit

#

copy/pasting verbose AI slop should be a criminal offense

fiery turtle
#

crazy stuff

kindred beacon
#

rip out ACPICA from linux, replace with uACPI

#

unironically

#

ACPICA has been lost entirely now, there's no going back

fiery turtle
#

lmao

calm latch
# fiery turtle

I think I should try and implement that to see how it works...

fiery turtle
#

he's right tho, you must use refcounting here unfortunately

calm latch
#

Though it would have been more convenient if it was per thread

#

I don't know/haven't though much about how to do it globally

fiery turtle
#

while unlikely, there might be multiple opregions in aml mapping the same io range

calm latch
#

that is not the issue

#

How do you handle one thread mapping io port, and then other one using it?

fiery turtle
#

u must synchronize the tss for all threads

calm latch
#

I guess it's a similar issue to paging

#

Wait, does x86 look into TSS every time IO port is accessed?

fiery turtle
#

u can do it lazily as well but u would need an instruction decoder in kernel lol

calm latch
#

IO instructions shouldn't be too difficult to decode

fiery turtle
#

probably

calm latch
fiery turtle
#

why

calm latch
#

For lazy FP/vector stuff

fiery turtle
#

lazy fp is slower than eager fp btw

#

because literally all apps use fp nowadays

calm latch
#

My kernel doesn't enable them for threads until they're used for the first time

#

Then it's eager

fiery turtle
#

hm fair but probably still useless work

#

unless risc-v is not like x86 and compilers dont use sse unconditionally

calm latch
#

Not that much work

calm latch
#

Also vector extension has only been standardized very recently?

#

And on LoongArch it's undocumented and to be replaced

mortal yoke
calm latch
#

Though their exceptions are nicer

calm latch
#

But that's anoying

#

I guess I could use my TLB shootdowns mechanism

#

Or something similar

#

To make sure CPUs use the latest IO bitmap

#

Though it would be kinda annoying, since the scheduler would have to take locks and stuff...

#

Maybe I can make per-thread TSS conditional

#

Since it would only be used by drivers

fiery turtle
#

microkernel problems trl

calm latch
#

Just a couple more syscalls trl

#

(I have too many of them)

#

Also, how does this work on ia32?

flat badge
calm latch
#

Oh, it's the same

calm latch
fiery turtle
real jetty
#

Have copilot create a pr and chatgpt review it

calm latch
#

And slap a lock on that whole thing

#

The C++ and Rust abstractions should also be nice rust

trim frost
#

this shall be my new score

slim panther
#

wtf did you do

#

sleep(100) in your mem allocator?

trim frost
#

xD

trim frost
#

double digits

slim panther
#

nyaux speeds

#

jk

fiery ice
frank canopy
#

is the timer just off by a factor or something??

trim frost
#

no lol i was messing around with memcpy and other mem functions

fiery ice
trim frost
fiery ice
#

lol

trim frost
#

i actually tried spinlooping inside them but couldnt get it to work

#

crashes

#

so i did something else

calm latch
#

I think emulating RISC-V and whatnot also gives very low scores

fiery turtle
trim frost
keen shard
#

I’ve genuinely never used Ai for programming besides the intellisense which idek if that counts

jaunty fox
#

i have no idea why they call it "vibe coding"

#

rarted terminology

dense steppe
#

because you're vibing while someone something else codes

surreal current
# jaunty fox i have no idea why they call it "vibe coding"

It was coined by a really corny tech bro tweet about how like "i feel so much more in touch with my program... im freed from the irrelevant little details that make programming so tedious... im just vibing with the big picture..." or something

fiery turtle
#

...

surreal current
#

whats ur impression

torpid root
# fiery turtle

isn't it a good idea to use appropriate caching modes for different mappings?

fiery turtle
#

yea

torpid root
#

may I ask why uacpi doesn't use it?

calm latch
#

I think there was already discussion about it, but I can't find it

#

Iirc ACPI just doesn't give you that information?

fiery turtle
#

there were multiple yeah

#

TLDR it doesnt know

torpid root
#

ah

dense steppe
#

caching modes also differ heavily between different architectures, and ideally we would keep that away from the kernel interface

frank canopy
#

the one thing i would like to maybe have if possible actually is a way to differentiate temporary vs long-term mappings

#

just because of how my memory management works

calm latch
# fiery turtle

Though on x86 you can probably just get away with mapping everything as cached, wt?

frank canopy
#

not a big deal to not have but would be nice

dense steppe
#

the lowest-hanging fruit that I see is a flag passed to uacpi_kernel_map_memory that tells it whether or not this is an ACPI table mapping

calm latch
#

but even then you've got to modify the tables sometimes

fiery turtle
# torpid root ah

basically the problem is AML just tells you: map this with this length

#

uacpi cant possibly know what the hell its mapping

#

it could be normal ram, or device memory

#

only the os can know by looking at the memory map and deciding based on that

#

thats what linux does with acpica mappings for example

calm latch
fiery turtle
calm latch
#

I have to change pmOS to do this as well

gentle peak
#

it checks whether the range is fully occupied by ram and if so uses wb, if not uc

fiery turtle
#

AML is also allowed to request table mappings via a special opcode

#

and write to them all it wants

calm latch
#

But like it's probably gonna be super important when I begin porting to ARM

gentle peak
#

i just use the x86 memory types and let each arch map them to whatever it uses

calm latch
#

(I mean RISC-V is also probably broken)

gentle peak
#

but i don't know whether that actually happens in practice

dense steppe
calm latch
#

I've started with RISC-V types, and it didn't translate well to x86 types, so I just map all normal memory as cached, and everything else as UC

calm latch
frank canopy
#

i really want to get the FACS mapped somewhere separate so it doesnt stay long term in syspte space tbh. other than that i just map everything as writeback and it seems to work for now

gentle peak
frank canopy
#

(i rely on MTRRs to be set up correctly by the loader/bios)

gentle peak
dense steppe
fiery turtle
#

Strong and normal

#

Well technically more but

#

These should do it

gentle peak
#

what's the difference?

calm latch
dense steppe
frank canopy
#

(specifically, iirc on x86 the MTRRs can prevent caching even if i say writeback for the cache type on the mapping)

frank canopy
fiery turtle
calm latch
#

I do have zero copy

calm latch
gentle peak
# calm latch Idk what to do then

on sane platforms you just use fences and the platform takes care of it, on arm you need to run cache flushing instructions on the range iirc?

fiery turtle
#

Its device specific

#

Its normal unless you know otherwise

#

E.g. most M1 devices require strong mmio

calm latch
#

So the mapping syscall should take normal ram/mmio/strong mmio/framebuffer/guess argument?

fiery turtle
#

Yea

calm latch
torpid root
gentle peak
#

(in this case ram includes acpi reclaimable and such regions)

#

(actual kernel-owned ram is not allowed to be accessed by acpi, and the kernel enforces this)

torpid root
#

one more entry in my todo list

frank canopy
#

ok now i want to know why the debug info thinks uacpi_set_waking_vector is at address 0

fiery turtle
#

lol

fiery turtle
#

part of me just wants to ignore him

slim panther
#

yea tbh

#

i don't get why you put up with that

fiery turtle
#

let me just quickly disable semaphores trl

calm latch
#

What's the issue with having them in the first place?

slim panther
#

cant he just admit his kernel is trash

calm latch
#

He said he's running it as a userspace server

#

So it's even worse

fiery turtle
#

he doesnt have them lol

#

thats the issue

calm latch
#

Does he not have multithreading?

#

Like even if the kernel is complete trash, you can implement those in userspace

slim panther
#

what a great os

calm latch
vast kestrel
#

How did he run acpica before even

#

Or did he not

surreal current
slim panther
#

me when I'm stupid

#

i 100% bet that this guy does not have the skills to write assembly that's faster than gcc

fiery turtle
slim panther
#

i mean it makes sense that he says that because owcc doesn't seem to do any optimizations KEKW

real jetty
#

If I had to work with that compiler id be tempted to use asm instead too...

gentle peak
#

owcc does do optimizations actually

#

it's not gcc or clang level obviously but still

surreal current
# slim panther

wonder if hes even aware of the concept of mapping a file into kernel space as demand-paged memory and doing cached io by memcpying through that window

#

which bypasses toooooons of layering machinery in the cached case

#

reduces it to a window lookup and copy

real jetty
#

I can't imagine anyone reasonable would write page cache in asm honestly

jaunty fox
# slim panther

some say you don't need to optimize the file-system since the disk drives are slow anyway
some say? who says that

slim panther
#

nobody

#

it's head canon

gentle peak
#

the voices in his head

jaunty fox
#

what a lot of people really say: you need to optimise BECAUSE the disk drives are slow

slim panther
#

like the rest of his delusions

slim panther
#

bro what

#

this guy has been at it for over 20 years???

#

what is that copyright date

gentle peak
#

rdos is ancient

slim panther
#

and no fucking acpi?????

jaunty fox
slim panther
#

wow this guy has actually lost the plot

gentle peak
slim panther
#

still

jaunty fox
#

it might not be, i haven't looked in any depth

slim panther
#

iirc he only added 64-bit support in the past few years

#

like what

jaunty fox
slim panther
jaunty fox
#

so i'm not sure why he slates C for filesystems so much if his in C++

hasty plinth
#

lol

#

c is bad but c++ is ok

surreal current
#

i must outdo the 20 yr old boomer project in like 2 years

slim panther
#

holy shit WHAT is that coding style

#

this cannot be real

torpid root
#

it's not that bad

gentle peak
#

why put the name in the fucking comment when it's right above the member it's documenting

slim panther
calm latch
#

Does he have SMP?

fiery ice
mortal yoke
#

btw I tested this again because I couldn't get it to work last time I tried it but now I got it to work on an alderlake igpu with these changes to qemu on top of the changes those patch introduced which are now upstreamed to make it set up the opregion for it even when its not the boot gpu as its not reported as vga compatible if its not + this https://github.com/tomitamoeko/VfioIgdPkg (with the other patch applied because of the same reason) + IntelGopDriver.efi extracted from a bios update (also needs a patch to nop out a check at 0xa3d when the igpu is not the primary boot gpu as it checks for the vga class)

#

now the real question is whether the shotplug register is broken with this, hopefully not

fiery turtle
#

maybe upstream it as well?

#

there were some new patches i saw on the mailing list

#

about igd stuff i think

#

like literally today

mortal yoke
#

looks like there is some typo fix + a patch to respect x-igd-opregion=off

#

yeah I should probably upstream these (though I can't really do anything about the IntelGopDriver patch except make a mention of it somewhere)

hollow crescent
#

Because what if you document the wrong function with your comment

#

/j

gentle peak
#

good point

fiery turtle
#

doesnt implement most of the kernel apis and says its an aml bug

mortal yoke
#

lol

#

also for tables you have basically no way of knowing which ones you can make read-only (except the ones that are defined by acpi as static tables you don't write to ig)

fiery turtle
#

also aml might remap them and write to them if it wants to

#

via DataRegion or wahtever its called

dense steppe
#

how does an AML interpreter deal with self-modifying AML at all?

#

like it just sounds like a nightmare to wrap your head around

fiery turtle
#

methods are stored in heap allocated buffers (at least in uacpi and nt) so its not possible

#

well it could technically modify the dsdt as it's being loaded

#

that would not go well

vast kestrel
#

Have a template ssdt that patches and loads as required :^)

#

Also imagine deprecating Unload 😔

#

Can't have dynamic code loading/unloading smh

flat badge
#

AML has explicit opcodes that you could use to load code

#

at runtime

flat badge
fiery turtle
#

Aml is ahead of its time

flat badge
#

nah AML is just completely broken

fiery turtle
#

Shh

flat badge
#

what happens if I try to unload a control method by doing CopyObject over it?

slim panther
fiery turtle
gentle peak
flat badge
#

it's basically just Intel and Microsoft adding whatever adhoc stuff they needed to solve their next problem

fiery turtle
#

It was designed by incompetent firmware devs, not language designers

flat badge
#

it's object model is completely broken

#

the core VM is also completely broken

#

like, why are there 8 registers available

#

without any compiler support to do register allocation

#

that's just lazy AF

vast kestrel
#

Should have been wasm 😔

#

Riscv as a vm :^)

flat badge
#

they could have just copied the JVM

#

or any other stack based lang

fiery turtle
fiery ice
#

jvm is one of the best

flat badge
#

wasm as not a thing at that time but the jvm was

vast kestrel
#

Shhhhh

kind mantle
vast kestrel
#

RiscVM

#

Efi bytecode!?!

fiery turtle
#

Of this guy

fiery ice
#

he should learn how to code his kernel and apis properly

slim panther
fiery ice
#

(and use a good compiler)

slim panther
#

tell him that uacpi requires a mature kernel KEKW KEKW

kind mantle
#

This seems like the kind of person to think they know everything but actually not

fiery ice
#

mine is not mature but still works, lol

#

you just need to implement the apis

#

lol

#

i still need to add PCI tho

kind mantle
fiery ice
#

lol

kind mantle
#

I am a prophesshional kernle dev trust me (fr fr)

#

1.02M ops/s

#

The next up is 1.5M ops/s

fiery ice
#

that's still better than most

vast kestrel
#

Uacpi-os was done in a weekend :^)

fiery ice
#

well, still better than Nyaux

kind mantle
#

The slowness was probably down to my mutexes, which I have re-worked since.

fiery ice
#

my slowdown is prob bc of memory allocation

#

i need to try it on real hw

kind mantle
#

I'll measure again later but first I need to fix a lot of other stuf f

fiery ice
#

(and prob bc i am using PIT to measure the time too)

kind mantle
fiery ice
#

i hope to finish the scheduler soon

#

so i can add threads to uACPI

#

and then finish the APICs

torpid root
fiery ice
#

k

torpid root
#

that just uses the old bitmap allocator

#

if it doesn't work, the problem is somewhere else

kind mantle
#

btw did we end up settling on a standard way to test kernel performance for uACPI?

torpid root
fiery ice
#

lemme send the pic

torpid root
#

I know where it happens

#

so it's not the allocator's fault

fiery ice
#

it's a different RIP

kind mantle
keen shard
slim panther
#

mov is turing complete

kind mantle
#

BadgerOS has both RISC-V and x86_64 support

torpid root
fiery ice
#

my mem things if you want

#

try with these

kind mantle
# fiery ice

lmao you think that's gonna be faster than mine

torpid root
fiery ice
#

mammogram?

#

XD

kind mantle
#

mammogram
KEKW

flat badge
#

as if that memcpy was that complicated

fiery ice
flat badge
#

it's just thinking about how it'd work in asm and then hacking C until it generates the desired asm :^)

torpid root
kind mantle
#

Managarm memcpy does misaligned access if the pointers are misaligned, mine doesn't. On RISC-V, misaligned access can be slow or even cause a trap.

torpid root
#

uacpi points are x86_64 only

kind mantle
#

I know

#

Either way, though, I'm going to phinnish my device refactor first.

#

x86_64 probably won't boot before then

flat badge
kind mantle
flat badge
#

i'm aware that Managarm's memcpy does this but i don't think it's a problem: unless misaligned accesses are implemented in software, doing the misaligned accesses will still be faster than single byte accesses. you're correct that RISC-V allows M mode to implement them in software and hence they can be very slow. however, a physical CPU that does implement them in SW will likely not be powerful enough to run Managarm anyway

kind mantle
flat badge
#

are you sure that it has no hw misaligned access?

kind mantle
#

Yes. I read the datasheet.

fiery turtle
#

Will do all tests on my desktop probably

flat badge
fiery turtle
#

To remove that CPU column

flat badge
#

tbh that surprises me

kind mantle
kind mantle
#

That's why I remembered that in the first place

flat badge
#

yeah in that case you have to do the check first and resort to single byte accesses or similar

kind mantle
#

Like cursed bit shift memes

#

Will be faster on any RISC-V cpu larger than a literal microcontroller.

mortal yoke
#

or emulate the unaligned access using the trap

#

though that's slightly cursed

kind mantle
flat badge
#

fwiw all rva profile implementations will need to support this going forward

#
Zicclsm Misaligned loads and stores to main memory regions with both the cacheability and coherence PMAs must be supported.
kind mantle
#

Good.

fiery turtle
kind mantle
#

RISC-V really didn't put their foot down enough for profiles meant to be desktop or server or whatever chips.

flat badge
#
  • the more conditions you need to test for the slower the fast path gets
kind mantle
#

For large sizes at least.

flat badge
#

unclear if it's worth it tbh

kind mantle
#

idk.lol

flat badge
#

you can still do pipelining with single byte accesses

#

like, load ~16 bytes or so, store 16 bytes

kind mantle
#

Yeah but the memory ports can usually still do word-sized accesses.

flat badge
#

sure but you need at least 3 instructions or so to do the shift

kind mantle
#

I love that we somehow went from an ACPI discussion to discussing how unaligned memcpy would be implemented on a CPU without HW misaligned access

calm latch
#

#lounge2

kind mantle
calm latch
#

What's his issue with mapping everything as r/w?

gentle peak
#

"i don't keep that information" then either start keeping it or accept that you're mapping everything as rw and relying on mtrrs for caching

fiery turtle
#

how is that our problem that his kernel is poorly designed

left orbit
#

why even support acpi if you dont want power management

calm latch
#

It's important for device drivers

#

Though if your OS is stuck in the past...

frank canopy
#

enumeration of devices yeah

calm latch
#

He said he was using it for PCI interrupts routing

frank canopy
#

for discovering ioapics then or something? ig?

calm latch
#

You don't need AML for that

frank canopy
#

yeah i know

#

thats why im confused

#

so far im only using AML support for device discovery/enumeration

keen shard
#

It’s dogshit

#

Like

#

Holy crap

#

Do not even look at his PR’s

#

Like , I know I’m not the best at it, but damn, rdos is cancer

hollow crescent
#

"as soon as possible?"

#

i.e. as soon as interrupts are enabled AND the IPL is low (in my case)

fiery turtle
#

yes

dense steppe
kind mantle
#

XD

dense steppe
calm latch
#

define sane kernel trl

keen shard
#

There’s no os kernel without some dogshit bits

#

Even Linux, its TTY is ATROCIOUS and its build system is… yeah.

dense steppe
#
#if defined(__RDOS__)
        return UACPI_STATUS_WONTFIX;
#endif
#

-EWONTFIX sounds like an errno

hollow crescent
#

except that uacpi_kernel_schedule_work doesn't give me a DPC object to enqueue

#

which sucks

#

i need to dynamically allocate them or some shit

dense steppe
#

yeah

hollow crescent
#

and i do not really want to allow memory allocation in interrupt unsafe regions

dense steppe
#

you can do the very valid solution which is to use threaded IRQs

hollow crescent
#

what's that?

dense steppe
#

that's what I intend to do once I figure out how to do those

dense steppe
calm latch
#

My kernel does that

hollow crescent
#

so switch to a separate "fake" interrupts thread when handling interrupts

#

for each processor

#

right?

calm latch
hollow crescent
#

for each interrupt???

calm latch
#

But they are normal threads

hollow crescent
#

a new thread?

#

with a stack and everything?

calm latch
#

I mean not allocated during interrupt

dense steppe
#

like it should just be

  1. interrupt handler ("top half" in Linux parlance) is entered
  2. the handler disables the relevant IRQ line before unblocking a kernel thread and returning from the IRQ handler
  3. when the kernel thread has finished handling the IRQ, it enables the IRQ line and sleeps
hollow crescent
#

okay, i should mention that my kernel allows you to enqueue DPCs during interrupt routines so that you have access to some more services than you normally do, in those DPCs

calm latch
hollow crescent
calm latch
#

Like no kernel stacks for threads

kind mantle
#

Threaded interrupts? That's new to me.

dense steppe
hollow crescent
calm latch
#

As normal

hollow crescent
#

Do you just never preempt a thread if it's running a system call?

dense steppe
hollow crescent
calm latch
#

Like I don't switch stacks during task switches

frank canopy
#

my plan is to give each interrupt a preallocated DPC object to use

hollow crescent
#

Just enqueue the same DPC

kind mantle
#

What's a DPC?

frank canopy
#

and re-setup the dpc each time

hollow crescent
#

If it wasn't processed by the time a subsequent enqueue call is made then nothing happens

hollow crescent
frank canopy
kind mantle
#

ah

hollow crescent
#

Basically it defers a procedure call to an interrupt safe context

dense steppe
frank canopy
#

runs at a lower IRQL and gets enqueued for whatever

calm latch
hollow crescent
calm latch
frank canopy
#

NT runs them at IRQL 2 (dispatch level), i think by scheduling a self-ipi but not sure

kind mantle
#

I was just gonna allocate a buncha structs ahead of time for uacpi_kernel_schedule_work

hollow crescent
kind mantle
#

And use them with a spinlock for protection

dense steppe
frank canopy
#

my plan is to use a self-ipi for dpc scheduling which then gets hit once i drop out of the true ISR

hollow crescent
#

Boron does it in software even on x86_64

#

It used to do a self IPI but I think it's slower

#

I should do a latency benchmark at some point

calm latch
#

but in userspace

#

Since my kernel only deals with timers

frank canopy
#

i can only imagine self-ipi is slower but it makes it real easy to handle the irql stuff

dense steppe
calm latch
hollow crescent
dense steppe
#

you check "are there any DPCs" before exiting the IRQ handler

calm latch
#

Ok, I need to stop with ?

dense steppe
#

if there are, run them

calm latch
#

it was supposed to be a statement, not a question

frank canopy
#

i initially had a system where the return from interrupt would drop to dispatch level and then check dpcs yeah

hollow crescent
#

Basically, if the preempted IPL is < IPL DPC, then lower down to IPL DPC and see if you have any DPCs running, if so, then run them, and return from the interrupt handler

hollow crescent
#

The hardware interrupt "becomes" the DPC interrupt, so to speak

frank canopy
#

yeah

calm latch
#

You can emulate irql and stuff afaik

#

Like you would ususally assume that the the kernel can be preempted

frank canopy
#

its not hard i just couldnt be bothered to implement a good way to handle checking preempted ipl stuff

calm latch
#

But you can toggle a cpu-local variable, and if you get an interrupt, you just exit immediately as if there wasn't one in the first place

frank canopy
#

so self-ipi is easiest

calm latch
#

I was thinking about making timers preempt my kernel

dense steppe
hollow crescent
calm latch
hollow crescent
#

So that a higher priority interrupt can preempt this one of course

dense steppe
hollow crescent
#

My kernel core (read: scheduler) is "preemptible" in the way that it can be interrupted by hardware

dense steppe
kind mantle
#

wait but even if you do this, how are you adding the DPC to the list? Do you just have some fixed-size list somewhere?

kind mantle
hollow crescent
#

There is a list of enqueued DPCs for each CPU

kind mantle
#

You're in an interrupt

hollow crescent
#

It's an intrusive linked list

kind mantle
dense steppe
hollow crescent
#

It's a linked list

dense steppe
hollow crescent
kind mantle
hollow crescent
#

Yes, DPCs are statically allocated (usually)

#

But it's not fixed size

hollow crescent
kind mantle
hollow crescent
#

As long as the memory the DPC is in is nonpaged it's fair game

kind mantle
#

mis-type?

#

idk

hollow crescent
kind mantle
#

lmao

hollow crescent
#

It's fine

dense steppe
kind mantle
#

we are good at sleeping trl

dense steppe
hollow crescent
dense steppe
#

to raise the barrier of entry into understanding my kernel chad

#

no but I probably should do that, actually.

#

definitely do look at arch/x86/kernel/irq.cc and arch/x86/include/asm/irql.h too

dense steppe
#

because this right now is just unnecessary and annoying

dense steppe
calm latch
#

Linux just creates a new thread for it every time?

#

(my OS does as well since it was the easiest thing to do)

#

(for enqueue work callback)

lilac knoll
slim panther
flat badge
#

Forth is would be less horrible than AML, yes

dense steppe
dense steppe
fiery turtle
#

my new motheboard prints ACPI-related codes at runtime, pretty cool

#

damn, debugging S3 should be nice

calm latch
#

Does it let you write to 0x80 like my motherboard?

fiery turtle
#

not sure yet

#

waiting for cooling lmao

vast kestrel
#

It's probably 0x80 display yeah

fiery turtle
#

That's pretty cool for debugging gpu drivers lmao

calm latch
#

Serial port is more convenient though

fiery turtle
#

ofc, but its not a thing on my mobo

frank canopy
#

neat

slim panther
#

@fiery turtle do you think multi-cpu systems would be interesting to you?

#

i might be building a dual epyc testbench

fiery turtle
#

u mean uacpi-wise? yeah any special hw is interesting

left orbit
#

acpi dump appreciated :^)

fiery turtle
#

and test some OSes from here

slim panther
#

I'm building it mostly because numa is going to be interesting

#

and I've never owned a pc with more than one cpu xd

left orbit
#

you can just emulate numa in qemu

slim panther
#

yea but that's not the sameee

#

it is cheaper though

left orbit
#

free in fact

slim panther
#

ebay really wants me to buy them

#

friday is paycheck day

#

wait aren't intel x99 xeons also dirt cheap

calm latch
calm latch
#

Bruh I can't read

slim panther
#

or 7401p

calm latch
#

Because I think there were Epycs which give you 786 threads in one system?

slim panther
#

the latter is only 29€

#

the former more like 150-200

calm latch
#

not bad

slim panther
#

the killer is going to be the mainboard

#

those sp3 boards start at like 450€

fiery turtle
#

Btw uACPI has surpassed Astral in github stars trl

slim panther
calm latch
#

probably because of osdev forums?

rustic compass
#

I have a Dell r730xd server lying around

fiery turtle
#

its because of astral death lol

calm latch
#

Still 208 stars and almost 250k forum views is like ... a lot

fiery turtle
#

yeah im honestly confused why its that high

#

for example the FYSOS post from 2016 has less views

#

and somehow that didnt generate much traffic for the repo

#

yeah idk

calm latch
#

Could it be from ROS?

fiery turtle
#

dunno

hollow elm
#

vogons huh

fiery turtle
#

no idea what that is

fiery turtle
#

yes let me just go reverse engineer every aml blob and ill get back to you trl

slim panther
fiery turtle
#

the future of linux

slim panther
#

every time this guy makes a new comment i'm more and more baffled by the ignorance

#

like i know i say some pretty stupid stuff sometimes

#

but never ever on this level

#

does he mean the fucking pci bridge hierarchy???

fiery turtle
#

it's astonishing that he has like 20 years of experience in osdev and somehow says stuff like that

slim panther
#

how can you market yourself as a serious os and not know about any of this

#

like

#

what devices does he even target???

#

storage via i2c or what

kindred beacon
fiery turtle
#

lol

dusky glade
#

real

dire owl
slim panther
#

what

#

people... bought this shit?

kindred beacon
dire owl
#

yes, RDOS is used commercially iirc

slim panther
#

omfg

kindred beacon
#

(according to Mr. Dunning-Kruger)

slim panther
#

lol

dire owl
#

as a RTOS or something

slim panther
#

menix is actually used commerically on over 50 computers

#

(suse machines that i hijacked)

fiery turtle
#

really

fiery turtle
#

lol

slim panther
#

cooked

gentle peak
#

is there a list of kernel api functions that uacpi can call from interrupt handlers?

fiery turtle
#

log, spinlocks and schedule work

#

but no

#

there isnt a formalized list

gentle peak
#

alright that works thanks

fiery turtle
#

he gets more confused by the minute

vast kestrel
#

Just wait until he discovers the job of MCFG

gentle peak
#

is there some kind of centralized database or something where i can look up pnp ids for devices?

hollow elm
#

rg PNP... /usr/src/linux :^)

fiery ice
#

on wsl it doesn't exist

#

f

hollow elm
#

on most distros that path probably doesn't exist or only contains headers for building modules

fiery ice
#

on widnows you can dump the aml

hollow elm
#

just use a path to your local copy of the linux kernel sources

fiery ice
#

but you can only see the ones you have

gentle peak
calm latch
#

Though how did he have ACPICA working before?

frank canopy
hollow elm
#

yeah i bet

#

why are csv files registered to open in krita

frank canopy
#

no idea

hollow elm
frank canopy
frank canopy
#

i actually helped a guy figure out the device id for a thing for support the other week because a flight sim hardware company had just released a new thing that i got but he didnt lol

#

the actual device id is whatever the vendor wants

#

if you want the well known ones look at linux source

hollow elm
#

huh rpi have an officially assigned pnp vendor id

#
"Raspberry PI",RPL,05/07/2024
calm latch
#

Don't they have a weird south-bridge like thing?

hollow elm
#

they do yeah, but they don't officially ship acpi/uefi firmware

calm latch
#

I mean ARM SBCs seem to be getting semi-competent ACPI

#

With Windows and stuff

#

What if the next Raspbery Pi...

fiery turtle
#

@calm latch thanks for replying to him

dusky glade
#

I AM NOT A FURRY

dusky glade
slim panther
#

i swear

fiery turtle
dusky glade
#

can we make it possible to ban people from repos

#

specifically this person

rustic compass
#

wouldnt loading the namespace, then enumerate it for pci(e) stuff and then initializing the namespace solve his problem?

calm latch
#

It's what my kernel does

#

But the question was weird

#

Why would you need names?

#

And uACPI should give them to you anyway

fiery turtle
#

I have no idea what he meant by names

slim panther
#

wtf is he on about now

frank canopy
#

i get the sense that he doesnt understand that pci config space access doesnt require enumerating devices first

slim panther
#

he doesn't understand a lot of things

#

can we just port rdos to gcc

frank canopy
slim panther
#

force him to use paging

calm latch
#

He has a bunch of stuff in assembly

#

afaik

frank canopy
#

yeah youd also need to port it to c

#

its mostly assembly

slim panther
#

broooooo

#

tech debt os

frank canopy
#

he believes its faster that way

slim panther
#

(it's not)

calm latch
#

tbh I think that page was written 30 years ago, and never updated

#

though still

#

one would remove it...

#

yeah that's a bad argument

frank canopy
#

there might have been an argument for asm being faster 30 yearrs ago but even then doubtable

calm latch
#

I mean if you were using watcom trl

frank canopy
#

yeah its definitely possible with watcom, open or otherwise

rustic compass
#

compile times are definetly faster for assemblymeme

surreal current
#

Say "do it like this"

calm latch
#

I think I've left a link to mine in one of the messages sunflush

fiery turtle
slim panther
#

then close it as off topic trl

calm latch
#

"ask on discord"

fiery turtle
slim panther
fiery turtle
#

I will probably just answer with this

sterile egret
rustic compass
#

i want popcorn for when he reads the old messages in ths channel

slim panther
mortal yoke
#

then just wait until he gets mad and ban them trl

fierce kiln
#

oh this is the uacpi yap station

#

#osdev-misc-0 message

#

oops posted it in the wrong place

kindred beacon
#

oh god I didn't see that the rdos saga continued

sterile egret
#

oh no

sterile egret
kindred beacon
#

yeah

sterile egret
#

Also github isn't loading commits properly rn for me lol

kindred beacon
#

works for me

fiery turtle
#

someone should tell him to read a spec of how _PRT works

#

actually no it's fine, good thing he stole mishakov's code

hollow scaffold
#

I'm curious

fiery turtle
hollow scaffold
#

That sucks

slim panther
#

ew

#

me when i have no idea how software architecture works

calm latch
fiery turtle
#

looks fine to me

calm latch
#

The error handling is not great

fiery turtle
#

who needs error handling

calm latch
#

That's why I like exceptions

#

You just throw them when you feel like it

slim panther
#

or result propagation trl

kindred beacon
#

assert assertos

#

clearly superior

fiery turtle
#

not biased opinion btw trl

kindred beacon
#

clearly superior because managarm is superior ultrameme

fiery turtle
#

real

left orbit
#

when ultra kernel progress thread

fiery turtle
#

lol

#

when ultra progress is a thing

left orbit
#

come on i need inspiration

#

idk what im doing

#

i should honestly just drop the idea of making a cool kernel and go back to shitty non-preemptive kernel and get bash running or smth

fiery turtle
#

im waiting for qwinci intel driver to get inspired trl

surreal current
#

like min

#

oca

#

whatd u think i was gonna say

left orbit
#

min

#

oca

#

of course

fiery turtle
#

mintemple os

left orbit
#

i tried to look at mintia but too much stuff to go through

#

makes my brian melt

surreal current
#

resolidify brian

#

he did nothing wrong to you.

fiery turtle
#

kinda hate my brain

left orbit
#

no it's the beta *ux developer mindset

dusky glade
#

brian?

left orbit
#

i want to make something good

slim panther
#

me too but my brian is null

calm latch
dusky glade
#

thats crazy

#

i thought pmos was

calm latch
#

(like the sceduling is preemptive, but the kernel can't preempt itself)

fiery turtle
#

linux couldnt until recently as well

calm latch
#

huh?

#

It just wasn't realtime

surreal current
#

You almost get kernel preemption for free when you add smp support

#

Cuz both require you to support multiple executing contexts inside the kernel simultaneously

calm latch
#

how so?

surreal current
#

Unless you do a big kernel lock that is