profcs task status will now show CPU is SMP is enabled

This commit is contained in:
Gregory Nutt 2016-02-19 15:34:36 -06:00
parent 3994b094c5
commit 050b3ee06a
4 changed files with 37 additions and 1 deletions

View File

@ -11496,3 +11496,6 @@
actions from the TCB to the group structure. Signal handlers are not
per thread but, rather, per task group. I know, I preferred it the
other way too, but this is more compliant with POSIX (2016-02-18).
* fs/ procfs/fs_procfsproc.c: Add support for showing CPU if SMP is
is enabled (2016-02-19).

8
TODO
View File

@ -1,4 +1,5 @@
NuttX TODO List (Last updated February 18, 2016)
NuttX TODO List (Last updated February 18, 2016)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@ -1621,7 +1622,12 @@ o Linux/Cywgin simulation (arch/sim)
not an issue with the NuttX SMP logic but more likely some chaos
in the pthread controls. I have seen similar such strange behavior
other times that I have tried to use setjmp/longmp from a signal
handler!
handler! Like when I tried to implement simulated interrupts
using signals.
Apparently, if longjmp is invoked from the context of a signal
handler, the result is undefined:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1318.htm
You can enable SMP for ostest configuration by enabling:

View File

@ -375,6 +375,7 @@ static FAR const struct proc_node_s *proc_findnode(FAR const char *relpath)
* Type: xxxxxxx {Task, pthread, Kthread, Invalid}
* PPID: xxxxx Parent thread ID
* Group: xxxxx Group ID
* CPU: xxx CPU (CONFIG_SMP only)
* State: xxxxxxxx,xxxxxxxxx {Invalid, Waiting, Ready, Running, Inactive},
* {Unlock, Semaphore, Signal, MQ empty, MQ full}
* Flags: xxx N,P,X
@ -461,6 +462,30 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile,
}
#endif
#ifdef CONFIG_SMP
if (tcb->task_state >= FIRST_ASSIGNED_STATE &&
tcb->task_state <= LAST_ASSIGNED_STATE)
{
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", "CPU:",
tcb->cpu);
}
else
{
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s---\n", "CPU:");
}
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
totalsize += copysize;
buffer += copysize;
remaining -= copysize;
if (totalsize >= buflen)
{
return totalsize;
}
#endif
/* Show the thread state */
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%s\n", "State:",

View File

@ -222,6 +222,8 @@ typedef enum tstate_e tstate_t;
#define FIRST_READY_TO_RUN_STATE TSTATE_TASK_READYTORUN
#define LAST_READY_TO_RUN_STATE TSTATE_TASK_RUNNING
#define FIRST_ASSIGNED_STATE TSTATE_TASK_ASSIGNED
#define LAST_ASSIGNED_STATE TSTATE_TASK_RUNNING
#define FIRST_BLOCKED_STATE TSTATE_TASK_INACTIVE
#define LAST_BLOCKED_STATE (NUM_TASK_STATES-1)