* Switches the cpu tied to a specific callout. * The function expects a locked incoming callout cpu and returns with * locked outcoming callout cpu. */
| 340 | * locked outcoming callout cpu. |
| 341 | */ |
| 342 | static struct callout_cpu * |
| 343 | callout_cpu_switch(struct callout *c, struct callout_cpu *cc, int new_cpu) |
| 344 | { |
| 345 | struct callout_cpu *new_cc; |
| 346 | |
| 347 | MPASS(c != NULL && cc != NULL); |
| 348 | CC_LOCK_ASSERT(cc); |
| 349 | |
| 350 | /* |
| 351 | * Avoid interrupts and preemption firing after the callout cpu |
| 352 | * is blocked in order to avoid deadlocks as the new thread |
| 353 | * may be willing to acquire the callout cpu lock. |
| 354 | */ |
| 355 | c->c_cpu = CPUBLOCK; |
| 356 | spinlock_enter(); |
| 357 | CC_UNLOCK(cc); |
| 358 | new_cc = CC_CPU(new_cpu); |
| 359 | CC_LOCK(new_cc); |
| 360 | spinlock_exit(); |
| 361 | c->c_cpu = new_cpu; |
| 362 | return (new_cc); |
| 363 | } |
| 364 | #endif |
| 365 | |
| 366 | /* |
no test coverage detected