Commit Graph

1310 Commits

Author SHA1 Message Date
Gregory Nutt 39df7ed0c0 mm/iob and sched/semaphore: Work around some issues with the IOB throttle semaphore. It has some odd behaviors that can cause assertions in sem_post(). Also, it seems to get outside of its range occasionally. Need to REVISIT this. 2018-09-10 11:32:09 -06:00
Gregory Nutt 53930763f4 sched/sched/sched_waitpid.c: Remove a bad error check. I though Juha already removed this problem. Did I lose his change? 2018-09-10 06:57:12 -06:00
Gregory Nutt 4cb61bd8c2 sched/wqueue: Notifier design cleanup. The original concept used pre-allocated notification data structures. However, the notification dat must persist for an indeterminate amount of time. So the design was modified to use dynamically allocted data structures. This commit simplifies the design by removed some residual 'machinery' that is no longer needed. 2018-09-10 06:29:51 -06:00
Gregory Nutt 09d5d05b95 net/TCP: Extend the TCP notification logic logic so that it will also report loss of connection events. 2018-09-09 17:32:10 -06:00
Gregory Nutt 9d3148406c Signals were not a good choice of IPC to implement the poll function for several reasons: In order to handle the asynchrnous poll-related event, a substantial amount of state information is needed. Signals are only capable of passing minimal amounts of data. There are also complexities with performing kernel space signal handlers in kernel space code that is better to avoid. So, instead of signals, the equivalent logic was converted to run via a callback that executes on the high-priority work queue.
Squashed commit of the following:

    Fix up some final compile isses.

    net/netdev:  Convert the network down notification logic to use the new wqueue-based notification factility.

    net/udp:  Convert the UDP readahead notification logic to use the new wqueue-based notification factility.

    net/tcp:  Convert the TCP readahead notification logic to use the new wqueue-based notification factility.

    mm/iob:  Convert the IOB notification logic to use the new wqueue-based notification factility.

    sched/wqueue:  Signals are not good IPCs to support the target poll functionality for several reasons including the amount of data that can be passed with a signal and in the fact that in protected and kernel modes, user threads executing signal handlers in protected, kernel memory is problematic.  Instead, convert the same logic to perform the notifications via function callback on the high priority work queue.
2018-09-09 15:01:44 -06:00
Gregory Nutt 20814acad2 sched/signal: In signal notification facility, use sigqueue() to notify vs. kill(). With sigqueue, we can pass more info (but still not enough). 2018-09-09 11:57:25 -06:00
Gregory Nutt 32e3e51678 net/netdev: Add signal notification for the case where the network goes down. 2018-09-09 10:39:25 -06:00
Gregory Nutt fc127fd297 sched/signal: Add a generic signal notification facility. Modify the custom IOB available notifier so that it is now just a wrapper around this generic signal notification. This generic signal notification faility will, eventually, be used to support network polling.
Squashed commit of the following:

    mm/iob:  The IOB available notifier is now just a wrapper around the common signal notifier.

    sched/signal:  Add a generic signal notification facility.

    sched/signal/sig_evthread.c:  More trivial naming changes.

    sched/signal:  Rename nxsig_notification() to nxsig_evthread() to make forthcoming naming additions more consistent.
2018-09-09 08:32:37 -06:00
Gregory Nutt b7d1f13a54 b/sched/sched/sched_waitpid.c: Remove options check in DEBUG_FEATURES 2018-09-05 06:45:49 -06:00
Gregory Nutt 993321dda6 drivers/serial: Add support for Ctrl-Z. This works just like the recently added Ctrl-C support except that SIGSTP is sent when the Ctrl-Z characters is encountered vs. SIGINT. 2018-09-02 15:36:25 -06:00
Gregory Nutt 093348030e sched/: Update signal default STOP action. If waitpid was called with the WUNTRACED then wake up waitpid. Also fix some compile problems.. How did this work before? 2018-09-02 13:51:52 -06:00
Gregory Nutt a7265d71c6 This commit adds support for default signal actions for SIGSTOP, SIGSTP, and SIGCONT.
Squashed commit of the following:

    Add procfs support to show stopped tasks.  Add nxsig_action() to solve a chicken and egg problem:  We needed to use sigaction to set default actions, but sigaction() would refuse to set actions if the default actions could not be caught or ignored.

    sched/signal:  Add configuration option to selectively enabled/disable default signal actions for SIGSTOP/SIGSTP/SIGCONT and SIGKILL/SIGINT.  Fix some compilation issues.

    sched/sched:  Okay.. I figured out a way to handle state changes that may occur while they were stopped. If a task/thread was already blocked when SIGSTOP/SIGSTP was received, it will restart in the running state.  I will appear that to the task/thread that the blocked condition was interrupt by a signal and returns the EINTR error.

    sched/group and sched/sched:  Finish framework for continue/resume logic.

    sched/signal:  Roughing out basic structure to support task suspend/resume
