- 论坛徽章:
- 1
|
下面是Linux-4.0.4内核中函数watchdog_nmi_enable()的语句:
wd_attr = &wd_hw_attr;
wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
/* Try to register using hardware perf events */
event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL);
其中wd_hw_attr定义如下:
static struct perf_event_attr wd_hw_attr = {
.type = PERF_TYPE_HARDWARE,
.config = PERF_COUNT_HW_CPU_CYCLES,
.size = sizeof(struct perf_event_attr),
.pinned = 1,
.disabled = 1,
};
可见nmi watchdog是依据cpu-cycles的perf 计数器实现的。
我的理解是,每当达到wd_attr->sample_period,就会产生nmi中断,并调用到
函数watchdog_overflow_callback(),但是实际上在正常情况下发现nmi中断并没有增加。
看了很久代码也没有找到答案,请教大家了,为什么nmi中断没有增加?! |
|