IRC channel logs
2026-01-03.log
back to list of logs
<damo22>thank you youpi for fast review, i might work more on smp64 before i go back to work on the 5th <damo22>youpi: yes, you are right, (%esp) was the problem, it needs to be (%rsp) so it addresses the stack correctly <damo22>there is an argument for using a negative offset with that instruction <youpi>ah, right, using (%rsp) can bring dependencies <youpi>-4(%rsp) too, but less probable <damo22>youpi: do you know if "offset(basereg, reg, width)" syntax in AT&T asm actually sign extends the offset up to a 64 bit address if its a negative 32 bit immediate? <damo22>if it doesnt, then all our CX() calls are broken on 64 bit <nikolar>that's not a syntax thing, you should check the manuals <youpi>damo22: I don't know but it should be easy to test with a small program <Pellescours>I just tried to compile gnumach master (as of now) with ncpus=4 and I get this errror: <Pellescours>../i386/i386/mp_desc.c:80:1: error: requested alignment ‘1044480’ is not a positive power of 2 80 | uint8_t solid_intstack[NCPUS*INTSTACK_SIZE] __aligned(NCPUS*INTSTACK_SIZE); <youpi>that looks like an overzealous alignment <youpi>INTSTACK_SIZE should really be enough <damo22>test.c:11: Error: 0x80000000 out range of signed 32bit displacement <youpi>is a negative value acceptede? <damo22> asm ("movq 0x80000000(%[rax],%[rbx], 8), %[rcx]" <Pellescours>youpi: if ncpus is odd, the build fails, if its even (ex: 256) it works <youpi>that'd rather be power-of-two requirement <youpi>anyway, please test without NCPUS* and send a patch if successful <damo22>Pellescours: maybe remove the "NCPUS *" in the alignment <damo22>its not easy to test the sign extend because the memory address does not resolve in userspace <youpi>to compute the address without dereferencing it <damo22>asm ("leaq -0x7f000000(%[rax],%[rbx], 8), %[rcx]" <damo22>it does not look like it extends the offset to 64 bits <damo22>if it did, the top bits above would be cleared? <youpi>I vaguely remember that x86_64 mostly uses relative 32b adressing to reach variables, and it has an rip-relative mode that makes it convenient <youpi> 112d: 48 8b 05 e0 2e 00 00 mov 0x2ee0(%rip),%rax # 4014 <i> <damo22>so i have written macros such as: <damo22>+/* Workaround for missing 64 bit immediate for <damo22>+ * offset(, reg, width) syntax */ <damo22>+#define OP_CX(op, a64, cpureg, tmpreg, reg) \ <youpi>better use leaq a64(%rip),tmpreg <youpi>that'll produce smaller code <damo22>but a64(%rip) is relative to the current instruction but we have absolute addreses <youpi>that's not a problem, the linker will compute the offset <damo22>ah ok really? thats a nice instruction then <youpi>a reference will be left in the object, and the linker will compute the difference <youpi>you can learn a *lot* from gcc-O2-compiled assembly <damo22>im terrified to read GCC compiled assembly <damo22>with function prologues and epilogues <youpi>you can just discard that and read only the instruction <Pellescours>you’re right ncpus=6 doesn’t work. I didn’t tried withhout ncpus yet (but I don’t see any reason why it would not work). But when I try to run gnumach smp (i386), it always hang at rumpdisk step (even with the commit reverted) <azert>someone should contact the author of that commit to let him know <Pellescours>azert: I know, I’m telling that even with this commit being reverted my gnumach hang <youpi>damo22: btw, we build the kernel with -mno-red-zone to simplify interruption code, so -4(%rsp) is not supposed to be valid :) <gfleury>Pellescours: how do launch qemu. Note that -smp 2 is still broken even if you you revert that commit <gfleury>I have compiled gnumach with --enable-apic --enable-ncpus=4 <damo22>Pellescours: which branch hangs?