VirtualBox

Changeset 57322 in vbox


Ignore:
Timestamp:
Aug 13, 2015 1:22:09 PM (9 years ago)
Author:
vboxsync
Message:

spinlock-r0drv-linux.c: Fixed saving and restoring EFLAGS.AC, must do it when calling both spin_unlock variants as they may perhaps preempt. Also making sure it's not messed up when acquiring the lock, just for good measure.

File:
1 edited

Legend:

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

    r57276 r57322  
    132132    AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,
    133133              ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
     134    IPRT_LINUX_SAVE_EFL_AC();
    134135
    135136#ifdef CONFIG_PROVE_LOCKING
     
    143144    }
    144145    else
    145     {
    146         IPRT_LINUX_SAVE_EFL_AC();
    147146        spin_lock(&pThis->Spinlock);
    148         IPRT_LINUX_RESTORE_EFL_ONLY_AC();
    149     }
    150147#ifdef CONFIG_PROVE_LOCKING
    151148    lockdep_on();
    152149#endif
    153150
     151    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
    154152    RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis);
    155153}
     
    164162              ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
    165163    RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE(pThis);
     164    IPRT_LINUX_SAVE_EFL_AC();           /* spin_unlock* may preempt and trash eflags.ac. */
    166165
    167166#ifdef CONFIG_PROVE_LOCKING
     
    175174    }
    176175    else
    177     {
    178         IPRT_LINUX_SAVE_EFL_AC();
    179176        spin_unlock(&pThis->Spinlock);
    180         IPRT_LINUX_RESTORE_EFL_ONLY_AC();
    181     }
    182177#ifdef CONFIG_PROVE_LOCKING
    183178    lockdep_on();
    184179#endif
    185180
     181    IPRT_LINUX_RESTORE_EFL_ONLY_AC();
    186182    RT_ASSERT_PREEMPT_CPUID();
    187183}
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