[nuttx-website] 01/03: Add NuttX 12.1.0 release

2023-04-18 Thread btashton
This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git

commit b20af78e7e5e9cbed00752744d6d6d16341f74dd
Author: Alin Jerpelea 
AuthorDate: Mon Apr 17 08:28:12 2023 +0200

Add NuttX 12.1.0 release

Signed-off-by: Alin Jerpelea 
---
 _releases/12.1.0.md | 980 
 1 file changed, 980 insertions(+)

diff --git a/_releases/12.1.0.md b/_releases/12.1.0.md
new file mode 100644
index ..97319ea4
--- /dev/null
+++ b/_releases/12.1.0.md
@@ -0,0 +1,980 @@
+---
+layout: page
+released: true
+apache: true
+title: 12.1.0
+date: 2023-04-16
+summary: >
+Release v12.1.0
+
+artifact-root: "https://www.apache.org/dyn/closer.lua/nuttx/12.1.0;
+checksum-root: "https://downloads.apache.org/nuttx/12.1.0;
+key-file: "https://downloads.apache.org/nuttx/KEYS;
+
+source-os-dist:
+- "apache-nuttx-12.1.0.tar.gz"
+source-app-dist:
+- "apache-nuttx-apps-12.1.0.tar.gz"
+
+---
+
+
+
+
+{% include JB/setup %}
+
+# Apache NuttX-12.1.0 Release Notes
+* TOC
+{:toc}
+
+What's New In This Release
+
+Changes to Core OS
+Sched
+* [](https://github.com/apache/nuttx/pull/) Correct Real Time signal 
definitions. #8881 
+
+* [#8286](https://github.com/apache/nuttx/pull/8286) sched: Add _NSIG, SIGFPE, 
SIGILL and SIGSEGV definition 
+* [#8686](https://github.com/apache/nuttx/pull/8686) sched: add critical 
section in nxsched_get_stateinfo 
+* [#8708](https://github.com/apache/nuttx/pull/8708) sched: build error fix in 
task_exithook 
+* [#4819](https://github.com/apache/nuttx/pull/4819) sched: Disable stdio api 
by default when DEFAULT_SMALL equals y 
+* [#8642](https://github.com/apache/nuttx/pull/8642) sched: fix kconfig 
warning 
+* [#8151](https://github.com/apache/nuttx/pull/8151) sched: fix task_delete 
crash in SMP case 
+* [#8311](https://github.com/apache/nuttx/pull/8311) sched: fix run 
ltp_interfaces_sched_setscheduler_17_1 fail 
+* [#8210](https://github.com/apache/nuttx/pull/8210) sched: Map both NZERO and 
PTHREAD_DEFAULT_PRIORITY to SCHED_PRIORITY_DEFAULT 
+* [#8330](https://github.com/apache/nuttx/pull/8330) sched: Map SCHED_OTHER to 
SCHED_FIFO or SCHED_RR 
+* [#7882](https://github.com/apache/nuttx/pull/7882) sched: remove unnecessary 
type cast 
+* [#8374](https://github.com/apache/nuttx/pull/8374) sched: Remove the unused 
TCB_FLAG_SCHED_OTHER 
+* [#7956](https://github.com/apache/nuttx/pull/7956) sched: assert: modify 
assert message 
+* [#7957](https://github.com/apache/nuttx/pull/7957) sched: assert: Do not 
call the user space "exit" function 
+* [#7952](https://github.com/apache/nuttx/pull/7952) sched: assert: Fix 
printing argv when address environments are in use 
+* [#8224](https://github.com/apache/nuttx/pull/8224) sched: assert: sched: 
Implement tkill/tgkill 
+* [#8556](https://github.com/apache/nuttx/pull/8556) sched: assert: sync 
ps/assert output 
+* [#8897](https://github.com/apache/nuttx/pull/8897) sched: clock_gettime: 
Remove output log 
+* [#8653](https://github.com/apache/nuttx/pull/8653) sched: env: add tg_envc 
in task_group_s to avoid some loops in code 
+* [#8394](https://github.com/apache/nuttx/pull/8394) sched: getpid: replace 
syscall getpid/tid/ppid() to kernel version 
+* [#8066](https://github.com/apache/nuttx/pull/8066) sched: group: fix task 
info heap-use-after-free 
+* [#7997](https://github.com/apache/nuttx/pull/7997) sched: group: Fix memory 
corruption in group_leave.c 
+* [#8282](https://github.com/apache/nuttx/pull/8282) sched: group: Implement 
group_drop() 
+* [#8169](https://github.com/apache/nuttx/pull/8169) sched: group/addrenv: An 
assorment of fixes to address environment handling (part1)
+* [#7995](https://github.com/apache/nuttx/pull/7995) sched: misc: add 
linux-like reboot notifier list 
+* [#8035](https://github.com/apache/nuttx/pull/8035) sched: misc: assert: add 
a last type to call notifier 
+* [#8158](https://github.com/apache/nuttx/pull/8158) sched: misc: assert: fix 
build break 
+* [#8035](https://github.com/apache/nuttx/pull/8035) sched: misc: assert: add 
a last type to call notifier 
+* [#8144](https://github.com/apache/nuttx/pull/8144) sched: misc: crash dump 
message added 
+* [#7996](https://github.com/apache/nuttx/pull/7996) sched: misc: Rename 
panic.c to panic_notifier.c 
+* [#7893](https://github.com/apache/nuttx/pull/7893) sched: note: Change 
sched_note_[begin|end] to macro 
+* [#8521](https://github.com/apache/nuttx/pull/8521) sched: nxtask_sigchild: 
Set exit code when CONFIG_SCHED_CHILD_STATUS=y 
+* [#8486](https://github.com/apache/nuttx/pull/8486) sched: nxtask_sigchild: 
Set process exit code to group exit code 
+* [#8520](https://github.com/apache/nuttx/pull/8520) sched: pthread: change 
the wrong type cast 
+* [#8505](https://github.com/apache/nuttx/pull/8505) sched: pthread: check 
pthread group after find joininfo 
+* 

[nuttx-website] 03/03: download.md: fix git name after graduation

2023-04-18 Thread btashton
This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git

commit e36cef39aad5bf1e82697e4e034530ddb77fcf7f
Author: Alin Jerpelea 
AuthorDate: Tue Apr 18 08:15:38 2023 +0200

download.md: fix git name after graduation

the git was renamed after graduation and we should adjust the address

Signed-off-by: Alin Jerpelea 
---
 download.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/download.md b/download.md
index 33116072..f5f1ef5b 100644
--- a/download.md
+++ b/download.md
@@ -66,7 +66,7 @@ download has completed OK.
 For fast downloads, current source distributions are hosted on mirror servers.
 
 For security, hash and signature files are always hosted at
-[Apache](https://downloads.apache.org/incubator/nuttx/).
+[Apache](https://downloads.apache.org/nuttx/).
 {% else %}
 
 No official Apache releases have been made yet!



[nuttx-website] branch master updated (1fb7c750 -> e36cef39)

2023-04-18 Thread btashton
This is an automated email from the ASF dual-hosted git repository.

btashton pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git


from 1fb7c750 Bump commonmarker from 0.23.6 to 0.23.9
 new b20af78e Add NuttX 12.1.0 release
 new 0fecf7cd 12.0.0.md: fix git name after graduation
 new e36cef39 download.md: fix git name after graduation

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 _releases/12.0.0.md | 1480 +--
 _releases/12.1.0.md |  980 ++
 download.md |2 +-
 3 files changed, 1721 insertions(+), 741 deletions(-)
 create mode 100644 _releases/12.1.0.md



[GitHub] [nuttx-website] btashton merged pull request #89: NuttX 12.1.0 release

2023-04-18 Thread via GitHub


btashton merged PR #89:
URL: https://github.com/apache/nuttx-website/pull/89


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-website] jerpelea commented on pull request #89: NuttX 12.1.0 release

2023-04-18 Thread via GitHub


jerpelea commented on PR #89:
URL: https://github.com/apache/nuttx-website/pull/89#issuecomment-1514116984

   @xiaoxiang781216 @acassis @cederom 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] zhhyu7 opened a new pull request, #9043: forward: limit the forwarding range of broadcast packets

2023-04-18 Thread via GitHub


zhhyu7 opened a new pull request, #9043:
URL: https://github.com/apache/nuttx/pull/9043

   ## Summary
   These two scenarios do not require forwarding broadcast packets.
   ## Impact
   
   ## Testing
   sim
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] wengzhe opened a new pull request, #9042: net/rpmsg: Set family for rpaddr in ns_bind

2023-04-18 Thread via GitHub


wengzhe opened a new pull request, #9042:
URL: https://github.com/apache/nuttx/pull/9042

   ## Summary
   The rpmsg addr get from socket accept has rp_family=0, which is not 
intended, to avoid wrong logic in other place, set the rp_family in ns_bind 
function.
   
   ## Impact
   Set rp_family in rpaddr.
   
   ## Testing
   CI / Manually.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] wengzhe opened a new pull request, #9041: net/tcp: Fix clear condition in ofoseg input

2023-04-18 Thread via GitHub


wengzhe opened a new pull request, #9041:
URL: https://github.com/apache/nuttx/pull/9041

   ## Summary
   Fix clear condition in TCP ofoseg input (when receiving an out-of-ordered 
ACK)
   
   Note:
   - `iob_trimhead` won't return `NULL` when it's applying on normal IOB.
 - Keep `dev->d_iob == NULL` to avoid `iob_trimhead` changed.
   - `iob_free_chain` will do nothing when applied to `NULL`.
   
   ## Impact
   TCP Out-of-order segment process, especially when receiving an 
out-of-ordered ACK.
   
   ## Testing
   CI/Manually.
   We have a case that an http server gives an out-of-ordered ACK, and triggers 
problem on NuttX client.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] royfengsss opened a new pull request, #9040: [SYSLOG] avoid concurrent modification by other tasks

2023-04-18 Thread via GitHub


royfengsss opened a new pull request, #9040:
URL: https://github.com/apache/nuttx/pull/9040

   ## Summary
   when syslog write the iob buffer to interrupt buffer, one char a time 
disable scheduler to switch to other task in non-SMP environment.
   
   ## Impact
   syslog improvement
   
   ## Testing
   Test with developing board, no issue found.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] hujun260 commented on pull request #9023: arch/arm64:Suppot tickless mode

2023-04-18 Thread via GitHub


hujun260 commented on PR #9023:
URL: https://github.com/apache/nuttx/pull/9023#issuecomment-1514009815

   > @hujun260
   > 
   > ```
   > 

   > Configuration/Tool: qemu-armv8a/nsh_smp_tickless
   > 

   >   Cleaning...
   >   Configuring...
   >   Building NuttX...
   > Error: chip/qemu_serial.c:743:21: error: 'CONFIG_UART1_BAUD' undeclared 
here (not in a function); did you mean 'CONFIG_ARCH_BOARD'?
   >   743 |   .baud_rate  = CONFIG_UART1_BAUD,
   >   | ^
   >   | CONFIG_ARCH_BOARD
   > chip/qemu_serial.c: In function 'arm64_serialinit':
   > Error: chip/qemu_serial.c:843:40: error: 'CONSOLE_DEV' undeclared (first 
use in this function)
   >   843 |   ret = uart_register("/dev/console", _DEV);
   >   |^~~
   > chip/qemu_serial.c:843:40: note: each undeclared identifier is reported 
only once for each function it appears in
   > Error: chip/qemu_serial.c:849:38: error: 'TTYS0_DEV' undeclared (first use 
in this function)
   >   849 |   ret = uart_register("/dev/ttyS0", _DEV);
   >   |  ^
   > At top level:
   > Error: chip/qemu_serial.c:739:33: error: 'g_uart1priv' defined but not 
used [-Werror=unused-variable]
   >   739 | static struct pl011_uart_port_s g_uart1priv =
   >   | ^~~
   > Error: chip/qemu_serial.c:718:32: error: 'g_uart_ops' defined but not used 
[-Werror=unused-const-variable=]
   >   718 | static const struct uart_ops_s g_uart_ops =
   >   |^~
   > ```
   
   sorry , i update the patch and revalidation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] masayuki2009 merged pull request #9018: arch/arm: update running task when context switch occurred

2023-04-18 Thread via GitHub


masayuki2009 merged PR #9018:
URL: https://github.com/apache/nuttx/pull/9018


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: arch/arm: update running task when context switch occurred

2023-04-18 Thread masayuki
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new c00498c164 arch/arm: update running task when context switch occurred
c00498c164 is described below

commit c00498c164a79a368a58783ae17edf414f381c22
Author: zhangyuan21 
AuthorDate: Tue Apr 11 05:44:52 2023 +0800

arch/arm: update running task when context switch occurred

The text describes an issue related to the running task in code.
The running task is only used when calling the _assert function
to indicate the task that was running before an exception occurred.
However, the current code only updates the running task during
irq_dispatch, which is suitable for ARM-M architecture but not
for ARM-A or ARM-R architecture, because their context switches
are not done through irq handler. Therefore, if the following
process is followed, the value of the running task will be incorrect:

1. task1 is running, this_task()=task1
2. do_irq is executed, setting running task()=task1
3. task1 switches to task2
4. task2 is running and generates a data abort
5. In the data abort, the _assert function is called,
   and the running task obtained is still task1, but
   the actual task that generated the exception is task2.

Signed-off-by: zhangyuan21 
---
 arch/arm/src/arm/arm_syscall.c|  7 +++
 arch/arm/src/armv7-a/arm_syscall.c|  7 +++
 arch/arm/src/armv7-r/arm_syscall.c|  7 +++
 arch/arm64/src/common/arm64_syscall.c | 13 ++---
 4 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/arm/arm_syscall.c b/arch/arm/src/arm/arm_syscall.c
index 1e139debfa..085ccc53b6 100644
--- a/arch/arm/src/arm/arm_syscall.c
+++ b/arch/arm/src/arm/arm_syscall.c
@@ -33,6 +33,7 @@
 #include 
 
 #include "arm_internal.h"
+#include "sched/sched.h"
 
 /
  * Public Functions
@@ -173,6 +174,12 @@ uint32_t *arm_syscall(uint32_t *regs)
 
   if (regs != CURRENT_REGS)
 {
+  /* Record the new "running" task.  g_running_tasks[] is only used by
+   * assertion logic for reporting crashes.
+   */
+
+  g_running_tasks[this_cpu()] = this_task();
+
   restore_critical_section();
   regs = (uint32_t *)CURRENT_REGS;
 }
diff --git a/arch/arm/src/armv7-a/arm_syscall.c 
b/arch/arm/src/armv7-a/arm_syscall.c
index 14ab2ffdb2..632ef7ebde 100644
--- a/arch/arm/src/armv7-a/arm_syscall.c
+++ b/arch/arm/src/armv7-a/arm_syscall.c
@@ -39,6 +39,7 @@
 #include "addrenv.h"
 #include "arm.h"
 #include "arm_internal.h"
+#include "sched/sched.h"
 #include "signal/signal.h"
 
 /
@@ -604,6 +605,12 @@ uint32_t *arm_syscall(uint32_t *regs)
 
   if (regs != CURRENT_REGS)
 {
+  /* Record the new "running" task.  g_running_tasks[] is only used by
+   * assertion logic for reporting crashes.
+   */
+
+  g_running_tasks[this_cpu()] = this_task();
+
   restore_critical_section();
   regs = (uint32_t *)CURRENT_REGS;
 }
diff --git a/arch/arm/src/armv7-r/arm_syscall.c 
b/arch/arm/src/armv7-r/arm_syscall.c
index 20bd7803cb..726ee82f53 100644
--- a/arch/arm/src/armv7-r/arm_syscall.c
+++ b/arch/arm/src/armv7-r/arm_syscall.c
@@ -35,6 +35,7 @@
 
 #include "arm.h"
 #include "arm_internal.h"
+#include "sched/sched.h"
 #include "signal/signal.h"
 
 /
@@ -581,6 +582,12 @@ uint32_t *arm_syscall(uint32_t *regs)
 
   if (regs != CURRENT_REGS)
 {
+  /* Record the new "running" task.  g_running_tasks[] is only used by
+   * assertion logic for reporting crashes.
+   */
+
+  g_running_tasks[this_cpu()] = this_task();
+
   restore_critical_section();
   regs = (uint32_t *)CURRENT_REGS;
 }
diff --git a/arch/arm64/src/common/arm64_syscall.c 
b/arch/arm64/src/common/arm64_syscall.c
index bd04986af5..6a80b645ee 100644
--- a/arch/arm64/src/common/arm64_syscall.c
+++ b/arch/arm64/src/common/arm64_syscall.c
@@ -35,11 +35,12 @@
 #include 
 #include 
 
-#include "arch/irq.h"
-#include "signal/signal.h"
 #include "addrenv.h"
+#include "arch/irq.h"
 #include "arm64_internal.h"
 #include "arm64_fatal.h"
+#include "sched/sched.h"
+#include "signal/signal.h"
 
 /
  * Private Functions
@@ -214,7 +215,13 @@ uint64_t *arm64_syscall_switch(uint64_t * regs)
   addrenv_switch(NULL);
 #endif
 
-/* Restore the cpu lock */
+  /* Record the new "running" task.  g_running_tasks[] is only used by
+   * assertion logic for reporting crashes.
+   */
+
+  g_running_tasks[this_cpu()] = this_task();
+
+  /* Restore the cpu lock */
 
  

[nuttx-website] branch asf-site updated: Publishing web: 1fb7c7509c1d4c2677c5326e56b3014daf79f24d docs: 899be58905f7623e55a954fdd233fef063da9c97

2023-04-18 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new d1747d1f Publishing web: 1fb7c7509c1d4c2677c5326e56b3014daf79f24d 
docs: 899be58905f7623e55a954fdd233fef063da9c97
d1747d1f is described below

commit d1747d1fe70facda4088b42f4952ca5f725247a4
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
AuthorDate: Wed Apr 19 00:13:25 2023 +

Publishing web: 1fb7c7509c1d4c2677c5326e56b3014daf79f24d docs: 
899be58905f7623e55a954fdd233fef063da9c97
---
 content/docs/10.0.0/index.html | 2 +-
 content/docs/10.0.0/searchindex.js | 2 +-
 content/docs/10.0.1/index.html | 2 +-
 content/docs/10.0.1/searchindex.js | 2 +-
 content/docs/10.1.0/index.html | 2 +-
 content/docs/10.1.0/searchindex.js | 2 +-
 content/docs/10.2.0/index.html | 2 +-
 content/docs/10.2.0/searchindex.js | 2 +-
 content/docs/10.3.0/index.html | 2 +-
 content/docs/10.3.0/searchindex.js | 2 +-
 content/docs/11.0.0/index.html | 2 +-
 content/docs/11.0.0/searchindex.js | 2 +-
 content/docs/12.0.0/index.html | 2 +-
 content/docs/12.0.0/searchindex.js | 2 +-
 content/docs/12.1.0/index.html | 2 +-
 content/docs/12.1.0/searchindex.js | 2 +-
 content/docs/latest/index.html | 2 +-
 content/docs/latest/searchindex.js | 2 +-
 content/feed.xml   | 4 ++--
 19 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/content/docs/10.0.0/index.html b/content/docs/10.0.0/index.html
index 2fe365aa..8a486c64 100644
--- a/content/docs/10.0.0/index.html
+++ b/content/docs/10.0.0/index.html
@@ -133,7 +133,7 @@ by following these 
 NuttX Documentation
 NuttX is a real-time operating system (RTOS) with an emphasis on standards 
compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller 
environments, the primary governing standards in NuttX are Posix and ANSI 
standards. Additional standard APIs from Unix and other common RTOS’s (such as 
VxWorks) are adopted for functionality not available under these standards, or 
for functionality that is not appropriate for deeply-embedded environments 
(such as fork()).
-Last Updated: 18 April 23 at 00:09
+Last Updated: 19 April 23 at 00:10
 
 Table of 
Contents
 
diff --git a/content/docs/10.0.0/searchindex.js 
b/content/docs/10.0.0/searchindex.js
index 9b00348f..d02a4442 100644
--- a/content/docs/10.0.0/searchindex.js
+++ b/content/docs/10.0.0/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen
 [...]
\ No newline at end of file
+Search.setIndex({docnames:["applications/index","boards/index","components/binfmt","components/drivers/block/index","components/drivers/character/analog","components/drivers/character/can","components/drivers/character/index","components/drivers/character/keypad","components/drivers/character/pwm","components/drivers/character/quadrature","components/drivers/character/rtc","components/drivers/character/serial","components/drivers/character/timer","components/drivers/character/touchscreen
 [...]
\ No newline at end of file
diff --git a/content/docs/10.0.1/index.html b/content/docs/10.0.1/index.html
index 7a439994..d2d258ef 100644
--- a/content/docs/10.0.1/index.html
+++ b/content/docs/10.0.1/index.html
@@ -149,7 +149,7 @@ by following these 
 NuttX Documentation
 NuttX is a real-time operating system (RTOS) with an emphasis on standards 
compliance and small footprint. Scalable from 8-bit to 32-bit microcontroller 
environments, the primary governing standards in NuttX are Posix and ANSI 
standards. Additional standard APIs from Unix and other common RTOS’s (such as 
VxWorks) are adopted for functionality not available under these standards, or 
for functionality that is not appropriate for deeply-embedded environments 
(such as fork()).
-Last Updated: 18 April 23 at 00:09
+Last Updated: 19 April 23 at 00:10
 
 Table of 
Contents
 
diff --git a/content/docs/10.0.1/searchindex.js 
b/content/docs/10.0.1/searchindex.js
index 9b00348f..d02a4442 100644
--- a/content/docs/10.0.1/searchindex.js
+++ b/content/docs/10.0.1/searchindex.js
@@ -1 +1 @@

[GitHub] [nuttx] masayuki2009 commented on pull request #9023: arch/arm64:Suppot tickless mode

2023-04-18 Thread via GitHub


masayuki2009 commented on PR #9023:
URL: https://github.com/apache/nuttx/pull/9023#issuecomment-1513931299

   @hujun260 
   
   ```
   

   Configuration/Tool: qemu-armv8a/nsh_smp_tickless
   

 Cleaning...
 Configuring...
 Building NuttX...
   Error: chip/qemu_serial.c:743:21: error: 'CONFIG_UART1_BAUD' undeclared here 
(not in a function); did you mean 'CONFIG_ARCH_BOARD'?
 743 |   .baud_rate  = CONFIG_UART1_BAUD,
 | ^
 | CONFIG_ARCH_BOARD
   chip/qemu_serial.c: In function 'arm64_serialinit':
   Error: chip/qemu_serial.c:843:40: error: 'CONSOLE_DEV' undeclared (first use 
in this function)
 843 |   ret = uart_register("/dev/console", _DEV);
 |^~~
   chip/qemu_serial.c:843:40: note: each undeclared identifier is reported only 
once for each function it appears in
   Error: chip/qemu_serial.c:849:38: error: 'TTYS0_DEV' undeclared (first use 
in this function)
 849 |   ret = uart_register("/dev/ttyS0", _DEV);
 |  ^
   At top level:
   Error: chip/qemu_serial.c:739:33: error: 'g_uart1priv' defined but not used 
[-Werror=unused-variable]
 739 | static struct pl011_uart_port_s g_uart1priv =
 | ^~~
   Error: chip/qemu_serial.c:718:32: error: 'g_uart_ops' defined but not used 
[-Werror=unused-const-variable=]
 718 | static const struct uart_ops_s g_uart_ops =
 |^~
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on pull request #9039: sched/sched: address performance concerns for sched_lock in non-SMP case

2023-04-18 Thread via GitHub


pkarashchenko commented on PR #9039:
URL: https://github.com/apache/nuttx/pull/9039#issuecomment-1513804973

   @davids5 Please take a look if this solution is better


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko opened a new pull request, #9039: sched/sched: address performance concerns for sched_lock in non-SMP case

2023-04-18 Thread via GitHub


pkarashchenko opened a new pull request, #9039:
URL: https://github.com/apache/nuttx/pull/9039

   ## Summary
   Address performance concerns from https://github.com/apache/nuttx/pull/7464
   
   ## Impact
   `sched_lock`/`sched_unlock` should work as fast as before.
   
   ## Testing
   Pass `ostest` from https://github.com/apache/nuttx-apps/pull/1711
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on pull request #9002: sched/pthread: repalce sched_lock to enter_critical_section

2023-04-18 Thread via GitHub


pkarashchenko commented on PR #9002:
URL: https://github.com/apache/nuttx/pull/9002#issuecomment-1513753516

   Please rebase to get CI pass


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #1711: testing/ostest: add test case for task priority change with locked scheduler

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#discussion_r1170528717


##
testing/ostest/schedlock.c:
##
@@ -0,0 +1,259 @@
+/
+ * apps/testing/ostest/schedlock.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ /
+
+/
+ * Included Files
+ /
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_ARCH_SIM
+#  include 
+#endif
+
+#include 
+
+#include "ostest.h"
+
+static pthread_t g_lowpri;
+static pthread_t g_highpri;
+static volatile bool g_locked;
+static volatile bool g_pass;
+
+/
+ * Private Functions
+ /
+
+/
+ * Name: highpri_thread
+ /
+
+static FAR void *highpri_thread(FAR void *parameter)
+{
+  struct sched_param param;
+  int policy;
+  bool self = (bool)(uintptr_t)parameter;
+  pthread_t thread = self ? 0 : g_lowpri;
+
+  usleep(100);
+
+  pthread_getschedparam(0, , );
+  if (self)
+{
+  param.sched_priority -= 2;
+}
+  else
+{
+  param.sched_priority += 2;
+}
+
+  sched_lock();
+
+  g_locked = true;
+
+  pthread_setschedprio(thread, param.sched_priority);
+
+  /* Test pass if g_locked was not cleared by lowpri thread while scheduler
+   * is locked
+   */
+
+  g_pass = g_locked;
+
+  sched_unlock();
+
+  return NULL;
+}
+
+/
+ * Name: lowpri_thread
+ /
+
+static FAR void *lowpri_thread(FAR void *parameter)
+{
+  /* Wait until highpri thread starts the scheduler lock test */
+
+  while (!g_locked)
+{
+#ifdef CONFIG_ARCH_SIM
+  /* The simulator doesn't have any mechanism to do asynchronous
+   * pre-emption (basically because it doesn't have any
+   * interrupts/asynchronous events).  The simulator does "fake" a timer
+   * interrupt in up_idle() -- the idle thread that only executes when
+   * nothing else is running.  In the simulator, we cannot suspend the
+   * middle priority task, or we wouldn't have the test that we want.
+   * So, we have no option but to pump the fake clock here by calling
+   * up_idle().  Sigh!
+   */
+
+  up_idle();

Review Comment:
   Reposted here https://github.com/apache/nuttx-apps/issues/1716



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler

2023-04-18 Thread via GitHub


pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1513747711

   Currently this is blocked by https://github.com/apache/nuttx-apps/issues/1716


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] hartmannathan commented on pull request #8992: stm32 {f1,f2,f3,f4,F412,f7,h7,f0l0g0,wb,l15,l4,l5,g4xx} Remove GPIO_{SPEED|MODE}_xxx and provide a legacy path for lazy migration

2023-04-18 Thread via GitHub


hartmannathan commented on PR #8992:
URL: https://github.com/apache/nuttx/pull/8992#issuecomment-1513679969

   Are we ready to merge?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx-apps] branch master updated (700b0ed23 -> 4ce809e7d)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


from 700b0ed23 netutils/netlib: fix typos in comments
 add 4ce809e7d nsh/nsh_parse: Fix handling of back-quotes

No new revisions were added by this update.

Summary of changes:
 nshlib/nsh_parse.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)



[GitHub] [nuttx-apps] xiaoxiang781216 merged pull request #1702: nsh/nsh_parse: Fix handling of back-quotes

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #1702:
URL: https://github.com/apache/nuttx-apps/pull/1702


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx-apps] 01/04: nuttx: add missing FAR and CODE

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit f15605da2f93b5571175acfac76eaa2d3c6261e5
Author: Petro Karashchenko 
AuthorDate: Tue Apr 11 13:25:04 2023 +0300

nuttx: add missing FAR and CODE

Signed-off-by: Petro Karashchenko 
---
 examples/dac/dac_main.c |  4 ++--
 examples/webserver/webserver_main.c |  2 +-
 include/netutils/httpd.h| 30 +++---
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/examples/dac/dac_main.c b/examples/dac/dac_main.c
index d0ef1c6b1..c4f335b29 100644
--- a/examples/dac/dac_main.c
+++ b/examples/dac/dac_main.c
@@ -58,8 +58,8 @@
 struct command
 {
   FAR const char *name;
-  CODE int (* const cmd)(int argc, const char *argv[]);
-  const char *args;
+  CODE int (* const cmd)(int argc, FAR const char *argv[]);
+  FAR const char *args;
 };
 
 struct dac_state_s
diff --git a/examples/webserver/webserver_main.c 
b/examples/webserver/webserver_main.c
index 5e9a5f683..4fa508c1f 100644
--- a/examples/webserver/webserver_main.c
+++ b/examples/webserver/webserver_main.c
@@ -110,7 +110,7 @@ int main(int argc, FAR char *argv[])
   uint8_t mac[IFHWADDRLEN];
 #endif
 #ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC
-  void *handle;
+  FAR void *handle;
 #endif
 
   /* Many embedded network interfaces must have a software assigned MAC */
diff --git a/include/netutils/httpd.h b/include/netutils/httpd.h
index da8f57fbd..d0933d356 100644
--- a/include/netutils/httpd.h
+++ b/include/netutils/httpd.h
@@ -100,7 +100,7 @@
 
 struct httpd_fs_file
 {
-  char *data;
+  FAR char *data;
   int len;
 #if defined(CONFIG_NETUTILS_HTTPD_MMAP) || \
 defined(CONFIG_NETUTILS_HTTPD_SENDFILE)
@@ -113,17 +113,17 @@ struct httpd_fs_file
 
 struct httpd_state
 {
-  char ht_buffer[HTTPD_IOBUFFER_SIZE];  /* recv() buffer */
-  char ht_filename[HTTPD_MAX_FILENAME]; /* filename from GET command */
+  char ht_buffer[HTTPD_IOBUFFER_SIZE];  /* recv() buffer */
+  char ht_filename[HTTPD_MAX_FILENAME]; /* filename from GET command */
 #ifndef CONFIG_NETUTILS_HTTPD_KEEPALIVE_DISABLE
-  bool ht_keepalive;/* Connection: keep-alive */
+  bool ht_keepalive;/* Connection: keep-alive */
 #endif
 #if defined(CONFIG_NETUTILS_HTTPD_ENABLE_CHUNKED_ENCODING)
-  bool ht_chunked;  /* Server uses chunked encoding 
for tx */
+  bool ht_chunked;  /* Server uses chunked encoding for tx 
*/
 #endif
-  struct httpd_fs_file ht_file; /* Fake file data to send */
-  int  ht_sockfd;   /* The socket descriptor from 
accept() */
-  char*ht_scriptptr;
+  struct httpd_fs_file ht_file; /* Fake file data to send */
+  int ht_sockfd;/* The socket descriptor from accept() 
*/
+  FAR char *ht_scriptptr;
   uint16_t ht_scriptlen;
   uint16_t ht_sndlen;
 };
@@ -150,12 +150,12 @@ struct httpd_fsdata_file_noconst
 #endif
 };
 
-typedef void (*httpd_cgifunction)(struct httpd_state *, char *);
+typedef void CODE (*httpd_cgifunction)(FAR struct httpd_state *, FAR char *);
 
 struct httpd_cgi_call
 {
-  struct httpd_cgi_call *next;
-  const char *name;
+  FAR struct httpd_cgi_call *next;
+  FAR const char *name;
   httpd_cgifunction function;
 };
 
@@ -226,7 +226,7 @@ int httpd_listen(void);
  *
  /
 
-void httpd_cgi_register(struct httpd_cgi_call *cgi_call);
+void httpd_cgi_register(FAR struct httpd_cgi_call *cgi_call);
 
 /
  * Name: httpd_send_datachunk
@@ -248,7 +248,7 @@ void httpd_cgi_register(struct httpd_cgi_call *cgi_call);
  *
  /
 
-int httpd_send_datachunk(int sockfd, void *data, int len, bool chunked);
+int httpd_send_datachunk(int sockfd, FAR void *data, int len, bool chunked);
 
 /
  * Name: httpd_send_headers
@@ -267,10 +267,10 @@ int httpd_send_datachunk(int sockfd, void *data, int len, 
bool chunked);
  *
  /
 
-int httpd_send_headers(struct httpd_state *pstate, int status, int len);
+int httpd_send_headers(FAR struct httpd_state *pstate, int status, int len);
 
 #ifdef CONFIG_NETUTILS_HTTPDFSSTATS
-uint16_t httpd_fs_count(char *name);
+uint16_t httpd_fs_count(FAR char *name);
 #endif
 
 #ifdef CONFIG_NETUTILS_HTTPD_DIRLIST



[nuttx-apps] 02/04: netutils/webserver: improve modularity of httpd single server

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit f7448f848b7103b33d06791a5b034a5e5ad1cd3f
Author: Petro Karashchenko 
AuthorDate: Tue Apr 11 13:25:49 2023 +0300

netutils/webserver: improve modularity of httpd single server

Signed-off-by: Petro Karashchenko 
---
 netutils/webserver/httpd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netutils/webserver/httpd.c b/netutils/webserver/httpd.c
index 75b0fa7b1..9d3811873 100644
--- a/netutils/webserver/httpd.c
+++ b/netutils/webserver/httpd.c
@@ -809,7 +809,7 @@ static void single_server(uint16_t portno, 
pthread_startroutine_t handler,
 
   /* Handle the request. This blocks until complete. */
 
-  httpd_handler((FAR void *)acceptsd);
+  handler((FAR void *)acceptsd);
 }
 
   /* Close the sockets */



[nuttx-apps] branch master updated (69d5f960f -> 700b0ed23)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


from 69d5f960f system/ramspeed:Fix the problem that irq_disable is often 
opened.
 new f15605da2 nuttx: add missing FAR and CODE
 new f7448f848 netutils/webserver: improve modularity of httpd single server
 new a926c8bf1 include/netutils: fix code alignments
 new 700b0ed23 netutils/netlib: fix typos in comments

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/dac/dac_main.c |  4 ++--
 examples/webserver/webserver_main.c |  2 +-
 include/netutils/httpd.h| 30 +++---
 include/netutils/netlib.h   |  8 
 netutils/netlib/netlib_server.c |  4 ++--
 netutils/webserver/httpd.c  |  2 +-
 6 files changed, 25 insertions(+), 25 deletions(-)



[nuttx-apps] 03/04: include/netutils: fix code alignments

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit a926c8bf1232b3e961541df6dd8f53d943df81ad
Author: Petro Karashchenko 
AuthorDate: Fri Apr 14 21:49:48 2023 +0300

include/netutils: fix code alignments

Signed-off-by: Petro Karashchenko 
---
 include/netutils/netlib.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/netutils/netlib.h b/include/netutils/netlib.h
index 065b74a5a..45b9e0e4a 100644
--- a/include/netutils/netlib.h
+++ b/include/netutils/netlib.h
@@ -339,9 +339,9 @@ FAR struct ipt_entry *netlib_ipt_masquerade_entry(FAR const 
char *ifname);
 
 /* HTTP support */
 
-int  netlib_parsehttpurl(FAR const char *url, uint16_t *port,
-  FAR char *hostname, int hostlen,
-  FAR char *filename, int namelen);
+int netlib_parsehttpurl(FAR const char *url, uint16_t *port,
+FAR char *hostname, int hostlen,
+FAR char *filename, int namelen);
 
 #ifdef CONFIG_NETUTILS_NETLIB_GENERICURLPARSER
 int netlib_parseurl(FAR const char *str, FAR struct url_s *url);
@@ -351,7 +351,7 @@ int netlib_parseurl(FAR const char *str, FAR struct url_s 
*url);
 
 int netlib_listenon(uint16_t portno);
 void netlib_server(uint16_t portno, pthread_startroutine_t handler,
-int stacksize);
+   int stacksize);
 
 int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags);
 int netlib_ifup(FAR const char *ifname);



[nuttx-apps] 04/04: netutils/netlib: fix typos in comments

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 700b0ed2355a80d37e48307851ae44266671792b
Author: Petro Karashchenko 
AuthorDate: Fri Apr 14 21:50:43 2023 +0300

netutils/netlib: fix typos in comments

Signed-off-by: Petro Karashchenko 
---
 netutils/netlib/netlib_server.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/netutils/netlib/netlib_server.c b/netutils/netlib/netlib_server.c
index 30deef28d..c62bec9f5 100644
--- a/netutils/netlib/netlib_server.c
+++ b/netutils/netlib/netlib_server.c
@@ -89,7 +89,7 @@ void netlib_server(uint16_t portno,
 
   for (; ; )
 {
-  /* Accept the next connectin */
+  /* Accept the next connection */
 
   addrlen = sizeof(struct sockaddr_in);
   acceptsd = accept(listensd, (struct sockaddr *), );
@@ -157,7 +157,7 @@ void netlib_server(uint16_t portno,
   pthread_detach(child);
 }
 
-  /* Close the listerner socket */
+  /* Close the listener socket */
 
   close(listensd);
 }



[GitHub] [nuttx-apps] xiaoxiang781216 merged pull request #1710: Fix misc issues found by code review

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #1710:
URL: https://github.com/apache/nuttx-apps/pull/1710


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx-apps] branch master updated: system/ramspeed:Fix the problem that irq_disable is often opened.

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
 new 69d5f960f system/ramspeed:Fix the problem that irq_disable is often 
opened.
69d5f960f is described below

commit 69d5f960fc6ae27b7dce58d82e6b18cc9a964fd5
Author: chenrun1 
AuthorDate: Mon Apr 3 19:35:43 2023 +0800

system/ramspeed:Fix the problem that irq_disable is often opened.

Fix the problem that "when repeat_num!=0, there is no break, so irq_disable 
will be configured to true by default".
---
 system/ramspeed/ramspeed_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/system/ramspeed/ramspeed_main.c b/system/ramspeed/ramspeed_main.c
index 86757f7c2..445b2a220 100644
--- a/system/ramspeed/ramspeed_main.c
+++ b/system/ramspeed/ramspeed_main.c
@@ -143,6 +143,7 @@ static void parse_commandline(int argc, FAR char **argv,
 printf(RAMSPEED_PREFIX " must >= 32");
 exit(EXIT_FAILURE);
   }
+
 break;
   case 'v':
 OPTARG_TO_VALUE(info->value, uint8_t, 16);
@@ -155,6 +156,7 @@ static void parse_commandline(int argc, FAR char **argv,
 exit(EXIT_FAILURE);
   }
 
+break;
   case 'i':
 info->irq_disable = true;
 break;



[GitHub] [nuttx-apps] xiaoxiang781216 merged pull request #1708: system/ramspeed:Fix the problem that irq_disable is changed due to missing break

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #1708:
URL: https://github.com/apache/nuttx-apps/pull/1708


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1707: apps/examples/pipe: check POSIX-compliant behavior of NuttX's FIFOs

2023-04-18 Thread via GitHub


xiaoxiang781216 commented on code in PR #1707:
URL: https://github.com/apache/nuttx-apps/pull/1707#discussion_r1170459142


##
examples/pipe/redirect_test.c:
##
@@ -233,59 +202,32 @@ static int redirect_writer(int argc, char *argv[])
 
 int redirection_test(void)
 {
-  char *argv[3];
-  char buffer1[8];
-  char buffer2[8];
-  int readerid;
-  int writerid;
+  pthread_t readerid, writerid;

Review Comment:
   ```suggestion
 pthread_t readerid;
 pthread_t writerid;
   ```



##
examples/pipe/interlock_test.c:
##
@@ -104,7 +148,7 @@ static void *null_writer(pthread_addr_t pvarg)
 
 int interlock_test(void)
 {
-  pthread_t writerid;
+  pthread_t readerid, writerid;

Review Comment:
   ```suggestion
   ```suggestion
 pthread_t writerid;
 pthread_t readerid;
   ``



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (2188c0f9a8 -> 899be58905)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 2188c0f9a8 trace: modify the dependency to SCHED_INSTRUMENTATION_DUMP
 add 899be58905 sim/win/hostfs: set O_BINARY for windows hostfs as default

No new revisions were added by this update.

Summary of changes:
 arch/sim/src/sim/win/sim_hostfs.c | 16 
 1 file changed, 16 insertions(+)



[GitHub] [nuttx] xiaoxiang781216 merged pull request #8997: sim/hostfs: pass flag O_BINARY to host

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #8997:
URL: https://github.com/apache/nuttx/pull/8997


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (f5f0af4f9c -> 2188c0f9a8)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from f5f0af4f9c arch/arm64: fixed backtrace skip calc error
 new 75d95ae01a trace: replace SCHED_NOTE_BEGIN to sched_note_begin
 new a297ff61f5 drivers/note: replace sched_note_filter_dump to 
sched_note_filter_tag
 new 2188c0f9a8 trace: modify the dependency to SCHED_INSTRUMENTATION_DUMP

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Kconfig|  2 +-
 drivers/note/note_driver.c |  8 
 include/nuttx/sched_note.h | 10 +-
 include/nuttx/trace.h  |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)



[nuttx] 01/03: trace: replace SCHED_NOTE_BEGIN to sched_note_begin

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 75d95ae01afbeaf8f94d2c21883eae0de0be211f
Author: yinshengkai 
AuthorDate: Sat Apr 8 15:22:55 2023 +0800

trace: replace SCHED_NOTE_BEGIN to sched_note_begin

Signed-off-by: yinshengkai 
---
 include/nuttx/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/nuttx/trace.h b/include/nuttx/trace.h
index c79c9d7f08..70c68d3f67 100644
--- a/include/nuttx/trace.h
+++ b/include/nuttx/trace.h
@@ -32,8 +32,8 @@
  /
 
 #ifdef CONFIG_TRACE
-#  define trace_begin(tag) SCHED_NOTE_BEGIN(tag)
-#  define trace_end(tag) SCHED_NOTE_END(tag)
+#  define trace_begin(tag) sched_note_begin(tag)
+#  define trace_end(tag) sched_note_end(tag)
 #else
 #  define trace_begin(tag)
 #  define trace_end(tag)



[nuttx] 02/03: drivers/note: replace sched_note_filter_dump to sched_note_filter_tag

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit a297ff61f5e9807f4762807b75fffaaf900163e1
Author: yinshengkai 
AuthorDate: Sat Apr 8 15:22:55 2023 +0800

drivers/note: replace sched_note_filter_dump to sched_note_filter_tag

Signed-off-by: yinshengkai 
---
 drivers/note/note_driver.c |  8 
 include/nuttx/sched_note.h | 10 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/note/note_driver.c b/drivers/note/note_driver.c
index ee47b5c779..fc079c11fd 100644
--- a/drivers/note/note_driver.c
+++ b/drivers/note/note_driver.c
@@ -467,7 +467,7 @@ static inline int note_isenabled_dump(uint32_t tag)
   /* If the dump trace is disabled, do nothing. */
 
   if (!(g_note_filter.mode.flag & NOTE_FILTER_MODE_FLAG_DUMP) ||
-  NOTE_FILTER_DUMPMASK_ISSET(tag, _note_filter.tag_mask))
+  NOTE_FILTER_TAGMASK_ISSET(tag, _note_filter.tag_mask))
 {
   return false;
 }
@@ -1876,7 +1876,7 @@ void sched_note_filter_irq(FAR struct note_filter_irq_s 
*oldf,
  * Name: sched_note_filter_tag
  *
  * Description:
- *   Set and get tsg filter setting
+ *   Set and get tag filter setting
  *   (Same as NOTECTL_GETDUMPFILTER / NOTECTL_SETDUMPFILTER ioctls)
  *
  * Input Parameters:
@@ -1893,8 +1893,8 @@ void sched_note_filter_irq(FAR struct note_filter_irq_s 
*oldf,
  /
 
 #  ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
-void sched_note_filter_dump(FAR struct note_filter_tag_s *oldf,
-FAR struct note_filter_tag_s *newf)
+void sched_note_filter_tag(FAR struct note_filter_tag_s *oldf,
+   FAR struct note_filter_tag_s *newf)
 {
   irqstate_t falgs;
 
diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h
index 8e07bc7e1b..4810aa4b3a 100644
--- a/include/nuttx/sched_note.h
+++ b/include/nuttx/sched_note.h
@@ -109,13 +109,13 @@
 /* Helper macros for dump instrumentation filter */
 
 #ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
-#  define NOTE_FILTER_DUMPMASK_SET(tag, s) \
+#  define NOTE_FILTER_TAGMASK_SET(tag, s) \
   ((s)->tag_mask[(tag) / 8] |= (1 << ((tag) % 8)))
-#  define NOTE_FILTER_DUMPMASK_CLR(tag, s) \
+#  define NOTE_FILTER_TAGMASK_CLR(tag, s) \
   ((s)->tag_mask[(tag) / 8] &= ~(1 << ((tag) % 8)))
-#  define NOTE_FILTER_DUMPMASK_ISSET(tag, s) \
+#  define NOTE_FILTER_TAGMASK_ISSET(tag, s) \
   ((s)->tag_mask[(tag) / 8] & (1 << ((tag) % 8)))
-#  define NOTE_FILTER_DUMPMASK_ZERO(s) \
+#  define NOTE_FILTER_TAGMASK_ZERO(s) \
   memset((s), 0, sizeof(struct note_filter_tag_s));
 #endif
 
@@ -686,7 +686,7 @@ void sched_note_filter_irq(FAR struct note_filter_irq_s 
*oldf,
 #endif
 
 #if defined(CONFIG_SCHED_INSTRUMENTATION_FILTER) && \
-defined(CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER)
+defined(CONFIG_SCHED_INSTRUMENTATION_DUMP)
 void sched_note_filter_tag(FAR struct note_filter_tag_s *oldf,
FAR struct note_filter_tag_s *newf);
 #endif



[nuttx] 03/03: trace: modify the dependency to SCHED_INSTRUMENTATION_DUMP

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2188c0f9a8407405872c671ac6e6277e81e4a406
Author: yinshengkai 
AuthorDate: Sat Apr 8 17:00:25 2023 +0800

trace: modify the dependency to SCHED_INSTRUMENTATION_DUMP

Signed-off-by: yinshengkai 
---
 Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Kconfig b/Kconfig
index d67b1b9692..b3ed47f5d1 100644
--- a/Kconfig
+++ b/Kconfig
@@ -2009,7 +2009,7 @@ endmenu # Debug Options
 menuconfig  TRACE
bool "Enable tracepoints"
default n
-   depends on SCHED_INSTRUMENTATION
+   depends on SCHED_INSTRUMENTATION_DUMP
---help---
If this option is enabled, tracepoints at critical code in
the kernel will be enabled.



[GitHub] [nuttx] xiaoxiang781216 merged pull request #8987: fix note_drivers error

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #8987:
URL: https://github.com/apache/nuttx/pull/8987


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (49c863f238 -> f5f0af4f9c)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 49c863f238 sim/win/hostuart: only read key event from console
 new e4ae2b48b8 arch/arm64: Obtaining the correct fp pointer
 new 2c599bb9e6 arch/arm64: call PANIC in arm64_fatal_error
 new f5f0af4f9c arch/arm64: fixed backtrace skip calc error

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/arm64/src/common/Make.defs |  6 +-
 arch/arm64/src/common/arm64_backtrace.c | 11 +--
 arch/arm64/src/common/arm64_fatal.c | 33 +++--
 3 files changed, 13 insertions(+), 37 deletions(-)



[nuttx] 01/03: arch/arm64: Obtaining the correct fp pointer

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e4ae2b48b8d8d2d54a74f949cc1adbbc8758fe7e
Author: zhangyuan21 
AuthorDate: Fri Mar 31 09:50:58 2023 +0800

arch/arm64: Obtaining the correct fp pointer

Signed-off-by: zhangyuan21 
---
 arch/arm64/src/common/Make.defs | 6 +-
 arch/arm64/src/common/arm64_backtrace.c | 7 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/src/common/Make.defs b/arch/arm64/src/common/Make.defs
index ac6e7205a3..44ab574f5a 100644
--- a/arch/arm64/src/common/Make.defs
+++ b/arch/arm64/src/common/Make.defs
@@ -47,7 +47,7 @@ CMN_CSRCS += arm64_nputs.c arm64_idle.c arm64_copystate.c 
arm64_createstack.c
 CMN_CSRCS += arm64_releasestack.c arm64_stackframe.c arm64_usestack.c
 CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c 
arm64_switchcontext.c
 CMN_CSRCS += arm64_schedulesigaction.c arm64_sigdeliver.c
-CMN_CSRCS += arm64_backtrace.c arm64_getintstack.c arm64_registerdump.c
+CMN_CSRCS += arm64_getintstack.c arm64_registerdump.c
 CMN_CSRCS += arm64_perf.c
 
 # Common C source files ( hardware BSP )
@@ -115,3 +115,7 @@ endif
 ifeq ($(CONFIG_STACK_COLORATION),y)
 CMN_CSRCS += arm64_checkstack.c
 endif
+
+ifeq ($(CONFIG_SCHED_BACKTRACE),y)
+CMN_CSRCS += arm64_backtrace.c
+endif
diff --git a/arch/arm64/src/common/arm64_backtrace.c 
b/arch/arm64/src/common/arm64_backtrace.c
index 24d1ac956d..60406f7f4d 100644
--- a/arch/arm64/src/common/arm64_backtrace.c
+++ b/arch/arm64/src/common/arm64_backtrace.c
@@ -53,14 +53,13 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
 
   if (pc)
 {
-  i++;
   if (*skip-- <= 0)
 {
-  *buffer++ = pc;
+  buffer[i++] = pc;
 }
 }
 
-  for (; i < size; fp = (uintptr_t *)*(fp - 1), i++)
+  for (; i < size; fp = (uintptr_t *)*fp)
 {
   if (fp > limit || fp < base || *fp == 0)
 {
@@ -69,7 +68,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
 
   if (*skip-- <= 0)
 {
-  *buffer++ = (void *)*fp;
+  buffer[i++] = (void *)*(fp + 1);
 }
 }
 



[nuttx] 02/03: arch/arm64: call PANIC in arm64_fatal_error

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 2c599bb9e6dbbc41aea992b168bd02a3793865ee
Author: zhangyuan21 
AuthorDate: Mon Apr 10 21:15:17 2023 +0800

arch/arm64: call PANIC in arm64_fatal_error

Signed-off-by: zhangyuan21 
---
 arch/arm64/src/common/arm64_fatal.c | 33 +++--
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/arch/arm64/src/common/arm64_fatal.c 
b/arch/arm64/src/common/arm64_fatal.c
index 0bb4b3b552..c941cfe278 100644
--- a/arch/arm64/src/common/arm64_fatal.c
+++ b/arch/arm64/src/common/arm64_fatal.c
@@ -301,25 +301,6 @@ void up_mdelay(unsigned int milliseconds)
 }
 }
 
-/
- * Name: arm64_dump_fatal
- /
-
-void arm64_dump_fatal(struct regs_context *regs)
-{
-#ifdef CONFIG_SCHED_BACKTRACE
-  struct tcb_s *rtcb = (struct tcb_s *)regs->tpidr_el1;
-
-  /* Show back trace */
-
-  sched_dumpstack(rtcb->pid);
-#endif
-
-  /* Dump the registers */
-
-  up_dump_register(regs);
-}
-
 /
  * Name: arm64_fatal_error
  *
@@ -330,10 +311,10 @@ void arm64_dump_fatal(struct regs_context *regs)
 void arm64_fatal_error(unsigned int reason, struct regs_context * reg)
 {
   uint64_t el, esr, elr, far;
-  int cpu = up_cpu_index();
 
   sinfo("reason = %d\n", reason);
-  sinfo("arm64_fatal_error: CPU%d task: %s\n", cpu, running_task()->name);
+
+  CURRENT_REGS = (uint64_t *)reg;
 
   if (reason != K_ERR_SPURIOUS_IRQ)
 {
@@ -391,13 +372,5 @@ void arm64_fatal_error(unsigned int reason, struct 
regs_context * reg)
 }
 }
 
-  if (reg != NULL)
-{
-  arm64_dump_fatal(reg);
-}
-
-  for (; ; )
-{
-  up_mdelay(1000);
-}
+  PANIC();
 }



[nuttx] 03/03: arch/arm64: fixed backtrace skip calc error

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f5f0af4f9ca649b002f0e2f43c4fa9e0b60d63d1
Author: zhangyuan21 
AuthorDate: Tue Apr 11 01:41:23 2023 +0800

arch/arm64: fixed backtrace skip calc error

Signed-off-by: zhangyuan21 
---
 arch/arm64/src/common/arm64_backtrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/src/common/arm64_backtrace.c 
b/arch/arm64/src/common/arm64_backtrace.c
index 60406f7f4d..b8b6875479 100644
--- a/arch/arm64/src/common/arm64_backtrace.c
+++ b/arch/arm64/src/common/arm64_backtrace.c
@@ -53,7 +53,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
 
   if (pc)
 {
-  if (*skip-- <= 0)
+  if ((*skip)-- <= 0)
 {
   buffer[i++] = pc;
 }
@@ -66,7 +66,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
   break;
 }
 
-  if (*skip-- <= 0)
+  if ((*skip)-- <= 0)
 {
   buffer[i++] = (void *)*(fp + 1);
 }



[GitHub] [nuttx] xiaoxiang781216 merged pull request #8994: arch/arm64: fixed arm64 backtrace issue

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #8994:
URL: https://github.com/apache/nuttx/pull/8994


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: sim/win/hostuart: only read key event from console

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 49c863f238 sim/win/hostuart: only read key event from console
49c863f238 is described below

commit 49c863f238930de5f5b12fe8901d06e9335c7202
Author: chao an 
AuthorDate: Tue Apr 11 12:13:46 2023 +0800

sim/win/hostuart: only read key event from console

This commit will detect input events and filter out 
events(mouse/window/etc) other than key

Signed-off-by: chao an 
---
 arch/sim/src/sim/win/sim_hostuart.c | 78 +
 1 file changed, 53 insertions(+), 25 deletions(-)

diff --git a/arch/sim/src/sim/win/sim_hostuart.c 
b/arch/sim/src/sim/win/sim_hostuart.c
index 2dad21907a..430a2aa18d 100644
--- a/arch/sim/src/sim/win/sim_hostuart.c
+++ b/arch/sim/src/sim/win/sim_hostuart.c
@@ -25,6 +25,12 @@
 #include 
 #include 
 
+/
+ * Pre-processor Definitions
+ /
+
+#define NUM_INPUT 16
+
 /
  * Private Data
  /
@@ -89,58 +95,80 @@ int host_uart_puts(int fd, const char *buf, size_t size)
 }
 
 /
- * Name: host_uart_getc
+ * Name: host_uart_checkin
  /
 
-int host_uart_gets(int fd, char *buf, size_t size)
+bool host_uart_checkin(int fd)
 {
-  DWORD nread;
-  int ret;
+  DWORD size;
 
-  ret = ReadConsole(g_stdin_handle, buf, size, , 0);
+  if (GetNumberOfConsoleInputEvents(g_stdin_handle, ) && size > 1)
+{
+  return true;
+}
 
-  return ret == 0 ? -EIO : nread;
+  return false;
 }
 
 /
- * Name: host_uart_getcflag
+ * Name: host_uart_checkout
  /
 
-int host_uart_getcflag(int fd, unsigned int *cflag)
+bool host_uart_checkout(int fd)
 {
-  return -ENOSYS;
+  return true;
 }
 
 /
- * Name: host_uart_setcflag
+ * Name: host_uart_getc
  /
 
-int host_uart_setcflag(int fd, unsigned int cflag)
+int host_uart_gets(int fd, char *buf, size_t size)
 {
-  return -ENOSYS;
+  INPUT_RECORD input[NUM_INPUT];
+  char *pos = buf;
+  DWORD ninput;
+  int i;
+
+  while (size > 0 && host_uart_checkin(fd))
+{
+  ninput = size > NUM_INPUT ? NUM_INPUT : size;
+  if (ReadConsoleInput(g_stdin_handle,
+   (void *), ninput, ) <= 0 ||
+  ninput == 0)
+{
+  break;
+}
+
+  for (i = 0; i < ninput; i++)
+{
+  if (input[i].EventType == KEY_EVENT &&
+  input[i].Event.KeyEvent.bKeyDown &&
+  input[i].Event.KeyEvent.uChar.AsciiChar != 0)
+{
+  *pos++ = input[i].Event.KeyEvent.uChar.AsciiChar;
+  size--;
+}
+}
+}
+
+  return pos == buf ? -EIO : pos - buf;
 }
 
 /
- * Name: host_uart_checkin
+ * Name: host_uart_getcflag
  /
 
-bool host_uart_checkin(int fd)
+int host_uart_getcflag(int fd, unsigned int *cflag)
 {
-  DWORD size;
-
-  if (GetNumberOfConsoleInputEvents(g_stdin_handle, ) && size > 1)
-{
-  return true;
-}
-
-  return false;
+  return -ENOSYS;
 }
 
 /
- * Name: host_uart_checkout
+ * Name: host_uart_setcflag
  /
 
-bool host_uart_checkout(int fd)
+int host_uart_setcflag(int fd, unsigned int cflag)
 {
-  return true;
+  return -ENOSYS;
 }



[GitHub] [nuttx] xiaoxiang781216 merged pull request #8996: sim/win/hostuart: only read key event from console

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #8996:
URL: https://github.com/apache/nuttx/pull/8996


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: fs/hostfs: align operation flags define with fcntl.h

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 8b43096e28 fs/hostfs: align operation flags define with fcntl.h
8b43096e28 is described below

commit 8b43096e288253ec6fef45c0502501869275fbae
Author: chao an 
AuthorDate: Tue Apr 11 17:04:31 2023 +0800

fs/hostfs: align operation flags define with fcntl.h

follow the change: https://github.com/apache/nuttx/pull/6357

Signed-off-by: chao an 
---
 include/nuttx/fs/hostfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/nuttx/fs/hostfs.h b/include/nuttx/fs/hostfs.h
index 7e0262de1f..779320634b 100644
--- a/include/nuttx/fs/hostfs.h
+++ b/include/nuttx/fs/hostfs.h
@@ -82,7 +82,7 @@
 #define NUTTX_O_TRUNC   (1 << 5)  /* Delete contents */
 #define NUTTX_O_NONBLOCK(1 << 6)  /* Don't wait for data */
 #define NUTTX_O_SYNC(1 << 7)  /* Synchronize output on write */
-#define NUTTX_O_BINARY  (1 << 8)  /* Open the file in binary mode. */
+#define NUTTX_O_TEXT(1 << 8)  /* Open the file in text 
(translated) mode. */
 #define NUTTX_O_DIRECT  (1 << 9)  /* Avoid caching, write directly to 
hardware */
 #define NUTTX_O_CLOEXEC (1 << 10) /* Close on execute */
 #define NUTTX_O_DIRECTORY   (1 << 11) /* Must be a directory */



[GitHub] [nuttx] xiaoxiang781216 merged pull request #9000: fs/hostfs: align operation flags define with fcntl.h

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #9000:
URL: https://github.com/apache/nuttx/pull/9000


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: sched/wqueue: fix issue about worker can't wake up thread before work_thread running

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 1f665e3498 sched/wqueue: fix issue about worker can't wake up thread 
before work_thread running
1f665e3498 is described below

commit 1f665e349818d917f5ea8e58c1b36019126f1c15
Author: dongjiuzhu1 
AuthorDate: Wed Apr 12 17:48:56 2023 +0800

sched/wqueue: fix issue about worker can't wake up thread before 
work_thread running

Problem:
AppBringup task in default priority 240 ->
board_late_initialize() ->
   some driver called work_queue() ->
  nxsem_post(&(wqueue).sem) failed because sem_count is 0

hp work_thread in default priority 224 ->
  nxsem_wait_uninterruptible(>sem);

so hp_work_thread can't wake up, worker can't run immediately.

Signed-off-by: dongjiuzhu1 
---
 sched/wqueue/kwork_thread.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sched/wqueue/kwork_thread.c b/sched/wqueue/kwork_thread.c
index 43d966c04f..df80969f7f 100644
--- a/sched/wqueue/kwork_thread.c
+++ b/sched/wqueue/kwork_thread.c
@@ -139,13 +139,6 @@ static int work_thread(int argc, FAR char *argv[])
 
   for (; ; )
 {
-  /* Then process queued work.  work_process will not return until: (1)
-   * there is no further work in the work queue, and (2) semaphore is
-   * posted.
-   */
-
-  nxsem_wait_uninterruptible(>sem);
-
   /* And check each entry in the work queue.  Since we have disabled
* interrupts we know:  (1) we will not be suspended unless we do
* so ourselves, and (2) there will be no changes to the work queue
@@ -182,6 +175,13 @@ static int work_thread(int argc, FAR char *argv[])
   CALL_WORKER(worker, arg);
   flags = enter_critical_section();
 }
+
+  /* Then process queued work.  work_process will not return until: (1)
+   * there is no further work in the work queue, and (2) semaphore is
+   * posted.
+   */
+
+  nxsem_wait_uninterruptible(>sem);
 }
 
   leave_critical_section(flags);



[GitHub] [nuttx] xiaoxiang781216 merged pull request #9007: sched/wqueue: fix issue about worker can't wake up thread before work_thread running

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #9007:
URL: https://github.com/apache/nuttx/pull/9007


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: Added missing checks in strdup'ed strings.

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new ab1b3c0337 Added missing checks in strdup'ed strings.
ab1b3c0337 is described below

commit ab1b3c0337a9e2c510455ff14eead861c5e9f23a
Author: Fotis Panagiotopoulos 
AuthorDate: Wed Apr 12 17:23:56 2023 +0300

Added missing checks in strdup'ed strings.
---
 drivers/wireless/gs2200m.c | 7 +++
 fs/nxffs/nxffs_pack.c  | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c
index 1a2e5864ab..f33dc2a276 100644
--- a/drivers/wireless/gs2200m.c
+++ b/drivers/wireless/gs2200m.c
@@ -3506,6 +3506,12 @@ FAR void *gs2200m_register(FAR const char *devpath,
 
   nxmutex_init(>dev_lock);
 
+  if (!dev->path)
+{
+  wlerr("Failed to allocate driver path.\n");
+  goto errout;
+}
+
   ret = gs2200m_initialize(dev, lower);
   if (ret < 0)
 {
@@ -3531,6 +3537,7 @@ FAR void *gs2200m_register(FAR const char *devpath,
 
 errout:
   nxmutex_destroy(>dev_lock);
+  lib_free(dev->path);
   kmm_free(dev);
   return NULL;
 }
diff --git a/fs/nxffs/nxffs_pack.c b/fs/nxffs/nxffs_pack.c
index d57b65bdde..24c5c562bf 100644
--- a/fs/nxffs/nxffs_pack.c
+++ b/fs/nxffs/nxffs_pack.c
@@ -1093,6 +1093,8 @@ nxffs_setupwriter(FAR struct nxffs_volume_s *volume,
   pack->dest.entry.utc= wrfile->ofile.entry.utc;
   pack->dest.entry.datlen = wrfile->ofile.entry.datlen;
 
+  DEBUGASSERT(pack->dest.entry.name != NULL);
+
   memset(>src, 0, sizeof(struct nxffs_packstream_s));
   memcpy(>src.entry, >ofile.entry,
  sizeof(struct nxffs_entry_s));



[GitHub] [nuttx] xiaoxiang781216 merged pull request #9010: Added missing checks in strdup'ed strings.

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #9010:
URL: https://github.com/apache/nuttx/pull/9010


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (433ec4c9de -> 098b7bbfb3)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 433ec4c9de drivers/sensors/Kconfig: Fix bmp280 texts in Kconfig
 add 098b7bbfb3 Fixes in asprintf usage.

No new revisions were added by this update.

Summary of changes:
 fs/inode/fs_inodesearch.c | 12 +++-
 fs/vfs/fs_dir.c   |  8 +++-
 fs/vfs/fs_rename.c| 12 +++-
 libs/libc/stdio/lib_tempnam.c |  5 +++--
 tools/gencromfs.c | 12 ++--
 5 files changed, 34 insertions(+), 15 deletions(-)



[GitHub] [nuttx] xiaoxiang781216 merged pull request #9009: Fixes in asprintf usage.

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #9009:
URL: https://github.com/apache/nuttx/pull/9009


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (a4546f35d2 -> 433ec4c9de)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from a4546f35d2 drivers/mtd:fix uninit data in mtd_config_fs
 add 433ec4c9de drivers/sensors/Kconfig: Fix bmp280 texts in Kconfig

No new revisions were added by this update.

Summary of changes:
 drivers/sensors/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



[GitHub] [nuttx] xiaoxiang781216 merged pull request #9013: drivers/sensors/Kconfig: Fix bmp280 texts in Kconfig

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #9013:
URL: https://github.com/apache/nuttx/pull/9013


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (1530e04f20 -> a4546f35d2)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 1530e04f20 ostest: Enabled KASAN, UBSAN & assertions.
 add a4546f35d2 drivers/mtd:fix uninit data in mtd_config_fs

No new revisions were added by this update.

Summary of changes:
 drivers/mtd/mtd_config_fs.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)



[GitHub] [nuttx] xiaoxiang781216 merged pull request #9011: drivers/mtd:fix uninit data in mtd_config_fs

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #9011:
URL: https://github.com/apache/nuttx/pull/9011


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated: ostest: Enabled KASAN, UBSAN & assertions.

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
 new 1530e04f20 ostest: Enabled KASAN, UBSAN & assertions.
1530e04f20 is described below

commit 1530e04f2029601e9c0653736853a4758d5c0146
Author: Fotis Panagiotopoulos 
AuthorDate: Wed Apr 5 21:07:22 2023 +0300

ostest: Enabled KASAN, UBSAN & assertions.
---
 boards/sim/sim/sim/configs/ostest/defconfig | 5 +
 tools/ci/testlist/sim-02.dat| 3 +++
 2 files changed, 8 insertions(+)

diff --git a/boards/sim/sim/sim/configs/ostest/defconfig 
b/boards/sim/sim/sim/configs/ostest/defconfig
index 37312520c3..8b2959cb55 100644
--- a/boards/sim/sim/sim/configs/ostest/defconfig
+++ b/boards/sim/sim/sim/configs/ostest/defconfig
@@ -14,10 +14,15 @@ CONFIG_BOARDCTL=y
 CONFIG_BOARDCTL_POWEROFF=y
 CONFIG_BOARD_LOOPSPERMSEC=100
 CONFIG_CANCELLATION_POINTS=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_FS_NAMED_SEMAPHORES=y
 CONFIG_IDLETHREAD_STACKSIZE=4096
 CONFIG_INIT_ENTRYPOINT="ostest_main"
+CONFIG_MM_KASAN=y
+CONFIG_MM_UBSAN=y
+CONFIG_MM_UBSAN_TRAP_ON_ERROR=y
 CONFIG_PTHREAD_CLEANUP=y
 CONFIG_PTHREAD_CLEANUP_STACKSIZE=3
 CONFIG_PTHREAD_MUTEX_TYPES=y
diff --git a/tools/ci/testlist/sim-02.dat b/tools/ci/testlist/sim-02.dat
index 28b3e693fd..c47ec022f9 100644
--- a/tools/ci/testlist/sim-02.dat
+++ b/tools/ci/testlist/sim-02.dat
@@ -6,6 +6,9 @@
 -Darwin,sim:rpserver
 -Darwin,sim:sotest32
 
+# clang doesn't -fsanitize=kernel-address
+-Darwin,sim:ostest
+
 # macOS doesn't support --wrap flag
 # ld: unknown option: --wrap
 -Darwin,sim:segger



[GitHub] [nuttx] xiaoxiang781216 merged pull request #8972: ostest: Enabled KASAN, UBSAN & assertions.

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #8972:
URL: https://github.com/apache/nuttx/pull/8972


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (770817ba2f -> fcd6ec7809)

2023-04-18 Thread xiaoxiang
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 770817ba2f fs/littlefs:littlefs shouldn't be used without C99 BOOL
 add fcd6ec7809 sched/sched: fix scheduler lock/unlock operation for 
non-SMP case

No new revisions were added by this update.

Summary of changes:
 sched/sched/sched_lock.c |  25 -
 sched/sched/sched_mergepending.c | 110 +--
 2 files changed, 82 insertions(+), 53 deletions(-)



[GitHub] [nuttx] xiaoxiang781216 merged pull request #7464: sched: fix context switching with locked scheduler

2023-04-18 Thread via GitHub


xiaoxiang781216 merged PR #7464:
URL: https://github.com/apache/nuttx/pull/7464


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on pull request #7464: sched: fix context switching with locked scheduler

2023-04-18 Thread via GitHub


pkarashchenko commented on PR #7464:
URL: https://github.com/apache/nuttx/pull/7464#issuecomment-1513605570

   > @pkarashchenko - this looks correct to me. 
   > The only concern I have is that copy loop could add latency and jitter to 
interrupt processing.
   > Do you think it will be significant?
   
   I think that a similar approach is applied in the SMP case. At least I can't 
reproduce an issue in SMP mode (newly added ostest pass in SMP mode). Maybe 
because SMP has ready-to-run and assigned lists, but non-SMP has only 
ready-to-run. I've experimented with a few possible solutions and ended up with 
this because it does not impact SMP mode, but I can try to evaluate something 
that moves tasks only if currently running task downgrades the priority, so the 
overhead is not so big.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx-apps] pkarashchenko commented on pull request #1711: testing/ostest: add test case for task priority change with locked scheduler

2023-04-18 Thread via GitHub


pkarashchenko commented on PR #1711:
URL: https://github.com/apache/nuttx-apps/pull/1711#issuecomment-1513595873

   Ok. Could you please point me to some examples, or should I just place some 
explanations in the comments?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (18e2aa2d03 -> 770817ba2f)

2023-04-18 Thread davids5
This is an automated email from the ASF dual-hosted git repository.

davids5 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 18e2aa2d03 Revert "risv-v/esp32c6: disable custom optimize level 
temporary"
 add 770817ba2f fs/littlefs:littlefs shouldn't be used without C99 BOOL

No new revisions were added by this update.

Summary of changes:
 fs/littlefs/lfs_vfs.c | 8 
 1 file changed, 8 insertions(+)



[GitHub] [nuttx] davids5 merged pull request #9037: fs/littlefs:littlefs shouldn't be used without C99 BOOL

2023-04-18 Thread via GitHub


davids5 merged PR #9037:
URL: https://github.com/apache/nuttx/pull/9037


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (45bba6e761 -> 18e2aa2d03)

2023-04-18 Thread archer
This is an automated email from the ASF dual-hosted git repository.

archer pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 45bba6e761 xtensa/esp32: ESP32 not use IMEM in user heap mode
 add 18e2aa2d03 Revert "risv-v/esp32c6: disable custom optimize level 
temporary"

No new revisions were added by this update.

Summary of changes:
 boards/risc-v/esp32c6/esp32c6-devkit/configs/coremark/defconfig | 2 ++
 1 file changed, 2 insertions(+)



[GitHub] [nuttx] anchao merged pull request #9038: Revert "risv-v/esp32c6: disable custom optimize level temporary"

2023-04-18 Thread via GitHub


anchao merged PR #9038:
URL: https://github.com/apache/nuttx/pull/9038


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[nuttx] branch master updated (5207295f83 -> 45bba6e761)

2023-04-18 Thread gustavonihei
This is an automated email from the ASF dual-hosted git repository.

gustavonihei pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


from 5207295f83 esp32c6: fixed ci build issue
 add 45bba6e761 xtensa/esp32: ESP32 not use IMEM in user heap mode

No new revisions were added by this update.

Summary of changes:
 arch/xtensa/src/esp32/Kconfig| 11 ++-
 arch/xtensa/src/esp32/esp32_serial.c | 20 
 arch/xtensa/src/esp32/esp32_spi.c| 34 ++
 3 files changed, 48 insertions(+), 17 deletions(-)



[GitHub] [nuttx] gustavonihei merged pull request #9020: xtensa/esp32: ESP32 not use IMEM in user heap mode

2023-04-18 Thread via GitHub


gustavonihei merged PR #9020:
URL: https://github.com/apache/nuttx/pull/9020


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] gustavonihei commented on a diff in pull request #9037: fs/littlefs:littlefs shouldn't be used without C99 BOOL

2023-04-18 Thread via GitHub


gustavonihei commented on code in PR #9037:
URL: https://github.com/apache/nuttx/pull/9037#discussion_r1170086569


##
fs/littlefs/lfs_vfs.c:
##
@@ -39,6 +39,14 @@
 #include "littlefs/lfs.h"
 #include "littlefs/lfs_util.h"
 
+/
+ * Pre-processor Definitions
+ /
+
+#ifndef CONFIG_C99_BOOL
+#  error littlefs requires CONFIG_C99_BOOL to be selected```

Review Comment:
   ```suggestion
   #  error littlefs requires CONFIG_C99_BOOL to be selected
   ```
   Probably some leftovers from markdown syntax



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] hujun260 commented on pull request #9023: arch/arm64:Suppot tickless mode

2023-04-18 Thread via GitHub


hujun260 commented on PR #9023:
URL: https://github.com/apache/nuttx/pull/9023#issuecomment-1513088965

   > @hujun260 Can you add qemu-armv8a:tickless configuration to test this PR?
   
   Ok,I just add configure qemu-armv8a:nsh_smp_tickless.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on issue #8917: nxsem_wait_irq with MMU

2023-04-18 Thread via GitHub


pussuw commented on issue #8917:
URL: https://github.com/apache/nuttx/issues/8917#issuecomment-1513086554

   I'll move the discussion back here to avoid spamming the mailing list. 
   
   My understanding of the semaphore handling logic increases bit by bit and 
thus far I have found the following:
   - `tcb->waitobj` is user by the system scheduler to implement the 
`TSTATE_WAIT_SEM`-list, it accesses `dq_queue_t waitlist;`
   - This basically means that whenever a semaphore is set into `tcb->waitobj` 
-> **the memory must be accessible to the kernel, even from other processes** 
and this access has to be deterministic (preferably also fast).
   - Adding temporary mappings to (or addrenv switch) into `nxsem_wait_irq` 
does fix the watchdog interrupt and signal dispatch cases, but not the case 
mentioned above -> **doing any temp mappings in `nxsem_wait_irq` is simply 
futile**.
   - `nxsem_canceled` is called from `nxsem_wait_irq`, this accesses the 
priority inheritance list `tcb->holdsem`, which also holds a reference to the 
semaphore via `holdsem->sem`, and this points to user memory also.
   - This means that not only does the semaphore access not work, priority 
inheritance is also broken with CONFIG_BUILD_KERNEL. -> **the pointer in 
`tcb->holdsem->sem` must also be accessible to the kernel in a deterministic 
(preferably also fast) manner**.
   
   Implementing dynamic mappings for the semaphore works wonderfully when the 
semaphore structure fits inside a single page. When it crosses a page boundary 
the problems start. In this case we lose all measures of deterministic 
behavior, because we need to:
   - Do two table walks to find the physical pages -> this is O(1)
   - Find a virtual memory area where the mapping fits -> this is O(n) 
orO(log(n)) at best
   - Map the pages into kernel addressable memory -> this is O(1)
   - Mark the mappings into a list, where they can be found later -> this is 
O(1)
   
   When the semaphore is taken, the process marks itself as the holder. 
   - The mapping needs to exist until the the semaphore is released, because 
only at this point the holder list can be updated. This means the mapping can 
live for a LONG time.
   - When the semaphore is released, the virtual memory must be unmapped.
   - This means the mapping list must be traversed to find whether a mapping 
really exists -> this is O(n)
   - Why do we need a list? Because semaphores are used by the kernel itself 
too, these don't need to be dynamically mapped.
   
   So to me it seems like mapping the semaphore to kernel memory won't fix 
anything. Unless there is some obvious solution I'm missing.
   
   Please correct me if I'm typing nonsense, as I'm still trying to grasp the 
big picture.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] XinStellaris commented on a diff in pull request #9037: fs/littlefs:littlefs shouldn't be used without C99 BOOL

2023-04-18 Thread via GitHub


XinStellaris commented on code in PR #9037:
URL: https://github.com/apache/nuttx/pull/9037#discussion_r1169945114


##
fs/littlefs/lfs_vfs.c:
##
@@ -39,6 +39,14 @@
 #include "littlefs/lfs.h"
 #include "littlefs/lfs_util.h"
 
+/
+ * Pre-processor Definitions
+ /
+
+#ifndef CONFIG_C99_BOOL
+#  error littlefs is based on C99 BOOL

Review Comment:
   it is a typo error, I will fix it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] davids5 commented on a diff in pull request #9037: fs/littlefs:littlefs shouldn't be used without C99 BOOL

2023-04-18 Thread via GitHub


davids5 commented on code in PR #9037:
URL: https://github.com/apache/nuttx/pull/9037#discussion_r1169942095


##
fs/littlefs/lfs_vfs.c:
##
@@ -39,6 +39,14 @@
 #include "littlefs/lfs.h"
 #include "littlefs/lfs_util.h"
 
+/
+ * Pre-processor Definitions
+ /
+
+#ifndef CONFIG_C99_BOOL
+#  error littlefs is based on C99 BOOL

Review Comment:
   Why remove littlefs?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] XinStellaris commented on a diff in pull request #9037: fs/littlefs:littlefs shouldn't be used without C99 BOOL

2023-04-18 Thread via GitHub


XinStellaris commented on code in PR #9037:
URL: https://github.com/apache/nuttx/pull/9037#discussion_r1169935855


##
fs/littlefs/lfs_vfs.c:
##
@@ -39,6 +39,14 @@
 #include "littlefs/lfs.h"
 #include "littlefs/lfs_util.h"
 
+/
+ * Pre-processor Definitions
+ /
+
+#ifndef CONFIG_C99_BOOL
+#  error littlefs is based on C99 BOOL

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] zyfeier commented on pull request #8994: arch/arm64: fixed arm64 backtrace issue

2023-04-18 Thread via GitHub


zyfeier commented on PR #8994:
URL: https://github.com/apache/nuttx/pull/8994#issuecomment-1512949510

   @pkarashchenko If there are no issues, please help to merge it, thank you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] zyfeier commented on pull request #9018: arch/arm: update running task when context switch occurred

2023-04-18 Thread via GitHub


zyfeier commented on PR #9018:
URL: https://github.com/apache/nuttx/pull/9018#issuecomment-1512948568

   @masayuki2009 If there are no issues, please help to merge it, thank you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] davids5 commented on a diff in pull request #9037: fs/littlefs:littlefs shouldn't be used without C99 BOOL

2023-04-18 Thread via GitHub


davids5 commented on code in PR #9037:
URL: https://github.com/apache/nuttx/pull/9037#discussion_r1169912071


##
fs/littlefs/lfs_vfs.c:
##
@@ -39,6 +39,14 @@
 #include "littlefs/lfs.h"
 #include "littlefs/lfs_util.h"
 
+/
+ * Pre-processor Definitions
+ /
+
+#ifndef CONFIG_C99_BOOL
+#  error littlefs is based on C99 BOOL

Review Comment:
   ```suggestion
   #  error littlefs requires CONFIG_C99_BOOL to be selected```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] davids5 commented on pull request #8992: stm32 {f1,f2,f3,f4,F412,f7,h7,f0l0g0,wb,l15,l4,l5,g4xx} Remove GPIO_{SPEED|MODE}_xxx and provide a legacy path for lazy migration

2023-04-18 Thread via GitHub


davids5 commented on PR #8992:
URL: https://github.com/apache/nuttx/pull/8992#issuecomment-1512925581

   > > LGTM.
   > > One thing that worries me is that we will stay with two versions of the 
pinouts and the migration process will never end. Maybe we should define some 
deadline when migration should be completed (in terms of release version)? 
Creating an issue to track progress in upstream boards migration will also be a 
good idea. We could follow who is willing to help in the migration process to 
avoid duplication of work.
   > 
   > Remember there are out-of-tree boards that will need to be updated. We 
should allow enough time for that. How long? That should be discussed on 
mailing list.
   > 
   > When migration begins, the first step should be to set default of 
STM32xx_USE_LEGACY_PINMAP to No for a while (how long? again, let's discuss 
on-list). After that, the legacy pinmaps can be removed.
   
   > One thing that worries me is that we will stay with two versions of the 
pinouts and the migration process will never end
   @raiden00pl Yes me too.
   
   @hartmannathan I fully agree the approach and the TBD1 & TBD2 for N should 
approved on the mailing list.
   
   Here is one approach I was thinking about:
   
   Once this repo has had all boards converted say in release (N). After 
(N+(TBD1)) releases, in a single commit, the STM32xx_USE_LEGACY_PINMAP logic 
would be removed from all the .h files, AND the gpio.c #"pragma message" 
replaced with an #error that point to the PR deleting the legacy.h files as a 
second commit. 
   
   The legacy files are deleted (in a second single commit)  Then any 
latecomers: to the party, can revert the second commit and have all the legacy 
files to run the conversion tool against.
   
   N+TBD2 remove the Kconfig entries and  #error 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] davids5 commented on a diff in pull request #8992: stm32 {f1,f2,f3,f4,F412,f7,h7,f0l0g0,wb,l15,l4,l5,g4xx} Remove GPIO_{SPEED|MODE}_xxx and provide a legacy path for lazy migration

2023-04-18 Thread via GitHub


davids5 commented on code in PR #8992:
URL: https://github.com/apache/nuttx/pull/8992#discussion_r1169874310


##
tools/stm32_pinmap_tool.py:
##
@@ -0,0 +1,571 @@
+#!/usr/bin/env python3
+
+# tools/stm32_pinmap_tool.py
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+
+
+# for python2.7 compatibility
+from __future__ import print_function
+
+import argparse
+import os
+import re
+import sys
+from argparse import RawTextHelpFormatter
+from glob import glob
+
+suffix = "_0"
+remaps_re = re.compile(r"(.*REMAP.*)=y")
+ip_block_re = re.compile(r"CONFIG_STM32[A-Z0-9]*_([A-Z0-9]+[0-9]*)=")
+stm32f1_re = re.compile(r"stm32f10[0-9][a-z]*_pinmap")
+speed_re = re.compile(r"(GPIO_(?:SPEED|MODE)_[zA-Z0-9]+)")
+port_re = re.compile(r"GPIO_PORT([A-Z])\|")
+pin_re = re.compile(r"GPIO_PIN(\d+)")
+define_re = re.compile(r"#\s*define\s+(GPIO.*)\s+(GPIO.*?)\s+")
+
+
+class GPIODef:
+def __init__(self, original_name, name, description):
+self.original_name = original_name
+self.name = name
+self.block = name.split("_")[1]
+self.speed = None
+s = speed_re.search(description)
+if s:
+self.speed = s.group(1)
+s = port_re.search(description)
+if s:
+self.port = s.group(1)
+s = pin_re.search(description)
+if s:
+self.pin = s.group(1)
+
+def __str__(self):
+fmt = "#define {0: <20} {1} /* P{2} */"
+if self.speed:
+if "MODE" in self.speed:
+if "MHz" in self.speed:
+# F1 has mode, MHz is output, we must adjust the speed
+fmt = "#define {0: <20} GPIO_ADJUST_MODE({1}, {3}) /* P{2} 
*/ "
+else:
+# All others had a OSPEDD reg so wee just set it
+fmt = "#define {0: <20} ({1} | {3}) /* P{2} */ "
+
+return fmt.format(
+self.original_name,
+self.name,
+self.port + self.pin,
+self.speed,
+)
+
+def __repr__(self):
+return f""
+
+
+# Detect python version
+if sys.version_info[0] < 3:
+runningPython3 = False
+else:
+runningPython3 = True
+
+
+def parse_args():
+# Parse commandline arguments
+parser = argparse.ArgumentParser(
+formatter_class=RawTextHelpFormatter,
+description="""stm32_pinmap_tool.py
+
+   This tool is used to migrate legacy stm32 pinmap files that
+   had included pin speed (slew rate control) in pinmap pin definitions
+
+   These speeds should have never been part of the defines as these

Review Comment:
   all changes to spelling in stm32_pinmap_tool.py Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] hartmannathan commented on pull request #8992: stm32 {f1,f2,f3,f4,F412,f7,h7,f0l0g0,wb,l15,l4,l5,g4xx} Remove GPIO_{SPEED|MODE}_xxx and provide a legacy path for lazy migration

2023-04-18 Thread via GitHub


hartmannathan commented on PR #8992:
URL: https://github.com/apache/nuttx/pull/8992#issuecomment-1512887005

   > LGTM. 
   > 
   > One thing that worries me is that we will stay with two versions of the 
pinouts and the migration process will never end. Maybe we should define some 
deadline when migration should be completed (in terms of release version)? 
Creating an issue to track progress in upstream boards migration will also be a 
good idea. We could follow who is willing to help in the migration process to 
avoid duplication of work.
   
   
   Remember there are out-of-tree boards that will need to be updated. We 
should allow enough time for that. How long? That should be discussed on 
mailing list.
   
   When migration begins, the first step should be to set default of
   STM32xx_USE_LEGACY_PINMAP to No for a while (how long? again, let's discuss 
on-list). After that, the legacy pinmaps can be removed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] davids5 commented on a diff in pull request #8992: stm32 {f1,f2,f3,f4,F412,f7,h7,f0l0g0,wb,l15,l4,l5,g4xx} Remove GPIO_{SPEED|MODE}_xxx and provide a legacy path for lazy migration

2023-04-18 Thread via GitHub


davids5 commented on code in PR #8992:
URL: https://github.com/apache/nuttx/pull/8992#discussion_r1169866728


##
arch/arm/src/stm32f0l0g0/Kconfig:
##
@@ -945,6 +945,26 @@ config ARCH_BOARD_STM32F0G0L0_CUSTOM_CLOCKCONFIG
---help---
Enables special, board-specific STM32 clock configuration.
 
+config STM32F0G0L0_USE_LEGACY_PINMAP
+   bool "Use the legacy pinmap with GPIO_SPEED_xxx included."
+   default y
+   ---help---
+   In the past, pinmap files included GPIO_SPEED_xxxMhz. These 
speed
+   settings should have come from the board.h as it describes the 
wiring
+   of the SoC to the board. The speed is really slew rate control 
and
+   therefore is related to the layout and can only be properly set
+   in board.h.
+
+   STM32F0G0L0_USE_LEGACY_PINMAP is provided, to allow lazy 
migration to
+   using pinmaps without speeds. The work required to do this can 
be aided
+   by running tools/stm32_pinmap_tool.py. The tools will take a 
board.h
+   file and a legacy pinmap and outut the required changes that 
one needs

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] davids5 commented on a diff in pull request #8992: stm32 {f1,f2,f3,f4,F412,f7,h7,f0l0g0,wb,l15,l4,l5,g4xx} Remove GPIO_{SPEED|MODE}_xxx and provide a legacy path for lazy migration

2023-04-18 Thread via GitHub


davids5 commented on code in PR #8992:
URL: https://github.com/apache/nuttx/pull/8992#discussion_r1169866493


##
arch/arm/src/stm32/Kconfig:
##
@@ -3452,6 +3452,26 @@ config STM32_NOEXT_VECTORS
Sometimes you may not need any Vector support beyond SysTick
and wish to save memory. This applies only to ARMv7-M 
architectures.
 
+config STM32_USE_LEGACY_PINMAP
+   bool "Use the legacy pinmap with GPIO_SPEED_xxx included."
+   default y
+   ---help---
+   In the past, pinmap files included GPIO_SPEED_xxxMhz. These 
speed
+   settings should have come from the board.h as it describes the 
wiring
+   of the SoC to the board. The speed is really slew rate control 
and
+   therefore is related to the layout and can only be properly set
+   in board.h.
+
+   STM32_USE_LEGACY_PINMAP is provided, to allow lazy migration to
+   using pinmaps without speeds. The work required to do this can 
be aided
+   by running tools/stm32_pinmap_tool.py. The tools will take a 
board.h
+   file and a legacy pinmap and outut the required changes that 
one needs

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8876: arch/arm64: fixed cache issue and add more cache interface

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #8876:
URL: https://github.com/apache/nuttx/pull/8876#discussion_r1169789469


##
arch/arm64/src/common/arm64_mpu.h:
##
@@ -202,13 +202,23 @@
 .mair_idx = MPU_MAIR_INDEX_DEVICE,\
   }
 
-#define REGION_RAM_ATTR   \
-  {   \
-/* AP, XN, SH */  \
-.rbar = NOT_EXEC | P_RW_U_NA_MSK | NON_SHAREABLE_MSK, \
-/* Cache-ability */   \
-.mair_idx = MPU_MAIR_INDEX_SRAM,  \
-  }
+#ifdef CONFIG_SMP
+#  define REGION_RAM_ATTR \
+{ \
+  /* AP, XN, SH */\
+  .rbar = (NOT_EXEC | P_RW_U_NA_MSK | INNER_SHAREABLE_MSK) ,  \
+  /* Cache-ability */ \
+  .mair_idx = MPU_MAIR_INDEX_SRAM,\

Review Comment:
   ```suggestion
   #  define REGION_RAM_ATTR\
   {\
 /* AP, XN, SH */   \
 .rbar = (NOT_EXEC | P_RW_U_NA_MSK | INNER_SHAREABLE_MSK) , \
 /* Cache-ability */\
 .mair_idx = MPU_MAIR_INDEX_SRAM,   \
   ```



##
arch/arm64/src/common/arm64_mmu.c:
##
@@ -584,8 +584,6 @@ int arm64_mmu_init(bool is_primary_core)
 {
   uint64_t  val;
   unsigned  flags = 0;

Review Comment:
   ```suggestion
 uint64_t val;
 unsigned flags = 0;
   ```



##
arch/arm64/src/common/arm64_cache.c:
##
@@ -371,6 +415,20 @@ void up_invalidate_icache_all(void)
 
 size_t up_get_dcache_linesize(void)
 {
+  uint64_t  ctr_el0;
+  uint32_t  dminline;

Review Comment:
   ```suggestion
 uint64_t ctr_el0;
 uint32_t dminline;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] xiaoxiang781216 closed pull request #9035: tools/ci: Skip esp32c6 build untils espressif fix the problem

2023-04-18 Thread via GitHub


xiaoxiang781216 closed pull request #9035: tools/ci: Skip esp32c6 build untils 
espressif fix the problem
URL: https://github.com/apache/nuttx/pull/9035


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169757594


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   And I will take a look into `kmm_free` as `DEBUGASSERT((mem == NULL) || 
kmm_heapmember(mem));` seems to be not needed since `mm_free` contains 
`DEBUGASSERT(mm_heapmember(heap, mem));` inside



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169755562


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Sorry to keep spamming, in fact using addrenv_free in elf_addrenv_alloc is 
wrong, it leaks memory if the address environment was partially created (all 
pages allocated will not be freed). 
   
   So removing addrenv_free() and using addrenv_drop() instead is the right 
solution.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169754398


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Yeah... The `DEBUGASSERT((mem == NULL) || kmm_heapmember(mem));` does 
exactly either allow `NULL` or if not NULL the pointer should be a member of 
kernel heap.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169750742


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Anyway `DEBUGASSERT((mem == NULL) || kmm_heapmember(mem));` and not 
`DEBUGASSERT((mem != NULL) && kmm_heapmember(mem));` seems to be odd to me from 
the first look.
   Maybe we can think of unification of operation by
   ```
   #  define kmm_free(p) \
 do \
   { \
 DEBUGASSERT(((p) == NULL) || kmm_heapmember(p)); \
 free(p);\
   } \
 while(0)
   ```



##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Anyway `DEBUGASSERT((mem == NULL) || kmm_heapmember(mem));` and not 
`DEBUGASSERT((mem != NULL) && kmm_heapmember(mem));` seems to be odd to me from 
the first look.
   Maybe we can think of unification of operation by
   ```
   #  define kmm_free(p) \
 do \
   { \
 DEBUGASSERT(((p) == NULL) || kmm_heapmember(p)); \
 free(p); \
   } \
 while(0)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169750742


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Anyway `DEBUGASSERT((mem == NULL) || kmm_heapmember(mem));` and not 
`DEBUGASSERT((mem != NULL) && kmm_heapmember(mem));` seems to be odd to me from 
the first look.
   Maybe we can think of unification of operation by
   ```
   #  define kmm_free(p)do \
  { \
 DEBUGASSERT(((p) == NULL) || kmm_heapmember(p)); \
 free(p);\
  } \
while(0)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169746610


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   I solved this by removing the function entirely, I realized after your 
comment it is not needed anyway :) Need to re-test this still, so something 
unexpected is not done in addrenv_drop.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169746610


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   I solved this by removing the function entirely, I realized after your 
comment it is not needed anyway :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169745218


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Yeah, the separated build will.. because of `DEBUGASSERT((mem == NULL) || 
kmm_heapmember(mem));`, but if `kmm_free` is mapped to `free`, then no issues



##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Yeah, the separated build will... because of `DEBUGASSERT((mem == NULL) || 
kmm_heapmember(mem));`, but if `kmm_free` is mapped to `free`, then no issues



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169742984


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   I'll remove this function entirely, addrenv_drop() can do the same work.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169742593


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Ok. Let's keep it as is. But the system won't crash even if somebody gives a 
NULL pointer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169742462


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.
  *
  * Input Parameters:
  *   tcb - The tcb of the task.
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   None
  *
  /
 
-int addrenv_free(FAR struct tcb_s *tcb)
+void addrenv_free(FAR struct addrenv_s *addrenv)
 {
-  if (tcb->addrenv_own != NULL)
+  if (addrenv)
 {
-  kmm_free(tcb->addrenv_own);
-  tcb->addrenv_own = NULL;

Review Comment:
   Maybe this function can simply be removed, addrenv_drop() can do the same 
work.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169739708


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.
  *
  * Input Parameters:
  *   tcb - The tcb of the task.
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   None
  *
  /
 
-int addrenv_free(FAR struct tcb_s *tcb)
+void addrenv_free(FAR struct addrenv_s *addrenv)
 {
-  if (tcb->addrenv_own != NULL)
+  if (addrenv)
 {
-  kmm_free(tcb->addrenv_own);
-  tcb->addrenv_own = NULL;

Review Comment:
   addrenv_own is not set for any TCB when this is called, so no need to clear 
it.
   
   The addrenv is attached after addrenv_attach() is called, and after that 
addrevn_free() must NOT be called, addrenv_drop() should be used instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169739708


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.
  *
  * Input Parameters:
  *   tcb - The tcb of the task.
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   None
  *
  /
 
-int addrenv_free(FAR struct tcb_s *tcb)
+void addrenv_free(FAR struct addrenv_s *addrenv)
 {
-  if (tcb->addrenv_own != NULL)
+  if (addrenv)
 {
-  kmm_free(tcb->addrenv_own);
-  tcb->addrenv_own = NULL;

Review Comment:
   addrenv_own is not set for any TCB when this is called, so no need to clear 
it.
   
   The addrenv is attached after addrenv_attach() is called, and after that 
addrevn_free() must NOT be called, addrenv_drop() should be used instead 
(addrenv_drop() checks the reference counter).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pussuw commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pussuw commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169738431


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   Here "undonditionally" means "do not check for holders / references". The 
struct addrenv_s has a reference counter that protects it from being freed if 
someone is using it.
   
   This function is intended to handle special cases where no one is for SURE 
not yet using it, e.g. inside elf_addrenv_alloc. This function is called to 
simply free the kmalloc'd memory obtained by addrenv_allocate().
   
   The "if (addrenv)" test is simply a sanity check, so if someone gives a NULL 
pointer here the system won't crash.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9030: sched/addrenv, binfmt: Always allocate address environment from heap

2023-04-18 Thread via GitHub


pkarashchenko commented on code in PR #9030:
URL: https://github.com/apache/nuttx/pull/9030#discussion_r1169727198


##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.

Review Comment:
   ```suggestion
*   Free an address environment.
   ```
   Or remove `if (addrenv)` as those seems to go in conflict.



##
sched/addrenv/addrenv.c:
##
@@ -237,62 +208,48 @@ int addrenv_switch(FAR struct tcb_s *tcb)
  *   Allocate an address environment for a new process.
  *
  * Input Parameters:
- *   tcb   - The tcb of the newly created task.
- *   ttype - The type of the task.
+ *   None
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   Pointer to the new address environment, or NULL if out of memory.
  *
  /
 
-int addrenv_allocate(FAR struct tcb_s *tcb, uint8_t ttype)
+FAR struct addrenv_s *addrenv_allocate(void)
 {
-  int ret = OK;
+  FAR struct addrenv_s *addrenv;
 
-  if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
+  addrenv = (FAR struct addrenv_s *)kmm_zalloc(sizeof(struct addrenv_s));
+  if (addrenv)
 {
-  tcb->addrenv_own = NULL;
-}
-  else
-{
-  tcb->addrenv_own = (FAR struct addrenv_s *)
-kmm_zalloc(sizeof(struct addrenv_s));
-  if (tcb->addrenv_own == NULL)
-{
-  ret = -ENOMEM;
-}
+  /* Take reference so this won't get freed */
+
+  addrenv->refs = 1;
 }
 
-  return ret;
+  return addrenv;
 }
 
 /
  * Name: addrenv_free
  *
  * Description:
- *   Free an address environment for a process.
+ *   Unconditionally free an address environment.
  *
  * Input Parameters:
  *   tcb - The tcb of the task.
  *
  * Returned Value:
- *   This is a NuttX internal function so it follows the convention that
- *   0 (OK) is returned on success and a negated errno is returned on
- *   failure.
+ *   None
  *
  /
 
-int addrenv_free(FAR struct tcb_s *tcb)
+void addrenv_free(FAR struct addrenv_s *addrenv)
 {
-  if (tcb->addrenv_own != NULL)
+  if (addrenv)
 {
-  kmm_free(tcb->addrenv_own);
-  tcb->addrenv_own = NULL;

Review Comment:
   Where `addrenv_own` is cleared now?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



  1   2   >