VirtualBox

Changeset 22139 in vbox


Ignore:
Timestamp:
Aug 10, 2009 2:18:37 PM (15 years ago)
Author:
vboxsync
Message:

IPRT: Corrected RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE to work around solaris issue where RTThreadPreemptionIsEnabled doesn't notice that we're in a spinlock.

Location:
trunk/src/VBox/Runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/iprt.h

    r22135 r22139  
    107107 * RTSpinlockRelease* returns. */
    108108#ifdef RT_MORE_STRICT
    109 # define RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE_VARS()    RTCPUID idAssertCpu, idAssertCpuAfter
     109# define RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE_VARS()    RTCPUID idAssertCpu
    110110#else
    111111# define RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE_VARS()    RTCPUID idAssertCpuDummy
     
    120120    do \
    121121    { \
    122         idAssertCpu          = (pThis)->idCpuOwner; \
    123         idAssertCpuAfter     = (pThis)->idAssertCpu; \
    124         RT_ASSERT_PREEMPT_CPUID(); \
     122        RTCPUID const idCpuOwner     = (pThis)->idCpuOwner; \
     123        RTCPUID const idAssertCpuNow = RTMpCpuId(); \
     124        AssertMsg(idCpuOwner == idAssertCpuNow,  ("%#x, %#x\n", idCpuOwner, idAssertCpuNow)); \
    125125        (pThis)->idCpuOwner  = NIL_RTCPUID; \
     126        idAssertCpu = (pThis)->idAssertCpu; \
    126127        (pThis)->idAssertCpu = NIL_RTCPUID; \
    127128    } while (0)
    128129#else
    129130# define RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE(pThis)    NOREF(idAssertCpuDummy)
    130 #endif
    131 
    132 /** @def RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASED
    133  * Extended version of RT_ASSERT_PREEMPT_CPUID for use in RTSpinlockRelease*
    134  * after having released the spinlock. It must be teamed up with
    135  * RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE. */
    136 #ifdef RT_MORE_STRICT
    137 # define RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASED() \
    138     do \
    139     { \
    140         idAssertCpu = idAssertCpuAfter; \
    141         RT_ASSERT_PREEMPT_CPUID(); \
    142     } while (0)
    143 #else
    144 # define RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASED()        NOREF(idAssertCpuDummy)
    145131#endif
    146132
  • trunk/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c

    r22131 r22139  
    145145    spin_unlock_irqrestore(&pThis->Spinlock, pTmp->flFlags);
    146146
    147     RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASED();
     147    RT_ASSERT_PREEMPT_CPUID();
    148148}
    149149RT_EXPORT_SYMBOL(RTSpinlockReleaseNoInts);
     
    176176    spin_unlock(&pThis->Spinlock);
    177177
    178     RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASED();
     178    RT_ASSERT_PREEMPT_CPUID();
    179179}
    180180RT_EXPORT_SYMBOL(RTSpinlockRelease);
  • trunk/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c

    r22134 r22139  
    141141    ASMSetFlags(pTmp->uFlags);
    142142
    143     RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASED();
     143    RT_ASSERT_PREEMPT_CPUID();
    144144}
    145145
     
    171171    mutex_exit(&pThis->Mtx);
    172172
    173     RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASED();
     173    RT_ASSERT_PREEMPT_CPUID();
    174174}
    175175
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