You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/07/04 21:52:40 UTC

[incubator-nuttx] branch master updated (7b54b75 -> f4a374b)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 7b54b75  fs/tmpfs: Account the filename in the allocation block
     new 0941bad  note: Move up_schednote.c to drivers/note folder
     new 8fe701c  note/notelog: Implement more sched_note callback
     new f4a374b  boards/sim: Add instrumentation config to notelog driver

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/sim/src/Makefile                              |   6 -
 .../sim/sim/configs/{linuxi2c => note}/defconfig   |  22 +--
 drivers/note/Kconfig                               |   6 +
 drivers/note/Make.defs                             |   4 +
 .../note/notelog_driver.c                          | 203 ++++++++++++++++++++-
 5 files changed, 220 insertions(+), 21 deletions(-)
 copy boards/sim/sim/sim/configs/{linuxi2c => note}/defconfig (68%)
 rename arch/sim/src/sim/up_schednote.c => drivers/note/notelog_driver.c (52%)

[incubator-nuttx] 03/03: boards/sim: Add instrumentation config to notelog driver

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit f4a374b6d98878491ad4cc2def5f48a820264794
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Jun 26 14:00:32 2021 +0800

    boards/sim: Add instrumentation config to notelog driver
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 boards/sim/sim/sim/configs/note/defconfig | 37 +++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/boards/sim/sim/sim/configs/note/defconfig b/boards/sim/sim/sim/configs/note/defconfig
new file mode 100644
index 0000000..feae620
--- /dev/null
+++ b/boards/sim/sim/sim/configs/note/defconfig
@@ -0,0 +1,37 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+CONFIG_ARCH="sim"
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+CONFIG_ARCH_CHIP="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_BOARDCTL_POWEROFF=y
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEV_LOOP=y
+CONFIG_DEV_ZERO=y
+CONFIG_DRIVER_NOTE=y
+CONFIG_DRIVER_NOTELOG=y
+CONFIG_EXAMPLES_HELLO=y
+CONFIG_FS_BINFS=y
+CONFIG_FS_PROCFS=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_READLINE=y
+CONFIG_READLINE_TABCOMPLETION=y
+CONFIG_SCHED_HAVE_PARENT=y
+CONFIG_SCHED_INSTRUMENTATION=y
+CONFIG_SCHED_INSTRUMENTATION_CSECTION=y
+CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER=y
+CONFIG_SCHED_INSTRUMENTATION_PREEMPTION=y
+CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS=y
+CONFIG_SCHED_ONEXIT=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_USER_ENTRYPOINT="nsh_main"

[incubator-nuttx] 01/03: note: Move up_schednote.c to drivers/note folder

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 0941bad877d1e4a5513eb067c51ca675b628c229
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Oct 13 20:19:28 2020 +0800

    note: Move up_schednote.c to drivers/note folder
    
    since it is general enough to work on other target
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/Makefile                                            | 6 ------
 drivers/note/Kconfig                                             | 6 ++++++
 drivers/note/Make.defs                                           | 4 ++++
 arch/sim/src/sim/up_schednote.c => drivers/note/notelog_driver.c | 2 +-
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index bd669e8..29b5380 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -104,12 +104,6 @@ endif
   HOSTSRCS += up_simsmp.c
 endif
 
-ifeq ($(CONFIG_SCHED_INSTRUMENTATION),y)
-ifneq ($(CONFIG_SCHED_INSTRUMENTATION_BUFFER),y)
-  CSRCS += up_schednote.c
-endif
-endif
-
 ifeq ($(CONFIG_ONESHOT),y)
   CSRCS += up_oneshot.c
 endif
diff --git a/drivers/note/Kconfig b/drivers/note/Kconfig
index 61a2274..0644402 100644
--- a/drivers/note/Kconfig
+++ b/drivers/note/Kconfig
@@ -46,6 +46,12 @@ config DRIVER_NOTEARCH
 	---help---
 		The note driver is provided by arch specific code.
 
