Are cores detected in the MADT?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Are cores detected in the MADT?

Post by nexos »

Hello,
I am currently writing code that starts up APs. It works perfectly on QEMU. I noticed something on my newer UEFI laptop, however. The MADT reports 8 CPUs. After starting the first 3 APs, it halted. After debugging, the problem was that the online capable bit wasn't set in the LAPIC entry. I added code to not use these CPUs, and it works. I rebooted it into Windows, and Task Manager reports 4 logical CPUs, with 2 cores per CPU. I think that the four unusable entries were the cores. So my question is, how do i start CPU cores up?
Thanks,
nexos
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
thewrongchristian
Member
Member
Posts: 426
Joined: Tue Apr 03, 2018 2:44 am

Re: Are cores detected in the MADT?

Post by thewrongchristian »

nexos wrote:Hello,
I am currently writing code that starts up APs. It works perfectly on QEMU. I noticed something on my newer UEFI laptop, however. The MADT reports 8 CPUs. After starting the first 3 APs, it halted. After debugging, the problem was that the online capable bit wasn't set in the LAPIC entry. I added code to not use these CPUs, and it works. I rebooted it into Windows, and Task Manager reports 4 logical CPUs, with 2 cores per CPU. I think that the four unusable entries were the cores. So my question is, how do i start CPU cores up?
Thanks,
nexos
4 HT capable cores with HT disabled in UEFI settings?
Octocontrabass
Member
Member
Posts: 5572
Joined: Mon Mar 25, 2013 7:01 pm

Re: Are cores detected in the MADT?

Post by Octocontrabass »

nexos wrote:Task Manager reports 4 logical CPUs, with 2 cores per CPU.
What kind of CPU is it? It sounds like you're using a CPU capable of only 4 threads, so the MADT has extra entries for APs that don't exist.

(Why would the MADT have entries for APs that don't exist? Sometimes firmware designers are lazy and use a fixed-size table, then mark the extra entries as unusable. Sometimes the CPU manufacturer actually builds a CPU capable of 8 threads and then disables 4 of them in the factory.)
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Are cores detected in the MADT?

Post by nexos »

I don't have my PC in front of me, but it has an Intel Core i3
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Are cores detected in the MADT?

Post by iansjack »

Task Manager is telling you that your processor has 2 physical cores which each support 2 threads - giving you 4 logical processors. Hence you can only start 4. Although different i3s have different capabilities, that sounds like a typical, fairly modern, one.
Post Reply