2018-08-30 10:27:18 -06:00
Gregory Nutt aaa660bae6 sched/group and sched/signal: Some good but trivial stuff harvested from the suspend branch. 2018-08-29 15:50:01 -06:00
Gregory Nutt 1d04ef2f93 sched/signal/sig_default.c: Lock the scheduler while while killing the children so that we do not lose priority and let the task group continue to run in an indeterminate state. 2018-08-29 14:55:45 -06:00
Gregory Nutt 94910d2925 sched/: Cosmetic reordering of conditional compilation. Style is that comments related to the conditionally compiled logic are included within the conditional compipilation so that its scope and belongingness is clear. 2018-08-29 13:09:00 -06:00
Gregory Nutt d24f58c790 sched/group/group_killchildren.c: In some circumstances, group_killchildren() could have called pthread_cancel() to kill a task. Also, the behavior would not be as expected if a pthread had cancellation disabled. sched/signal/sig_default.c: Correct signal handling in the multiple threaded case. The SIGKILL signal may actually be processed on a pthread, not the main thread of the task. 2018-08-29 07:33:28 -06:00
Gregory Nutt 73c73af777 sched/irq/irq_dispatch.c: Fix my typo that was added while reviewing Xiang's changne. 2018-08-29 07:13:26 -06:00
Xiang Xiao 19bde835e2 sched/signal/sig_default.c: Fix warnings about implicit declaration of 'this_task' and 'group_killchildren' 2018-08-29 06:10:52 -06:00
Xiang Xiao 347d10497c sched/irq/irq_dispatch.c: Fix error 'ndx undeclared' 2018-08-29 06:10:52 -06:00
Gregory Nutt dcb3d4b050 sched/signal: Add logic and an interface to determin if a signal can be caught or ignored. sigaction now correctly returns EINVAL on any attempt to catch or ignore such signals (only SIGKILL for now and only if CONFIG_SIG_DEFAULT=y). 2018-08-28 12:39:03 -06:00
Gregory Nutt 0756cf66ed sched/signal: Add support for SIGINT in addition to SIGKILL. drivers/serial: Use SIGINT instead of SIGKILL when control-C is pressed. 2018-08-28 12:15:31 -06:00
Gregory Nutt 5a51702ef2 sched/signal/sig_default.c: Correct an error in signal number usage. Add critical sections (not sure if that is necessary). Update some comments. 2018-08-27 22:32:57 -06:00
Gregory Nutt 499b89feed sched/signal: Default Signal Actions. Change some types to superficially simplify. Add configuration options to enabled default signal behaviors on a per-signal basis. I don't think users are prepared for SIGALRM to terminate the task (which is the correct default behavior if you don't change it). Extend the implementation of default signals so that it is totally table driven and extensible by simply mondifying the content of const tables. 2018-08-27 15:37:43 -06:00
Gregory Nutt 6d094e4b33 sched/signals: Update the signal default action logic to support sigaction(). signaction() must be able to handle and input action of SIG_DFL to setup the default signal action; it mast also return SIG_DFL it is replacing the default action. 2018-08-27 13:13:23 -06:00
Gregory Nutt c0d234a474 Squashed commit of the following:
drivers/serial/Kconfig:  It is no longer necessary to restrict Ctrl-C handling to the FLAT build

    sched/signal:  Add a new configuration option to select signal default actions, separate handling of signal default actions from both task startup logic and from the serial TTY Ctrl-C logic.  Add a signal set in the group structure to keep track of what signals have been set to the default action.  In dispatching signals in PROTECTED or KERNEL mode, use this signal set to determine if the default signal handler is attached and dispatch the signal in kernel mode for the default actions.
2018-08-27 11:40:09 -06:00
Xiang Xiao 71ad1993f2 Move clock_timespec_[add|subtract] to include/nuttx/clock.h 2018-08-27 06:04:04 -06:00
ligd 11f8dc735c Squashed commit of the following:
drivers/serial:  Add Ctrl-C/Ctrl-X support.  This is an initial working implementation that still requires that several details be resolved.

    sched/task/task_start.c: Add default signal action to SIGKILL.
2018-08-26 08:49:08 -06:00
xuanlin 7e63b0b288 sched/wqueue, libs/libc/wqueue, configs: Remove work queue polling delay to simplify the code logic and save the power. 2018-08-25 14:58:07 -06:00
ligd 631071cded Squashed commit of the following:
sched/wqueue:  Modify high priority work queue to support multiple threads.

    sched/wqueue and libs/libc/wqueue:  workqueues don't need set global data to zero since .bss is cleared automatically.  Removing this unnecessary initialization also avoids the loss the work items queued before initialization.
