Changeset 83326 in vbox for trunk/src/VBox
- Timestamp:
- Mar 19, 2020 12:16:12 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
r82968 r83326 39 39 #include "r0drv/mp-r0drv.h" 40 40 41 #ifdef nr_cpumask_bits 42 # define VBOX_NR_CPUMASK_BITS nr_cpumask_bits 41 42 /********************************************************************************************************************************* 43 * Defined Constants And Macros * 44 *********************************************************************************************************************************/ 45 #if defined(nr_cpumask_bits) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) 46 # define VBOX_NR_CPUMASK_BITS (nr_cpumask_bits) /* same as nr_cpu_ids */ 43 47 #else 44 # define VBOX_NR_CPUMASK_BITS NR_CPUS48 # define VBOX_NR_CPUMASK_BITS (NR_CPUS) 45 49 #endif 46 50 … … 76 80 RTDECL(RTCPUID) RTMpCpuIdFromSetIndex(int iCpu) 77 81 { 78 return iCpu < VBOX_NR_CPUMASK_BITS ? (RTCPUID)iCpu : NIL_RTCPUID;82 return (unsigned)iCpu < VBOX_NR_CPUMASK_BITS ? (RTCPUID)iCpu : NIL_RTCPUID; 79 83 } 80 84 RT_EXPORT_SYMBOL(RTMpCpuIdFromSetIndex); … … 83 87 RTDECL(RTCPUID) RTMpGetMaxCpuId(void) 84 88 { 85 return VBOX_NR_CPUMASK_BITS - 1; //???89 return VBOX_NR_CPUMASK_BITS - 1; 86 90 } 87 91 RT_EXPORT_SYMBOL(RTMpGetMaxCpuId); … … 91 95 { 92 96 #if defined(CONFIG_SMP) 93 if (RT_UNLIKELY(idCpu >= VBOX_NR_CPUMASK_BITS)) 94 return false; 95 96 # if defined(cpu_possible) 97 return cpu_possible(idCpu); 97 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 2) || defined(cpu_possible) 98 return idCpu < VBOX_NR_CPUMASK_BITS && cpu_possible(idCpu); 98 99 # else /* < 2.5.29 */ 99 return idCpu < (RTCPUID) smp_num_cpus;100 return idCpu < (RTCPUID)(smp_num_cpus); 100 101 # endif 101 102 #else … … 125 126 { 126 127 #ifdef CONFIG_SMP 127 # if defined(CONFIG_HOTPLUG_CPU) /* introduced & uses cpu_present */ 128 return num_present_cpus(); 129 # elif defined(num_possible_cpus) 128 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4) || defined(num_possible_cpus) 130 129 return num_possible_cpus(); 131 130 # elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) … … 146 145 { 147 146 #ifdef CONFIG_SMP 148 if (RT_UNLIKELY(idCpu >= VBOX_NR_CPUMASK_BITS)) 149 return false; 150 # ifdef cpu_online 151 return cpu_online(idCpu); 147 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(cpu_online) 148 return idCpu < VBOX_NR_CPUMASK_BITS && cpu_online(idCpu); 152 149 # else /* 2.4: */ 153 return cpu_online_map & RT_BIT_64(idCpu);150 return idCpu < VBOX_NR_CPUMASK_BITS && cpu_online_map & RT_BIT_64(idCpu); 154 151 # endif 155 152 #else … … 184 181 { 185 182 #ifdef CONFIG_SMP 186 # if defined(num_online_cpus)183 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(num_online_cpus) 187 184 return num_online_cpus(); 188 185 # else
Note:
See TracChangeset
for help on using the changeset viewer.