Commit Graph

1725 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
b1ecca08c1 sched/semaphore/sem_holder.c: Fix syslog formats 2020-11-22 19:01:05 -08:00
YAMAMOTO Takashi
09b7660795 sched/sched/sched_timerexpiration.c: Fix a syslog format 2020-11-22 19:01:05 -08:00
YAMAMOTO Takashi
fe4395f916 sched/pthread/pthread_getaffinity.c: Fix a syslog format 2020-11-22 19:01:05 -08:00
YAMAMOTO Takashi
e4c2494a74 sched/pthread/pthread_setaffinity.c: Fix a syslog format 2020-11-22 19:01:05 -08:00
Nathan Hartman
8e8ead3224 sched/signal/sig_timedwait.c: Fix typo in comment
sched/signal/sig_timedwait.c:

    * nxsig_timedwait(): Fix typo in comment:
      "is store din" -> "is stored in"

include/nuttx/signal.h:

    * Fix same typo in extern declaration of nxsig_timedwait().
2020-11-22 18:31:49 -08:00
Matias N
d5b6ec450f Parallelize depend file generation 2020-11-22 09:02:59 -03:00
YAMAMOTO Takashi
d2d48a1b9b sched/module/mod_modhandle.c: Fix a syslog format 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
0c8aa190ca sched/signal/sig_dispatch.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
b83d658df2 sched/signal/sig_dispatch.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
92397727ab sched/signal/sig_notification.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
Masayuki Ishikawa
12862c7b33 armv7-a: Fix comments on Cortex-A SGI
Summary:
- I noticed that Cortex-A SGI can be masked
- We thought the SGI is not maskable
- Although I can not remember how I tested it before
- It actually works as expected now
- Also, fixed the number of remaining bugs in TODO

Impact:
- No impact

Testing:
- Tested with sabre-6quad:smp (QEMU and dev board)
- Add the following code in up_idle() before calling asm("WFI");
+  if (0 != up_cpu_index())
+    {
+      up_irq_save();
+    }
- Run the hello app, you can see "Hello, World!!"
- But nsh will freeze soon because arm_pause_handler is not called.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-19 18:01:30 -08:00
Masayuki Ishikawa
4cc38caba9 sched: Fix nx_waitid(), nx_waitpid(), nxtask_exithook() for SMP
Summary:
- I noticed waitpid_test stops with lc823450-xgevk:rndis
- The condition was CONFIG_DEBUG_ASSERTION=y
- Actually, the child task sent SIGCHILD but the parent couldn't catch the signal
- Then, I found that nx_waitid(), nx_waitpid() use sched_lock()
- However, a parent task and a child task are running on different CPUs
- So, sched_lock() is not enough and need to use a critical section
- Also, signal handling in nxtask_exithook() must be done in a critical section

Impact:
- SMP only

Testing:
- Tested with ostest with the following configurations
- lc823450-xgevk:rndis (CONFIG_DEBUG_ASSERTION=y and n)
- spresense:smp
- spresense:wifi_smp (NCPUS=2 and 4)
- sabre-6quad:smp (QEMU)
- esp32-core:smp (QEMU)
- maix-bit:smp (QEMU)
- sim:smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-14 16:31:49 -08:00
Masayuki Ishikawa
1dad55d4be sched: sched: Remove sched_tasklistlock.c for SMP
Summary:
- sched_tasklistlock.c was introduced to stabilize NuttX SMP
- However, the current SMP implementation is stable by recent fixes
- So I decided to remove the file finally

Impact:

- SMP only

Testing:
- Tested with ostest with the following configurations
- spresense:smp
- spresense:wifi_smp (NCPUS=2 and 4)
- sabre-6quad:smp (QEMU)
- esp32-core:smp (QEMU)
- maix-bit:smp (QEMU)
- sim:smp
- lc823450-xgevk:rndis

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-10 23:18:08 -08:00
Masayuki Ishikawa
f0bf2143f6 sched: pthread: Fix pthread_join() for SMP
Summary:
- I noticed 'pthread_rwlock test' in ostest sometimes stops
- This issue happened with spresense:wifi_smp (NCPUS=4) and sim:smp
- Finally, I found an issue in pthread_join()
- In pthread_join(), sched_lock() is used to avoid pre-emption
- However, this is not enough for SMP
- Because another CPU would continue the pthread and exit sequences
- So we need to protect it with a critical section

Impact:
- Affect SMP only

