VirtualBox

Changeset 92460 in vbox for trunk/src/VBox/Runtime/r0drv


Ignore:
Timestamp:
Nov 16, 2021 2:04:29 PM (3 years ago)
Author:
vboxsync
Message:

IPRT/thread-r0drv-linux.c: Must test more config options for propertly detection kernel preemption. bugref:10145

File:
1 edited

Legend:

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

    r90416 r92460  
    4343
    4444/*********************************************************************************************************************************
     45*   Defined Constants And Macros                                                                                                 *
     46*********************************************************************************************************************************/
     47#if  defined(CONFIG_PREEMPT_COUNT) /* since 3.1 */ \
     48  || defined(CONFIG_PREEMPTION)    /* since 5.3 */ \
     49  || defined(CONFIG_PREEMPT)       /* since 2.6.13 - preemption model choice; before that arch specific choice back to 2.5.45. */
     50# define IPRT_LNX_HAVE_PREEMPTION
     51#endif
     52
     53
     54/*********************************************************************************************************************************
    4555*   Global Variables                                                                                                             *
    4656*********************************************************************************************************************************/
    47 #ifndef CONFIG_PREEMPT
     57#ifndef IPRT_LNX_HAVE_PREEMPTION
    4858/** Per-cpu preemption counters. */
    4959static int32_t volatile g_acPreemptDisabled[NR_CPUS];
     
    104114RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread)
    105115{
    106 #ifdef CONFIG_PREEMPT
     116#ifdef IPRT_LNX_HAVE_PREEMPTION
    107117    Assert(hThread == NIL_RTTHREAD); RT_NOREF_PV(hThread);
    108118# ifdef preemptible
     
    165175RTDECL(bool) RTThreadPreemptIsPossible(void)
    166176{
    167 #ifdef CONFIG_PREEMPT
     177#ifdef IPRT_LNX_HAVE_PREEMPTION
    168178    return true;    /* Yes, kernel preemption is possible. */
    169179#else
    170     return false;   /* No kernel preemption (or CONFIG_PREEMPT_VOLUNTARY). */
     180    return false;   /* No kernel preemption (or just CONFIG_PREEMPT_VOLUNTARY). */
    171181#endif
    172182}
     
    176186RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState)
    177187{
    178 #ifdef CONFIG_PREEMPT
     188#ifdef IPRT_LNX_HAVE_PREEMPTION
    179189    AssertPtr(pState);
    180190    Assert(pState->u32Reserved == 0);
    181191    pState->u32Reserved = 42;
    182     /* This ASSUMES that CONFIG_PREEMPT_COUNT is always defined with CONFIG_PREEMPT. */
    183192    preempt_disable();
    184193    RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
    185194
    186 #else /* !CONFIG_PREEMPT */
     195#else /* !IPRT_LNX_HAVE_PREEMPTION */
    187196    int32_t c;
    188197    AssertPtr(pState);
     
    201210RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
    202211{
    203 #ifdef CONFIG_PREEMPT
     212#ifdef IPRT_LNX_HAVE_PREEMPTION
    204213    IPRT_LINUX_SAVE_EFL_AC(); /* paranoia */
    205214    AssertPtr(pState);
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