Ticket #5412: D1789.diff

File D1789.diff, 2.9 KB (added by Itms, 5 years ago)
  • source/lib/sysdep/arch/x86_x64/apic.h

     
    1 /* Copyright (C) 2011 Wildfire Games.
     1/* Copyright (C) 2019 Wildfire Games.
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    4040// apicId<->contiguousId and apicId<->processor.
    4141LIB_API bool AreApicIdsReliable();
    4242
     43// we may get the apicId of a processor we don't have access to.
     44LIB_API bool IsProcessorKnown(ApicId apicId);
     45
    4346LIB_API size_t ProcessorFromApicId(ApicId apicId);
    4447LIB_API size_t ContiguousIdFromApicId(ApicId apicId);
    4548
  • source/lib/sysdep/arch/x86_x64/apic.cpp

     
    1 /* Copyright (C) 2011 Wildfire Games.
     1/* Copyright (C) 2019 Wildfire Games.
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    110110    return true;
    111111}
    112112
     113bool IsProcessorKnown(ApicId apicId)
     114{
     115    ModuleInit(&apicInitState, InitApicIds);
     116
     117    const ApicId* pos = std::find(processorApicIds, processorApicIds+numIds, apicId);
     118    return pos != processorApicIds+numIds;
     119}
    113120
    114121static size_t IndexFromApicId(const ApicId* apicIds, ApicId apicId)
    115122{
  • source/lib/sysdep/os/win/wnuma.cpp

     
    1 /* Copyright (C) 2018 Wildfire Games.
     1/* Copyright (C) 2019 Wildfire Games.
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    232232        header = (const AffinityHeader*)(uintptr_t(header) + header->length))
    233233    {
    234234        const AffinityAPIC* affinityAPIC = DynamicCastFromHeader<AffinityAPIC>(header);
    235         if(affinityAPIC)
     235        if(!affinityAPIC)
     236            continue;
     237
     238        if(!IsProcessorKnown(affinityAPIC->apicId))
    236239        {
    237             const size_t processor = ProcessorFromApicId(affinityAPIC->apicId);
    238             const u32 proximityDomainNumber = affinityAPIC->ProximityDomainNumber();
    239             ProximityDomain& proximityDomain = proximityDomains[proximityDomainNumber];
    240             proximityDomain.processorMask |= Bit<uintptr_t>(processor);
     240            debug_printf("Processor with APIC ID %d found in SRAT but not known to CPUID.", affinityAPIC->apicId);
     241            continue;
    241242        }
     243
     244        const size_t processor = ProcessorFromApicId(affinityAPIC->apicId);
     245        const u32 proximityDomainNumber = affinityAPIC->ProximityDomainNumber();
     246        ProximityDomain& proximityDomain = proximityDomains[proximityDomainNumber];
     247        proximityDomain.processorMask |= Bit<uintptr_t>(processor);
    242248    }
    243249
    244250    return proximityDomains;