DragonFly commits List (threaded) for 2009-06
DragonFly BSD
DragonFly commits List (threaded) for 2009-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

DragonFly-2.3.1.430.g7ea07 master sys/platform/pc32/i386 mp_machdep.c


From: Sepherosa Ziehau <sephe@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Jun 2009 04:46:23 -0700 (PDT)

commit 7ea07fd226314dc116e1089cb39196610300b406
Author: Sepherosa Ziehau <sephe@dragonflybsd.org>
Date:   Wed Jun 17 19:54:22 2009 +0800

    Correct the logical_cpus calculation in mptable_hyperthread_fixup()
    
    The original code extracts logical_cpus directly from the output of
    cpuid(eax=1), however,
    According to Intel's #253668, section 7.7
    "(CPUID.1:EBX[23:16]) -- Indicates the maximum number of addressable
     ID for logical processors in a physical package."
    According to AMD's #25481 CPUID Fn0000_0001_EBX
    "LogicalProcessorCount is the number of threads per CPU core times the
     number of CPU cores per processor."
    
    So what we originally saved in logical_cpus is actually the upper limit
    of the logical CPUs per phyical CPU package.  It may work correctly if
    there is only one logical CPU per physical CPU package detected in MP
    table.  But if more than one logical CPUs per phyical CPU package are
    detected in the MP table, then the missing logical CPUs will not be
    detected later, since the code assumed that logical_cpus is the number
    of logical CPUs missed between two detected logical CPUs.
    
    We try to fix the problem by calculating the distances between two nearest
    APIC IDs.  If all such distances for all detect logical CPUs are same,
    then the logical_cpus is set the calculated distance.  The value extracted
    from cpuid(eax=1) just serves as the upper limit of the logical_cpus now.
    
    Reported-and-Tested-by: Robert Luciani <rluciani@gmail.com>

Summary of changes:
 sys/platform/pc32/i386/mp_machdep.c |   78 ++++++++++++++++++++++++++++++++--
 1 files changed, 73 insertions(+), 5 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7ea07fd226314dc116e1089cb39196610300b406


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]