tick-common.c (f8381cba04ba8173fd5a2b8e5cd8b3290ee13a98) | tick-common.c (79bf2bb335b85db25d27421c798595a2fa2a0e82) |
---|---|
1/* 2 * linux/kernel/time/tick-common.c 3 * 4 * This file contains the base functions to manage periodic tick 5 * related events. 6 * 7 * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de> 8 * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar --- 20 unchanged lines hidden (view full) --- 29/* 30 * Tick next event: keeps track of the tick time 31 */ 32ktime_t tick_next_period; 33ktime_t tick_period; 34static int tick_do_timer_cpu = -1; 35DEFINE_SPINLOCK(tick_device_lock); 36 | 1/* 2 * linux/kernel/time/tick-common.c 3 * 4 * This file contains the base functions to manage periodic tick 5 * related events. 6 * 7 * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de> 8 * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar --- 20 unchanged lines hidden (view full) --- 29/* 30 * Tick next event: keeps track of the tick time 31 */ 32ktime_t tick_next_period; 33ktime_t tick_period; 34static int tick_do_timer_cpu = -1; 35DEFINE_SPINLOCK(tick_device_lock); 36 |
37/** 38 * tick_is_oneshot_available - check for a oneshot capable event device 39 */ 40int tick_is_oneshot_available(void) 41{ 42 struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev; 43 44 return dev && (dev->features & CLOCK_EVT_FEAT_ONESHOT); 45} 46 |
|
37/* 38 * Periodic tick 39 */ 40static void tick_periodic(int cpu) 41{ 42 if (tick_do_timer_cpu == cpu) { 43 write_seqlock(&xtime_lock); 44 --- 112 unchanged lines hidden (view full) --- 157 * This allows us to handle this x86 misfeature in a generic 158 * way. 159 */ 160 if (tick_device_uses_broadcast(newdev, cpu)) 161 return; 162 163 if (td->mode == TICKDEV_MODE_PERIODIC) 164 tick_setup_periodic(newdev, 0); | 47/* 48 * Periodic tick 49 */ 50static void tick_periodic(int cpu) 51{ 52 if (tick_do_timer_cpu == cpu) { 53 write_seqlock(&xtime_lock); 54 --- 112 unchanged lines hidden (view full) --- 167 * This allows us to handle this x86 misfeature in a generic 168 * way. 169 */ 170 if (tick_device_uses_broadcast(newdev, cpu)) 171 return; 172 173 if (td->mode == TICKDEV_MODE_PERIODIC) 174 tick_setup_periodic(newdev, 0); |
175 else 176 tick_setup_oneshot(newdev, handler, next_event); |
|
165} 166 167/* 168 * Check, if the new registered device should be used. 169 */ 170static int tick_check_new_device(struct clock_event_device *newdev) 171{ 172 struct clock_event_device *curdev; --- 31 unchanged lines hidden (view full) --- 204 } 205 206 /* 207 * If we have an active device, then check the rating and the oneshot 208 * feature. 209 */ 210 if (curdev) { 211 /* | 177} 178 179/* 180 * Check, if the new registered device should be used. 181 */ 182static int tick_check_new_device(struct clock_event_device *newdev) 183{ 184 struct clock_event_device *curdev; --- 31 unchanged lines hidden (view full) --- 216 } 217 218 /* 219 * If we have an active device, then check the rating and the oneshot 220 * feature. 221 */ 222 if (curdev) { 223 /* |
224 * Prefer one shot capable devices ! 225 */ 226 if ((curdev->features & CLOCK_EVT_FEAT_ONESHOT) && 227 !(newdev->features & CLOCK_EVT_FEAT_ONESHOT)) 228 goto out_bc; 229 /* |
|
212 * Check the rating 213 */ 214 if (curdev->rating >= newdev->rating) 215 goto out_bc; 216 } 217 218 /* 219 * Replace the eventually existing device by the new 220 * device. If the current device is the broadcast device, do 221 * not give it back to the clockevents layer ! 222 */ 223 if (tick_is_broadcast_device(curdev)) { 224 clockevents_set_mode(curdev, CLOCK_EVT_MODE_SHUTDOWN); 225 curdev = NULL; 226 } 227 clockevents_exchange_device(curdev, newdev); 228 tick_setup_device(td, newdev, cpu, cpumask); | 230 * Check the rating 231 */ 232 if (curdev->rating >= newdev->rating) 233 goto out_bc; 234 } 235 236 /* 237 * Replace the eventually existing device by the new 238 * device. If the current device is the broadcast device, do 239 * not give it back to the clockevents layer ! 240 */ 241 if (tick_is_broadcast_device(curdev)) { 242 clockevents_set_mode(curdev, CLOCK_EVT_MODE_SHUTDOWN); 243 curdev = NULL; 244 } 245 clockevents_exchange_device(curdev, newdev); 246 tick_setup_device(td, newdev, cpu, cpumask); |
247 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) 248 tick_oneshot_notify(); |
|
229 230 spin_unlock_irqrestore(&tick_device_lock, flags); 231 return NOTIFY_STOP; 232 233out_bc: 234 /* 235 * Can the new device be used as a broadcast device ? 236 */ --- 43 unchanged lines hidden (view full) --- 280 case CLOCK_EVT_NOTIFY_ADD: 281 return tick_check_new_device(dev); 282 283 case CLOCK_EVT_NOTIFY_BROADCAST_ON: 284 case CLOCK_EVT_NOTIFY_BROADCAST_OFF: 285 tick_broadcast_on_off(reason, dev); 286 break; 287 | 249 250 spin_unlock_irqrestore(&tick_device_lock, flags); 251 return NOTIFY_STOP; 252 253out_bc: 254 /* 255 * Can the new device be used as a broadcast device ? 256 */ --- 43 unchanged lines hidden (view full) --- 300 case CLOCK_EVT_NOTIFY_ADD: 301 return tick_check_new_device(dev); 302 303 case CLOCK_EVT_NOTIFY_BROADCAST_ON: 304 case CLOCK_EVT_NOTIFY_BROADCAST_OFF: 305 tick_broadcast_on_off(reason, dev); 306 break; 307 |
308 case CLOCK_EVT_NOTIFY_BROADCAST_ENTER: 309 case CLOCK_EVT_NOTIFY_BROADCAST_EXIT: 310 tick_broadcast_oneshot_control(reason); 311 break; 312 |
|
288 case CLOCK_EVT_NOTIFY_CPU_DEAD: | 313 case CLOCK_EVT_NOTIFY_CPU_DEAD: |
314 tick_shutdown_broadcast_oneshot(dev); |
|
289 tick_shutdown_broadcast(dev); 290 tick_shutdown(dev); 291 break; 292 293 default: 294 break; 295 } 296 --- 16 unchanged lines hidden --- | 315 tick_shutdown_broadcast(dev); 316 tick_shutdown(dev); 317 break; 318 319 default: 320 break; 321 } 322 --- 16 unchanged lines hidden --- |