Testing:
- Tested with ostest with the following configurations
- spresnese:smp
- spresense:wifi_smp (NCPUS=2, NCPUS=4)
- sabre-6quad:smp (QEMU)
- esp32-core:smp (QEMU)
- maix-bit:smp (QEMU)
- sim:smp
- lc823450-xgevk:rndis

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-10 19:41:46 -08:00
chao.an
f6cd23e9d2 sched/init: init the default home directory to environment
Change-Id: Ib08a7702ce2256d48b210a70fa181591bbe8abe8
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 23:42:46 -08:00
chao.an
723698c787 sched/timer: add support of CLOCK_MONOTONIC
Reference here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/timer_create.html

DESCRIPTION
...
  Each implementation shall define a set of clocks that can be
  used as timing bases for per-process timers. All implementations
  shall support a clock_id of CLOCK_REALTIME.

  *** If the Monotonic Clock option is supported, implementations shall
  support a clock_id of CLOCK_MONOTONIC. ***
...

Change-Id: Ia8e7302ed4a7e9ec11a0059bd68e9674ea942001
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 15:01:36 -03:00
Masayuki Ishikawa
2395ab7f6e sched: task: Fix nxtask_exit() for SMP
Summary:
- I noticed that nxsched_merge_pending() is called outside a critical section
- The issue happens if a new rtcb does not hold a critical section
- Actually, global IRQ control is done in nxsched_resume_scheduler() in nxtask_exit()
- However, nxsched_merge_pending() was called after calling nxsched_resume_scheduler()
- This commit fixes the issue by moving nxsched_merge_pending() before the function
- NOTE: the sequence was changed for SMP but works for non-SMP as well

Impact:
- This commit affects both SMP and non-SMP

Testing:
- Tested with ostest with the following configurations
- spresense:wifi_smp (NCPUS=2 and 4)
- spresense:wifi (non SMP)
- sabre-6quad:smp (QEMU)
- esp32-core:smp (QEMU)
- maix-bit:smp (QEMU)
- sim:smp
- lc823450-xgevk:rndis

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-09 10:59:20 +01:00
Yoshinori Sugino
878dc33736 sched/task/task_exithook.c: Remove a redundant assignment 2020-11-07 11:14:43 +01:00
Yoshinori Sugino
d3700649c0 sched/sched/sched_waitid.c: Allow WNOHANG
In the current implementation of waitid, WEXITED is mandatory and WNOHANG is optional.
2020-11-06 00:44:55 -08:00
Yoshinori Sugino
51875ab039 sched/sched/sched_waitpid.c: Fix a typo 2020-11-05 23:06:51 -08:00
ligd
2dfd7a4e8f signal.h: fix compile failed when open TTY_SIGINT
In file included from string/lib_strsignal.c:40:0:
string/lib_strsignal.c: In function ‘strsignal’:
string/lib_strsignal.c:142:12: error: ‘CONFIG_SIG_STOP’ undeclared (first use in this function); did you mean ‘CONFIG_SIG_PIPE’?
       case SIGSTOP:
            ^
string/lib_strsignal.c:142:12: note: each undeclared identifier is reported only once for each function it appears in
string/lib_strsignal.c:147:12: error: ‘CONFIG_SIG_STP’ undeclared (first use in this function); did you mean ‘CONFIG_SIG_STOP’?
       case SIGSTP:

Esnure all standard signal number is always defined

Change-Id: I3abce86079ebeba7bab038d7c770efc90b9cffd7
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-11-05 08:28:53 +01:00
Yoshinori Sugino
5c6c0d2d57 sched/signal: Fix typos 2020-11-03 01:30:14 -08:00
Masayuki Ishikawa
6ec94082a1 sched: irq: Fix enter_critical_section() in an irq handler for SMP
Summary:
- I found a deadlock during Wi-Fi audio streaming test plus stress test
- The testing environment was spresense:wifi_smp (NCPUS=4)
- The deadlock happened because two CPUs called up_cpu_pause() almost simultaneously
- This situation should not happen, because up_cpu_pause() is called in a critical section
- Actually, the latter call was from nxsem_post() in an IRQ handler
- And when enter_critical_section() was called, irq_waitlock() detected a deadlock
- Then it called up_cpu_paused() to break the deadlock
- However, this resulted in setting g_cpu_irqset on the CPU
- Even though another CPU had held a g_cpu_irqlock
- This situation violates the critical section and should be avoided
- To avoid the situation, if a CPU sets g_cpu_irqset after calling up_cpu_paused()
- The CPU must release g_cpu_irqlock first
- Then retry irq_waitlock() to acquire g_cpu_irqlock

Impact:
- Affect SMP

