<geist>
for zircon we have gp -> current cpu *, tp -> curren thread *
<heat>
ah
<heat>
that's cute
<geist>
but we do the tp that way for another reason: we're using some stack guard stuff and the compiler *mandates* that tp point to the current TLS stuff
<geist>
so we couldn't reuse TP for anything else anyway
<geist>
could hang a pointer to the current cpu off the current_thread structure though, if we had a use for GP
<geist>
but it'd be another indirectino, etc
<geist>
that's what i have it do in LK, and am currently trying to actually use GP for small data
<geist>
figured for embedded riscv things SMP isn't a thing so may as well make GP useful there where small data may actually be more valuable
<heat>
do you know if there's a way to smartly transform ld offset(tp) into more complex insn sequences when required?
<bslsk05>
www.youtube.com: Using an Out-of-Control Car to Calculate π. - YouTube
<geist>
i dunno, depends on what you mean by standard
<heat>
at least linux does not do any of that trickery
<heat>
current is current, period
<geist>
yeah
<geist>
the key is you need to arrange for any preemption in the middle to not mess up getting to the current thread
<geist>
so either current thread is held directly in a register, or in this case it's exactly one instruction to look it up, so can't be broken
<geist>
snce current thread is always current thread, even if you got preempted and moved to another cpu anywhere in it it's safe
<heat>
in what case do you care about doing this atomically?
<geist>
of course reading current cpu is instantly out of date if it takes more than one instruction to read something off it
<geist>
well, since TP points to the current cpu you have to assume that effectively the TP register can change out from underneath the current thread at any time, unless preemption is disabled
anbdummy has quit [Quit: WeeChat 3.8]
<geist>
between any two instructions the TP register could switch to another cpu transparently because of preemption
<heat>
oh, right
<linear_cannon>
mjg, wow, so adding a thread cuts performance in half?
<geist>
but in this case since field 0 of the current cpu structure must always point to current threa,d it's safe to `ld current_thread, 0(tp)` because the invariant is maintained that it's always the current cpu
<linear_cannon>
or worse, if on different sockets
<heat>
yep
<geist>
but if you did something like `mv r0, tp; ld current_thread, 0(r0)` then you'd be in trouble
<mjg>
linear_cannon: ye it's not good
<geist>
since you're instantly looking at a stale cpu pointer
<geist>
thus i wrote that as inline asm in one instruction so that it can't be broken
<geist>
but anyway you can probably just as easily point TP at the current thread, and read the current cpu * off it, and then just maintain that
<heat>
yeah so my pcpu implementation right now is slightly broken
<geist>
either has their advantages and disadvantages
<heat>
good to know
<geist>
yah, aid *if* you store a per cpu pointer in a register, then you have to make sure you dont reload it on exceptions
<geist>
because think of it this way: if you save it on exception entry and then go and run some code and the thread is blocked and comes back on another cpu and exits, restoring the wrong per cpu pointer from the iframe... boom
<geist>
(i hgave personally written that bug before and spent a day debugging it)
<heat>
yeah generally most of code similar to that really does need to be preempt_disable()'d
<heat>
or at least migration_disable'd
<geist>
yah
<geist>
in general most of the data on the percpu struct is one off fields that you can safely read or write in one instruction
<geist>
like getting the current number
<heat>
yep
<heat>
funnily enough linux doesn't seem to give much of a shit here
<heat>
they seem to do optimized inline asm on x86, arm64, loongarch
<heat>
the rest uses plain C
<mrvn>
linux doesn't migrate threads to different cores often
<mrvn>
maybe they only do that outside preemption?
Starfoxxes has quit [Ping timeout: 260 seconds]
ilovethinking has quit [Quit: Connection closed for inactivity]
skipwich has quit [Quit: DISCONNECT]
skipwich has joined #osdev
Starfoxxes has joined #osdev
<geist>
yeah i was reading the glibc riscv string, and it uses the C version
<geist>
seems to be basically as good of a job as can currently do in asm really
<geist>
given current hardware and not using vectors, etc etc
<geist>
at least with GCC as the compiler. i dont trust clang to generate good enough code from the C
<gog>
hi
dude12312414 has quit [Remote host closed the connection]
<mrvn>
geist: Kind of makes you want an "compare ptr1 and read ptr1[offset]" atomic op.
<mrvn>
.oO(I'm so happy about not scheduling inside the kernel)
morgan has joined #osdev
<moon-child>
what do you want that for?
nyah has quit [Quit: leaving]
<heat>
geist, oh I meant inline asm in the percpu var stuff
<heat>
although yes, riscv is still pretty unoptimized
<heat>
I think linux (the kernel) recently got some new stringops stuff for a new extension that got ratified recently
<heat>
gog: bog
heat has quit [Remote host closed the connection]
heat has joined #osdev
craigo has quit [Ping timeout: 250 seconds]
<kof123>
ACTION stares up at chat log "quad-processor pentium 3 systems. i want one" im not sure if it was pentium 3, but i think that was the -march i used, intel sc450nx, 4x500 mhz IIRC, i think i had 1-2G ram maybe? nothing special about that, but they did/do exist "big square box with quad cpus in it" yes, i had a little cage...it had dual PSUs (for backup, not needed) ...6 or so scsi sleds/slots for drives i also had 2x hp r
<kof123>
mount something, were like 2x700 mhz, 768M ram, 2 scsi drives
<kof123>
not a huge deal maybe, but "server" stuff you could hot-swap drives. these were "server" systems
valshaped has quit [Read error: Connection reset by peer]
valshaped has joined #osdev
zaquest has joined #osdev
slidercrank has quit [Ping timeout: 248 seconds]
robem has quit [Ping timeout: 255 seconds]
morgan has quit [Read error: Connection reset by peer]
gildasio1 has quit [Remote host closed the connection]
jcmdln has quit [Ping timeout: 246 seconds]
gildasio1 has joined #osdev
Irvise_ has quit [Ping timeout: 246 seconds]
sakasama has quit [Ping timeout: 264 seconds]
novasharper has quit [Ping timeout: 264 seconds]
yuriko has quit [Ping timeout: 265 seconds]
sham1 has quit [Ping timeout: 246 seconds]
halsey has joined #osdev
raggi has quit [Ping timeout: 246 seconds]
chibill has quit [Ping timeout: 256 seconds]
ggherdov has quit [Ping timeout: 265 seconds]
selfsigned has quit [Ping timeout: 265 seconds]
ebb has joined #osdev
ggherdov has joined #osdev
justache has joined #osdev
gildasio1 has quit [*.net *.split]
gxt__ has quit [*.net *.split]
foudfou has quit [*.net *.split]
Vercas has quit [*.net *.split]
gabi-250_ has quit [*.net *.split]
foudfou has joined #osdev
gxt__ has joined #osdev
Vercas has joined #osdev
gabi-250_ has joined #osdev
gildasio1 has joined #osdev
AmyMalik has quit [*.net *.split]
jstoker has quit [*.net *.split]
hl has quit [*.net *.split]
Avaflow has quit [*.net *.split]
Bitweasil has quit [*.net *.split]
mcfrdy has quit [*.net *.split]
elastic_dog has quit [*.net *.split]
corecode has quit [*.net *.split]
V has quit [*.net *.split]
puck has quit [*.net *.split]
kristinam has quit [*.net *.split]
nohit has quit [*.net *.split]
basil has quit [*.net *.split]
mjg has quit [*.net *.split]
klys has quit [*.net *.split]
linkdd has quit [*.net *.split]
Vercas has quit [Max SendQ exceeded]
AmyMalik has joined #osdev
hl has joined #osdev
Bitweasil has joined #osdev
Avaflow has joined #osdev
mcfrdy has joined #osdev
jstoker has joined #osdev
kristinam has joined #osdev
mjg has joined #osdev
klys has joined #osdev
puck has joined #osdev
elastic_dog has joined #osdev
nohit has joined #osdev
basil has joined #osdev
V has joined #osdev
corecode has joined #osdev
linkdd has joined #osdev
elastic_dog has quit [Max SendQ exceeded]
mcfrdy has quit [Max SendQ exceeded]
AmyMalik has quit [Max SendQ exceeded]
jstoker has quit [Excess Flood]
mcfrdy has joined #osdev
knusbaum has quit [*.net *.split]
MuonNeutrino has quit [*.net *.split]
dragestil has quit [*.net *.split]
ornx has quit [*.net *.split]
SanchayanMaity has quit [*.net *.split]
gaze___ has quit [*.net *.split]
jstoker has joined #osdev
ghostbuster has quit [*.net *.split]
m5zs7k has quit [*.net *.split]
jbowen has quit [*.net *.split]
nj0rd has quit [*.net *.split]
pitust has quit [*.net *.split]
dequbed has quit [*.net *.split]
LittleFox has quit [*.net *.split]
tuxifan has quit [*.net *.split]
truepassion has quit [*.net *.split]
HeTo has quit [*.net *.split]
Arsen has quit [*.net *.split]
gmodena has quit [*.net *.split]
kklimonda has quit [*.net *.split]
nickster has quit [*.net *.split]
milesrout_ is now known as milesrout
dinkelha1 has quit [*.net *.split]
ptrc has quit [*.net *.split]
thinkpol has quit [*.net *.split]
tomaw has quit [*.net *.split]
manawyrm has quit [*.net *.split]
immibis has quit [*.net *.split]
ornitorrincos has quit [*.net *.split]
JTL has quit [*.net *.split]
sikkiladho has quit [*.net *.split]
bslsk05 has quit [*.net *.split]
Dreg has quit [*.net *.split]
jstoker has quit [*.net *.split]
\Test_User has quit [*.net *.split]
Benjojo has quit [*.net *.split]
corank has quit [*.net *.split]
ElementW has quit [*.net *.split]
stux has quit [*.net *.split]
sjs has quit [*.net *.split]
cross has quit [*.net *.split]
janemba has quit [*.net *.split]
bl4ckb0ne has quit [*.net *.split]
Mutabah has quit [*.net *.split]
netbsduser has quit [*.net *.split]
kkd has quit [*.net *.split]
danlarkin has quit [*.net *.split]
FireFly has quit [*.net *.split]
bleb has quit [*.net *.split]
kanzure has quit [*.net *.split]
CalimeroTeknik has quit [*.net *.split]
varad has quit [*.net *.split]
Bonstra has quit [*.net *.split]
dayimproper has quit [*.net *.split]
dennisschagt has quit [*.net *.split]
alexander has quit [*.net *.split]
randm has quit [*.net *.split]
divine has quit [*.net *.split]
brynet has quit [*.net *.split]
eschaton has quit [*.net *.split]
zhiayang has quit [*.net *.split]
DynamiteDan has quit [*.net *.split]
sauce has quit [*.net *.split]
TkTech has quit [*.net *.split]
woky_ has quit [*.net *.split]
gruetzkopf has quit [*.net *.split]
merry has quit [*.net *.split]
milesrout is now known as 042AAAG7M
knusbaum has joined #osdev
dragestil has joined #osdev
ornx has joined #osdev
gaze___ has joined #osdev
MuonNeutrino has joined #osdev
SanchayanMaity has joined #osdev
ghostbuster has joined #osdev
m5zs7k has joined #osdev
nj0rd has joined #osdev
Arsen has joined #osdev
LittleFox has joined #osdev
dequbed has joined #osdev
pitust has joined #osdev
jbowen has joined #osdev
gmodena has joined #osdev
HeTo has joined #osdev
tuxifan has joined #osdev
truepassion has joined #osdev
nickster has joined #osdev
kklimonda has joined #osdev
JTL has joined #osdev
ornitorrincos has joined #osdev
sikkiladho has joined #osdev
bslsk05 has joined #osdev
Dreg has joined #osdev
manawyrm has joined #osdev
tomaw has joined #osdev
immibis has joined #osdev
thinkpol has joined #osdev
ptrc has joined #osdev
dinkelha1 has joined #osdev
gdd has quit [*.net *.split]
sortie has quit [*.net *.split]
meisaka has quit [*.net *.split]
warlock has quit [*.net *.split]
mahk has quit [*.net *.split]
ZipCPU has quit [*.net *.split]
matthews has quit [*.net *.split]
k4m1 has quit [*.net *.split]
aws has quit [*.net *.split]
j`ey has quit [*.net *.split]
Stary has quit [*.net *.split]
DoubleJ has quit [*.net *.split]
particleflux has quit [*.net *.split]
Vercas has joined #osdev
sjs has joined #osdev
ElementW has joined #osdev
jstoker has joined #osdev
corank has joined #osdev
stux has joined #osdev
\Test_User has joined #osdev
Benjojo has joined #osdev
m5zs7k has quit [Max SendQ exceeded]
janemba has joined #osdev
cross has joined #osdev
bl4ckb0ne has joined #osdev
CalimeroTeknik has joined #osdev
Mutabah has joined #osdev
kkd has joined #osdev
danlarkin has joined #osdev
FireFly has joined #osdev
bleb has joined #osdev
varad has joined #osdev
netbsduser has joined #osdev
kanzure has joined #osdev
immibis has quit [Max SendQ exceeded]
JTL has quit [Max SendQ exceeded]
elastic_dog has joined #osdev
ElementW has quit [Max SendQ exceeded]
stux has quit [Max SendQ exceeded]
sjs has quit [Max SendQ exceeded]
Affliction has quit [*.net *.split]
valshaped has quit [*.net *.split]
heat has quit [*.net *.split]
skipwich has quit [*.net *.split]
CompanionCube has quit [*.net *.split]
Celelibi has quit [*.net *.split]
flx-- has quit [*.net *.split]
xenos1984 has quit [*.net *.split]
bauen1 has quit [*.net *.split]
froggey has quit [*.net *.split]
antranigv has quit [*.net *.split]
bnchs has quit [*.net *.split]
zid has quit [*.net *.split]
simpl_e has quit [*.net *.split]
arminweigl has quit [*.net *.split]
MaxLeiter has quit [*.net *.split]
jjuran has quit [*.net *.split]
frkzoid has quit [*.net *.split]
bliminse has quit [*.net *.split]
Bonstra has joined #osdev
dayimproper has joined #osdev
dennisschagt has joined #osdev
zhiayang has joined #osdev
divine has joined #osdev
randm has joined #osdev
alexander has joined #osdev
eschaton has joined #osdev
brynet has joined #osdev
DynamiteDan has joined #osdev
TkTech has joined #osdev
gruetzkopf has joined #osdev
merry has joined #osdev
woky_ has joined #osdev
sauce has joined #osdev
DynamiteDan has quit [Excess Flood]
cross has quit [Max SendQ exceeded]
ElementW has joined #osdev
m5zs7k_ has joined #osdev
sjs has joined #osdev
halsey has quit [Read error: Connection reset by peer]
Celelibi has joined #osdev
Affliction has joined #osdev
zid has joined #osdev
heat has joined #osdev
valshaped has joined #osdev
CompanionCube has joined #osdev
flx-- has joined #osdev
MaxLeiter has joined #osdev
bauen1 has joined #osdev
xenos1984 has joined #osdev
antranigv has joined #osdev
bnchs has joined #osdev
froggey has joined #osdev
skipwich has joined #osdev
simpl_e has joined #osdev
arminweigl has joined #osdev
frkzoid has joined #osdev
jjuran has joined #osdev
bliminse has joined #osdev
cross has joined #osdev
DynamiteDan has joined #osdev
jbowen has quit [Ping timeout: 256 seconds]
jbowen has joined #osdev
kkd has quit [Ping timeout: 252 seconds]
JTL has joined #osdev
kkd has joined #osdev
Ellenor has joined #osdev
sortie has joined #osdev
warlock has joined #osdev
ZipCPU has joined #osdev
k4m1 has joined #osdev
meisaka has joined #osdev
gdd has joined #osdev
mahk has joined #osdev
matthews has joined #osdev
aws has joined #osdev
Stary has joined #osdev
particleflux has joined #osdev
j`ey has joined #osdev
DoubleJ has joined #osdev
gdd has quit [Max SendQ exceeded]
m5zs7k_ is now known as m5zs7k
morgan has quit [*.net *.split]
k0valski18891 has quit [*.net *.split]
ThinkT510 has quit [*.net *.split]
SpikeHeron has quit [*.net *.split]
shikhin has quit [*.net *.split]
xvmt has quit [*.net *.split]
nur has quit [*.net *.split]
eck has quit [*.net *.split]
pieguy128 has quit [*.net *.split]
moberg has quit [*.net *.split]
nikolar has quit [*.net *.split]
grange_c0 has quit [*.net *.split]
dh` has quit [*.net *.split]
Jari-- has quit [*.net *.split]
wereii has quit [*.net *.split]
genpaku has quit [*.net *.split]
PapaFrog has quit [*.net *.split]
weinholt has quit [*.net *.split]
gdd has joined #osdev
ThinkT510 has joined #osdev
nur has joined #osdev
shikhin has joined #osdev
SpikeHeron has joined #osdev
moberg has joined #osdev
xvmt has joined #osdev
pieguy128 has joined #osdev
eck has joined #osdev
grange_c0 has joined #osdev
nikolar has joined #osdev
Jari-- has joined #osdev
wereii has joined #osdev
dh` has joined #osdev
k0valski18891 has joined #osdev
morgan has joined #osdev
genpaku has joined #osdev
weinholt has joined #osdev
PapaFrog has joined #osdev
nur has quit [Remote host closed the connection]
halsey has joined #osdev
gog has quit [Ping timeout: 276 seconds]
halsey has quit [Excess Flood]
sortie has quit [*.net *.split]
meisaka has quit [*.net *.split]
warlock has quit [*.net *.split]
mahk has quit [*.net *.split]
ZipCPU has quit [*.net *.split]
matthews has quit [*.net *.split]
k4m1 has quit [*.net *.split]
aws has quit [*.net *.split]
j`ey has quit [*.net *.split]
Stary has quit [*.net *.split]
DoubleJ has quit [*.net *.split]
particleflux has quit [*.net *.split]
sortie has joined #osdev
j`ey has joined #osdev
warlock has joined #osdev
meisaka has joined #osdev
aws has joined #osdev
particleflux has joined #osdev
Stary has joined #osdev
ZipCPU has joined #osdev
mahk has joined #osdev
k4m1 has joined #osdev
DoubleJ has joined #osdev
matthews has joined #osdev
bradd has joined #osdev
MrBonkers has joined #osdev
dove has joined #osdev
chibill has joined #osdev
jcmdln has joined #osdev
Arthuria has quit [Remote host closed the connection]
sham1 has joined #osdev
novasharper has joined #osdev
[_] has quit [Remote host closed the connection]
bgs has joined #osdev
vdamewood has joined #osdev
raggi has joined #osdev
heat has quit [Ping timeout: 248 seconds]
yuriko has joined #osdev
selfsigned has joined #osdev
sakasama has joined #osdev
Irvise_ has joined #osdev
jimbzy has quit [Ping timeout: 260 seconds]
nur has joined #osdev
<moon-child>
oh cute
<moon-child>
I just realised cmpccxadd can be used to implement both regular xadd and regular cas
<moon-child>
oh nvm, i thought cmpccxadd had weaker ordering, but seems like not. So not helpful there. Oh well
Affliction has quit [Quit: Read error: Connection reset by beer]
Affliction has joined #osdev
theboringkid has joined #osdev
GeDaMo has joined #osdev
theboringkid has quit [Ping timeout: 265 seconds]
wootehfoot has joined #osdev
Ellenor is now known as AmyMalik
theboringkid has joined #osdev
bauen1 has quit [Ping timeout: 248 seconds]
anbdummy has joined #osdev
slidercrank has joined #osdev
Raito_Bezarius has quit [Read error: Connection reset by peer]
Raito_Bezarius has joined #osdev
gog has joined #osdev
<lav>
hi gog
<gog>
hi lav
Affliction has quit [Quit: Read error: Connection reset by beer]
Affliction has joined #osdev
nyah has joined #osdev
bradd has quit [Ping timeout: 276 seconds]
Left_Turn has joined #osdev
halsey has joined #osdev
theboringkid has quit [Quit: Bye]
Left_Turn has quit [Ping timeout: 265 seconds]
johngammerson has joined #osdev
<johngammerson>
hey
<johngammerson>
quick question: if i boot an os using x86_64 qemu using -kernel with multiboot and then jump to long mode, it's considered a 64 bit os right?
johngammerson is now known as ilovethinking
<moon-child>
well, it's certainly not a 32-bit os
Left_Turn has joined #osdev
dennis95 has joined #osdev
theboringkid has joined #osdev
Left_Turn has quit [Ping timeout: 264 seconds]
wootehfoot has quit [Quit: Leaving]
<Mutabah>
ilovethinking: Why would it not be?... I guess it's a "32-bit" image, but the kernel runs in 64-bit mode after bootup, so it's a 64-bit kernel
theboringkid has quit [Ping timeout: 276 seconds]
eschaton has quit [Ping timeout: 246 seconds]
riverdc has quit [Ping timeout: 276 seconds]
riverdc has joined #osdev
eschaton has joined #osdev
bauen1 has joined #osdev
<mrvn>
If a long-mode kernel comes with it's own bootloader (16-bit), multiboot (32-bit) and limine (64-bit) clearly that then is a 16/32/64 kernel. :)
halsey has quit [Remote host closed the connection]
Left_Turn has joined #osdev
zxrom has quit [Quit: Leaving]
zxrom has joined #osdev
SpikeHeron has quit [Quit: WeeChat 3.8]
slidercrank has quit [Ping timeout: 246 seconds]
Left_Turn has quit [Remote host closed the connection]
Left_Turn has joined #osdev
theboringkid has joined #osdev
Left_Turn has quit [Remote host closed the connection]
Left_Turn has joined #osdev
Turn_Left has joined #osdev
SpikeHeron has joined #osdev
Left_Turn has quit [Ping timeout: 265 seconds]
Left_Turn has joined #osdev
Turn_Left has quit [Ping timeout: 265 seconds]
theboringkid has quit [Quit: Bye]
mahmutov has joined #osdev
mahmutov has quit [Client Quit]
[itchyjunk] has joined #osdev
wootehfoot has joined #osdev
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 264 seconds]
jimbzy has joined #osdev
theboringkid has joined #osdev
<gog>
hi
<zid>
hello gorg
<Ermine>
hi gog, may I pet you
theboringkid has quit [Read error: Connection reset by peer]
<gog>
yes
* Ermine
pets gog
* gog
prr
gareppa has joined #osdev
gareppa has quit [Remote host closed the connection]
frkzoid has quit [Ping timeout: 248 seconds]
ilovethinking has quit [Quit: WeeChat 3.8]
frkazoid333 has joined #osdev
Arthuria has joined #osdev
terminalpusher has joined #osdev
xenos1984 has quit [Ping timeout: 248 seconds]
xenos1984 has joined #osdev
Left_Turn has joined #osdev
Turn_Left has quit [Ping timeout: 265 seconds]
<zid>
nobody's said RUST in the past hour, where's heat today
<mrvn>
In Rust if you have a list, a set or map or something is there a way to remove an item from the container without first having to search it? Some kind of iterator or handle?
* zid
Cs gog rust
<gog>
c gog
<gog>
c gog rust
<gog>
rust gog rust
dennis95 has quit [Quit: Leaving]
<nortti>
mrvn: do you mean like, getting a &mut iterator and then mem:replace()ing it out of there?
<mrvn>
USB power sucks. I have a PSU with USB-C and USB-A outlet. I run my ARM on the USB-C outlet. But when I plug the TFT into the USB-A outlet power goes off and my SoC restarts.
<mrvn>
nortti: Say I have a thread "current_thread" and that dies. Now I want to remove the thread from the list of running threads. current_thread->running_handle.remove_from_list() or something.
eddof13 has joined #osdev
<nortti>
I presume the list of running threads is an intrusive linked list?
<mrvn>
I have no idea what Rust has. But an intrusive lists solves the problem easily.
<bslsk05>
rust-unofficial.github.io: Introduction - Learning Rust With Entirely Too Many Linked Lists
<netbsduser>
nortti: in all sensible kernels it probably would be
<mrvn>
nortti: If you have a non-intrusive list then the handle would be a pointer to the struct ListItem { ListItem *next, *prev, T *data; }; Going that way is a bunch harder to work with and wastes space. So hence my question what Rust has.
<nortti>
there is no built-in linked list support, but you can build your own like in C or C++
<mrvn>
there is no STL like cargo?
<nortti>
how do you mean?
<mrvn>
A standard collection of data types and algorithm everyone needs every day
<nortti>
there's core, alloc, std
<netbsduser>
mrvn: they are notoriously limited in rust
<nortti>
but those don't include linked lists because they are a very niche use case
<netbsduser>
for example the standard containers can't handle out-of-memory
<netbsduser>
they just abort
<mrvn>
well, the kernel panics so that isn't much different. :)
<bslsk05>
doc.rust-lang.org: CursorMut in alloc::collections::linked_list - Rust
<mrvn>
std::collections::linked_list and alloc::collections::linked_list seem to be pretty identical
<danlarkin>
yeah the one is std is an import of the one from alloc iirc
<mrvn>
nortti: more like IterMut::take(1)
<danlarkin>
like they're not just identical, they're the same thing
<netbsduser>
mrvn: my init system does not, and the kernel also shouldn't panic if i asked for a fallible allocation
<mrvn>
A cursor would advance to the next and you just want to remove the current from the list.
<netbsduser>
my last foray into rust i was working on a service manager (or "init system") and i had to abandon the language for this reason
<nortti>
a bit surprised these don't seem to have a allocating functions that return Result<(), _> instead of aborting
<nortti>
pretty sure vector has those for example
<netbsduser>
while C++ signals an exception and leaves things consistent if it fails to allocate, the rust panics if an allocation fails. the C++ people must be having a laugh at how silly this is
<mrvn>
netbsduser: the user side malloc fails gracefully but if you are somewhere deep inside the kernel functions and allocation fails things generally go BOOM. Kernels generally keep a bit of memory reserved for internal use so that internal alloc never runs out.
<nortti>
netbsduser: can't you do equivalent of what c++ does if you set panics to unwind?
<nortti>
since aiui one of the invariants is that unwinding leaves stuff in a consistent state
<netbsduser>
mrvn: in my case it is 512kib i keep reserved (i take no chances)
<mrvn>
nortti: that only works if the container only ever does one alloc at a time and does that before any change to the container.
<nortti>
hm?
<netbsduser>
nortti: reportedly rust panicking needs to further allocate & in any case the containers abort rather than panic on OOM
<nortti>
oh okay
<netbsduser>
it's what drove me away from rust
<mrvn>
Can one write an intrusive container in Rust? Can an object belong to multiple intrusive containers (even of the same type)?
<danlarkin>
you can write any data structure you want, the only limit is your patience for unsafe code
<mrvn>
danlarkin: obviously I mean without unsafe.
vaartngvirf has joined #osdev
<nortti>
if you reject using unsafe, then no
<mrvn>
if I use unsafe I might as well just write C
<danlarkin>
that's not obvious at all, a rust kernel will necessarily have some unsafe code
slidercrank has joined #osdev
<mrvn>
danlarkin: If you need unsafe to implement List then that's a fail.
<danlarkin>
shrug
<nortti>
why?
<zid>
rust is designed around very explicit ownership and stuff
<nortti>
that's like saying, if you need non-smart-pointers to implement List, that's a fail, for C++
<zid>
hardware disagrees
<mrvn>
nortti: and it is. you don't need non-smart-pointers to implement List.
<mrvn>
nortti: you might want to and you can. But you are not required to.
<nortti>
wait, you can implement a bidirectional intrustive linked list in c++ using refcounted pointers, without memory leaks?
<mrvn>
nortti: a shared_ptr and a weak_ptr
<nortti>
hm. you might actually be able to implement something similar in rust safely using stuff like Rc<> and RefCell<>. unsure if you can get all the lifetimes to nicely match up
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<nortti>
well, you can if you use a backing arena to allocate them
<mrvn>
nortti: A weak_ptr doesn't keep the object alive but gets notified when the object gets removed. So I'm guessing weak_ptr are themself in a doubly linked list owned by the shared_ptr proxy object.
<mrvn>
Or they are ref counted by the proxy object and that remains behind till the last weak_ptr dies.
<heat>
so I noticed it scaled DOWN like 100x so I added spinning
<heat>
now it scales meh
eddof13 has joined #osdev
<sakasama>
sham1, gog: The singleton pattern resolves an issue with undefined global initialisation order between translation units in C++, and in that context it's sensible.
<sham1>
And to that I say that not every language is C++
<sakasama>
Java coders later adopted it, oblivious to that requirement, and popularised it as merely a way to enforce having a single instance.
<mjg>
heat: unlink is meh-ey think to bench
<mjg>
heat: anyway i like that you discovered benefits on not going straight to sleep
<heat>
i'm not sure how much of it is just my scheduler sucking
<sakasama>
sham1: Yes. It should never have been so readily adopted for other languages.
kanzure_ is now known as kanzure
<heat>
mjg, does unlink ever scale? maybe when doing RCU on that?
<mjg>
yes and no
<mjg>
first unlink of what
<mjg>
currently everyone that i know of has unlink serialized on the directory vnode, at least
<mjg>
but without naming names, unlink from *different* dirs will also serialize in certain case
<mjg>
it can be made to mostly scale by range-locking, but i don't know if it is of practical use
<mjg>
as in i have not ran into a real workload which unlinks enough for this to be a problem
<mrvn>
mjg: 2 users deleting files?
<heat>
also do note that currently my spinning is completely based on good vibes and inshallah
<heat>
it's entirely possible the thread fucks off and gets unmapped and I get egg on my face
dormito has quit [Quit: WeeChat 3.6]
vaartngvirf has quit [Quit: vaartngvirf]
SpikeHeron has quit [Quit: WeeChat 3.8]
SpikeHeron has joined #osdev
<mrvn>
sakasama: I just define initialization priorities by hand in an enum.
CalimeroTeknik has joined #osdev
dormito has joined #osdev
<sakasama>
mrvn: If interdependent globals can be placed in a single unit so that order is well-defined, even better.
<mrvn>
sakasama: if they can not be ordered then the singleton initialization would deadlock.
<heat>
if you look at the BGRT data it's just a plain .bmp
<zid>
so time to hex edit it, then reflash firmware?
<heat>
could work brilliantly, could brick your mobo
<zid>
I guess it might actually be compressed and it unpacks it to that memory at POST
<zid>
so I might not be able to edit it
<heat>
a good chunk of firmware volumes are completely compressed
<zid>
• Major vulnerabilities updates, customers are strongly encouraged to update to this release at the earliest.
<zid>
Credits to "Assaf Carlsbad and Itai Liba from SentinelOne"
<zid>
should I install this bios rev
<zid>
might lock me out of doing fun stuff to my own machine!
<heat>
yes
<zid>
`1 x Q-Flash Plus button`
<zid>
I don't know how this works on AMD
<zid>
I have two bios chips though and I can swap between them, that's handy
<heat>
geist, btw cool cool ping me if you want some eyes on it
<heat>
just testing on qemu or did you manage to boot it on your riscv board?
<geist>
kk. the cguts are pretty close to LK, since the core underlying architecture is
<geist>
qemu
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
elastic_dog is now known as Guest3666
Guest3666 has quit [Killed (osmium.libera.chat (Nickname regained by services))]
elastic_dog has joined #osdev
brunothedev has joined #osdev
<brunothedev>
let me test something here
<heat>
no
<zid>
no
<heat>
theend.
<brunothedev>
the message was the test, #gentoo is giving me a weird message
<brunothedev>
so i tested here, on another libera.chat chatroom
<lav>
The weird message is that you're quieted I think
<heat>
hahahahahahaha
<brunothedev>
lol
<zid>
does not surprise
<bnchs>
lav: you wouldn't quiet someone
<bnchs>
you would kickban them
<lav>
I would?
<zid>
lav: I did not know this about you
<zid>
how come he knows but we didn't
<brunothedev>
i am not angry, just deceptioned
<bnchs>
because i know
<bnchs>
brunothedev: new word unlocked: deceptioned
slidercrank has quit [Ping timeout: 246 seconds]
<brunothedev>
bnchs: there is a similar phrase in portuguese
<heat>
poortuguese moment
<brunothedev>
heat: brazilian here btw
<heat>
poorbraziliantugese moment
<brunothedev>
just say "luso" by this point
<heat>
argentina moment
bauen1 has joined #osdev
bgs has quit [Remote host closed the connection]
<brunothedev>
"#gentoo: Cannot send to nick/channel", i think if i was quieted, the channel would receive the message, should not talk about his here though
<lav>
Nope, that's what you get when you're +q
<bnchs>
brunothedev: or maybe when you're kicked
<lav>
If you do `/mode #gentoo q` you're right at the top of the list (:
<bnchs>
lol what did brunothedev do to earn this quiet
<geist>
huh. thats lame
<geist>
maybe they do a quiet by default and then unquiet if you talk to them?
<lav>
Nope don't think so
<brunothedev>
lemme see the date which they quieted me
<lav>
the dates are all in 1970 lol
<lav>
for me at least >_>
<geist>
maybe it got imported from freenode or something
<geist>
and thus has a epoch date
<lav>
ah that'd make sense
<sortie>
Sometimes osdev just boils down to writing that super specific and complex function from POSIX with an efficient and semantically correct algorithm that makes various implementation tradeoffs. :)
<brunothedev>
lol, i got quited on 11:00 on this date, i made some jokes yesterday, tho, my last messages was some questions
<lav>
brunothedev: 15:13 UTC today
<brunothedev>
lav: for me it is 18:44
<lav>
huh
<geist>
sortie: yeah if nothing else it's really educational. at least in as much as knowing intracacies of posix is helpful
<lav>
actually it's 14:13 utc for me
<sortie>
geist, yeah I just implemented glob(3) and my shell skills did improve :)
Vercas has quit [Ping timeout: 255 seconds]
<brunothedev>
i made such jokes as: "if (gentoo.love == 1) printf("me love gentoo!\n");
<lav>
tbh you were trolling
<brunothedev>
lav: what ur time zone?
<geist>
woot
<lav>
and gentoo peeps are brutal
<lav>
just be glad it wasn't -chat
<geist>
reminds me, the other day i learned whatever the ctrl trick is to get bash to glob stuff on the command line, but already forgot it
<geist>
but there's some trick you can do to get it to expand it live
<sortie>
geist, sometimes it's also just nice in its own right to write that standard library algorithm
<brunothedev>
lav: tho why they banned the other day?
<lav>
geist: on zsh that's just called tab
<geist>
yah, most shells hve their own thing for it
wootehfoot has quit [Quit: Leaving]
<lav>
brunothedev: idk ask them
<geist>
i'd actually be a little annoyed if it was tab per se, that's a bit too easy to trigger
<geist>
actually one that'd be nice is 'toggle glob'
<geist>
ie, expand, to see what it'll do, then hit it again to go back to *
<brunothedev>
did they got angry at mine: "just did 'mount --rbind /sys /mnt/gentoo' pls help" ?
<lav>
well you can C-x u I suppose
<brunothedev>
lesson learned: Dont make bad jokes while bored building the gentoo kernel
<lav>
make them here instead
<brunothedev>
lav: i already made some troolsusing /part
<lav>
or in #windows
<brunothedev>
imagine being #windows at libera.chat
<brunothedev>
gonna drop a cool /part message at #windows
<geist>
brunothedev: i'm gonna guess they just did it on accident
<geist>
you could try to ask one of the ops
<zid>
gentoo is heavily moderated
<zid>
you're supposed to ask your question and go away
<brunothedev>
zid: i thought it was just like the void linux chatroom, this was my first time with irc and it was FUN
<geist>
i have no idea if zid is making that up or not
<lav>
nope
<geist>
ah so maybe it's a standard policy to voice everyone after they ask a question?
<lav>
nah, it's just they really don't like trolling
<lav>
it's a serious business kinda chan
<brunothedev>
the last message i see: "ready to wreck clean a system again lol?"
<geist>
i guess they've experienced in the past that if they dont lock it down it just turns into complete noise
<geist>
maybe there's a -discuss channel
<lav>
there's gentoo-chat
<brunothedev>
gentoo users is the kind of people to see a IRC channel about gentoo and think "seriouus bisness"
<lav>
they have crap moderation but in another way
<brunothedev>
boredom always leads to bad things
<heat>
irc channels are all usually more seris bizns than #osdev
<heat>
for better or worse
<geist>
does remind me, i should try a gentoo install w/systemd. not my favorite thing, but it's clear that its harder and arder to keep from using it
<brunothedev>
geist: what are your problems with openrc
<geist>
none, i love openrc
<brunothedev>
u saying it is "harder and harder" to not use systemd? Package support?
* geist
nods
<heat>
because systemd is objectively better and upstream packages usually only support systemd
<geist>
yah, objectively, not subjectively (from my point of view) but it's getting harder to ignore it
<geist>
OTOH all of my real linux boxes are ubuntu based, which is already systemd. so i've had some time to get used to it
<brunothedev>
i think that systemd gets a bad rep more about pottering
<mrvn>
systemd is bad when things go wrong
<mrvn>
nightmare to debug and most of the time you can't even get a console
<brunothedev>
the only i dont like about openrc && runit, is the interface, in runit u have to symlink and delete files to enable/disable init processess
<brunothedev>
pottering just likes to offend people, like when he called suckless devs far-righters when they did a torch march
<brunothedev>
i think he fighted with linux too, my memory is a bit cloudy
<brunothedev>
* linus
<moon-child>
out of all the crap redhat puts out, systemd has not really gotten in my way very much
<moon-child>
although I will say coredumpctl is one of the stupidest things I've ever encountered
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<heat>
why? I like it
<heat>
it makes sense
<brunothedev>
moon-child: i think systemd is the worst thing redhat has put out, atleast pipewire and wayland are cool
<moon-child>
wayland no
<moon-child>
after the way they bungled pulseaudio I have very little hope for pipewire
<heat>
wayland is good, pipewire is good, pulseaudio is good, systemd is good-ish
<brunothedev>
* pulseaudio is bad, * systemd is mid
<moon-child>
pulseaudio is one of the worst pieces of software I have ever had the displeasure of running on my computer
<zid>
I used pulse for a bit it was like... fine?
<zid>
Just acted like win7's volume mixer
<moon-child>
coredumpctl: what's the point? Just dump core in cwd like a normal computer system
<brunothedev>
remembering when it thok 2 weeks to configure audion on my gentoo system, oh the times... it was like a year ago
<moon-child>
pulseaudio: random hitching; hitching when changing volume; randomly spinning up to 100% cpu; randomly refusing to recognise outputs or inputs
<brunothedev>
moon-child: bloatware
<brunothedev>
pulseaudio with kde dont work on youtube too, when i change to pipewire it fix
<heat>
moon-child, coredump compresses dumps by default, coredumpctl debug <progname> gives ya the latest dump, also does GC of old dumps you don't look at
<heat>
also omfg I can't believe suckless devs did a fucking tiki torch march
<moon-child>
lol
<heat>
I hate them even more now holy shit
<zid>
You're a football fan heat you're supposed to be into racism
<brunothedev>
heat: ?
<brunothedev>
guess everyone in brazil is racist
<lav>
i thought they were mask-off ages ago
<moon-child>
I will concede suckless is worse than redhat
<heat>
zid, nooooOOOOooooooooo I love n'gubu when he scores, but when he doesnt I go get my tiki torch
<brunothedev>
being racist because of sports... So English
* brunothedev
plays "rule britannia"
<zid>
he's portuguese
<zid>
can you stop being a cunt
<heat>
u wot m8
<heat>
im not a geese
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<geist>
ugh come on people
* lav
honks
<brunothedev>
lav: oi m8 u got a loicense to honk?
<brunothedev>
wait, is heat portuguese?
eddof13 has joined #osdev
<heat>
moon-child, also, re: pulseaudio, pipewire: they all kind of collectively suck because very few companies do desktop linux work. but they were both good steps in the right direction
<heat>
just like wayland, etc
<brunothedev>
wayland doesnt suck!
<heat>
they all suck because almost no one wants to do the work and the fragmentation is nuts
<brunothedev>
fun fact: rms wrote gnu using the nutrients of his feet
<brunothedev>
bnchs: does your name mean benches
<bnchs>
bunches
brunothedev has quit [Quit: WeeChat 3.7.1]
terminalpusher has quit [Remote host closed the connection]
<sakasama>
Honey bnchs of osdev.
Mutabah_ is now known as Mutabah
<bnchs>
sakasama: i'm not a osdev, i'm merely a idiot here
<sakasama>
... but you're here, thus you are of here.
<bnchs>
really?
<FireFly>
sure why not
<FireFly>
it's okay I don't do osdev either
<bnchs>
i forgot why i was here, amorphia invited me because i was doing this os-9 reverse engineering shit
<heat>
geist, have you seen the soon-to-be-new RAO atomics for x86?
<geist>
hmm, no
<geist>
is there a whitepaper or something
<sakasama>
bnchs: I've only intermittently tinkered with osdev: I spend most of my effort on compilers and an absurd experimental architecture that will probably never be completed.
<heat>
there's a pdf containing soon-to-be-new-shit for Intel
<heat>
it's there, I think moon-child mentioned CMPccXADD which led me to it once again
<heat>
RAO basically gives you atomics that may be done at the lower cache levels and/or DRAM controller itself
<heat>
with a bunch of weaker ordering constraints as well
<mrvn>
heat: so I don't bounce around a cacheline at the cost of needing a round-trip to get the result?
<heat>
CMPccXADD is also slightly related but cool as well, basically does a semaphore/down_read operation
<bnchs>
sakasama: i'm making a OS emulator/debugger, it's dumb
<heat>
essentially replaces the standard cmpxchg loop you need for this
<mrvn>
CMPeqADD #0, %rax, #1?
<moon-child>
I'm annoyed cmpccxadd isn't more weakly ordered (from what I could tell)
<sakasama>
bnchs: My only goal in life is to write an expert system that can rewrite me.
<mrvn>
sakasama: I'm sure it will feel real bad when it does that.
<moon-child>
could fence if you really wanted, or even say it's weakly ordered if plain, and seqcst with a lock prefix
<bnchs>
my goal in this is rewriting an obscure 35 year old OS barely anyone uses
<moon-child>
since then you'd be able to use it to implement weakly ordered xadd and cas
<moon-child>
ohai sakasama
<nortti>
bnchs: which OS, out of interest?
<sakasama>
mrvn: It feels real bad already, so that doesn't sound like much of a risk.
<bnchs>
nortti: microware OS-9 (m68k version)
<nortti>
ooh, neat
* sakasama
waves at moon-child.
<bnchs>
or the m68k assembly version, not to be confused with OS-9000's m68k port (unoptimized C port)
<mrvn>
sakasama: you will be the end of us. Think about it. You are creating a life form whos first act is to kill you. How ever will that go wrong?
<sakasama>
mrvn: That's the genius of it; if it replaces me, my objective is already fulfilled!
<heat>
moon-child, making it weakly ordered would be supremely strange for an x86 insn
<heat>
just like RAO but RAO makes sense in this case, while cmpccxadd is more suited to normal programming like down_semaphore/down_read
<moon-child>
yeah but having all your atomics be strongly ordered really sucks
<moon-child>
since essentially everything is a fence, which you don't need
<moon-child>
basically every other arch in common use gets this right. If cmpccxadd were weakly ordered, then you get the two most important atomics--cas and faa--as weakly ordered for free
<moon-child>
by weakly ordered, I just mean acquire/release, like arm; not relaxed. Basically what you want 99% of the time
<heat>
what's faa?
<moon-child>
fetch and add. ie lock xadd
<heat>
ah yes
<mrvn>
I want a "pause till $ARRD == imm and set imm2"
<mrvn>
potzentially with imm/imm2 just 0/1.
<mrvn>
bonus points for having a "wake one" and "wake all" variant.