+config DRIVER_NOTELOG
+	bool "Note syslog driver"
+	select SCHED_INSTRUMENTATION_EXTERNAL
+	---help---
+		The note driver output to syslog.
+
 endchoice
 
 config DRIVER_NOTERAM_BUFSIZE
diff --git a/drivers/note/Make.defs b/drivers/note/Make.defs
index 943e4ff..fc74611 100644
--- a/drivers/note/Make.defs
+++ b/drivers/note/Make.defs
@@ -26,6 +26,10 @@ ifeq ($(CONFIG_DRIVER_NOTERAM),y)
   CSRCS += noteram_driver.c
 endif
 
+ifeq ($(CONFIG_DRIVER_NOTELOG),y)
+  CSRCS += notelog_driver.c
+endif
+
 ifeq ($(CONFIG_DRIVER_NOTECTL),y)
   CSRCS += notectl_driver.c
 endif
diff --git a/arch/sim/src/sim/up_schednote.c b/drivers/note/notelog_driver.c
similarity index 99%
rename from arch/sim/src/sim/up_schednote.c
rename to drivers/note/notelog_driver.c
index e06976b..4b855e3 100644
--- a/arch/sim/src/sim/up_schednote.c
+++ b/drivers/note/notelog_driver.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/sim/src/sim/up_schednote.c
+ * drivers/note/notelog_driver.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with

[incubator-nuttx] 02/03: note/notelog: Implement more sched_note callback

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8fe701c8ae235ea0badced4cf2c8cbb5c6a64b51
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Jun 26 13:55:54 2021 +0800

    note/notelog: Implement more sched_note callback
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/note/notelog_driver.c | 201 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 200 insertions(+), 1 deletion(-)

diff --git a/drivers/note/notelog_driver.c b/drivers/note/notelog_driver.c
index 4b855e3..cba8be6 100644
--- a/drivers/note/notelog_driver.c
+++ b/drivers/note/notelog_driver.c
@@ -23,9 +23,12 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
-#include <stdbool.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <syscall.h>
 #include <syslog.h>
 #include <nuttx/sched.h>
