Skip to content

开启多核后,创建定时器,后续使用中断有问题 #8375

Description

@messigogogo

开启SMP,创建周期定时器,启动后再使用rt_thread_mdelay或rt_kprintf等中断相关操作都会卡住,原因不明,跑死瞬间难以捕捉,在我们的开发板和qemu-vexpress-a9都会出现,疑似是(#8042)这次pr带来的问题,之前的旧版本没有问题。

测试代码如下:
/*

  • Copyright (c) 2006-2020, RT-Thread Development Team
  • SPDX-License-Identifier: Apache-2.0
  • Change Logs:
  • Date Author Notes
  • 2020/12/31 Bernard Add license info
    */

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <rtthread.h>

#define THREAD_STACK_SIZE 4096
#define TOTAL_TEST_TIMES 10

rt_timer_t soft_timer;

static void timer_callback(void *parameter)
{

rt_kprintf("timer_callback\n");

}

int task_init(void)
{
// 创建定时器
soft_timer = rt_timer_create("my_timer", timer_callback, RT_NULL, 100, RT_TIMER_FLAG_PERIODIC | RT_TIMER_FLAG_SOFT_TIMER);

if (soft_timer != RT_NULL)
{
    // 启动定时器,每1个tick触发一次 1ms
    rt_timer_start(soft_timer);
}
else
{
    rt_kprintf("Failed to create timer\n");
    return -1;
}

return 0;

}

int jitter_test(void)
{
task_init();

/*以下使用rt_kprintf或者delay都会出现问题*/
rt_kprintf("jitter_test\n");
// rt_thread_mdelay(TOTAL_TEST_TIMES + 100);/*ms*/

return RT_EOK;

}
INIT_DEVICE_EXPORT(jitter_test);

int main(void)
{
printf("Hello RT-Thread!\n");

return 0;

}
0fe230a96b85c074f9d4e6a1d10d44d

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions