VirtualBox

Changeset 18617 in vbox for trunk/include


Ignore:
Timestamp:
Apr 1, 2009 10:11:29 PM (16 years ago)
Author:
vboxsync
Message:

PGM,EM: Handle out of memory situations more gracefully - part 1. New debugger commands: .pgmerror and .pgmerroroff.

Location:
trunk/include/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/param.h

    r18263 r18617  
    4848 * @{
    4949 */
    50 
    5150/** Initial address of Hypervisor Memory Area.
    5251 * MUST BE PAGE TABLE ALIGNED! */
     
    7978/** The default size of the below 4GB RAM hole. */
    8079#define MM_RAM_HOLE_SIZE_DEFAULT    (512U * _1M)
     80/** @} */
    8181
     82
     83/** @defgroup   grp_vbox_param_pgm  Page Manager Parameters
     84 * @ingroup grp_vbox_param
     85 * @{
     86 */
     87/** The number of handy pages.
     88 * This should be a power of two. */
     89#define PGM_HANDY_PAGES             128
     90/** The threshold at which allocation of more handy pages is flagged. */
     91#define PGM_HANDY_PAGES_SET_FF      32
     92/** The threshold at which we will allocate more when in ring-3.
     93 * This is must be smaller than both PGM_HANDY_PAGES_SET_FF and
     94 * PGM_HANDY_PAGES_MIN. */
     95#define PGM_HANDY_PAGES_R3_ALLOC    8
     96/** The threshold at which we will allocate more when in ring-0 or raw mode.
     97 * The idea is that we should never go below this threshold while in ring-0 or
     98 * raw mode because of PGM_HANDY_PAGES_RZ_TO_R3. However, should this happen and
     99 * we are actually out of memory, we will have 8 page to get out of whatever
     100 * code we're executing.
     101 *
     102 * This is must be smaller than both PGM_HANDY_PAGES_SET_FF and
     103 * PGM_HANDY_PAGES_MIN. */
     104#define PGM_HANDY_PAGES_RZ_ALLOC    8
     105/** The threshold at which we force return to R3 ASAP.
     106 * The idea is that this should be large enough to get out of any code and up to
     107 * the main EM loop when we are out of memory.
     108 * This must be less or equal to PGM_HANDY_PAGES_MIN. */
     109#define PGM_HANDY_PAGES_RZ_TO_R3    24
     110/** The minimum number of handy pages (after allocation).
     111 * This must be greater or equal to PGM_HANDY_PAGES_SET_FF.
     112 * Another name would be PGM_HANDY_PAGES_EXTRA_RESERVATION or _PARANOIA. :-) */
     113#define PGM_HANDY_PAGES_MIN         32
    82114/** @} */
    83115
     
    87119 * @{
    88120 */
    89 
    90121/** VMM stack size. */
    91122#define VMM_STACK_SIZE              8192U
    92 
    93123/** @} */
    94124
  • trunk/include/VBox/vm.h

    r17546 r18617  
    211211/** PGM needs to allocate handy pages. */
    212212#define VM_FF_PGM_NEED_HANDY_PAGES      RT_BIT_32(18)
     213/** PGM is out of memory.
     214 * Abandon all loops and code paths which can be resumed and get up to the EM
     215 * loops. */
     216#define VM_FF_PGM_NO_MEMORY             RT_BIT_32(19)
    213217/** Check the interupt and trap gates */
    214 #define VM_FF_TRPM_SYNC_IDT             RT_BIT_32(19)
     218#define VM_FF_TRPM_SYNC_IDT             RT_BIT_32(20)
    215219/** Check Guest's TSS ring 0 stack */
    216 #define VM_FF_SELM_SYNC_TSS             RT_BIT_32(20)
     220#define VM_FF_SELM_SYNC_TSS             RT_BIT_32(21)
    217221/** Check Guest's GDT table */
    218 #define VM_FF_SELM_SYNC_GDT             RT_BIT_32(21)
     222#define VM_FF_SELM_SYNC_GDT             RT_BIT_32(22)
    219223/** Check Guest's LDT table */
    220 #define VM_FF_SELM_SYNC_LDT             RT_BIT_32(22)
     224#define VM_FF_SELM_SYNC_LDT             RT_BIT_32(23)
    221225/** Inhibit interrupts pending. See EMGetInhibitInterruptsPC(). */
    222 #define VM_FF_INHIBIT_INTERRUPTS        RT_BIT_32(23)
     226#define VM_FF_INHIBIT_INTERRUPTS        RT_BIT_32(24)
    223227
    224228/** CSAM needs to scan the page that's being executed */
    225 #define VM_FF_CSAM_SCAN_PAGE            RT_BIT_32(24)
     229#define VM_FF_CSAM_SCAN_PAGE            RT_BIT_32(26)
    226230/** CSAM needs to do some homework. */
    227 #define VM_FF_CSAM_PENDING_ACTION       RT_BIT_32(25)
     231#define VM_FF_CSAM_PENDING_ACTION       RT_BIT_32(27)
    228232
    229233/** Force return to Ring-3. */
     
    242246/** High priority pre-execution actions. */
    243247#define VM_FF_HIGH_PRIORITY_PRE_MASK    (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_DEBUG_SUSPEND \
    244                                         | VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_PGM_NEED_HANDY_PAGES)
     248                                        | VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY)
    245249/** High priority pre raw-mode execution mask. */
    246 #define VM_FF_HIGH_PRIORITY_PRE_RAW_MASK (VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_PGM_NEED_HANDY_PAGES \
    247                                         | VM_FF_INHIBIT_INTERRUPTS)
     250#define VM_FF_HIGH_PRIORITY_PRE_RAW_MASK (VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL | VM_FF_SELM_SYNC_TSS | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT \
     251                                         | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_INHIBIT_INTERRUPTS | VM_FF_PGM_NO_MEMORY)
    248252/** High priority post-execution actions. */
    249 #define VM_FF_HIGH_PRIORITY_POST_MASK   (VM_FF_PDM_CRITSECT | VM_FF_CSAM_PENDING_ACTION)
     253#define VM_FF_HIGH_PRIORITY_POST_MASK   (VM_FF_PDM_CRITSECT | VM_FF_CSAM_PENDING_ACTION | VM_FF_PGM_NO_MEMORY)
    250254/** Normal priority post-execution actions. */
    251 #define VM_FF_NORMAL_PRIORITY_POST_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_CSAM_SCAN_PAGE)
     255#define VM_FF_NORMAL_PRIORITY_POST_MASK (VM_FF_TERMINATE | VM_FF_DBGF | VM_FF_RESET | VM_FF_CSAM_SCAN_PAGE | VM_FF_PGM_NO_MEMORY)
    252256/** Normal priority actions. */
    253257#define VM_FF_NORMAL_PRIORITY_MASK      (VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_REM_HANDLER_NOTIFY)
    254 /** Flags to check before resuming guest execution. */
     258/** Flags to clear before resuming guest execution. */
    255259#define VM_FF_RESUME_GUEST_MASK         (VM_FF_TO_R3)
     260/** Flags that causes the HWACCM loops to go back to ring-3. */
     261#define VM_FF_HWACCM_TO_R3_MASK         (VM_FF_TO_R3 | VM_FF_TIMER | VM_FF_PGM_NEED_HANDY_PAGES | VM_FF_PGM_NO_MEMORY)
    256262/** All the forced flags. */
    257263#define VM_FF_ALL_MASK                  (~0U)
    258264/** All the forced flags. */
    259 #define VM_FF_ALL_BUT_RAW_MASK          (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_CSAM_PENDING_ACTION | VM_FF_PDM_CRITSECT))
     265#define VM_FF_ALL_BUT_RAW_MASK          (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_CSAM_PENDING_ACTION | VM_FF_PDM_CRITSECT) | VM_FF_PGM_NO_MEMORY)
    260266
    261267/** @} */
     
    357363#else
    358364# define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) VM_FF_ISPENDING(pVM, fFlags)
     365#endif
     366
     367/** @def VM_FF_ISPENDING
     368 * Checks if one or more force action in the specified set is pending while one
     369 * or more other ones are not.
     370 *
     371 * @param   pVM     VM Handle.
     372 * @param   fFlags  The flags to check for.
     373 * @param   fExcpt  The flags that should not be set.
     374 */
     375#define VM_FF_IS_PENDING_EXCEPT(pVM, fFlags, fExcpt)            ( ((pVM)->fForcedActions & (fFlags)) && !((pVM)->fForcedActions & (fExcpt)) )
     376
     377/** @def VMCPU_FF_IS_PENDING_EXCEPT
     378 * Checks if one or more force action in the specified set is pending for given
     379 * VCPU while one or more other ones are not.
     380 *
     381 * @param   pVM     VM Handle.
     382 * @param   idCpu   Virtual CPU ID.
     383 * @param   fFlags  The flags to check for.
     384 * @param   fExcpt  The flags that should not be set.
     385 */
     386#ifdef VBOX_WITH_SMP_GUESTS
     387# define VMCPU_FF_IS_PENDING_EXCEPT(pVM, idCpu, fFlags, fExcpt) ( ((pVM)->aCpu[idCpu].fForcedActions & (fFlags)) && !((pVM)->aCpu[idCpu].fForcedActions & (fExcpt)) )
     388#else
     389# define VMCPU_FF_IS_PENDING_EXCEPT(pVM, idCpu, fFlags, fExcpt) VM_FF_ISPENDING(pVM, fFlags, fExcpt)
    359390#endif
    360391
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