Logical CPU -> physical CPU conversion

John Baldwin john at baldwin.cx
Thu Feb 17 05:17:10 PST 2005


On Feb 17, 2005, at 3:27 AM, Joseph Koshy wrote:

> Given a cpu number for a logical CPU, is there a way to map
> this to a CPU number for a physical CPU?
>
> Will:
>
>   physcpu = logicalcpu & ~1;
>
> always work?

For current Intel HTT CPUs, yes.  Note that this might get tricky with
the dual core CPUs coming from both AMD and Intel in the not too
distant future as we don't know yet how they will enumerate the cores.
It may be that the cores "look" like HTT cores when they are actually
full cores, so I would try to abstract this in a way that you can use
different implementations for different CPUs to determine when a
logical CPU is a HTT CPU vs. a full core.  Also, I imagine that even
with dual core Intel CPUs there is a chance that they might do HTT
inside each core, so that a single physical processor would have 2
cores each with 2 HTT so a total of 4 logical CPUs from one piece of
silicon.

-- 

John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



More information about the freebsd-smp mailing list