Testing:
- Tested with spresense:wifi_smp (NCPUS=2 and 4)
- Tested with spresense:smp
- Tested with sim:smp
- Tested with sabre-6quad:smp (QEMU)
- Tested with maix-bit:smp (QEMU)
- Tested with esp32-core:smp (QEMU)
- Tested with lc823450-xgevk:rndis

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-03 08:19:41 +01:00
Nakamura, Yuuichi
60bf4a4d8a Fix build break when CONFIG_TASK_NAME_SIZE == 0 2020-11-01 18:46:26 -08:00
Yoshinori Sugino
106b140319 sched/signal/sig_default.c: Fix a comment 2020-10-30 19:57:06 -07:00
Yoshinori Sugino
834b74c786 sched/signal/sig_default.c: Fix a typo 2020-10-30 19:56:37 -07:00
Yoshinori Sugino
c13f869432 Modify SIGSTP to SIGTSTP
Follow the POSIX description.
SIGTSTP should be sent when the Ctrl-Z characters is encountered, not SIGSTP.

Testing:
Built with hifive1-revb:nsh (CONFIG_SERIAL_TERMIOS=y, CONFIG_SIG_DEFAULT=y and CONFIG_TTY_SIGTSTP=y)
2020-10-29 01:12:43 -07:00
Yoshinori Sugino
04c0055355 Fix typos 2020-10-28 19:15:04 -07:00
chao.an
d0bde1114d sched/task: do not migrate the task state to INVALID
which still on used in task/nxmq_recover()

Change-Id: I31273aadd9e09c283cc3d0420dfc854ca8ae1899
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-10-28 11:15:22 -07:00
Juha Niskanen
8c464b0e7a sched: use nx_close instead of close
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-10-28 09:11:50 -07:00
Masayuki Ishikawa
46659d5a14 sched: Fix sched_lock() logic for SMP
Summary:
- I noticed sched_lock() logic is different from sched_unlock()
- I think sched_lock() should use critical section
- Also, the code should be simple like sched_unlock()
- This commit fixes these issues

Impact:
- Affects SMP only

Testing:
- Tested with spresense:wifi_smp (both NCPUS=2 and 3)
- Tested with lc823450-xgevk:rndis
- Tested with maix-bit:smp (QEMU)
- Tested with esp32-core:smp (QEMU)
- Tested with sabre-6quad:smp (QEMU)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-26 22:22:31 -07:00
Masayuki Ishikawa
0820549223 sched: Fix DEBUGASSERT() in sched_unlock() for SMP
Summary:
- I noticed DEBUGASSERT() happens in sched_unlock()
- The test was Wi-Fi audio streaming stress test with spresense 3cores
- Actually, g_cpu_schedlock was locked but g_cpu_lockset was incorrect
- Finally, I found that cpu was obtained before enter_critical_section()
- And the task was moved from one cpu to another cpu
- However, that call should be done within the critical section
- This commit fixes this issue

Impact:
- Affects SMP only

Testing:
- Tested with spresense:wifi_smp (both NCPUS=2 and 3)
- Tested with lc823450-xgevk:rndis
- Tested with maix-bit:smp (QEMU)
- Tested with esp32-core:smp (QEMU)
- Tested with sabre-6quad:smp (QEMU)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-26 22:22:31 -07:00
YAMAMOTO Takashi
6a2bd9a75b Change the default value of SIGPIPE
To avoid the conflicting default with SIGQUIT.
2020-10-25 20:35:41 -07:00
Yoshinori Sugino
fabfc9ab10 sched/signal/sig_procmask.c: Remove an unnecessary variable 2020-10-24 14:10:20 +01:00
Yoshinori Sugino
ea5ec14995 sched/signal/sig_procmask.c: Fix a typo 2020-10-24 09:36:46 +01:00
Masayuki Ishikawa
d1f82ced26 Revert "sched: Call up_[use|create]_stack after nxtask_setup_scheduler"
This reverts commit 6eba1ad90a.
2020-10-22 18:31:31 +09:00
Xiang Xiao
6eba1ad90a sched: Call up_[use|create]_stack after nxtask_setup_scheduler
to ensure the basic info(e.g. pid) setup correctly before call arch API

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I851cb0fdf22f45844938dafc5981b3f576100dba
2020-10-22 15:30:01 +09:00
Nakamura, Yuuichi
d8d19911ef Add SCHED_INSTRUMENTATION_HIRES support 2020-10-21 00:33:10 +08:00
Nakamura, Yuuichi
87a7c0317e Add note_syscall args support 2020-10-21 00:31:51 +08:00
Nakamura, Yuuichi
9e470ad73e Fix note_syscall_leave_s to avoid unaligned access 2020-10-17 23:48:43 +08:00
Yoshinori Sugino
296eff3d40 Fix typos 2020-10-17 09:04:37 +01:00
Masayuki Ishikawa
35c8da34a8 sched: task: Fix nxtask_exit() for SMP
Summary:
- During Wi-Fi audio streaming test, I found a deadlock in nxtask_exit()
- Actually, nxtask_exit() was called and tried to enter critical section
- In enter_critical_section(), there is a deadlock avoidance logic
- However, if switched to a new rtcb with irqcount=0, the logic did not work
- Because the 2nd critical section was treated as if it were the 1st one
- Actually, it tried to run the deadlock avoidance logic
- But nxtask_exit() was called with critical section (i.e. IRQ already disabled)
- So the logic did not work as expected because up_irq_restore() did not enable the IRQ.
- This commit fixes this issue by incrementing irqcount before calling nxtask_terminate()
- Also it adjusts g_cpu_irqlock and g_cpu_lockset