+#include <nuttx/sched_note.h>
 
 /****************************************************************************
  * Public Functions
@@ -130,6 +133,74 @@ void sched_note_resume(FAR struct tcb_s *tcb)
 #endif
 }
 
+#ifdef CONFIG_SMP
+void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu)
+{
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p CPU%d START\n",
+         tcb->cpu, tcb->name, tcb, cpu);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p CPU%d START\n",
+         tcb->cpu, tcb, cpu);
+#endif
+}
+
+void sched_note_cpu_started(FAR struct tcb_s *tcb)
+{
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p CPU%d STARTED\n",
+         tcb->cpu, tcb->name, tcb, tcb->cpu);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p CPU%d STARTED\n",
+         tcb->cpu, tcb, tcb->cpu);
+#endif
+}
+
+void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu)
+{
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p CPU%d PAUSE\n",
+         tcb->cpu, tcb->name, tcb, cpu);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p CPU%d PAUSE\n",
+         tcb->cpu, tcb, cpu);
+#endif
+}
+
+void sched_note_cpu_paused(FAR struct tcb_s *tcb)
+{
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p CPU%d PAUSED\n",
+         tcb->cpu, tcb->name, tcb, tcb->cpu);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p CPU%d PAUSED\n",
+         tcb->cpu, tcb, tcb->cpu);
+#endif
+}
+
+void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu)
+{
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p CPU%d RESUME\n",
+         tcb->cpu, tcb->name, tcb, cpu);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p CPU%d RESUME\n",
+         tcb->cpu, tcb, cpu);
+#endif
+}
+
+void sched_note_cpu_resumed(FAR struct tcb_s *tcb)
+{
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p CPU%d RESUMED\n",
+         tcb->cpu, tcb->name, tcb, tcb->cpu);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p CPU%d RESUMED\n",
+         tcb->cpu, tcb, tcb->cpu);
+#endif
+}
+#endif
+
 #ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
 /* This does not work well... it interferes with the operation of the
  * simulated /dev/console device which, of course, does disable preemption
@@ -189,3 +260,131 @@ void sched_note_csection(FAR struct tcb_s *tcb, bool enter)
 #endif
 }
 #endif
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
+void sched_note_spinlock(FAR struct tcb_s *tcb,
+                         FAR volatile void *spinlock)
+{
+#ifdef CONFIG_SMP
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p spinlock@%p LOCK\n",
+         tcb->cpu, tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p spinlock@%p LOCK\n",
+         tcb->cpu, tcb, spinlock);
+#endif
+#else
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "Task %s TCB@%p spinlock@%p LOCK\n",
+         tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "TCB@%p spinlock@%p LOCK\n",
+         tcb, spinlock);
+#endif
+#endif
+}
+
+void sched_note_spinlocked(FAR struct tcb_s *tcb,
+                           FAR volatile void *spinlock)
+{
+#ifdef CONFIG_SMP
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p spinlock@%p LOCKED\n",
+         tcb->cpu, tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p spinlock@%p LOCKED\n",
+         tcb->cpu, tcb, spinlock);
+#endif
+#else
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "Task %s TCB@%p spinlock@%p LOCKED\n",
+         tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "TCB@%p spinlock@%p LOCKED\n",
+         tcb, spinlock);
+#endif
+#endif
+}
+
+void sched_note_spinunlock(FAR struct tcb_s *tcb,
+                           FAR volatile void *spinlock)
+{
+#ifdef CONFIG_SMP
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p spinlock@%p UNLOCK\n",
+         tcb->cpu, tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p spinlock@%p UNLOCK\n",
+         tcb->cpu, tcb, spinlock);
+#endif
+#else
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "Task %s TCB@%p spinlock@%p UNLOCK\n",
+         tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "TCB@%p spinlock@%p UNLOCK\n",
+         tcb, spinlock);
+#endif
+#endif
+}
+
+void sched_note_spinabort(FAR struct tcb_s *tcb,
+                          FAR volatile void *spinlock)
+{
+#ifdef CONFIG_SMP
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "CPU%d: Task %s TCB@%p spinlock@%p ABORT\n",
+         tcb->cpu, tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "CPU%d: TCB@%p spinlock@%p ABORT\n",
+         tcb->cpu, tcb, spinlock);
+#endif
+#else
+#if CONFIG_TASK_NAME_SIZE > 0
+  syslog(LOG_INFO, "Task %s TCB@%p spinlock@%p ABORT\n",
+         tcb->name, tcb, spinlock);
+#else
+  syslog(LOG_INFO, "TCB@%p spinlock@%p ABORT\n",
+         tcb, spinlock);
+#endif
+#endif
+}
+#endif
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+void sched_note_syscall_enter(int nr, int argc, ...)
+{
+  char buf[128];
+  FAR char *p = buf;
+  va_list ap;
+
+  va_start(ap, argc);
+  while (argc-- > 0)
+    {
+      if (argc)
+        {
+          p += sprintf(p, "%#"PRIxPTR", ", va_arg(ap, uintptr_t));
+        }
+      else
+        {
+          p += sprintf(p, "%#"PRIxPTR, va_arg(ap, uintptr_t));
+        }
+    }
+
+  va_end(ap);
+  syslog(LOG_INFO, "%s@%d ENTER %s\n", g_funcnames[nr], nr, buf);
+}
+
+void sched_note_syscall_leave(int nr, uintptr_t result)
+{
+  syslog(LOG_INFO, "%s@%d LEAVE %"PRIdPTR"\n", g_funcnames[nr], nr, result);
+}
+#endif
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+void sched_note_irqhandler(int irq, FAR void *handler, bool enter)
+{
+  syslog(LOG_INFO, "IRQ%d handler@%p %s\n",
+         irq, handler, enter ? "ENTER" : "LEAVE");
+}
+#endif