Hi,
We have been facing an issue of blocking of a ARM core while starting a userspace application on our custom board based on K2HK (2 ARM Cores and 4 DSP cores). Whenever we start the user space application, we randomly get into a state where one of the ARM core is fully used and blocked with the application.
TOP reports 50% cpu idle time.
We tried to reproduce the issue on the K2HK eval kit. The problem could be reproduced on the eval kit as well. Here we use 66AKh12 (4 ARM core and 8 DSP core version). Inorder to provoke the issue, we have to run the userspace application many times(Start stop) till you see the state where TOP shows 70% idle time. In normal state while running the application, CPU idle time is 98%.
We are using kernel version from the TI keystone 2 git repository with tag K2_LINUX_03.10.10_14.12
The kernel version is 3.10.10-00067-ge366686
We have also tested latest kernel version from TI keystone 2 git repository master , and the problem is still there. We tested the userspace application with the initial kernel version based on 3.8 and we could not reproduce the issue.
We suspect that this is a kernel bug. We have not tried with earlier 3.10 version. We will try to move back to older kernel versions to see if the issue is still there or not.
The user space application creates a 10 ms timer. The code snipped is below.
Regards
Rams
#include <iostream> #include <fstream> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> int main() { // Create timer to expire every 10 ms. int ret = 0; int fd = timerfd_create(CLOCK_MONOTONIC, 0); printf("FD: %d\n", fd); struct itimerspec ts; bzero(&ts,sizeof(ts)); ts.it_interval.tv_sec = 0; ts.it_interval.tv_nsec = 10 * 1000 * 1000; ts.it_value.tv_sec = 0; ts.it_value.tv_nsec = 1 * 1000 * 1000; if(timerfd_settime(fd, 0, &ts, NULL) < 0 ) { printf("timerfd_settime Failed\n"); } fd_set readSet; while(true) { // Wait for timer to expire. FD_ZERO(&readSet); FD_SET(fd, &readSet); ret = select(fd + 1, &readSet, NULL, NULL, NULL); if (ret == -1) perror("select()"); else if (ret) { if(FD_ISSET(fd, &readSet)) { uint64_t timerExpCnt = 0; if(read(fd, &timerExpCnt, sizeof(uint64_t)) > 0) { printf("timer expired\n"); } } else { printf("Select returned, but the timer did not expire!\n"); break; } } else { printf("select timedout\n"); } // Do work for a small amount of time. const auto done = std::chrono::steady_clock::now() + std::chrono::milliseconds(2); int i = 0; while(std::chrono::steady_clock::now() < done) { ++i;; } } close(fd); return 0; }