VirtualBox

Changeset 44544 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Feb 5, 2013 1:56:17 PM (12 years ago)
Author:
vboxsync
Message:

Linux r0drv: implement DO_NOT_DISABLE_PROVE_LOCKING option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c

    r44538 r44544  
    9595#endif
    9696
     97#if defined(CONFIG_PROVE_LOCKING) && defined(DO_NOT_DISABLE_PROVE_LOCKING)
     98    /*
     99      PLEASE DO NOT MODIFY THE NEXT FOUR LINES OF CODE!
     100      We use this approach in order to split RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE and
     101      RTSPINLOCK_FLAGS_INTERRUPT_SAFE spinlocks into separated locking classes when
     102      CONFIG_PROVE_LOCKING kernel option is enabled. Using single spin_lock_init()
     103      call will trigger kernel warning regarding to incorrect spinlock usage.
     104    */
     105    if (fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE)
     106        spin_lock_init(&pThis->Spinlock);
     107    else
     108        spin_lock_init(&pThis->Spinlock);
     109#else
    97110    spin_lock_init(&pThis->Spinlock);
     111#endif
    98112
    99113    *pSpinlock = pThis;
     
    131145              ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
    132146
    133 #if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
     147#if defined(CONFIG_PROVE_LOCKING) && !defined(DO_NOT_DISABLE_PROVE_LOCKING)
    134148    lockdep_off();
    135149#endif
     
    142156    else
    143157        spin_lock(&pThis->Spinlock);
    144 #if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
     158#if defined(CONFIG_PROVE_LOCKING) && !defined(DO_NOT_DISABLE_PROVE_LOCKING)
    145159    lockdep_on();
    146160#endif
     
    159173    RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE(pThis);
    160174
    161 #if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
     175#if defined(CONFIG_PROVE_LOCKING) && !defined(DO_NOT_DISABLE_PROVE_LOCKING)
    162176    lockdep_off();
    163177#endif
     
    170184    else
    171185        spin_unlock(&pThis->Spinlock);
    172 #if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
     186#if defined(CONFIG_PROVE_LOCKING) && !defined(DO_NOT_DISABLE_PROVE_LOCKING)
    173187    lockdep_on();
    174188#endif
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