Commit Graph

108 Commits

Author SHA1 Message Date
Gregory Nutt a2e62f557d Squashed commit of the following:
sched/init/nx_bringup.c:  Fix a naming collision.
    sched/init:  Rename os_start() to nx_start()
    sched/init:  Rename os_smp* to nx_smp*
    sched/init:  Rename os_bringup to nx_bringup
    sched/init:  rename all internal static functions to begin with nx_ vs os_
2019-02-04 16:20:35 -06:00
Xiang Xiao e57f7cf6ae Critical Section Monitor (sched/ and fs/procfs: Remove SCHED_IRQMONITOR_GETTIME to simplify the clock source selection: (1) Use up_critmon_gettime if SCHED_IRQMONITOR, (2) Call clock_systimespec if SCHED_TICKLESS, (3) Don't collect timing info for all other cases and move up_critmon_* to arch.h avoid the duplicated declaration. 2019-01-27 10:13:28 -06:00
David Sidrane 5433ec589b fs/driver/fs_blockpartition.c: Fix void pointer warning.
libs/libc/unistd/lib_daemon.c:  Fix compiler error is streams disabled.
sched/irq/irq_procfs.c:  Fix warning
sched/task/task_vfork.c: Fix void * math warning
2018-12-03 17:54:21 -06:00
Gregory Nutt d8cf3bfe25 Rethink some of the conditional logic of commit 1ac95584603258402ea4e9c48977e52f494f4c77: If the Critical Section Monitor enabled, that that platform-specific timer should be used to measure interrupt processing time, no matter what. 2018-11-26 12:18:58 -06:00
Gregory Nutt 553c566650 sched/irq: Include a few ProcFS-related changes missed in commit 1ac9558460 2018-11-26 12:01:36 -06:00
Gregory Nutt 1ac9558460 sched/irq and sched/sched: Measurement of interrupt handler duration used to be available only in Tickless mode since it used the high resolution Tickless timer to measure interrupt time. This commit adds CONFIG_SCHED_IRQMONITOR_GETTIME which, if enabled, will force the interrupt duration caculation to use the same high-resolution, platform-specific timer as is used with the Critical Section Monitor. This leads to two improvements: (1) You can now measure interrupt duration in non-Tickless mode, and (2) in either mode, the interrupt duration and the critical section measures will use the same high-resulotion timer and should, therefore, never be any descripancy due to different clock sources. 2018-11-26 11:29:20 -06:00
Gregory Nutt 80e7107c9f sched/irq/Make.defs: Fix warning about irq_csection.o appearing multiple times in the same rule. 2018-11-25 17:22:33 -06:00
Gregory Nutt 4ca7b72a98 sched/Kconfig: Simplify some configurations. This adds configuration settings that control individual features, rather than long complex OR expressions that determines if an individual feature is required. 2018-11-25 11:50:15 -06:00
Gregory Nutt 807d5bb4ae Critical Section Monitor: Add low level timer support for simulation. Fix serial bugs and logic errors in initial implementation. Still does not work; takes assertions. 2018-11-24 15:07:12 -06:00
Gregory Nutt fc6084f311 Squashed commit of the following:
fs/procfs/fs_procfsproc:  Extended the process ID ProcFS output to show per-thread maximum time for pre-emption disabled and maximum time within a critical section.

    sched/sched/sched_critmonitor.c:  Adds data collection logic in support of monitoring critical sections and pre-emption state.
2018-11-24 10:32:45 -06:00
Xiang Xiao dbf01d12b7 Assertions: Identify the running task correctly when dumping task state information. It takes time to switch to the target task after g_readytorun has been modified. If panic/assert happen during this period, the dump will contain the incorrect and confusing information due to the difference between the real running task and the return value of this_task(). This change resolve this problem by adding g_running_task to track the real running task through the context switch. 2018-11-15 07:11:51 -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 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 347d10497c sched/irq/irq_dispatch.c: Fix error 'ndx undeclared' 2018-08-29 06:10:52 -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 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 e1202d2ed3 Replace all ASSERT with DEBUGASSERT to save the code space 2018-08-24 06:58:30 -06:00
Gregory Nutt 8fdbb1e0a4 Elimate use of the non-standard type systime_t and replace it the equivalent, standard type clock_t
Squashed commit of the following:

    sched:  Rename all use of system_t to clock_t.
    syscall:  Rename all use of system_t to clock_t.
    net:  Rename all use of system_t to clock_t.
    libs:  Rename all use of system_t to clock_t.
    fs:  Rename all use of system_t to clock_t.
    drivers:  Rename all use of system_t to clock_t.
    arch:  Rename all use of system_t to clock_t.
    include:  Remove definition of systime_t; rename all use of system_t to clock_t.
2018-06-16 12:16:13 -06:00
Masayuki Ishikawa 97ca4ef956 Merged in masayuki2009/nuttx.nuttx/change_copyright (pull request #621)
Change all Sony related copyright to conform with our company's internal rules.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-04-04 12:35:47 +00:00
Gregory Nutt 50ab5d638a sched/task: It is not appropriate for logic in task_exit() to call the new version of this_task(). sched/irq: Remove redundant fetch of CPU index; configs/sabre-6qguad: update README. 2018-02-06 19:06:33 -06:00
Gregory Nutt 0ba7853016 sched/irq: Fix a infinite recursion problem that a recent change introduced into the i.MX6 SMP implementation. 2018-02-06 09:18:03 -06:00
Gregory Nutt 56bb76caca sched/irq: Fix an error in a assertion introduced in commit 37c9b3d54a. Noted by Masayuki Ishikawa. 2018-02-05 21:13:42 -06:00
Gregory Nutt b884fb9fed sched/sched: Extend the last global lock change to work with the lc823450-xgevk which does not support the atomic fetch add but does support disabling interprocessor interrupts. Disabling interprocessor interrupts will also guarantee that the TCB addres calculation is atomic. 2018-02-05 13:32:09 -06:00
Gregory Nutt 37c9b3d54a sched/sched: Implements a global scheduler lock capability as part of SMP support. This allows the scheduler to be locked with no knowledge or access to the TCB of the currently running task. This is necessary because accessing the TCB of the currenlty running task is, itself, a non-atomic operation. This global scheduler lock cpability was add just to support that atomic access to the TCB. 2018-02-05 13:12:36 -06:00
Gregory Nutt 5beab6fbf0 spin_lock_irqsave() and spin_unlock_irqrestore() are only valid if the CPU supports global disabling of interrupts. 2018-02-04 15:41:22 -06:00
Gregory Nutt fad70bf90e Update some comments 2018-02-03 09:35:46 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt 12e3e47d3c Update comments, mostly spelling errors. 2018-01-27 09:37:46 -06:00
Gregory Nutt 0080225473 sched/irq: Add a configuration option to show interrupt information via a procfs file. 2018-01-12 18:26:46 -06:00
Gregory Nutt b2adb4917f arch/arm/src/lpc54xx: Add register level debug output for Ethernet testing. Fixed a few start up problems. Still hangs on start-up, however. 2017-12-31 11:11:57 -06:00
Masayuki Ishikawa 6150299f54 Merged in masayuki2009/nuttx.nuttx/irq_spinlock (pull request #550)
SMP: Introduce spin_lock_irqsave() and spin_unlock_irqrestore()

These APIs are simplified version of enter_critical_section() and
leave_critical_section() to protect data (e.g. registers) in SMP mode.
By using these APIs inside drivers, performace will be improved.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-12-07 19:39:04 +00:00
Arjun Hary b274a97840 Miscellaneous fixes from astyle tool. 2017-08-14 17:19:27 -06:00
Jussi Kivilinna dffb8a67e3 Add entropy pool and strong random number generator
Entropy pool gathers environmental noise from device drivers, user-space, etc., and returns good random numbers, suitable for cryptographic use. Based on entropy pool design from *BSDs and uses BLAKE2Xs algorithm for CSPRNG output.

Patch also adds /dev/urandom support for using entropy pool RNG and new 'getrandom' system call for getting randomness without file-descriptor usage (thus avoiding file-descriptor exhaustion attacks). The 'getrandom' interface is similar as 'getentropy' and 'getrandom' available on OpenBSD and Linux respectively.
2017-03-30 07:38:37 -06:00
Gregory Nutt e1218c4b4b Smaller vector tables: Add irq_mapped_t. 2017-03-03 10:20:40 -06:00
Gregory Nutt c2b620b4f8 Implements support for smaller interrupt tables as described at http://www.nuttx.org/doku.php?id=wiki:howtos:smallvectors . This is largely the work of Mark Schulte. However, I have made several changes to match with the Wiki document. If you like the change, thanks go to Marc. For any errors you can blame me. 2017-03-03 09:20:25 -06:00
Gregory Nutt 02b1e1ec1a Fixes for coding standard: '*' needs to 'snuggle' with following variable name 2017-02-28 18:22:57 -06:00
Gregory Nutt 840c5935a3 Correct a typo from one of the preceding commits. 2017-02-27 11:58:20 -06:00
Mark Schulte b3222bbc8a irq_dispatch: Add argument pointer to irq_dispatch
Provide a user defined callback context for irq's, such that when
registering a callback users can provide a pointer that will get
passed back when the isr is called.
2017-02-27 06:27:56 -06:00
Gregory Nutt 9ce4022096 SMP: Fix an error in critical section logic when performing a context switch from an interrupt handler. The g_cpu_irqset bit was not being set for the CPU so other CPUs did not know about the critical section. 2017-01-13 06:48:10 -06:00
Gregory Nutt e7d2b9f0e8 SMP: Move sharable function to common file as irq_cpu_locked(). Use irq_cpu_locked() in sched_unlock() 2016-12-29 08:17:10 -06:00
Gregory Nutt 96394f339e SMP: Fix a gap where we may try to make modifications to the task lists without being in a critical sections. That permits concurrent access to the tasks lists and many subtle problems. This fix just remains in the critical section throughout the operation (and possible until the task is restore in the event of a context switch). Makes a big difference in stability 2016-12-28 13:58:24 -06:00
Gregory Nutt 849a5dc2a9 SMP: Enforce this rule: Tasks which are normally restored when sched_unlock() is called must remain pending (1) if we are in a critical section, i.e., g_cpu_irqlock is locked , or (2) other CPUs still have pre-emption disabled, i.e., g_cpu_schedlock is locked. In those cases, the release of the pending tasks must be deferred until those conditions are met. 2016-12-26 08:15:02 -06:00
Gregory Nutt d45a81d643 Revert "SMP: Fix a error introduced in 36b676eea6 and fully decouple disabling of pre-emption from critical sections."
This reverts commit 9aedf1bdec.
2016-12-26 07:48:22 -06:00
Gregory Nutt 9aedf1bdec SMP: Fix a error introduced in 36b676eea6 and fully decouple disabling of pre-emption from critical sections. 2016-12-25 06:54:43 -06:00
Gregory Nutt efb86382c3 SMP: Back out deferred IRQ locking. This was accidentally merged into master and it looks like it is going to be more work than I thought to get it working again. Changes will go to the irqlock branch. 2016-12-24 19:53:37 -06:00
Gregory Nutt f55bad863b SMP: Fix logic error in last change: Deferred restoration of IRQ lock only applies if the context switch was on this CPU. 2016-12-24 18:52:58 -06:00
Gregory Nutt d75a7643d0 Fix a trivial typo 2016-12-23 13:01:20 -06:00