问题描述
我编写了一个示例程序来测试ftrace输出的preempt-depth
字段。
来自ftrace文档:
的级别
preempt-depth
:preempt_disabled
我的示例代码:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
static int test_hello_init(void)
{
trace_printk("%s: In init\n",__func__);
preempt_disable();
trace_printk("Disabled preemption:%d\n",smp_processor_id());
preempt_enable();
trace_printk("Enabled preemption:%d\n",smp_processor_id());
return 0;
}
static void test_hello_exit(void)
{
trace_printk("%s: In exit\n",__func__);
}
module_init(test_hello_init);
module_exit(test_hello_exit);
在跟踪文件中输出:
insmod-27709 [003] .... 155744.793916: test_hello_init: test_hello_init: In init
insmod-27709 [003] .... 155744.793918: test_hello_init: Disabled preemption:3
insmod-27709 [003] .... 155744.793919: test_hello_init: Enabled preemption:3
^
should be a number indicating preempt-depth
为什么preempt-depth
字段为空?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)