VirtualBox

Changeset 9563 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 10, 2008 11:01:33 AM (17 years ago)
Author:
vboxsync
Message:

Cache the KeQueryActiveProcessors() result at init (see crash reading the mask at DPC_LEVEL in SUPDrv-win.cpp).

Location:
trunk/src/VBox/Runtime/r0drv/nt
Files:
1 added
3 edited

Legend:

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

    r8245 r9563  
    2929 */
    3030
    31 
    3231/*******************************************************************************
    3332*   Header Files                                                               *
     
    3635#include <iprt/err.h>
    3736#include <iprt/assert.h>
     37#include <iprt/mp.h>
    3838#include "internal/initterm.h"
     39#include "internal-r0drv-nt.h"
     40
     41
     42/*******************************************************************************
     43*   Global Variables                                                           *
     44*******************************************************************************/
     45/** The Nt CPU set.
     46 * KeQueryActiveProcssors() cannot be called at all IRQLs and therefore we'll
     47 * have to cache it. Fortunately, Nt doesn't really support taking CPUs offline
     48 * or online. It's first with W2K8 that support for adding / onlining cpus at
     49 * runtime is (officially) supported. Once we start caring about this, we'll
     50 * simply use the native MP event callback and update this variable as cpus
     51 * comes online.
     52 */
     53RTCPUSET g_rtMpNtCpuSet;
     54
    3955
    4056int rtR0InitNative(void)
    4157{
     58    /*
     59     * Init the Nt cpu set.
     60     */
     61    KAFFINITY ActiveProcessors = KeQueryActiveProcessors();
     62    RTCpuSetEmpty(&g_rtMpNtCpuSet);
     63    RTCpuSetFromU64(&g_rtMpNtCpuSet, ActiveProcessors);
     64
     65#if 0 /* W2K8 support */
     66    return RTR0MpNotificationInit(NULL);
     67#else
    4268    return VINF_SUCCESS;
     69#endif
    4370}
    4471
     
    4673void rtR0TermNative(void)
    4774{
     75#if 0 /* W2K8 support */
     76    RTR0MpNotificationTerm(NULL);
     77#endif
    4878}
    4979
  • trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp

    r9436 r9563  
    4040#include <iprt/asm.h>
    4141#include "r0drv/mp-r0drv.h"
     42#include "internal-r0drv-nt.h"
    4243
    4344
     
    9596        return false;
    9697
    97     /** @todo this must be done at init time as it's not safe under all circumstances (braindead OS design). */
     98#if 0 /* this isn't safe at all IRQLs (great work guys) */
    9899    KAFFINITY Mask = KeQueryActiveProcessors();
    99100    return !!(Mask & RT_BIT_64(idCpu));
     101#else
     102    return RTCpuSetIsMember(&g_rtMpNtCpuSet, idCpu);
     103#endif
    100104}
    101105
     
    125129RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet)
    126130{
     131#if 0 /* this isn't safe at all IRQLs (great work guys) */
    127132    KAFFINITY Mask = KeQueryActiveProcessors();
    128133    return RTCpuSetFromU64(pSet, Mask);
     134#else
     135    *pSet = g_rtMpNtCpuSet;
     136    return pSet;
     137#endif
    129138}
    130139
     
    255264}
    256265
     266
    257267RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
    258268{
     
    260270}
    261271
     272
    262273RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
    263274{
    264275    return rtMpCall(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_OTHERS, 0);
    265276}
     277
    266278
    267279RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
  • trunk/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp

    r9311 r9563  
    3939#include <iprt/cpuset.h>
    4040#include "r0drv/mp-r0drv.h"
     41#include "internal-r0drv-nt.h"
    4142
    4243
     
    8889        case KeProcessorAddCompleteNotify:
    8990            rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu);
     91            RTCpuSetAdd(&g_rtMpNtCpuSet, idCpu);
    9092            break;
    9193
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