Impact:
- Affects SMP only

Testing:
- Tested with spresense:wifi_smp (smp, ostest, nxplayer, telnetd)
- Tested with sabre-6quad:smp with QEMU (smp, ostest)
- Tested with maix-bit:smp with QEMU (smp, ostest)
- Tested with esp32-core:smp with QEMU (smp, ostest)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-10 13:01:01 -06:00
Xiang Xiao
c59fcd3a53 sched: nxtask_start should call entry point directly for kernel thread
since nxtask_startup will initialize c++ global variables which shouldn't
be done inside the kernel thread

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-08 09:14:33 +02:00
Nakamura, Yuuichi
89ea234af8 Add on-boot instrumentation support for note filter 2020-10-06 03:26:46 +08:00
Nakamura, Yuuichi
6b54377476 Add note filter functions 2020-10-06 03:26:46 +08:00
Yoshinori Sugino
e4094eff12 sched/signal: Cosmetic changes 2020-10-05 01:05:45 +08:00
Nathan Hartman
80ce7800a9 Sources and Docs: Fix typos and nxstyle issues
Documentation/contributing/coding_style.rst:

    * Fix repeated words: ("this this").
    * Remove trailing spaces.

boards/z80/z80/z80sim/README.txt:

    * Fix repeated words: ("this this") and rewrap lines.

graphics/Kconfig,
libs/libc/math/Kconfig:

    * Fix repeated words: ("this this").

arch/arm/src/armv7-a/arm_assert.c,
arch/arm/src/armv7-r/arm_assert.c,
arch/arm/src/imxrt/imxrt_enet.c,
arch/arm/src/kinetis/kinetis_enet.c,
arch/arm/src/kinetis/kinetis_flexcan.c,
arch/arm/src/s32k1xx/s32k1xx_enet.c,
arch/arm/src/s32k1xx/s32k1xx_flexcan.c,
arch/arm/src/stm32/stm32_pwm.c,
arch/arm/src/stm32h7/stm32_pwm.c,
arch/arm/src/stm32l4/stm32l4_pwm.c,
arch/renesas/src/rx65n/rx65n_usbdev.c,
binfmt/libnxflat/libnxflat_bind.c,
drivers/pipes/pipe_common.c,
net/igmp/igmp_input.c,
net/tcp/tcp_conn.c,
sched/sched/sched_roundrobin.c:

    * Fix typo in comment ("this this").

arch/arm/src/cxd56xx/cxd56_usbdev.c,
arch/arm/src/lc823450/lc823450_usbdev.c:

    * Fix typo in comment and rewrap lines.

arch/arm/src/imxrt/imxrt_usbdev.c,
arch/arm/src/stm32/stm32_dac.c,
arch/arm/src/stm32f0l0g0/stm32_pwm.c,
arch/arm/src/stm32f7/stm32_pwm.c,
arch/arm/src/tiva/lm/lm4f_gpio.h,
fs/nxffs/nxffs_write.c,
include/nuttx/analog/pga11x.h,
include/nuttx/usb/usbdev.h,
net/mld/mld_join.c:

    * Fix typo in comment ("this this").
    * Fix nxstyle issues.
2020-10-02 04:54:52 +02:00
Gregory Nutt
ebdfd16f0f Move gettid() implementation to /libs/libc/unistd
Move sched/task/task/task_gettid.c to libs/libc/unistd/lib_gettid.c.  gettid() is a dumb wrapper around getpid().  It is wasteful of resources to support TWO systme calls, one for getpid() and one for gettid().  Instead, move gettid() in the C library where it calls the single sysgtem call, getpid().  Much cleaner.
2020-09-22 19:40:56 -07:00
chao.an
bf8446e235 sched/task: Implement gettid(2) syscall
See the reference here:
https://man7.org/linux/man-pages/man2/gettid.2.html

Change-Id: Ia814d0ccc3b20d8dfc36c809682ddf6e21811d20
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:07:00 -07:00
Xiang Xiao
18c19c1198 init: Move file system initialization before clock/irq
since these subsystem may register the driver under /dev

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-17 15:51:03 +09:00