Commit Graph

266 Commits

Author SHA1 Message Date
Xiang Xiao c5a7da5b7a mm/iob/Kconfig: Make the default of IOB_NCHAINS same as IOB_NBUFFERS. It is reasonable default value since iob_qentry_s is much small than iob_s and could avoid the buffer can be allocated but the chain can't: 'tcp_datahandler: ERROR: Failed to queue the I/O buffer chain: -12' 2019-11-24 10:43:45 -06:00
Nathan Hartman 366053e464 Fix typos, 1 in a #define, others in comments. This changes one definition: _MQ_TIMEDRECIEVE is changed to _MQ_TIMEDRECEIVE. It appears this symbol is not used anywhere. 2019-09-11 08:56:56 -06:00
Gregory Nutt dd2219c1db mm/iob/iob_statistics.c: Fix an error found in build testing. Must include nuttx/mm/iob.h. 2019-08-19 11:50:52 -06:00
Anthony Merlino 70404ed0dc Merged in antmerlino/nuttx/iobinstrumentation (pull request #1001)
Iobinstrumentation

* mm/iob: Introduces producer/consumer id to every iob call. This is so that the calls can be instrumented to monitor the IOB resources.

* iob instrumentation - Merges producer/consumer enumeration for simpler IOB user.

* fs/procfs: Starts adding support for /proc/iobinfo

* fs/procfs: Finishes first pass of simple IOB user stastics and /proc/iobinfo entry

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-16 22:42:25 +00:00
Nathan Hartman 68d43d3679 Fix typos. 2019-08-04 14:50:28 -06:00
Gregory Nutt 2dae0ef0db mm/mm_heap/mm_sem.c: Fix error that occurs when CONFIG_CPP_HAVE_VARARGS is not defined. In that case, the arguments to the debug macro will all be evaluated even though they are not used any variables that are references must at least be defined. 2019-06-03 09:02:55 -06:00
Gregory Nutt b21c12bd18 Fix errors found in build testing:
arch/mips/src:  Previous commit used CP0 register definitions that were not defined in the cp0.h header file.  Probably these were from the Microchip hacked up GCC toolchain but are not generally available.  Fix:  Add definitions to NuttX cp0.h header file.

mm/iob:  Eliminate some warnings about testing the value of an undefined pre-processor variable.
2019-05-25 11:45:22 -06:00
anchao bb8648e7a0 ibs/libc/Makefile, libs/libnx/Makefile, and mm/Makefile: Remove obj-path MKDEPS option since make dependency target (MT) is not supported by some toolchains. 2019-03-19 10:14:50 -06:00
Gregory Nutt 419c4cb6be A little more progress toward the implementation of per-window framebuffers. Still missing:
- Logic that generates the low lever framebuffer renderers for the per-window framebuffers,
- The logic that picks off the per-window framebuffer updates from normal graphics device updates.  This logic must update both the per-window framebuffer and the graphics device (from the framebuffer).

Squashed commit of the following:

    graphics:  Add logic to allocate the per-window framebuffer.

    graphics:  A few fragmentary thoughts on how a per-window framebuffer could be represented and allocated.
2019-03-14 11:20:14 -06:00
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
Gregory Nutt 90e4cf4349 mm/umm_heap: sbrk() is only available in the KERNEL build. 2019-02-04 10:32:31 -06:00
Xiang Xiao fe421022e2 sched/wqueue/kwork_notifier.c and several Kconfig files: Notifier should work with either lpwork or hpwork and other minor typo fix. 2019-01-27 11:02:56 -06:00
Xiang Xiao b6606e61b4 mm/iob/iob_copyin.c: iob_copyin() should wait for each buffer and adjust the return value of iob_copyin_internal return to simplify the code 2019-01-26 10:48:47 -06:00
Xiang Xiao 2671709e62 mm/umm_heap: Ensure all user allocation try sbrk before fail 2019-01-26 10:42:36 -06:00
Xiang Xiao 3047ef80dc mm/mm_gran/mm_graninfo.c: Fix the wrong data in g_1bit_info and make the internal function static 2019-01-26 10:30:50 -06:00
Xiang Xiao 7d813fb6d3 mm/mm_gran/mm_pgalloc.c: mm/pgalloc: shouldn't just allocate one page always. 2019-01-26 10:21:58 -06:00
Xiang Xiao 5a37ac25a9 mm/shm/shm_initialize.c: Remove some unused, #ifdef'ed out code. 2019-01-26 10:17:21 -06:00
Xiang Xiao fb4ab391f6 mm/shm/shmget.c: Should call shm_extend to allocate the physical memory 2019-01-26 10:14:42 -06:00
Xiang Xiao b5e2754d2d mm/shm: Convert bytes to pages by MM_NPAGES instead of MM_PGALIGNUP 2019-01-26 10:11:06 -06:00
Xiang Xiao 1ecc33b7db mm/iob: Miscellaneous changes and fixes from code review. 2019-01-26 09:56:27 -06:00
Xiang Xiao 0354702525 mm/iob/iob_dump.c: Format the whole line before log to avoid the multiple timestamp prefix in each line 2019-01-26 09:44:58 -06:00
Xiang Xiao ee28417246 mm/iob/iob_notifier.c: Don't check iob_navail in iob_notifier_setup to avoid a potential race condition. 2019-01-26 09:43:54 -06:00
Xiang Xiao 4721381d1c mm/iob/iob_alloc.c: iob_allocwait should decrease semcount manually. 2019-01-26 09:24:12 -06:00
Xiang Xiao 9cef84b6ad mm/kmm_heap/kmm_kernel.c: Remove unused, duplicated kmm_heapmember(). 2019-01-26 08:48:02 -06:00
Xiang Xiao e2544b7ddf mm/umm_heap/umm_sbrk.c: Pass ARCH_HEAP_VEND as maxbreak argument 2019-01-26 07:29:23 -06:00
Xiang Xiao e15670a191 mm/mm_heap/mm_sbrk.c: Fix backward conditional test. Should call mm_initialize() when brkaddr equal zero 2019-01-26 07:07:42 -06:00
Gregory Nutt 70efabd0ad mm/mm_heap/mm_calloc.c: Verify that the number of elements times the size of an element will not overflow type size_t. This is required by the SEI CERT C coding style and resolves anonymous Bitbucket Issue #139 2019-01-07 16:13:48 -06:00
Gregory Nutt 40cdc187bb mm/mm_heap/mm_sem.c and sched/task/task_getpid.c: Commits 43d37c866b and f37202cbc0 resolved some problems with the original fix of 91aa26774b. However, Those changes used an internal OS interface (sched_self()) which is not available when the the user-space memory manager is built in the PROTECTED or KERNEL builds and resulted in build failures.
This commit repartitions the logic by moving some of the changes from mm_sem.c into task_getpid.c.  The logic is equivalent for the case of mm_trysemaphore(), but no has wider impact since it potentially affects all callers of getpid().  Hence, this change may also introduce some other issues that will need to be addressed.
2018-12-30 08:41:06 -06:00
Gregory Nutt 86224f9b7e Improve some comments. 2018-12-27 09:32:47 -06:00
David Sidrane 43d37c866b mm/mm_heap/mm_sem.c: Defer freeing if mm is held by a not running task. When the holder is running we can add a holder count. If there is no holder OR it is not running we want to try to take the semaphore. There will not be a count if the task is the holder and not running because it already holds the count. This will result it the deferred free. We will take it when not held and do the free when we can get the count because there was no holder. 2018-12-20 13:39:06 -06:00
Gregory Nutt f37202cbc0 This is a candidate replacement for the reverted change 91aa26774b
This change adds a check to mm_trysemaphore() (the root implementation of both kmm_trysemaphore() and umm_trysemaphore()).  It checks if the that task that is apparently executing is marked as RUNNING.  If not, how could the non-running task be trying to get the MM semaphore?  I think only in the exact scenario that Eunbong Song has described.

So I think the solution should provide the same protection as 91aa26774b but without the horrific consequences to memory usage.
2018-12-20 10:19:52 -06:00
Petteri Aimonen fe0532c226 Merged in paimonen/nuttx/pullreq_libc_libnx_updates (pull request #757)
Pullreq libc libnx updates

* NuttX: make strerror() return 'Success' for 0

* NuttX: fix strrchr() so that it considers null terminator as part of string

    From strrchr(3) man page:
    "The terminating null byte is considered part of the string, so that if c
    is specified as '\0', these functions return a pointer to the terminator."

* NuttX: mm_free(): Add DEBUGASSERT()'s to catch memory corruption early.

    It's easier to find the source when asserts fail already when freeing
    an overflowed buffer, than if the corruption is only detected on next
    malloc().

* MM_FILL_ALLOCATIONS: Add debug option to fill all mallocs()

    This is helpful for detecting uninitialized variables,
    especially in C++ code. I seem to be forgetting to initialize
    member variables and then they just get random values..

* NuttX: nxtk_bitmapwindow: Fix warning message when bitmap is fully off-screen.

* nxfonts_getfont: Avoid unnecessary warnings for other whitespace chars also.

* NuttX: Fix kerning of 'I' in Sans17x22 font

    The I character was running together with some other
    characters, e.g. in sequence "IMI".

* NXMU: Revalidate window pointer for mouse events.

    NXMU caches the previous window pointer so that further mouse
    events can be sent to the same window. However, if the window
    is destroyed while mouse button is held down, the pointer may
    become invalid and cause a crash. This patch revalidates the
    pointer before using it.

Approved-by: GregoryN <gnutt@nuttx.org>
2018-11-12 15:36:35 +00:00
Gregory Nutt dec7ecbd56 net/tcp/tcp_recvwindow.c: In order to receive data we must not only have IOBs available, but we must also have at least one IOB chain qentry available. Otherwise, we will advertise that we an buffer a lot of data when, in fact, we cannot. This is an expermental fix to a performance problem noted by Masayuki Ishikawa. 2018-09-22 09:33:29 -06:00
Gregory Nutt 22da175629 mm/iob: Add a divider that can be used to reduce the rate of IOB notifications. 2018-09-13 06:56:29 -06:00
Gregory Nutt 76eec53e4f mm/iob: iob_navail() was returning the number of free IOB chain queue entries, not the number of free IOBs. Completely misnamed. 2018-09-12 06:40:18 -06:00
Gregory Nutt 11a635dcb3 mm/iob: IOB free notifier should accept the work queue ID as a paramter. The notification may need to run on either the high- or low- priority work queue. sched/work: Change the default priority of the low-priority work queue to 100. 2018-09-11 08:49:39 -06:00
Gregory Nutt af0ee3c8f7 sched/wqueue: Add an option to work queue notifier so that the notification can occur on different work queues. 2018-09-11 07:22:23 -06:00
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 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 32e3e51678 net/netdev: Add signal notification for the case where the network goes down. 2018-09-09 10:39:25 -06:00
Gregory Nutt 28f73bd928 net/tcp and udp: Add logic to signal events when TCP or UDP read-ahead data is buffered.
Squashed commit of the following:

    net/tcp:  Add signal notification for the case when UDP read-ahead data is buffered.  This is basically of clone of the TCP notification logic with naming adapted for UDP.

    net/tcp:  Add signal notification for the case when TCP read-ahead data is buffered.
2018-09-09 09:21:39 -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 0eb1beee63 mm/iob: Improve the IOB notifier data structures. Replace the fixed array with a singly linked list. For small value of CONFIG_IOB_NWAITERS, either solution is fine. But the fixed array does not scale well when CONFIG_IOB_NWAITERS is large. 2018-09-08 17:47:43 -06:00
Gregory Nutt 5bd0f596fc Fix some trivial typos. 2018-09-08 16:53:12 -06:00
Gregory Nutt bba8541ad6 mm/iob: Add an IOB notifier that will send a signal to any registered threads that want to be notified when an IOB has been freed. This is an untested work-in-progress and is intended to be a part of a larger solution to correctly handling network poll operations. 2018-09-08 11:21:18 -06:00
Xiang Xiao 86eef8ce3a mm/: add mm_heapmember function and reimplement kmm_heapmember base on mm_heapmember since this function is very useful if multiple heaps exist. 2018-08-23 09:38:49 -06:00
Alan Carvalho de Assis 283b73edc5 Fix lots of typos in C comments and Kconfig help text 2018-07-08 18:24:45 -06:00
Juha Niskanen 044d538da3 Fix some errors found during upstream merge 2018-06-28 07:06:57 -06:00
Gregory Nutt 0786b5d053 net/tcp: Re-think CONFIG_NET_TCP_RWND_CONTROL TCP windowing controls. 2018-06-24 14:46:12 -06:00
Dmitriy Linikov 87c8b116ca mm/iob/iob_copyin.c: Fixed problem with send() ret value when using nonblocking io over buffered tcp socket 2018-03-20 06:58:57 -06:00