本文介绍了人们会如何去生成"人工"在中断Linux内核?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里读了答案:?这是一个很好的,但并不完全是我所需要的。

I've read the answer here: Trigger Kernel Interrupt Handler: How? and it's a good one, but not quite what I need.

我microbenchmarking的问候处理中断所RNG的功能,所以我需要的人工和可重复产生中断的好方法。例如,我可以重定向到的东西会产生300中断或类似的东西PROCFS接口。

I'm microbenchmarking the RNG functions in regards to processing interrupts, so I need a good way to artificially and repeatably generate interrupts. For example, I could redirect something into a Procfs interface that generates 300 interrupts or something like that.

这是在产生一个中断内核中运行某种功能容易吗?

Is it as easy as running some kind of function in the kernel that generates an interrupt?

是否有某种中断实际上并没有做任何东西,而是通过整个中断处理程序路径还行?我知道我可以只输入键或类似的东西,但是,这不是真正的可重复和可编写脚本用于研究目的。

Is there some kind of interrupt that does not actually do "Anything", but still goes through the entire interrupt handler path? I realize I could just type keys or something like that but that's not really repeatable and scriptable for research purposes.

我与x86架构的工作。

I'm working with the x86 architecture.

推荐答案

刚开始高分辨率定时器:

Just start a high-resolution timer:

struct hrtimer timer;

hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
timer.function = my_little_timer;
hrtimer_start(&timer, ktime_set(0, 500000000 /* ns */), HRTIMER_MODE_REL);

...

hrtimer_cancel(&timer);

...

enum hrtimer_restart my_little_timer(struct hrtimer *timer)
{
    // either:
    hrtimer_forward_now(timer, ktime_set(...));
    return HRTIMER_RESTART;
    // or:
    return HRTIMER_NORESTART;
}

这篇关于人们会如何去生成"人工"在中断Linux内核?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 21:12