VirtualBox

Changeset 19957 in vbox


Ignore:
Timestamp:
May 24, 2009 2:47:43 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
47659
Message:

VMM,SUPDrv-win,Config.kmk: VBOX_WITH_VMMR0_DISABLE_PREEMPTION

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r19955 r19957  
    496496## For experimenting with linking libxml2 into VBoxRT.
    497497#VBOX_WITH_LIBXML2_IN_VBOXRT = 1
     498
     499## For experimenting with disabling preemption instead of interrupts
     500# when working VT-x/AMD-V in VMMR0.
     501## @todo Move to VMM/Makefile.kmk later.
     502#if1of ($(KBUILD_TARGET), darwin linux)
     503# VBOX_WITH_VMMR0_DISABLE_PREEMPTION=1
     504#endif
    498505
    499506#
  • trunk/src/VBox/HostDrivers/Support/Makefile.kmk

    r19892 r19957  
    164164VBoxDrv_DEFS          = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER
    165165VBoxDrv_DEFS.amd64    = RT_WITH_W64_UNWIND_HACK
     166ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     167VBoxDrv_DEFS         += VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     168endif
    166169VBoxDrv_SDKS          = W2K3DDK WINPSDKINCS
    167170VBoxDrv_INCS         := $(PATH_SUB_CURRENT)
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r18478 r19957  
    322322        ||  ulCmd == SUP_IOCTL_FAST_DO_NOP)
    323323    {
    324         /* Raise the IRQL to DISPATCH_LEVEl to prevent Windows from rescheduling us to another CPU/core. */
     324#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     325        int rc = supdrvIOCtlFast(ulCmd, (unsigned)(uintptr_t)pIrp->UserBuffer /* VMCPU id */, pDevExt, pSession);
     326#else
     327        /* Raise the IRQL to DISPATCH_LEVEL to prevent Windows from rescheduling us to another CPU/core. */
    325328        Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
    326329        KIRQL oldIrql;
     
    328331        int rc = supdrvIOCtlFast(ulCmd, (unsigned)(uintptr_t)pIrp->UserBuffer /* VMCPU id */, pDevExt, pSession);
    329332        KeLowerIrql(oldIrql);
     333#endif
    330334
    331335        /* Complete the I/O request. */
  • trunk/src/VBox/VMM/Makefile.kmk

    r19757 r19957  
    406406VMMR0_DEFS     += VBOX_WITH_R0_LOGGING
    407407endif
     408ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     409VMMR0_DEFS     += VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     410endif
    408411VMMR0_DEFS.darwin.x86 = \
    409412        VBOX_WITH_2X_4GB_ADDR_SPACE   VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 \
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r19910 r19957  
    4444#include <iprt/cpuset.h>
    4545#include <iprt/mp.h>
     46#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     47# include <iprt/thread.h>
     48#endif
    4649#include "HWSVMR0.h"
    4750
     
    915918    }
    916919
     920#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     921    /** @todo This must be repeated (or moved down) after we've disabled interrupts
     922     *        below because a rescheduling request (IPI) might arrive before we get
     923     *        there and we end up exceeding our timeslice. (Putting it here for
     924     *        now because I don't want to mess up anything.) */
     925    if (RTThreadPreemptIsPending(NIL_RTTHREAD))
     926    {
     927        rc = VINF_EM_RAW_INTERRUPT_HYPER;
     928        goto end;
     929    }
     930#endif
     931
    917932    /* When external interrupts are pending, we should exit the VM when IF is set. */
    918933    /* Note! *After* VM_FF_INHIBIT_INTERRUPTS check!!! */
     
    9891004    }
    9901005
    991     /* Disable interrupts to make sure a poke will interrupt execution. 
     1006    /* Disable interrupts to make sure a poke will interrupt execution.
    9921007     * This must be done *before* we check for TLB flushes; TLB shootdowns rely on this.
    9931008     */
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r19913 r19957  
    3636#include <VBox/iom.h>
    3737#include <VBox/rem.h>
     38#include <iprt/asm.h>
     39#include <iprt/assert.h>
    3840#include <iprt/param.h>
    39 #include <iprt/assert.h>
    40 #include <iprt/asm.h>
    4141#include <iprt/string.h>
     42#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     43# include <iprt/thread.h>
     44#endif
    4245#include "HWVMXR0.h"
    4346
     
    21112114    }
    21122115
     2116#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     2117    /** @todo This must be repeated (or moved down) after we've disabled interrupts
     2118     *        below because a rescheduling request (IPI) might arrive before we get
     2119     *        there and we end up exceeding our timeslice. (Putting it here for
     2120     *        now because I don't want to mess up anything.) */
     2121    if (RTThreadPreemptIsPending(NIL_RTTHREAD))
     2122    {
     2123        rc = VINF_EM_RAW_INTERRUPT_HYPER;
     2124        goto end;
     2125    }
     2126#endif
     2127
    21132128    /* When external interrupts are pending, we should exit the VM when IF is set. */
    21142129    /* Note! *After* VM_FF_INHIBIT_INTERRUPTS check!!! */
     
    21962211        goto end;
    21972212
    2198     /* Disable interrupts to make sure a poke will interrupt execution. 
     2213    /* Disable interrupts to make sure a poke will interrupt execution.
    21992214     * This must be done *before* we check for TLB flushes; TLB shootdowns rely on this.
    22002215     */
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r19734 r19957  
    3333#include "VMMInternal.h"
    3434#include <VBox/vm.h>
     35
    3536#include <VBox/gvmm.h>
    3637#include <VBox/gmm.h>
     
    3839#include <VBox/hwaccm.h>
    3940#include <VBox/param.h>
    40 
    4141#include <VBox/err.h>
    4242#include <VBox/version.h>
    4343#include <VBox/log.h>
     44
    4445#include <iprt/assert.h>
     46#include <iprt/mp.h>
    4547#include <iprt/stdarg.h>
    46 #include <iprt/mp.h>
    4748#include <iprt/string.h>
     49#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     50# include <iprt/thread.h>
     51#endif
    4852
    4953#if defined(_MSC_VER) && defined(RT_ARCH_AMD64) /** @todo check this with with VC7! */
     
    624628            STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
    625629
    626 #if !defined(RT_OS_WINDOWS) /** @todo check other hosts */
     630#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     631            RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     632            RTThreadPreemptDisable(&PreemptState);
     633#elif !defined(RT_OS_WINDOWS)
    627634            RTCCUINTREG uFlags = ASMIntDisableFlags();
    628635#endif
     
    660667
    661668            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
    662 #if !defined(RT_OS_WINDOWS) /** @todo check other hosts */
     669#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
     670            RTThreadPreemptRestore(&PreemptState);
     671#else !defined(RT_OS_WINDOWS)
    663672            ASMSetFlags(uFlags);
    664673#endif
Note: See TracChangeset for help on using the changeset viewer.

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