Print this page
5042 stop using deprecated atomic functions

*** 1216,1234 **** * it (i.e. it blocked at some point in its past) has finished running * its handler. intr_thread() updated the interrupt statistic for its * PIL and zeroed its timestamp. Since there was no pinned thread to * return to, swtch() gets called and we end up here. * ! * Note that we use atomic ops below (cas64 and atomic_add_64), which ! * we don't use in the functions above, because we're not called ! * with interrupts blocked, but the epilog/prolog functions are. */ if (t->t_intr_start) { do { start = t->t_intr_start; interval = tsc_read() - start; ! } while (cas64(&t->t_intr_start, start, 0) != start); cpu = CPU; cpu->cpu_m.intrstat[t->t_pil][0] += interval; atomic_add_64((uint64_t *)&cpu->cpu_intracct[cpu->cpu_mstate], interval); --- 1216,1235 ---- * it (i.e. it blocked at some point in its past) has finished running * its handler. intr_thread() updated the interrupt statistic for its * PIL and zeroed its timestamp. Since there was no pinned thread to * return to, swtch() gets called and we end up here. * ! * Note that we use atomic ops below (atomic_cas_64 and ! * atomic_add_64), which we don't use in the functions above, ! * because we're not called with interrupts blocked, but the ! * epilog/prolog functions are. */ if (t->t_intr_start) { do { start = t->t_intr_start; interval = tsc_read() - start; ! } while (atomic_cas_64(&t->t_intr_start, start, 0) != start); cpu = CPU; cpu->cpu_m.intrstat[t->t_pil][0] += interval; atomic_add_64((uint64_t *)&cpu->cpu_intracct[cpu->cpu_mstate], interval);
*** 1248,1258 **** ASSERT((t->t_flag & T_INTR_THREAD) != 0); ASSERT(t->t_pil > 0 && t->t_pil <= LOCK_LEVEL); do { ts = t->t_intr_start; ! } while (cas64(&t->t_intr_start, ts, tsc_read()) != ts); } /* * Dispatch a hilevel interrupt (one above LOCK_LEVEL) */ --- 1249,1259 ---- ASSERT((t->t_flag & T_INTR_THREAD) != 0); ASSERT(t->t_pil > 0 && t->t_pil <= LOCK_LEVEL); do { ts = t->t_intr_start; ! } while (atomic_cas_64(&t->t_intr_start, ts, tsc_read()) != ts); } /* * Dispatch a hilevel interrupt (one above LOCK_LEVEL) */