VirtualBox

Changeset 86177 in vbox for trunk/src


Ignore:
Timestamp:
Sep 19, 2020 4:06:57 PM (4 years ago)
Author:
vboxsync
Message:

Revert r140428 for now (Runtime/mp-r0drv-nt.cpp: Dynamically determine the size of the KAFFINITY_EX structure as it is not static across Windows versions (increased lately with W10 20H2) )

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp

    r86176 r86177  
    3737#include <iprt/log.h>
    3838#include <iprt/mem.h>
    39 #include <iprt/string.h>
    4039#include <iprt/time.h>
    4140#include "r0drv/mp-r0drv.h"
     
    123122/** The handle of the rtR0NtMpProcessorChangeCallback registration. */
    124123static PVOID                            g_pvMpCpuChangeCallback = NULL;
    125 /** Size of the KAFFINITY_EX structure.
    126  * This increased from 20 to 32 bitmap words in the 2020 H2 windows 10 release
    127  * (i.e. 1280 to 2048 CPUs).  We expect this to increase in the future. */
    128 static size_t                           g_cbRtMpNtKaffinityEx = RT_UOFFSETOF(KAFFINITY_EX, Bitmap)
    129                                                               + RT_SIZEOFMEMB(KAFFINITY_EX, Bitmap[0]) * 256;
    130 /** The size value of the KAFFINITY_EX structure. */
    131 static uint16_t                         g_cRtMpNtKaffinityExEntries = 256;
    132124
    133125
     
    606598        && g_pfnrtKeGetProcessorIndexFromNumber)
    607599    {
    608         /* Determine the real size of the KAFFINITY_EX structure. */
    609         union
    610         {
    611             KAFFINITY_EX Struct;
    612             uint8_t      ab[_4K + 8]; /* This should suffice for determining the real size. */
    613         } u;
    614         RT_ZERO(u);
    615         size_t const cMaxEntries = (sizeof(u) - RT_UOFFSETOF(KAFFINITY_EX, Bitmap[0])) / sizeof(u.Struct.Bitmap[0]);
    616         g_pfnrtKeInitializeAffinityEx(&u.Struct);
    617         if (u.Struct.Size > 1 && u.Struct.Size <= cMaxEntries)
    618         {
    619             g_cRtMpNtKaffinityExEntries = u.Struct.Size;
    620             g_cbRtMpNtKaffinityEx       = u.Struct.Size * sizeof(u.Struct.Bitmap[0]) + RT_UOFFSETOF(KAFFINITY_EX, Bitmap[0]);
    621             g_pfnrtMpPokeCpuWorker      = rtMpPokeCpuUsingHalRequestIpiW7Plus;
    622             DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingHalRequestIpiW7Plus\n");
    623             return VINF_SUCCESS;
    624         }
    625         DbgPrint("IPRT: RTMpPoke can't use rtMpPokeCpuUsingHalRequestIpiW7Plus! u.Struct.Size=%u\n", u.Struct.Size);
    626         AssertReleaseMsg(u.Struct.Size <= cMaxEntries, ("%#x\n", u.Struct.Size)); /* stack is toast if larger (32768 CPUs). */
    627     }
    628 
    629     if (pOsVerInfo->uMajorVer >= 6 && g_pfnrtKeIpiGenericCall)
     600        g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalRequestIpiW7Plus;
     601        DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingHalRequestIpiW7Plus\n");
     602    }
     603    else if (pOsVerInfo->uMajorVer >= 6 && g_pfnrtKeIpiGenericCall)
    630604    {
    631605        DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingBroadcastIpi\n");
     
    18871861{
    18881862    /* idCpu is an HAL processor index, so we can use it directly. */
    1889     PKAFFINITY_EX pTarget = (PKAFFINITY_EX)alloca(g_cbRtMpNtKaffinityEx);
    1890     pTarget->Size = g_cRtMpNtKaffinityExEntries; /* (just in case KeInitializeAffinityEx starts using it) */
    1891     g_pfnrtKeInitializeAffinityEx(pTarget);
    1892     g_pfnrtKeAddProcessorAffinityEx(pTarget, idCpu);
    1893 
    1894     g_pfnrtHalRequestIpiW7Plus(0, pTarget);
     1863    KAFFINITY_EX Target;
     1864    g_pfnrtKeInitializeAffinityEx(&Target);
     1865    g_pfnrtKeAddProcessorAffinityEx(&Target, idCpu);
     1866
     1867    g_pfnrtHalRequestIpiW7Plus(0, &Target);
    18951868    return VINF_SUCCESS;
    18961869}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette