Commit Graph

59 Commits

Author SHA1 Message Date
Michal Lenc cdfe7b5a54 sched/wdog/wd_start.c: prevent accessing watch-dog lag if head is NULL
If statement in line 103 could acces wdactivelist.head->lag when head was
NULL which could result in hard fault. The statement was also redundant
as the same condition is checked in the while loop below. This change
remove the if statement to prevent hard fault to occur.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2021-09-06 09:29:21 -07:00
ligd 35379403f8 sched/wdog: move SMP enter_critical_section to sched_timerexpiration.c
Change-Id: Id654e6d2151e3b807ed2df4ab8169b90ab07b015
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-08-27 16:59:20 +09:00
ligd 9116ed9247 sched/wdog: fix switch_context caused error in wd_start()
Thead A:                     Thread B:
wd_start(wdogX)
wd_cancel
nxsched_cancel_timer  -->    wd_start(wdogX)
                             wd_cancel
                             add wdogX to g_wdactivelist
                      <--
add wdogX to g_wdactivelist

then, you will find wdogX add twice.

Change-Id: Icbf3b2badff20908e115c9134e2400cdcb32b1e0
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-08-27 16:59:20 +09:00
ligd adfaa140cc sched: add CONFIG_SCHED_CRITMONITOR_XX for debugging system lantency
Change-Id: Id2a75db28caf1a89552e33391bd90f85cde08dbd
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 08:25:02 -05:00
Xiang Xiao d7d3177668 sched/wdog: Remove flags field from wdog_s to save memory
since WDOG_ISACTIVE can check func field instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I21d7f9cfe6195c8ccb6cc5925ff66f3c89822f9d
2021-07-01 19:27:10 -03:00
Gustavo Henrique Nihei 330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Xiang Xiao acca9fcc3b sched/wdog: Remove MAX_WDOGPARMS and related stuff
since the variable arguments are error prone and seldom used.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:19:50 -06:00
Xiang Xiao a0ce81d659 sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
2020-08-11 12:28:55 -06:00
Xiang Xiao f618de9c97 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Xiang Xiao 4c706771c3 sched/wdog: Replace all callback argument from uint32_t to wdparm_t
and alwasy cast the argument of wd_start to wdparm_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Xiang Xiao 517974787f Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]
follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-10 14:35:50 -06:00
Gregory Nutt f92dba212d sched/sched/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 16:58:42 -03:00
ligd 231ad202ee global change: repace sched_xfree() to kxmm_free()
Changes:
sched_xfree() => kxmm_free()
remove garbage related APIs
remove ARCH_HAVE_GARBAGE

Cause garbage feature move to mm_heap, then don't need
garbage anymore.

Change-Id: If310790a3208155ca8ab319e8d038cb6ff92c518
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
Gregory Nutt f2e6e131d4 include/nuttx/wdog.h: Add some additional comments. 2020-04-07 17:40:46 +01:00
Gregory Nutt c21d198ac5 sched/wdog: Update to Apache 2.0 Headers
And run each .c and .h file through nxstyle to assure compliance.
2020-03-11 18:35:18 -03:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt b5111d2c38 tools/nxstyle.c: Add logic to detect if there is a blank line following the final right brace. sched/: Applied the modified nxstyle to all C file as a test. 2019-10-24 11:02:42 -06:00
Gregory Nutt bcb4409756 sched/wdog/wd_start.c: Back out a kludge-workaround for an SDCC compiler problem fix back in Feb 2017 by commit b8f3bd857b. That workaround now appears to conflict with newer GCC versions using unsupport warning options. 2019-10-04 09:10:15 -06:00
Gregory Nutt 53d5e44d89 Cosmetic updates. 2019-08-28 15:14:27 -06:00
Gregory Nutt f6b9fe5b14 tools/nxstyle.c: Add logic to detect a blank line following a left brace or a blank line preceding a right brace. 2019-03-10 09:53:33 -06:00
Gregory Nutt bb623d1e04 This commit renames all internal OS functions defined under sched/task so that they begin with the prefix. For example, nxtask_exit() vs. task_exit().
Squashed commit of the following:

    Trivial, cosmetic
    sched/, arch/, and include:  Rename task_vforkstart() as nxtask_vforkstart()
    sched/, arch/, and include:  Rename task_vforkabort() as nxtask_vforkabort()
    sched/, arch/, and include:  Rename task_vforksetup() as nxtask_vfork_setup()
    sched/:  Rename notify_cancellation() as nxnotify_cancellation()
    sched/:  Rename task_recover() to nxtask_recover()
    sched/task, sched/pthread/, Documentation/:  Rename task_argsetup() and task_terminate() to nxtask_argsetup() and nxtask_terminate(), respectively.
    sched/task:  Rename task_schedsetup() to nxtask_schedsetup()
    sched/ (plus some binfmt/, include/, and arch/):  Rename task_start() and task_starthook() to nxtask_start() and nxtask_starthook().
    arch/ and sched/:  Rename task_exit() and task_exithook() to nxtask_exit() and nxtask_exithook(), respectively.
    sched/task:  Rename all internal, static, functions to begin with the nx prefix.
2019-02-04 13:42:51 -06:00
ligd 441cf6c207 sched/wdog: improve accuracy of wd_gettime() in tickless mode 2018-11-09 09:26:34 -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 8e203e09d4 Costmetic changes 2018-08-19 11:19:43 -06:00
Gregory Nutt b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -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 da50646bcf sched/wdog: wd_start() is an internal OS function and should not set the errno value. Reviewed and updated every call to wd_start() to verify if return value is used and if so if the errno value is accessed. 2018-01-31 10:09:14 -06:00
Gregory Nutt 9f80e4ccf1 sched/: Various fixes for typos, improved parameter verification. 2018-01-12 18:26:45 -06:00
Gregory Nutt 0de294a586 Fix lots of occurrences of 'the the', 'the there', 'the these', 'the then', 'the they. 2017-05-11 13:35:56 -06:00
Gregory Nutt 12a4a58aa6 Update some wdog-related comments 2017-02-24 10:58:37 -06:00
Gregory Nutt 69e9f8638d Most interrupt handling logic interacts with tasks via standard mechanism such as sem_post, sigqueue, mq_send, etc. This all call enter_critical_section and are assumed to be safe in the SMP case.
But certain logic interacts with tasks in different ways.  The only one that comes to mind are wdogs.  There is a tasking interface that to manipulate wdogs, and a different interface in the timer interrupt handling logic to manage wdog expirations.

In the normal case, this is fine.  Since the tasking level code calls enter_critical_section, interrupts are disabled an no conflicts can occur.  But that may not be the case in the SMP case.  Most architectures do not permit disabling interrupts on other CPUs so enter_critical_section must work differently:  Locks are required to protect code.

So this change adds locking (via enter_critical section) to wdog expiration logic for the the case if the SMP configuration.
2016-11-18 13:57:30 -06:00
Gregory Nutt 18ce4ff57b sched/: Review and correct some stylistic inconsistencies 2016-08-07 08:25:30 -06:00
Gregory Nutt 1cdc746726 Rename CONFIG_DEBUG to CONFIG_DEBUG_FEATURES 2016-06-11 14:14:08 -06:00
Gregory Nutt 970b34ae8f Remove some empty file section section header comments 2016-02-17 17:17:44 -06:00
Gregory Nutt 6e3107650d nuttx/sched: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section() 2016-02-14 08:17:46 -06:00
Dimitry Kloper b48ca00cd5 The delay parameter has 'int' type while explicit int32_t is used in sigtimedwait() (sig_timedwait.c) This can lead to wrong argument for systems that have default int size different than int32 (namely AVR). 2016-01-05 07:58:04 -06:00
Gregory Nutt 79d554939e sched/: Fix some spacing issues 2015-10-07 19:59:14 -06:00
Gregory Nutt 0f90500f72 Standardize the width of all comment boxes in header files 2015-10-02 17:48:24 -06:00
Gregory Nutt 5b51a9fcdd Standardize the width of all comment boxes in C files 2015-10-02 17:43:18 -06:00
Gregory Nutt cb9e27c3b0 Standardize naming used for public data and function groupings 2015-10-02 16:30:35 -06:00
Gregory Nutt 0b2fbd7a2c Fix a DEBUGASSERTion 2015-08-21 12:33:14 -06:00
Gregory Nutt 89b5ef8d35 wdogs: Fix counting of free, pre-allocated wdog timers. The could could get decremented below zero in some situations 2015-08-21 11:30:22 -06:00
Gregory Nutt ea7dbc984b Add basic sporadic schedule state machine 2015-07-24 09:03:21 -06:00
Gregory Nutt 3adcae8ffb Update the type passed to watchdog timer handlers. Using uint32_t is a problem for 64-bit machines. 2015-05-18 08:53:42 -06:00
Gregory Nutt b4423c1eed Make some file section headers more consistent with standard 2015-04-08 06:47:36 -06:00
Gregory Nutt b3a1939020 Sempahores: Add logic to clean up after task_delete() or pthread_cancel() if the task happens to be waiting on a semaphore when it is cancelled 2014-12-13 12:02:25 -06:00
Gregory Nutt 1aa528a572 More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs. 2014-11-25 14:10:35 -06:00
Gregory Nutt 2caeead612 Fix an important bug in the watchdog creation logic 2014-11-10 18:15:26 -06:00
Gregory Nutt 322f9f401c Simplify how C source files are selected in the build 2014-10-07 07:42:36 -06:00
Gregory Nutt 1780810d3d Rename kmalloc to kmm_malloc for consistency 2014-08-31 17:26:36 -06:00