VirtualBox

Changeset 90638 in vbox


Ignore:
Timestamp:
Aug 11, 2021 9:35:56 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146250
Message:

VMM,VMMDev: Force 32-byte alignment of PDMCRITSECTRW so all members that are being updated atomically are in the same cacheline. This also ensures that the 128-bit union is correctly aligned. bugref:6695

Location:
trunk
Files:
5 edited

Legend:

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

    r90486 r90638  
    16131613/** Internal error in read-write critical section. */
    16141614#define VERR_PDM_CRITSECTRW_IPE                     (-7205)
     1615/** Misaligned read/write critical section. */
     1616#define VERR_PDM_CRITSECTRW_MISALIGNED              (-7206)
    16151617/** @} */
    16161618
  • trunk/src/VBox/Devices/VMMDev/VMMDevState.h

    r90503 r90638  
    393393#ifndef VBOX_WITHOUT_TESTING_FEATURES
    394394AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
     395AssertCompileMemberAlignment(VMMDEV, CritSectRw, 32);
    395396#endif
    396397
  • trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp

    r90637 r90638  
    251251    VM_ASSERT_EMT(pVM);
    252252    Assert(pCritSect->Core.u32Magic != RTCRITSECTRW_MAGIC);
     253    AssertMsgReturn(((uintptr_t)&pCritSect->Core & 31) == 0, ("&Core=%p, must be 32-byte aligned!\n", &pCritSect->Core),
     254                    VERR_PDM_CRITSECTRW_MISALIGNED);
     255    AssertMsgReturn(((uintptr_t)&pCritSect->Core.u & (sizeof(pCritSect->Core.u.u128) - 1)) == 0 /* paranoia */,
     256                    ("&Core.u=%p, must be 16-byte aligned!\n", &pCritSect->Core.u),
     257                    VERR_PDM_CRITSECTRW_MISALIGNED);
    253258
    254259    /*
  • trunk/src/VBox/VMM/include/IOMInternal.h

    r90347 r90638  
    384384typedef struct IOM
    385385{
     386    /** Lock serializing EMT access to IOM. */
     387#ifdef IOM_WITH_CRIT_SECT_RW
     388    PDMCRITSECTRW                   CritSect;
     389#else
     390    PDMCRITSECT                     CritSect;
     391#endif
     392
    386393    /** @name I/O ports
    387394     * @note The updating of these variables is done exclusively from EMT(0).
     
    438445    /** @} */
    439446
    440 
    441     /** Lock serializing EMT access to IOM. */
    442 #ifdef IOM_WITH_CRIT_SECT_RW
    443     PDMCRITSECTRW                   CritSect;
    444 #else
    445     PDMCRITSECT                     CritSect;
    446 #endif
    447 
    448447    /** @name I/O Port statistics.
    449448     * @{ */
     
    470469    /** @} */
    471470} IOM;
     471#ifdef IOM_WITH_CRIT_SECT_RW
     472AssertCompileMemberAlignment(IOM, CritSect, 32);
     473#endif
    472474/** Pointer to IOM instance data. */
    473475typedef IOM *PIOM;
  • trunk/src/VBox/VMM/include/TMInternal.h

    r87816 r90638  
    320320    PDMCRITSECTRW           AllocLock;
    321321} TMTIMERQUEUE;
     322AssertCompileMemberAlignment(TMTIMERQUEUE, AllocLock, 32);
    322323AssertCompileSizeAlignment(TMTIMERQUEUE, 64);
    323324/** Pointer to a timer queue. */
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