微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ftrace preempt_depth字段未更新

如何解决ftrace preempt_depth字段未更新

我编写了一个示例程序来测试ftrace输出preempt-depth字段。

来自ftrace文档:

preempt-depthpreempt_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 举报,一经查实,本站将立刻删除。