IRC channel logs


back to list of logs

<damo22>hey AlmuHS
<damo22>nice work with smp
<damo22>ive been looking into ioapic
<damo22> <--- i wrote this
<AlmuHS>has you read Richard x15 code?
<AlmuHS>I also need to initialize lapic LVT
<AlmuHS>I enumerated the apic_id of each processor, but I need to initialize the another lapic registers
<AlmuHS>but I don't know how do It exactly
<damo22>read my doc
<damo22>it doesnt have all the detail required but there is some setup we need to do so that legacy PIC doesn't conflict
<AlmuHS>ok, It seems well
<AlmuHS>you can read chapter 10 in Intel Manuals, to get more info about APIC
<AlmuHS>yes, but this is very simple
<AlmuHS>read this
<AlmuHS>chapter 10
<AlmuHS>you can also read the MP Spec, but is older than the manual
<AlmuHS>btw, other problem with Mach is that, the most modern cpu which have registered in its code is Pentium Pro
<AlmuHS>see this
<damo22>we cannot rely on MP tables
<damo22>they are not supported anymore
<AlmuHS>MP Tables is deprecated
<AlmuHS>I'm using ACPI tables
<AlmuHS>the table which stores the APIC data is MADT
<damo22>mach supporting pentium pro is not a bad thing
<damo22>it means it will theoretically work on any x86
<AlmuHS>but could be necessary to detect more modern models
<AlmuHS>pentium 4, by example
<damo22>we can forget about the extended apic setups
<AlmuHS>no, I can't
<AlmuHS>my implementation is xAPIC based
<damo22>xAPIC is ok
<AlmuHS>because original APIC don't works in Pentium 4 or later
<damo22>x2APIC is too complex i think
<AlmuHS>x2APIC is 64 bit based
<AlmuHS>so, at now I can't use this
<damo22>i mean, there is a mode of apic that uses logical clusters of NUMA nodes
<damo22>we can avoid that
<AlmuHS>but could be interesting detect if the cpu use x2APIC and, in this case, enable xAPIC compatibility mode
<AlmuHS>the latest Core iX models use x2APIC
<AlmuHS>x2APIC has a legacy xAPIC mode, but It is not enabled by default (and I have not implemented It)
<AlmuHS>in my Final Degree Thesis I explain all about this. But this is wrotten in spanish
<damo22>no worries
<AlmuHS>if you understand spanish, I can share the link
<AlmuHS> Select "Grado en Ingeniería Informática" and "2019", and you can find It in the list
<damo22>why dont we use Fixed mode for all interrupts in the IO APIC
<damo22>and route them to actual interrupt vectors
<AlmuHS>It's possible
<damo22>its not that hard
<AlmuHS>but I don't understand APIC very well, so I avoided It
<AlmuHS>if you want implement this, I can say you where is the structures in my code
<AlmuHS>wait a moment
<damo22>ive been reading some gnumach code
<damo22>spl.S etc
<AlmuHS>my apic structures is here:
<AlmuHS>I recovered It from old Mach 4 headers, and updated It with latest lapic table
<damo22>there is an ugly hack in gnumach that enables interrupts when setting the IPL
<damo22>to allow linux drivers to call cli/sti
<AlmuHS>and the apic enumeration from acpi tables is here:
<damo22>ok thanks
<AlmuHS>I have to rename some functions, btw
<AlmuHS>the name is not clear about its purpuse
<AlmuHS>the cpu enabling and configuration is here:
<AlmuHS>and here is the assembly snippet to jump to protected mode:
<AlmuHS>in the README I explain a bit about the implementation, although is a bit outdated
<damo22>doesnt the bootloader start in protected mode?
<damo22>you're basically switching back to flat 16 bit mode and starting from scratch
<AlmuHS>I explain
<AlmuHS>when the computer starts, it initialize some apic structures. But, after this, the BIOS select a cpu (called BSP), and start It. And the another are set as standby
<AlmuHS>to start the another cpus (called AP), It's needed to send an IPI (a special type of IRQ): the startup IPI
<youpi>on x86 the boot loader starts in real mode indeed. but grub loads the kernel in protected mode
<AlmuHS>but, when the cpu receive the IPI, It wake up in real mode
<youpi>what a legacy thing :/
<damo22>oh darn
<AlmuHS>but the kernel starts, at first, with only the BSP cpu
<AlmuHS>if the kernel wants to use another processors, It has to wake up them using startup IPI
<AlmuHS>and these processor (the AP processors) starts in real mode, as I said
<damo22>"(22:58:58) AlmuHS: but, when the cpu receive the IPI, It wake up in real mode" This explains all
<AlmuHS>the BSP continue in protected mode, there isn't problem with this
<AlmuHS>the kernel starts only with BSP
<AlmuHS>and, during the kernel boot, I need to start the another processor (AP processors)
<AlmuHS>when I send startup IPI to APs, the APs wake up in real mode
<damo22>i get it now
<AlmuHS>the BSP continues in protected mode, no problem with this
<damo22>why is your idt_descr empty
<AlmuHS>I set It later, with idt_init() call
<AlmuHS>in cpu_setup()
<damo22>.word 3*8+7 allocates space for the IDT?
<AlmuHS>what line?
<AlmuHS>nope, It is part of gdt descriptor
<damo22>where is the idt?
<AlmuHS>is empty in this snippet
<AlmuHS>line 14 to 15
<damo22>yes, but you need space for it
<AlmuHS>I assumed that idt_init() do It
<AlmuHS>I load an empty IDT in line 78 in cpuboot.S
<damo22>how much space do you need for an IDT?
<AlmuHS>I don't know exactly
<AlmuHS>see idt.c file
<AlmuHS>this is not mine, is from gnumach
<damo22>ohhh you load an empty one
<AlmuHS>yes, I said It before
<damo22>and then allocate it again later
<AlmuHS>youpi: can you check my latest Hurd patch? I sent It two days ago
<youpi>AlmuHS: I assumed you were working on the last_pocessor field detection
<AlmuHS>youpi: I sent the patch after you latest email
<AlmuHS>just after, in fact
<youpi>"latest" is not precise enough :)
<AlmuHS>wait, I search It
<youpi>Date: Tue, 29 Oct 2019 00:05:09 +0100
<youpi>that's what I have
<youpi> the code seems correct to me, but lacking autoconf check for the field
<AlmuHS>oh, I didn't know about I have to do It
<AlmuHS>reply about how a to do It (a lightly idea at least), in which file
<AlmuHS>damo22: thanks. I didn't found this table before
<youpi>I thought we had discussed about it on irc
<AlmuHS>in my historial I don't find It
<youpi>add to a call to AC_CHECK_MEMBER to check for the struct member
<AlmuHS>oh, really
<youpi>that'll define a macro you can use in #ifdef/#else/#endif in the code
<AlmuHS>ok, then I'll check It later
<AlmuHS>damo22: do you understand my smp work?
<damo22>some of it yes
<AlmuHS>if you speak spanish, you can read my final degree thesis, that I linked It before
<damo22>unfortunately my spanish is not that good
<AlmuHS>then you can read the implementation chapter in
<AlmuHS>is a bit outdated, but includes all the basic
<AlmuHS>and you can read the original draft, in
<damo22>i know about ACPI a little alreadyt
<AlmuHS>in my draft I link to ACPI specification
<damo22>i wrote acpi translator for hurd
<damo22>you can access the tables raw in /servers/acpi/tables
<AlmuHS>yes, but I never wrote a translator, and a friend wrote me the acpi_rsdp.c function (I only fixed and improve It)
<AlmuHS>so I prefered use this
<damo22>yeah sure, you need it in gnumach anyway
<damo22>to enumerate the APIC tables
<AlmuHS>my laptop battery I'm mostly empty now, I have to shutdown in a moments
<damo22>i gtg to sleep
<AlmuHS>ok, good night
<damo22>use ctags and grep more AlmuHS
***deavmi_ is now known as deavmiHurd
<deavmiHurd>Anyone running i3 on Debian Hurd here?
***deavmi_ is now known as deavmiHurdLaptop
<AlmuHS>youpi: is this check correct?
***Emulatorman_ is now known as Emulatorman
<youpi>AlmuHS: better use AC_CHECK_MEMBERS, which already does the AC_DEFINE on success
<AlmuHS>oh, ok
<AlmuHS>I never used It, I'm learning now at first time
<AlmuHS>youpi: and now?
<youpi>I believe you still need the #include ?
<youpi>(see in config.log for the details of what is happening)
<AlmuHS>youpi: config.log
<youpi>AlmuHS: see, it doesn't know the structure, the include is indeed missing in the test file
<AlmuHS>It's true. what is the syntax to add include in AC_CHECK_MEMBERS ?
<AlmuHS>I don't find any example which add include
<youpi>you need to read the info manual of autoconf to know that
<youpi>that's the proper documentation
<youpi>looking for examples on the web has limits
<jrtc27>first hit:
<jrtc27>AC_CHECK_MEMBERS([struct termios.c_line],,,
<jrtc27> [[#include <termios.h>]])
<youpi>yes, but again, looking at the proper doc is usually better to make sure how things are supposed to be
<AlmuHS>yes, but I didn't understand the docs
<youpi>examples are good, sure, but proper documentation should *also* be used
<AlmuHS>I'm very noob
<youpi>sure, I don't mean the documentation is enough
<youpi>but don't only use examples
<jrtc27>yeah, you really want both together
<jrtc27>anyway, is a lifesaver for finding examples of pretty much anything
<AlmuHS>ok, I'll take notes
<AlmuHS>check now