Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*


1965         if (deadman_counter != CPU->cpu_deadman_counter) {
1966                 CPU->cpu_deadman_counter = deadman_counter;
1967                 CPU->cpu_deadman_countdown = deadman_seconds;
1968                 return;
1969         }
1970 
1971         if (--CPU->cpu_deadman_countdown > 0)
1972                 return;
1973 
1974         /*
1975          * Regardless of whether or not we actually bring the system down,
1976          * bump the deadman_panics variable.
1977          *
1978          * N.B. deadman_panics is incremented once for each CPU that
1979          * passes through here.  It's expected that all the CPUs will
1980          * detect this condition within one second of each other, so
1981          * when deadman_enabled is off, deadman_panics will
1982          * typically be a multiple of the total number of CPUs in
1983          * the system.
1984          */
1985         atomic_add_32(&deadman_panics, 1);
1986 
1987         if (!deadman_enabled) {
1988                 CPU->cpu_deadman_countdown = deadman_seconds;
1989                 return;
1990         }
1991 
1992         /*
1993          * If we're here, we want to bring the system down.
1994          */
1995         panic("deadman: timed out after %d seconds of clock "
1996             "inactivity", deadman_seconds);
1997         /*NOTREACHED*/
1998 }
1999 
2000 /*ARGSUSED*/
2001 static void
2002 deadman_online(void *arg, cpu_t *cpu, cyc_handler_t *hdlr, cyc_time_t *when)
2003 {
2004         cpu->cpu_deadman_counter = 0;
2005         cpu->cpu_deadman_countdown = deadman_seconds;




1965         if (deadman_counter != CPU->cpu_deadman_counter) {
1966                 CPU->cpu_deadman_counter = deadman_counter;
1967                 CPU->cpu_deadman_countdown = deadman_seconds;
1968                 return;
1969         }
1970 
1971         if (--CPU->cpu_deadman_countdown > 0)
1972                 return;
1973 
1974         /*
1975          * Regardless of whether or not we actually bring the system down,
1976          * bump the deadman_panics variable.
1977          *
1978          * N.B. deadman_panics is incremented once for each CPU that
1979          * passes through here.  It's expected that all the CPUs will
1980          * detect this condition within one second of each other, so
1981          * when deadman_enabled is off, deadman_panics will
1982          * typically be a multiple of the total number of CPUs in
1983          * the system.
1984          */
1985         atomic_inc_32(&deadman_panics);
1986 
1987         if (!deadman_enabled) {
1988                 CPU->cpu_deadman_countdown = deadman_seconds;
1989                 return;
1990         }
1991 
1992         /*
1993          * If we're here, we want to bring the system down.
1994          */
1995         panic("deadman: timed out after %d seconds of clock "
1996             "inactivity", deadman_seconds);
1997         /*NOTREACHED*/
1998 }
1999 
2000 /*ARGSUSED*/
2001 static void
2002 deadman_online(void *arg, cpu_t *cpu, cyc_handler_t *hdlr, cyc_time_t *when)
2003 {
2004         cpu->cpu_deadman_counter = 0;
2005         cpu->cpu_deadman_countdown = deadman_seconds;