Changeset 86191 in vbox for trunk/src/VBox
- Timestamp:
- Sep 21, 2020 9:59:04 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
r86177 r86191 122 122 /** The handle of the rtR0NtMpProcessorChangeCallback registration. */ 123 123 static PVOID g_pvMpCpuChangeCallback = NULL; 124 /** Size of the KAFFINITY_EX structure. 125 * This increased from 20 to 32 bitmap words in the 2020 H2 windows 10 release 126 * (i.e. 1280 to 2048 CPUs). We expect this to increase in the future. */ 127 static size_t g_cbRtMpNtKaffinityEx = RT_UOFFSETOF(KAFFINITY_EX, Bitmap) 128 + RT_SIZEOFMEMB(KAFFINITY_EX, Bitmap[0]) * 256; 129 /** The size value of the KAFFINITY_EX structure. */ 130 static uint16_t g_cRtMpNtKaffinityExEntries = 256; 124 131 125 132 … … 598 605 && g_pfnrtKeGetProcessorIndexFromNumber) 599 606 { 600 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalRequestIpiW7Plus; 601 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingHalRequestIpiW7Plus\n"); 602 } 603 else if (pOsVerInfo->uMajorVer >= 6 && g_pfnrtKeIpiGenericCall) 607 /* Determine the real size of the KAFFINITY_EX structure. */ 608 size_t const cbAffinity = _8K; 609 PKAFFINITY_EX pAffinity = (PKAFFINITY_EX)RTMemAllocZ(cbAffinity); 610 AssertReturn(pAffinity, VERR_NO_MEMORY); 611 size_t const cMaxEntries = (cbAffinity - RT_UOFFSETOF(KAFFINITY_EX, Bitmap[0])) / sizeof(pAffinity->Bitmap[0]); 612 g_pfnrtKeInitializeAffinityEx(pAffinity); 613 if (pAffinity->Size > 1 && pAffinity->Size <= cMaxEntries) 614 { 615 g_cRtMpNtKaffinityExEntries = pAffinity->Size; 616 g_cbRtMpNtKaffinityEx = pAffinity->Size * sizeof(pAffinity->Bitmap[0]) + RT_UOFFSETOF(KAFFINITY_EX, Bitmap[0]); 617 g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalRequestIpiW7Plus; 618 RTMemFree(pAffinity); 619 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingHalRequestIpiW7Plus\n"); 620 return VINF_SUCCESS; 621 } 622 DbgPrint("IPRT: RTMpPoke can't use rtMpPokeCpuUsingHalRequestIpiW7Plus! pAffinity->Size=%u\n", pAffinity->Size); 623 AssertReleaseMsg(pAffinity->Size <= cMaxEntries, ("%#x\n", pAffinity->Size)); /* stack is toast if larger (32768 CPUs). */ 624 RTMemFree(pAffinity); 625 } 626 627 if (pOsVerInfo->uMajorVer >= 6 && g_pfnrtKeIpiGenericCall) 604 628 { 605 629 DbgPrint("IPRT: RTMpPoke => rtMpPokeCpuUsingBroadcastIpi\n"); … … 1861 1885 { 1862 1886 /* 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); 1887 PKAFFINITY_EX pTarget = (PKAFFINITY_EX)alloca(g_cbRtMpNtKaffinityEx); 1888 pTarget->Size = g_cRtMpNtKaffinityExEntries; /* (just in case KeInitializeAffinityEx starts using it) */ 1889 g_pfnrtKeInitializeAffinityEx(pTarget); 1890 g_pfnrtKeAddProcessorAffinityEx(pTarget, idCpu); 1891 1892 g_pfnrtHalRequestIpiW7Plus(0, pTarget); 1868 1893 return VINF_SUCCESS; 1869 1894 }
Note:
See TracChangeset
for help on using the changeset viewer.