2018-08-25 14:52:13 -06:00
Xiang Xiao c9b24615a6 sched/irq: Monitor the irq execution time. This is very useful for measuring the interrupt latency. 2018-08-25 07:12:21 -06:00
Gregory Nutt 3931eaf015 sched/Kconfig: Fix a warning found in build testing. 2018-08-24 16:14:21 -06:00
Gregory Nutt 38452007a3 sched/irq/irq_dispatch.c: Fix an error found in build testing. 2018-08-24 16:12:31 -06:00
Xiang Xiao 2aa208ccf0 sched/irq/irq_procfs.c: Fix occasional computation error when fracpart >= 1000 2018-08-24 15:16:11 -06:00
zhuguangqing d38be46655 sched/irq: Add support interrupt chains in NuttX. IRQ chain is very useful in these cases: (1) Multiple hardware connect to the same request line(e.g. PCI), (2) Need multiple driver to support one hardware block (like Linux MFD) 2018-08-24 15:10:23 -06:00
Xiang Xiao 6cb606d42b sched/irq/irq_dispatch.c: Ensure vector never points to NULL since interrupt may happen before irq_initialize() 2018-08-24 15:01:32 -06:00
Xiang Xiao 3af35699b9 include/nuttx/clock.h, sched/sched: Support the CPU load measurement using timer_lowerhalf_s interface 2018-08-24 10:10:57 -06:00
Xiang Xiao 430bf16f1e Squashed commit of the following:
include/nuttx/arch.h:  Add prototype for an architecture-specific up_trigger_irq function
    arch/, include/nuttx, sched/sched:  Add the garbage collection hook so each architecture can do custom memory cleanup if necesary.
    arch/Kconfig:  Add configureation CONFIG_ARCH_GNU_NO_WEAKFUNCTIONS to suppress use of weak functions.  Some gnu derived toolchains do not support weak symbols
2018-08-24 08:30:01 -06:00
Xiang Xiao 36b46a6a40 arch/ and task/sched: vfork operation needs to allocate and copy the task argument too. Also correction of the address correction cannot depend on the stack pointer since it is not available in all architectures. Rather callculate the offset from the stack allocation pointer 2018-08-24 07:43:00 -06:00
Xiang Xiao e1202d2ed3 Replace all ASSERT with DEBUGASSERT to save the code space 2018-08-24 06:58:30 -06:00
Xiang Xiao 467d2a58ea Replace non critical PANIC with DEBUGPANIC to save the code space 2018-08-24 06:21:15 -06:00
anchao 95163b2c59 Squashed commit of the following:
Author: Xiang Xiao <xiaoxiang@xiaomi.com>

     arch/arm/src/armv7-m:  Implement SYSTICK timer driver

   Author: anchao <anchao@pinecone.net>

     configs/sim/loadable:  Add loadable demo for arch sim
     sched/init: Restore previously reverted option to mount block device for INIT_FILEPATH case
     configs/stm3240g-eval/knxwm: Fix build breakage.

   Author: Gregory Nutt <gnutt@nuttx.org>
     configs:  With recent changes to apps/ all configurations that build applications as modules must now also select CONFIG_APPS_LOADABLE.

   Author: anchao <anchao@pinecone.net>
      configs/sim/loadable:  Add loadable demo for arch sim
       Kconfig and tools/Makefile.unix and : add dynamic application loadable support
2018-08-23 11:08:22 -06:00
xuanlin 2c93467436 pthreads: Add support static pthread stack. Add standard pthread_attr_setstack() and pthread_attr_getstack(). In all cases where the stack is released, add check to see which allocator must be used to free the stack: The user or the kernel allocator. 2018-08-23 09:49:20 -06:00
Xiang Xiao 377eb30129 binfmt: Add binfmt_initialize(). All binary formats are now registered centrally vs. in board-specific logic. This simplifies the usage of the binfmt subsystem. 2018-08-23 09:09:39 -06:00
Gregory Nutt b56d5a7548 Revert "sched/init: Add option to mount block device for INIT_FILEPATH case"
This reverts commit e5f9b7d66b.
2018-08-22 07:29:55 -06:00
Xiang Xiao e5f9b7d66b sched/init: Add option to mount block device for INIT_FILEPATH case 2018-08-22 06:57:00 -06:00
anchao 0124b629a9 sched/symtab: Reference default symtab name to binfmt 2018-08-22 06:21:20 -06:00
Gregory Nutt 8e203e09d4 Costmetic changes 2018-08-19 11:19:43 -06:00
Gregory Nutt 5a23ca37b1 Cosmetic update to comments. 2018-08-17 14:23:38 -06:00
Gregory Nutt 8c61c2f31b Remove trailing spaces at the end of lines. 2018-08-13 07:39:38 -06:00
Gregory Nutt 25fa50d504 fs/proc and sched/environ: Add support for a procfs entry that will permit examining the environment of any task. 2018-08-10 10:16:39 -06:00