Changeset 86176 in vbox for trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
- Timestamp:
- Sep 19, 2020 3:33:04 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
r86175 r86176 37 37 #include <iprt/log.h> 38 38 #include <iprt/mem.h> 39 #include <iprt/string.h> 39 40 #include <iprt/time.h> 40 41 #include "r0drv/mp-r0drv.h" … … 122 123 /** The handle of the rtR0NtMpProcessorChangeCallback registration. */ 123 124 static 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; 124 132 125 133 … … 598 606 && g_pfnrtKeGetProcessorIndexFromNumber) 599 607 { 600 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalRequestIpiW7Plus; 601 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingHalRequestIpiW7Plus\n"); 602 } 603 else if (pOsVerInfo->uMajorVer >= 6 && g_pfnrtKeIpiGenericCall) 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) 604 630 { 605 631 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingBroadcastIpi\n"); … … 1861 1887 { 1862 1888 /* idCpu is an HAL processor index, so we can use it directly. */ 1863 KAFFINITY_EX Target; 1864 g_pfnrtKeInitializeAffinityEx(&Target); 1865 g_pfnrtKeAddProcessorAffinityEx(&Target, idCpu); 1866 1867 g_pfnrtHalRequestIpiW7Plus(0, &Target); 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); 1868 1895 return VINF_SUCCESS; 1869 1896 }
Note:
See TracChangeset
for help on using the changeset viewer.