#Zinnia

1 messages Β· Page 10 of 1

near tartan
#

ah rust actually describes how it's encoded

grave peak
#

C++ does too, but you need a full compiler to decode it

near tartan
#

why

grave peak
#

Because it can get very very complex

#

With nested templates etc

#

Its easier to decode at compile time and feed that to your kernel

near tartan
#

rust has that as part of the stdlib

#

or well, a component of it

#

you have to explicitly link it in

#

πŸ˜ƒ

grave peak
#

Does it do hidden allocations to demangle?

near tartan
#

no

#

it only demangles on print

grave peak
#

Yes but still

#

When you print

#

If that's the case it might be unusable in panics

near tartan
#

no allocations

grave peak
#

Maybe If it's a super complex symbol idk

near tartan
#

nope

#

the demangle crate does not have a reference to alloc

#

it cannot make any allocations

grave peak
#

Well that's nice

near tartan
#

there is an std feature that's off by default

#

which probably gives you host support

marble salmon
#

It is somewhat annoying to decode because it allows back references but nothing that requires knowing about the actual type system etc

grave peak
#

Yeah like u still can't just handroll it, its quite a lot of code

marble salmon
#

at least you don't want to do that, yeah

eternal wharf
#

just do some macro and template magic to generate demangled names at compile time :^)

#
#define DEMANGLED(sym) \
    [[gnu::section(".demangled")]] constinit const demangle_entry entry_##__COUNTER__ = {&sym, detail::make_demangled<sym>()};

template <auto V>
constexpr std::string_view detail::make_demangled() {
    std::source_location loc = std::source_location::current();
    return compiler_specific_extract_tpl_param_from(loc.function_name());
}
``` ![meme](https://cdn.discordapp.com/emojis/575445094589661215.webp?size=128 "meme")
grave peak
#

Is that actually a thing

eternal wharf
#

wdym? yes you can stringify stuff you can feed into a template param via std::source_location

modern hamlet
#

fun!

grave peak
#

I mean tpl param

eternal wharf
#

the function name would be in form detail::make_demangled() [with V = ...]

#

just extract the ...

marble salmon
#

there's also a __cxa_demangle function but idk which lib implements it / how hard it is to get it into the kernel

modern hamlet
#

how does THIS navigate every single symbol to generate at compile time

grave peak
eternal wharf
#

or libstdc++ but i think it's the former

modern hamlet
#

or... not because the itanium abi names are actually kinda readable

#

not like m*crosoft symbol names

marble salmon
#

i didn't find the actual definition with a quick grep so it's probably behind some alias or macro

eternal wharf
#

i think the worst part about __cxa_demangle is that it mallocs the output string iirc

grave peak
#

Lmao

eternal wharf
#

not even operator new :^)

modern hamlet
grave peak
#

Worse than rust

marble salmon
#

what does rust do?

eternal wharf
#

The demangler interface is described in the source documentation linked to above. It is actually written in C, so you don't need to be writing C++ in order to demangle C++. (That also means we have to use crummy memory management facilities, so don't forget to free() the returned char array.)

grave peak
#

Idk how it works under the hood, see convo above

near tartan
#

it just converts the symbol name during print

#

you give it a buffer to the mangled symbol and it impls Display

#

so whenever you print it, it gets demangled

marble salmon
#

ah

distant cypress
eternal wharf
#

i don't think so

#

the call in the body is still dependent on the template param and will include it in the string

distant cypress
#

oh

#

yeah, I missed the extract_tpl_param_from part

eternal wharf
#

yeah i was too lazy to check the specific format of the string (and i think it differs between clang/gcc)

#

and msvc obviously

pine rock
#

it can do everything iirc

#

even rust demangling by the looks of it

somber solar
#

all c++ demanglers I've seen allocate though

#

welp I use the llvm one in my kernel for panics (if available)

pine rock
#

llvms ManglingParser takes an allocator as a template parameter, so you can give it a fixed buffer

#

it doesnt do nullptr checks though so you need exceptions for it to not crash on oomsade

somber solar
#

I do have an entry in my todo list to not allocate during demangling

#

but my todo list is quite large and nothing is being done currently

marble salmon
#

why exactly is allocation a problem?

#

if rust uses Display to format in a non-allocating way, the actual output stream still needs some memory buffer to emit a contiguous line etc

hoary cave
#

it’s core::io::Write all the way through, no temporary buffers

#

normally, to prevent mangled logs, a lock is used on stdout

marble salmon
#

well yes but it'll go into a buffered writer at some point

#

otherwise, it'd do one syscall per char or similar which would obviously be worse than allocating

#

and if you want to store the output somewhere you obviously also need an allocation

somber solar
marble salmon
#

that's true, in that case it's better to preallocate

near tartan
#

Display only operates on the stack and a static immutable buffer

#

that makes it really nice

somber solar
#

I guess I could have a fixed buffer and a separate allocator for it

near tartan
#

the buffer doesn't need allocation

#

it's a &'static str

somber solar
#

I'm talking about llvm demangler

near tartan
#

oh

idle flower
#

@near tartan i found a way for native rust tls, but you are forced to use fs

near tartan
#

fs?

idle flower
#

fs segment register instead of gs

near tartan
#

oh

#

that's bad

#

that kinda breaks abi

idle flower
#

what abi?

near tartan
#

well you can't swapgs obviously

#

kind of a deal breaker

idle flower
#

you have to work around that, for interrupt handlers you would need to push fs do swap gs and move gs into fs

#

for syscall handler you would need to declare one register as a scratch register to store user fs in it

near tartan
#

so how does one use the tls stuff then

idle flower
#

with #[thread_local]

#

also you need to pass tls-model=local-exec to rustc to ensure that it directly emitts fs relative accesses

near tartan
#

ah nvm native tls wouldn't work with my setup anyways

#

i think

idle flower
#

maybe, the problem is the resolve tls address function for dynamic tls will break interrupt/syscall handlers, so you would have to make sure that llvm still emits fs relative accesses for those, for example by using a different tls model that uses the direct accesses for all modules that are known at compile/link time

#

then the tls sensitive code has to be in those modules only

near tartan
#

eh

#

oh wait this is actually very useless

#

because then you can't access the data from other cores

#

my tls allows stuff like CpuData::get_from(4)

idle flower
#

well you would need a helper function that swaps fs before the access

near tartan
#

oh yea that's absolutely not gonna work out

#

woe

idle flower
#

but also why do you need to access other threads thread local data?

near tartan
#

load balancing?

#

like if you have local run queues you need to move tasks somehow, right?

idle flower
#

those are on the heap? Then you could also store a reference to them in a global/core local struct

vast lotus
near tartan
#

maybe not the best design

#

the runqueue stores an arc

eternal wharf
marble salmon
#

accessing cpu locals of other cpus in rust sounds like a lot of pain

#

since you can't hold refs to them unless they use interior mutability

near tartan
#

this is already handled by the fact that local variables are static

#

so they have interior mutability by design

marble salmon
#

like, let foo : &u32 = get_other_cpus_u32(); is instant UB

marble salmon
#

if you want to access the CPU local of other CPUs, you'd have to wrap them in Mutex or AtomicU32 or whatever

near tartan
#

what makes it ub?

marble salmon
#

the fact that the owning CPU could take a &mut to it

near tartan
#

it could not

#

you can't have mutable references to a thread local variable in my code

marble salmon
#

ah

#

then it's fine

#

but then you need to wrap everything in Mutex, don't you?

near tartan
#

or atomics

marble salmon
#

yeah

near tartan
#

static mut is only allowed if the underlying type implements sync + send

near tartan
marble salmon
#

my point is basically: with std rust thread_local's you can use single threaded data structures like RefCell but you can't do that if you allow access from other CPUs

#

so you get higher overhead

#

since you need to use thread-safe data structures even for CPU locals

near tartan
#

i would use it if it didn't complicate dealing with fs and gs

marble salmon
#

you can patch llvm to use gs as the thread local register :^)

#

but yeah probably not a good idea

#

we briefly considered doing that in managarm

somber solar
#

needing to compile llvm to build your kernel though FeelsBadMan

marble salmon
#

we do that anyway

near tartan
#

i do that too

#

because jinx' llvm is old

#

just get a good build machine

grave peak
#

smh my head just be binary compatible with linux and cp it

marble salmon
magic charm
near tartan
#

that would require actual infra trl

magic charm
#

it had some problem or other with coroutines that arsen told me about

eternal wharf
#

some time ago i rebased our patches onto gcc 15 master when it was still unreleased to check and it still ICEd

marble salmon
#

it's hard to call this a bug because it makes use of a gcc extension

eternal wharf
#

well clang supports it, and there is a comment on the bug report saying that the intention is to support it

#

plus at least it should print a nice error and not ICE in the frontend meme

marble salmon
#

true

#

yeah it's not unreasonable to expect it to work

#

there should be no interaction between statement exprs and coroutines

fiery marlin
eternal wharf
#

huh, good to know

#

hm i don't see it in libiberty?

fiery marlin
#

maybe I'm making shit up, one sec

#

I'm looking at __glibcxx_demangle_callback() in cp-demangle.c.

#

looks like it only really needs stddef, snprintf, some malloc/realloc/free (that was for my code meme ) and string.h functions.

#

I should clean this up and publish it, maybe that'd be easier lol

hoary cave
#

just imagedep experimental:llvm if u want llvm 20

#

i think debian unstable is like llvm 19

#

that isnt old

near tartan
hoary cave
#

debian unstable

#

yeah it isn't old at all

near tartan
#

it was old at least

#

idk if it still is

#

but either way i use a patched llvm anyways

near tartan
#

i realized i can use dyn traits for IRQ handlers

#

no more void *context

hoary cave
#

i told you that a million times

#

gg

near tartan
#

really

hoary cave
#

maybe not a million but still, i did tell you that at some point trl

near tartan
#

i must've missed it

#

anyways

#

cool that it works

hoary cave
#

yes

near tartan
#

vfs is almost done now as well

#

so i can actually start doing user shit KEKW

near tartan
#

@somber solar why what's the difference between instance::create and instance::mknod?

#

they do the same thing

somber solar
#

because I don't actually have mknod trl

near tartan
#

damn

somber solar
#

they're supposed to set it up and stuff

#

I think

#

I don't really remember my thinking

near tartan
#

bruh

somber solar
#

from some sort of device registry

near tartan
#

smh

somber solar
#

don't I do that?

near tartan
#

but why do you need dev for that

somber solar
#

dev is a value created from major and minor number combination

#

I don't think mknod should be implemented for each filesystem though, because it just calls create but with different ops

#

just code duplication

near tartan
#

should file systems even interact with nodes?

#

i thought they only touch inodes

#

the vfs stuff doesn't need to be handled by a fs

#

that's why i don't get your abstraction

#

iiuc it should use backing

somber solar
#

yes it should

#

I'm just a dumass

near tartan
#

lol

#

you gotta understand i'm stupid

#

i am doubting myself at every step

somber solar
near tartan
#

i have this abstraction now

#

probably fucked

somber solar
#

shouldn't inode ops mark itself as dirty?

#

why have a separate function

near tartan
#

true

#

that indeed makes no sense

#

anything else blatantly obvious?

somber solar
#

uhh create inode should probably take type and mode as arguments?

#

other than that, it looks fine

near tartan
#

i guess

eternal wharf
#

why can destroy_inode not fail?

#

create_inode too

somber solar
#

ah true

near tartan
#

yea it should

#

delete should also use INode instead of a shared ptr

#

because i assume delete will be called when no other references exist

#

hm

somber solar
#

it can just fail if there are other references, no?

near tartan
#

ideally

near tartan
somber solar
#

ah

near tartan
#

that way i can force an invariant by just asking the caller to do that

#

if i don't then every implementing fs has to do this check

#

which is a bit meh

near tartan
#

unless type is part of mode

somber solar
#

well yes it generally is

near tartan
#

do i bother writing a high level concept around mode_t

#

i already have FileType

#

i could make mode into bitflags

somber solar
#

if your syscalls are going to take mode_t as an argument, you would need to translate it

near tartan
#

i think that's fine

somber solar
#

hmmm do you store children in vnode or inode

near tartan
#

vnode

somber solar
#

hmmmmm

#

then filesystem would need to access vnodes

#

for populate()

#

it's fineeeeeee

near tartan
#

i have this for inodes

#

wait lookup has a broken return type

#

mfw

somber solar
#

I should probably have sync for inodes as well

near tartan
#

tbh idk what i was thinking with lookup

somber solar
#

I think this is better

#

for fs instance

#

no more need for separate mknod

#

oops forgot to change link target

near tartan
#

what would populate do

#

does it set backing for a node

somber solar
#

optionally you can supply name if you want to request only one child

somber solar
#

resolve calls that with needed path segment, if it can't find a child on first try

#

I don't like the name "backing"

#

resource or inode sounds better

#

tbf populate should return a list of backings with their respective names and I should have a separate function that adds those to vnode children

#

perfect trl

distant cypress
#

Is this what you do for readdir()?

somber solar
#

no

#

I don't have readdir

distant cypress
#

this has filesystem design vibes

somber solar
#

how should I do it?

distant cypress
#

what is the purpose of populate()?

somber solar
distant cypress
#

and why do you do that other than lookup?

somber solar
#

that doesn't add it though

#

hm?

#

when you want to get all files in a directory

distant cypress
#

that's just readdir lol

somber solar
#

yeah same thing

#

something like this

distant cypress
#

readdir (or e.g. getdents64, which readdir is based on) is usually implemented as a separate operation on the open file handle, not a vnode operation

somber solar
#

what's wrong with this approach though?

distant cypress
#

it allocates everything all at once (at populate() time)

#

and this can be impractical for large directories

#

also it is just generally an uncomfortable interface

#

a function that allocates and returns a potentially very large array, in kernel space

somber solar
near tartan
#

is this sane

somber solar
distant cypress
distant cypress
near tartan
#

for vnodes

somber solar
distant cypress
#

despite having similar names, a hard link and a soft link are very different things

near tartan
#

like, a hard link points to an actual inode, and a soft link only points to a node via a path, right?

somber solar
#

soft link redirects vnode to another vnode

distant cypress
#

there is no such thing as a hard link

#

a "hard link" is a vnode which is referenced by multiple directory entries

near tartan
#

so how should i do it

distant cypress
#

nlink

near tartan
distant cypress
#

refcount

#

that's how it is usually done

near tartan
#

i get that part

distant cypress
# near tartan

is there a one-to-one between an Entry and an on-disk inode?

near tartan
#

no

#

many to one

distant cypress
#

yup

#

that's how hard links work

near tartan
#

yea but like

#

Entry is my vnode

distant cypress
#

bruh

near tartan
#

idk

distant cypress
#

Linux actually does a very nice thing here

near tartan
#

yea dentry

distant cypress
#

and it is that the VFS deals mostly in struct dentry and the underlying fs deals mostly with struct inode (the "vnode")

near tartan
#

why is inode the vnode

distant cypress
#

because linux

near tartan
#

i thought inode was the inode abstraction

distant cypress
#

same thing

near tartan
#

well i have a struct inode

distant cypress
#

is your "vnode" (Entry) the same as the Linux "dentry"?

near tartan
#

yes

distant cypress
#

ah

#

ok

#

then we are on the same page about terminology :-)

near tartan
#

:-)

#

INode has no hierarchy records, only a reference to its superblock

distant cypress
#

so there is not much reason for the dentry to have a record about the mode of the inode it points to

near tartan
#

so should it always point to an inode?

distant cypress
#

well, you can have a negative dentry

near tartan
#

im confuzzled here

#

negative = null?

distant cypress
#

but generally you get the file type from the inode

distant cypress
near tartan
#

oh right symlinks are also inodes

#

i forgor

#

my old kernel did this on the vfs layer (dumb)

distant cypress
#

there's also gray/a dentry that hasn't been looked up (not in cache)

near tartan
distant cypress
somber solar
#

why can't I forward declare nested structs nooo

near tartan
#

forward declaration

#

couldn't be me

somber solar
#

yes, I know

distant cypress
near tartan
#

can there be a dentry that points to nothing?

distant cypress
distant cypress
near tartan
#

like

#

if a dentry is negative, is that not the same as the inode not being cached?

distant cypress
#

no

#

you can cache ENOENT

near tartan
#

ohhh

distant cypress
#

and caching ENOENT can give performance boosts e.g. with shell exec, because it does lookup on all the possible PATHs it can find an executable in.

near tartan
#

i see

distant cypress
#

cache ALL THE THINGS

somber solar
#

good idea

near tartan
#

So in this case link should have 3 variants

#

Some, Negative, Uncached

distant cypress
#

basically, except maybe not named like that

#

I'd do Positive, Negative, Unknown, with entries defaulting to Unknown until they have been looked up

near tartan
#

i can do that

#

i guess link is also a bad name?

somber solar
near tartan
distant cypress
near tartan
#

what's a synonym

somber solar
#

connect :P

near tartan
#

i couldn't think of anything better

#

node is bad imo

#

because that might also be confusing

distant cypress
#

Entry::inode

near tartan
#

eh fair enough

distant cypress
somber solar
#

I can't wait to actually use this mostly untested vfs and have to redesign everything

#

it's somewhat tested, basic file lookup and stuff works (I load modules from initramfs)

near tartan
#

i can return enosup

distant cypress
#

yeah if you cannot leave it NULL because you are using a skill-issued language, obviously this is fine:

errno_t
tmpfs_lookup(inode *, dentry *e)
{
        dentry_make_negative(e):
        return ENOENT;
}
near tartan
#

ACTUALLY

#

i can do a default trait impl

distant cypress
near tartan
#

need to fix the function prototype

#

uhhhh

#

what arguments do i pass it

distant cypress
#

yeah just errno lookup(inode, dentry) is how Linux does it, I'm relatively sure

somber solar
#

@distant cypress could you glance over my code and tell me if I'm doing anything that stands out as obviously wrong? (other than populate being meh)

distant cypress
#

(if you remind me sometime during the day)

near tartan
#

thanks for the pointers

somber solar
somber solar
distant cypress
#

I should write some notes about filesystems and VFS design and make them available somewhere (although that'd be a slightly more longterm thing to do)

distant cypress
near tartan
#

okay last thing

#

shouldn't lookup just modify the given dentry?

distant cypress
#

yes

#

exactly

near tartan
#

why does linux return a dentry pointer πŸ’€

distant cypress
#

because linux

near tartan
#

does it just return the input?

distant cypress
#

actually the reason is some NFS stuff iirc; AFAIK everything else just returns the input dentry or a negative errno

near tartan
#

ah

#

okay good

distant cypress
#

because with NFS there's some condition where there can be multiple struct dentry for one path or something, and that is fixed by keeping a list per inode of dentries that point to it and returning one of those

near tartan
#

nothing that can't be fixed later

#

i love refactoring

somber solar
#

real

distant cypress
#

yeah, if you already have a errno lookup(inode, dentry), changing it to a dentry_or_errno lookup(inode, dentry) shouldn't be that big of a deal.

somber solar
distant cypress
#

pong

#

it is probably a good idea to move to your progress thread

somber solar
#

@near tartan how's the vfs going

near tartan
#

im mounting coolers atm

#

i think im going to get it working tonight

somber solar
#

green is just the best colour for pcbs

#

how many gibs of ram btw?

near tartan
#

512

grave peak
grave peak
near tartan
#

nothing

#

i got it for free from work

grave peak
#

Wtf

near tartan
#

because we only carry ddr5 now

#

this is ddr4 ecc 3200

grave peak
#

Dammn

near tartan
#

I'm so fucking lucky

#

0mm fan clearance

grave peak
#

How big of a PSU does this thing need

near tartan
#

not much

#

500w

#

each cpu is like 150W

somber solar
#

my gpu is like 50 πŸ’€

grave peak
near tartan
#

it's done!

nocturne rampart
hybrid island
#

and RAM too

somber solar
# near tartan

what's the point of the third pcie slot being open at the end if the nearby nvme slot would be blocking any cards with larger connectors?

hybrid island
#

Smooth brained PCB

grave peak
near tartan
#

I'm struggling

#

it spins to life but i dont get video

#

ipmi time

somber solar
near tartan
#

IT LIVES

vast lotus
#

how long does the memory test take

near tartan
vast lotus
#

or just post in general

near tartan
#

takes like 20 seconds

#

to get to buos

vast lotus
#

damn

near tartan
#

bios

#

huh it only detects 480gb

#

NOOOOOO

#

One stick is broken

vast lotus
#

only 480G of ram nooo

near tartan
#

i need to find out which one

#

what a god damn sight to behold

eternal wharf
#

perfect machine to run gentoo

near tartan
#

IT RUNS MENIX

#

i can die happy

somber solar
near tartan
#

cpu1

#

i dont have smp yet

#

i need to read the sdm

grave peak
#

Maybe implement PCI kernel api so we can see the number of ops at least

somber solar
eternal wharf
#

try mammogram :^)

#

i wanna see if it works on a 96 core machine

somber solar
eternal wharf
near tartan
#

i dont have a build on hand rn

somber solar
eternal wharf
somber solar
#

dead project

eternal wharf
#

and we only do full rebuilds every sunday at 1am, other times it's triggered by commits

near tartan
#

lmfao managarm shit the bed

#

it's stuck on this

#

@marble salmon @eternal wharf

eternal wharf
#

hmmm

grave peak
#

Now try pmos

eternal wharf
#

ts pmos

near tartan
#

ts ts

grave peak
#

Also damn 21k ops not bad

#

And 0 warnings so at least its competent aml

near tartan
#

oh definitely

#

good aml

#

vbios doesn't seem to work though

#

i cant get efi gop from a gpu

somber solar
near tartan
#

lol this board has an NMI button

eternal wharf
#

hm you could try pressing it in managarm :^)

near tartan
#

didnt do anything

#

it was dead

eternal wharf
#

hmmmmm

near tartan
#

idk why managarm doesn't run on any of my machines

eternal wharf
#

when running correctly all the cpus that got the nmi should print some stuff

near tartan
#

@somber solar your thing also hangs

somber solar
near tartan
somber solar
#

oh it works

#

that's the most it does

#

I should really initialise cores in parallel lol

near tartan
#

is it supposed to die there?

somber solar
#

it doesn't die

#

there's nothing more to do

near tartan
#

oh

#

zamn

somber solar
#

I want to do uvm before anything else

#

and I'm avoiding working on it, so nothing gets done

grave peak
#

That's probably the first uACPI test on server hw

near tartan
#

nah

#

it's the first one that you see

#

i've ran menix before on dual xeon thinkcentres

#

also worked

grave peak
#

Damn

somber solar
near tartan
#

yes

#

many bridges and iommus

eternal wharf
# near tartan

hmm it prints that it's configuring the irq but not that it has allocated slot 0 for the irq

somber solar
#

also is it just me or does the framebuffer seem slow

near tartan
#

it's not accelerated

eternal wharf
near tartan
#

i'm curious why it says disabled for so many lapics

near tartan
#

THAT is slow

grave peak
#

Just reserved entries in apic

near tartan
#

why are they disabled?

#

ah

grave peak
#

Bios just fills them in

near tartan
#

oh yea how does that work

#

if you have >256 lapics

hoary cave
#

what's the context of >256 lapics

cyan nexus
#

1 per core

hoary cave
#

okay

cyan nexus
#

256+ cores

#

lol

hoary cave
#

more liek one per logical core

cyan nexus
#

idk how you would handle all of them tho

near tartan
hoary cave
#

or you could have even more

#

considering binning

near tartan
#

yea but how do you address them

cyan nexus
#

maybe via multiple ioapics?

hoary cave
#

address them like what

#

ah

#

in which case would you fail to address a lapic with id > 255?

#

or rather

#

when is that a problem?

eternal wharf
#

for >255 apics you need to use x2apic iirc

hoary cave
#

sending ipis works fine iirc

#

and i cant think of anything else

#

that too, yeah

cyan nexus
#

when you wanna have more than 255 irqs

hoary cave
near tartan
#

you wouldn't do that on one cpu anyways

#

that's stupid

eternal wharf
somber solar
hoary cave
#

yeah you wanna route to a cpu that's best suited to handle the interrupt

#

and if you use xapic you can't use some cpus

#

simple

cyan nexus
#

yeah, x2 apic is not really hard to support

#

it is even simpler to use

#

than normal lapic

hoary cave
#

both are lapic

cyan nexus
#

yeah

#

but i mean the prev version

near tartan
#

so it's safe to assume the x2apic is present if i have that many logical cores

cyan nexus
#

ye

somber solar
#

yes

hoary cave
#

you dont have to assume

near tartan
#

because i don't have an x2apic on this machine meme

hoary cave
#

you can check

cyan nexus
#

i hope

#

it would be stupid to not have it

hoary cave
#

some machines it's might even be enabled by default

somber solar
cyan nexus
#

can you even disable it?

hoary cave
#

no

near tartan
#

bios

cyan nexus
#

bios can?

hoary cave
#

once it's enabled you can't disable it

#

it's a cpu feature, maybe the firmware has some way to mess with it to disable it

#

but i doubt any board actually lets you

#

that's dumb

cyan nexus
#

but probably very rare

near tartan
#

my asrock am5 board lets you

hoary cave
#

thats crazy

#

i wonder if it's documented

somber solar
#

crazy? I was crazy once

cyan nexus
#

maybe bc nobody thinks that a consumer cpu can have 256+ cores

#

lol

hoary cave
#

what

near tartan
#

yea

cyan nexus
#

or is the am5 server?

near tartan
#

am5 is consumer

cyan nexus
#

oh ok

near tartan
#

no am5 cpu can do more than 32 logical cpus

#

not even the epycs

hoary cave
#

common amd L

near tartan
#

is this /gen

#

πŸ’€

hoary cave
#

idfk what that means bruh

#

speak like a human being

near tartan
#

are u fr

hoary cave
#

πŸ’€

#

idk

#

im an intel shill

#

but im mostly fucking around

near tartan
#

bc intel doesn't have that either

hoary cave
#

spreading misinformation

#

yeah but

#

nova lake

#

big revolution

near tartan
#

shit lake

hoary cave
#

coming in summer 2026 !!!

near tartan
#

(no bios)

hoary cave
#

at least it'll have 52 cores

cyan nexus
#

seems like only inter consumer has 32 thread with 24 phys cores

#

for now

marble salmon
#

Hmmm

#

This system has more than 256 gsis, we may not support that

#

CC @eternal wharf

eternal wharf
#

ah hmmm

marble salmon
#

I wonder if it overflows the gsi vector

cyan nexus
#

the vector should be u8

#

so prob

eternal wharf
#
kernel/thor/arch/x86/pic.cpp
730:void setupIoApic(int apic_id, int gsi_base, PhysicalAddr address) {
741:            globalSystemIrqs[gsi_base + i] = pin;
#

this smells bad

#

globalSystemIrqs is sized to be 256 entries long

#

i wonder if we write past the end of it and end up corrupting the globalIrqSlotsLock object

hoary cave
#

is globalSystemIrqs a static array?

eternal wharf
#

yes

hoary cave
#

doesn't thor have ubsan anyway?

#

it should catch that

eternal wharf
#

not enabled by default

hoary cave
#

ah

#

that's fair honestly

distant cypress
#

technically it doesn't make sense for it to be an array, because there might be hardware with IOAPIC 0 on GSI0...23 and IOAPIC 1 on GSI1337420...1337499

#

although this is very unlikely

marble salmon
#

yeah i think this assumption doesn't make sense

#

I may have done that because I assumed that all IRQs should be routable to a single CPU but that's not really a reasonable assumption

distant cypress
#

this is a struct irq_pin_or_whatever * array?

marble salmon
#

yeah this maps ACPI GSI numbers to our IRQ struct

distant cypress
#

yeah so just a map<uint32_t, IRQ *> or something would probably work

marble salmon
#

true

distant cypress
#

or it can be optimised by grouping together GSIs that belong to the same IOAPIC or are otherwise contiguous

marble salmon
#

that's not necessary, this is not on a hot path

distant cypress
#

yeah

marble salmon
#

it's only used during configuration, not during IRQ handling

#

we should also move this from x86 specific to acpi code (such that we can enable acpi on aarch64 and riscv64)

#

who wants to do the work? :^)

distant cypress
marble salmon
#

well, this system apparently has 9 I/O APICs

cyan nexus
#

216 irqs

#

cool

distant cypress
#

and they are probably assigned to GSIs 0-23 24-47 48-63 etc.

marble salmon
distant cypress
cyan nexus
#

cool

#

i tought ioapics only had 24 pins

distant cypress
#

you read it from IOAPIC_VER iirc

#

what do you even need 280 GSIs for now that there's MSI?

cyan nexus
#

i read them like this

near tartan
#

it's crazy i have no idea what this is about

#

need to learn

#

in the meanwhile i figured out the dead ram stick

cyan nexus
#

gg

near tartan
#

512 gigs now

#

im installing opensuse and then we test an llvm compile

#

the idle temps are actually insanely good

#

33C according to btop

#

which is perfect for my homelab

cyan nexus
#

meanwhile me with a mini pc as a server

#

lol

near tartan
#

actually

#

ill finish vfs stuff

#

then i can look into smp

#

when i have smp i should also look into initgraphs

#

instead of throwing every init function in the same init array

#

oh god initgraphs in rust

hoary cave
#

not fun

near tartan
#

idek how to start doing that

cyan nexus
#

initgraphs?

near tartan
#

what @somber solar and managarm use for init

hoary cave
#

look at managarm

cyan nexus
#

ah ok

hoary cave
#

initialization is done using a graph

near tartan
#

which is fucking cool tbh

hoary cave
#

instead of good ol init_a(); init_b(); init_c();

#

it's not fun at all to do in rust btw

#

i tried

#

maybe i am retarded but i could not get it done lol

#

of course not without allocating

#

or unsafe

marble salmon
#

Hm

cyan nexus
#

maybe by preallocating the steps?

marble salmon
#

yeah it probably needs unsafe

hoary cave
#

that makes no sense

marble salmon
#

to emulate [[constructor]]

hoary cave
#

in rust the issue is the backlink from node to engine

#

that's a cyclic reference

#

i was basically tying to rewrite managarm initgraph tho

marble salmon
#

Cyclic &'static refs are fine though

hoary cave
#

hm, i tried doing non-static lifetimes

#

maybe thats my issue

marble salmon
#

that sounds like pain

hoary cave
#

it is lmao

#

i cant do 'static though

#

unless i have a global instance of the engine

#

again, idk what the proper terminology is or what that means exactly

#

just using managarm initgraph terms

marble salmon
#

that's what Managarm does though

hoary cave
#

oh really?

#

i must have been blind then

#

it makes sense tbh

#

and i was definitely blind

#

it's passed through the constructor

#

so it has to be global

distant cypress
#

it should be possible and relatively easy to parse the source code for initgraph declarations and emit calls to them using an external tool, no?

hoary cave
#

why though

marble salmon
#

in C++ you could also use a non-global one but doing that in Rust would add a lot of complexity

distant cypress
hoary cave
#

managarm doesn't allocate either

marble salmon
#

if i wanted to do this in Rust I'd probably write a macro that emits whatever unsafe code you need to put a ctor into .init_array

#

for each init graph task

#

such that it can register itself with the engine

near tartan
near tartan
#

i thought all graph nodes are a comptime element

hoary cave
#

i think a macro is nice either way, so you can do stuff like menix::init_stage!("x86:discover-lapic", || { // ... });

#

or just a function as the 2nd arg works too

hoary cave
#

but how do you reference other stages with this

#

hmm

near tartan
#

by string would be braindead

hoary cave
#

yeah obviously

#

you need a static reference to it

near tartan
#

maybe identifier?

hoary cave
#

i think so yes

eternal wharf
#

proc macro to turn the string into a ref to the stage object

near tartan
#

🀒

#

then you could just mark a function as init stage

#
menix::init_stage!("x86:discover-lapic", &[memmap_ready], lapic_ready, || /*...*/);
#

something like this?

hoary cave
#

that's not how that works

near tartan
#

wdym

hoary cave
#

or you could make it work like that

near tartan
#

2nd arg would be requires and 3rd entails

#

i think

#

idk

hoary cave
#

interesting

near tartan
#

shit

#

i need to hurry up

#

need to be the first rust os

eternal wharf
#

first rust os to have a gui

near tartan
#

TRUE

#

crazy that until now there wasnt a single kernel with x11

eternal wharf
#

rust kernel*

near tartan
#

yea

#

okay let me lock in

#

i need to wire the vfs stuff now

near tartan
#

when i mount a FS, should that mount on a dentry or an inode πŸ€”

vast lotus
#

dentry imo

near tartan
distant cypress
#

you mount a filesystem on a path

#

the mountpoint is a path

#

you can have e.g. the following:

  • fs1 mounted on /media/a and /media/b
  • fs2 mounted on /media/a/foo
    a lookup in /media/b/foo will not resolve to a path within fs2
#

(and the path consists of parent mount and dentry)

nocturne rampart
near tartan
#

i fiorgot

idle flower
#

Rust has the petgraph crate for graph structures

near tartan
#

tbh i prefer writing my own

nocturne rampart
near tartan
#

they don't have the stack for it

#

before they had their own weird protocol

nocturne rampart
#

Yeah

#

And they are implementing x11 inside their window server

#

So why not implement wayland instead?

near tartan
#

they have their own window server?

nocturne rampart
#

X11 support has begun to be implemented within the Oribtal display server so that X11 apps will be able to work gracefully on Redox without display-related changes.

#

Read the article

near tartan
#

i missed that

nocturne rampart
#

They're implementing x11

#

Not porting xorg

near tartan
#

wtf

nocturne rampart
#

Which is why I had the doubt why not implement wayland instead?

near tartan
#

makes sense

#

anyways

#

ill port xorg

nocturne rampart
#

Menix should run Weston /s

near tartan
#

i mean

#

why not

#

i plan to do drm + sysfs anyways

nocturne rampart
#

Though isn't there a wayland compositor for bsds that doesn't on drm and epoll?

near tartan
#

and all the weird fd's that i need

#

bsd has drm

fair lintel
#

eventfd is easy

near tartan
#

is that all?

#

i keep forgetting what weston needs

fair lintel
#

I signalfd should be easy with a reasonable implementation of signals

nocturne rampart
fair lintel
#

I forgot what else it needs

nocturne rampart
#

Ok so signals as well

near tartan
#

well duh

#

you should have signals either way

nocturne rampart
#

Probably I'll do that after networking

near tartan
#

netlink

#

fun

nocturne rampart
#

Yeah

#

Oh another thing

#

Did they implement Unix sockets?

near tartan
#

probably

#

would we super weird if they hadnt

nocturne rampart
#

Now I'm curious how their inhouse window manager work

#

Like what ipc mechanism

prime seal
near tartan
#

it's a joke reference

prime seal
#

oh

#

sorry

#

oh wait

#

is it to that one post

#

in r/osdev?

near tartan
#

yes

prime seal
#

ah

near tartan
#

@vast lotus following #x86 , so are IRQs always known beforehand and the controller maps the handler internally?

vast lotus
#

you mean the index parameter in open? that's pretty much just an opaque value whose meaning is IRQ controller dependent

#

on a pic controller it'd be the pin number which is known at compile time for most devices

#

on a PCI controller it'd be A/B/C/D which you get from the PCI header

#

etc

near tartan
#

neat

#

then i think i understand it

#

my open should probably return an Arc<Interrupt> which gets dropped if the device handling it is dropped

nocturne rampart
#

You need drm to be implemented

near tartan
#

duh

nocturne rampart
#

Some programs use the fd pulled from wayland for that

near tartan
#

did they respond to you on xitter

nocturne rampart
#

No but Tristan did

near tartan
#

damn

nocturne rampart
near tartan
#

this is the stupidest issue i've come across so far

#

fixed by doing this

near tartan
#

if i'm creating an inode, which has no idea of its own name, how does a filesystem record its file name?

somber solar
#

filesystem can store that name if it wants to

near tartan
#

hm

eternal wharf
#

you link the inode into a directory at a later time :^)

near tartan
#

what later time

eternal wharf
#

i mean you have a separate link operation that links it in

#

both for the initial link and extra hard links

somber solar
#

ah I misunderstood

near tartan
#

oh so when i do e.g. mknod i first run create_inode and then link_inode

#

and link_inode gets passed the name?

somber solar
#

what's the point of that?

near tartan
#

well inode has no idea what its name is

#

idk if that's right

#

and inodes also have no reference to a dentry

somber solar
#

yes so that's why you pass the name during creation

#

link() has no idea of vnode/dentry either

#

because it works on inodes

near tartan
#

im confused

eternal wharf
#

i mean idk what your idea is but in managarm you first create a unowned inode that you then link into a particular directory

hybrid island
# near tartan

This is because using an arc with the explicit type does not use the trait vtable, only has struct pointer under the hood

somber solar
#

rust

somber solar
#

confuzzled

near tartan
#

like

#

i need a code example for example for tmpfs

somber solar
#

ilobilix :P

hybrid island
#

BadgerOS also has working tmpfs with sym- and hardlink support too

near tartan
somber solar
#

everyone's design is different

near tartan
#

yes but iirc you always connect a vnode to an inode

somber solar
#

yes

near tartan
#

@eternal wharf where in managarm would i find tmpfs?

eternal wharf
#

posix-subsystem

zealous salmon
#

ig ontologically the inode is separate from the dirent

somber solar
#

it is, but what use is there for inode that doesn't do anything?

zealous salmon
#

but ig usually when you're creating something, you want to link it immediately anyway

hybrid island
#

BadgerOS basically just says inode management is the filesystem's problem

somber solar
hybrid island
#

All it does is make sure the same one will not be opened more than once at a time

#

(from the FS driver perspective)

near tartan
#

the vfs doesn't concern itself with inode management

hybrid island
#

It's a bit wacky with the dirents though

eternal wharf
#

managarm doesn't have much of a distinction between inodes and vnodes since stuff is done via inheritance in posix-subsystem

marble salmon
#

inode == vnode

near tartan
#

really?

marble salmon
#

Doesn't vnode just refer to the in memory representation of an inode?

near tartan
#

no

#

a vnode is a cached entry which stores parent, name and children

modern hamlet
#

It can be slightly more than that but that's what I was pretty sure it is

near tartan
#

yes

modern hamlet
#

parent? children?

#

that feels like youre talking about a directory entry

marble salmon
#

That's a "link" in Managarm's language and on linux it's called a dentry

near tartan
#

the in memory representation of an inode is what i call INode

hybrid island
#

technically inode is on-disk and vnode is in-memory

near tartan
#

ah

#

well then i have vnode and dentry

marble salmon
near tartan
#

but using linux terms it's inode and dentry

hybrid island
marble salmon
#

ah true

hybrid island
#

This many OSDV's is a beautiful sight

near tartan
#

yes

#

bruh

hybrid island
#

whuh

#

why tag gon

magic charm
cyan nexus
hybrid island
#

Because they changed it

cyan nexus
#

oh XD

#

so it disappears when they change it

near tartan
#

I think this is a decent init graph structure

nocturne rampart
#

@near tartan Redox implemented Unix sockets partially

idle flower
marble salmon
#

probably graphviz

mental tinsel
#

could it perhaps be possible to find symbols by literally parsing the executable from the filesystem and looking for the symbol at an address because I think it would be really funny to do that for panic traces once I have a working filesystem driver for iso9660

vast lotus
#

i mean yeah but why not use the executable image that's already in memory for that

#

you can just tell the linker to put the symbol table in an allocated section

mental tinsel
#

understandable, I will attempt both for the meme tho

vast lotus
#

realistically the biggest issue (other than that there's a far more practical and easier solution) with the filesystem approach is that you want your panic code to be as simple as possible so you don't get recursive panics

near tartan
#

you can look at menix in this case

#

i do that

#

see kernel.ld

mental tinsel
#

alrighty πŸ‘πŸ‘

near tartan
#

turns out my percpu data logic was broken