示例#1
0
void setup_apic_nmi_watchdog(void *unused)
{
    struct hrtimer *hrtimer = &__get_cpu_var(nmi_watchdog_hrtimer);

    if (__get_cpu_var(wd_enabled))
        return;

    /* cheap hack to support suspend/resume */
    /* if cpu0 is not active neither should the other cpus */
    if (smp_processor_id() != 0 && atomic_read(&nmi_active) <= 0)
        return;

    switch (nmi_watchdog) {
    case NMI_LOCAL_APIC:
        if (lapic_watchdog_init(nmi_hz) < 0) {
            __get_cpu_var(wd_enabled) = 0;
            return;
        }
    /* FALL THROUGH */
    case NMI_IO_APIC:
        __get_cpu_var(wd_enabled) = 1;
        atomic_inc(&nmi_active);

        /* kick off hrtimers to use to determine if interrupts are working */
        hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        hrtimer->function = nmi_watchdog_timer_fn;
        hrtimer_start(hrtimer, ns_to_ktime(get_sample_period()),
                      HRTIMER_MODE_REL_PINNED);
    }
}
示例#2
0
void setup_apic_nmi_watchdog(void)
{
	if (__get_cpu_var(wd_enabled) == 1)
		return;

	switch (nmi_watchdog) {
	case NMI_LOCAL_APIC:
		__get_cpu_var(wd_enabled) = 1;
		if (lapic_watchdog_init(nmi_hz) < 0) {
			__get_cpu_var(wd_enabled) = 0;
			return;
		}
		/* FALL THROUGH */
	case NMI_IO_APIC:
		__get_cpu_var(wd_enabled) = 1;
		if (atomic_inc_return(&nmi_watchdog_active) == 1)
			nmi_active = 1;
	}
}
示例#3
0
void __cpuinit nmi_watchdog_default(void)
{
    struct hrtimer *hrtimer = &__get_cpu_var(nmi_watchdog_hrtimer);

    if (nmi_watchdog != NMI_DEFAULT)
        return;
    /* if not specified, probe it */
    if (!lapic_watchdog_init(nmi_hz))
        nmi_watchdog = NMI_LOCAL_APIC;
    else {
        cpu_nmi_set_wd_enabled();
        nmi_watchdog = NMI_IO_APIC;
    }
    atomic_inc(&nmi_active);

    /* kick off hrtimers to use to determine if interrupts are working */
    hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
    hrtimer->function = nmi_watchdog_timer_fn;
    hrtimer_start(hrtimer, ns_to_ktime(get_sample_period()),
                  HRTIMER_MODE_REL_PINNED);
}
示例#4
0
void setup_apic_nmi_watchdog(void *unused)
{
	if (__get_cpu_var(wd_enabled))
		return;

	/* cheap hack to support suspend/resume */
	/* if cpu0 is not active neither should the other cpus */
	if (smp_processor_id() != 0 && atomic_read(&nmi_active) <= 0)
		return;

	switch (nmi_watchdog) {
	case NMI_LOCAL_APIC:
		if (lapic_watchdog_init(nmi_hz) < 0) {
			__get_cpu_var(wd_enabled) = 0;
			return;
		}
		/* FALL THROUGH */
	case NMI_IO_APIC:
		__get_cpu_var(wd_enabled) = 1;
		atomic_inc(&nmi_active);
	}
}