Commit Graph

357 Commits

Author SHA1 Message Date
Bowen Wang 71fe4acef4 MacOs: fix the sim compile warning in MacOS
CC:  clk/clk_fixed_rate.c clk/clk_divider.c:177:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
             ^
clk/clk_divider.c:177:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
             ^~~
clk/clk_divider.c:177:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
                               ^
clk/clk_divider.c:177:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
                               ^~~
CC:  mm_heap/mm_initialize.c 2 warnings generated.
clk/clk.c:1324:11: warning: variable 'irqflags' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      if (clk->parents == NULL)
          ^~~~~~~~~~~~~~~~~~~~
clk/clk.c:1341:19: note: uninitialized use occurs here
  clk_list_unlock(irqflags);
                  ^~~~~~~~
clk/clk.c:1324:7: note: remove the 'if' if its condition is always false
      if (clk->parents == NULL)
      ^~~~~~~~~~~~~~~~~~~~~~~~~
clk/clk.c:1255:22: note: initialize the variable 'irqflags' to silence this warning
  irqstate_t irqflags;
                     ^
                      = 0
CC:  clk/clk_mux.c clk/clk_multiplier.c:110:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
             ^
clk/clk_multiplier.c:110:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
             ^~~
clk/clk_multiplier.c:110:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
                               ^
clk/clk_multiplier.c:110:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
                               ^~~
clk/clk_mux.c:47:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
             ^
clk/clk_mux.c:47:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
             ^~~
clk/clk_mux.c:47:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
                               ^
clk/clk_mux.c:47:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
                               ^~~
AS:  sim/sim_fork_x86.S 2 warnings generated.
1 warning2 warnings generated.
 generated.
iperf.c:325:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'unsigned long' [-Wformat]
             now_len -last_len,
             ^~~~~~~~~~~~~~~~~
iperf.c:340:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
             now_len,
             ^~~~~~~
CC:  misc/rpmsgblk_server.c 2 warnings generated.
:28: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                           (uintmax_t)skip);
                           ^~~~~~~~~~~~~~~
nsh_dbgcmds.c:473:20: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                   (uintmax_t)position);
                   ^~~~~~~~~~~~~~~~~~~
CC:  nsh_main.c 2 warnings generated.

              return INTMAX_MIN;
              ~~~~~~ ^~~~~~~~~~
CC:  nsh_system.c  note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:103:37: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from -9223372036854775808 to 0 [-Wconstant-conversion]
          return (accum == limit) ? INTMAX_MIN : -(intmax_t)accum;
          ~~~~~~                    ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:136:29: note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:106:17: warning: result of comparison of constant 9223372036854775807 with expression of type 'uintmax_t' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare]
      if (accum > INTMAX_MAX)
          ~~~~~ ^ ~~~~~~~~~~
inttypes/lib_strtoimax.c:109:18: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
          return INTMAX_MAX;
          ~~~~~~ ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:137:29: note: expanded from macro 'INTMAX_MAX'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:66:29: note: expanded from macro 'INT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:35:23: note: expanded from macro 'INT64_C'
                      ^~~~~~~
<scratch space>:12:1: note: expanded from here
9223372036854775807ll
^~~~~~~~~~~~~~~~~~~~~
syslog/vsyslog.c:212:32: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                             , (uintmax_t)ts.tv_sec
                               ^~~~~~~~~~~~~~~~~~~~
CC:  iob/iob_free.c 4 warnings generated.
1 warning generated.
CC:  mqueue/mq_msgqalloc.c inttypes/lib_strtoumax.c:91:23: warning: implicit conversion from 'unsigned long long' to 'uintmax_t' (aka 'unsigned long') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
              accum = UINTMAX_MAX;
                    ~ ^~~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:140:29: note: expanded from macro 'UINTMAX_MAX'
                            ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:67:29: note: expanded from macro 'UINT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:36:23: note: expanded from macro 'UINT64_C'
                      ^~~~~~~~
<scratch space>:8:1: note: expanded from here
18446744073709551615ull
^~~~~~~~~~~~~~~~~~~~~~~
CC:  icmp/icmp_ioctl.c 1 warning generated.
time/lib_strftime.c:584:52: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
               len = snprintf(dest, chleft, "%ju", (uintmax_t)mktime(&tmp));
                                             ~~~   ^~~~~~~~~~~~~~~~~~~~~~~
                                             %ju

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-22 08:55:57 +08:00
yangsong8 e00fbc5557 syslog: enable LF to CRLF config as default
This commit fixes the issue #14418

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-21 10:50:36 +02:00
Xiang Xiao 8c882cb790 ramlog: Remove RAMLOG_CRLF config and related code
since the conversion is moved to common layer after:
https://github.com/apache/nuttx/pull/14362

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-21 16:27:35 +08:00
wanggang26 adc52bf968 syslog: fix ramlog not work issue with cmake
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-19 12:37:07 +02:00
yangsong8 8c13b8df1d syslog: convert \n to \r\n in syslog framework layer
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-17 02:29:51 +08:00
yinshengkai 211a56910a syslog: support syslog redirection to sched_note
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 01:30:11 +08:00
ligd e608d5522d syslogmask: add default value Kconfig to syslogmask
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-11 01:30:11 +08:00
yintao 37a30023f5 nuttx/drivers: add ept_release_cb for destroy server resource
use ept_release_cb to destory rpmsg services server dile resource
to avoid the used-after-free issue

Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-10 08:44:29 +08:00
hujun5 e249dd2672 arch: support customized up_cpu_index() in AMP mode
Some app with same code runs on different cores in AMP mode,
need the physical core on which the function is called.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-10-10 02:38:40 +08:00
Bowen Wang 064eb5fd35 rpmsg services: should release the tx buffer when rpmsg_send_nocopy failed
Otherwise, the tx buffer will be discarded and can no longer be obtained

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 18:26:39 +08:00
yuanyongjian 6869a05368 syslog/syslog_rpmsg.c: the last log may be lost when it crashes
At line 236, we may set the null terminate to the priv->buffer,
when flushing the priv->buffer, we should use up_putc() instead up_nputs()
to ensure all the data has been output, because up_nputs() will check
the null terminate but up_putc() not.

Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
yuanyongjian 9e1750d22c syslog/syslog_rpmsg.c: out of memory
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
ligd 7567e429b6 syslog_rpmsg: fix coding style
Follow the nxstyle

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 12:18:10 +08:00
yuanyongjian 8713638687 syslog/syslog_rpmsg.c: improve syslog_rpmsg performance
use copy buffer instead of single assignment

Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
Xiang Xiao 7c839d7a09 rptun: Remove include/nuttx/rptun/openamp.h
and use include/nuttx/rpmsg/rpmsg.h instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-07 00:44:28 +08:00
xuxingliang 7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
dulibo1 b29d103ad3 ramlog:flush should reset the tail of the reader
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
chao an a04e44ea75 syslog/channel: move syslog channel map into rodata
add SYSLOG_REGISTER to support disable syslog channel register

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 16:10:29 +08:00
chao an 9abe737ef3 syslog/channel: add constant attribute if SYSLOG_IOCTL is not enabled
move all private channel define from data to rodata

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 16:10:29 +08:00
chao an a5251161c6 syslog/channel: rename syslog_channel() to syslog_channel_register()
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 19:28:49 +08:00
chao an db5320fd9f drivers/syslog: compile syslog_device.c if console/char/file channel enabled
Add conditional compilation to syslog_device.c

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-23 14:36:40 +08:00
ligd 981bda5cf0 ramlog: workaround the unsafe critical section
thread1:                           thread2:
ramlog_addbuf()
    enter_critical_section()
    ramlog_pollnotify()
       foreach rl_list
             --> switch out
                                   ramlog_file_close
                                   enter_critical_section()
                                   list_delete()
                                   leave_critical_section()
             <--- switch back
       rl_list error
    leave_critical_section()

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 13:13:39 +08:00
ligd 78d93eb628 ramlog: unify the lock to critical section
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 13:13:39 +08:00
chao an 85c39e96d6 global/variables: add g_ prefix to some global variables
Signed-off-by: chao an <anchao@lixiang.com>
2024-09-02 18:23:57 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
yintao 279a676978 syslog_rpmsg: Ensure the syslog ept is ready when rpmsg_send
Signed-off-by: yintao <yintao@xiaomi.com>
2024-08-23 01:43:09 +08:00
hujun5 e4d0f404f1 driver: There is no need to use sched_[un]lock
purpose:
1 sched_lock is very time-consuming, and reducing its invocations can improve performance.
2 sched_lock is prone to misuse, and narrowing its scope of use is to prevent people from referencing incorrect code and using it

test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx

We have also tested this patch on other ARM hardware platforms.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-04-30 11:35:13 -03:00
hujun5 72548951d3 drivers: syslog: Replace sched_lock with critical section in syslog_flush_intbuffer()
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-04-21 11:40:01 +02:00
ligd 661d382322 syslog_rpmsg: handle syslog_rpmsg_transfer() return value
in case of only update head

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 02:14:28 +08:00
Bowen Wang 169f47beec rpmsg: make all the rpmsg services deponds on RPMSG
After decoupled the rpmsg and rptun, all the rpmsg service should
depends on the RPMSG.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 04:09:34 -08:00
wangyongrong 7508a10e20 rptun: Strip rpmsg and rptun
nuttx/driver/rpmsg: new folder, extract common rpmsg api in rptun.c to rpmsg.c.
rpmsg provide rpmsg_ops to each backend for specific implementation.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-16 15:58:32 +01:00
chao an b67c9e6ca7 syslog/ramlog: improve ramlog performance
replace char copy to memcpy to improve the performance

Signed-off-by: chao an <anchao@lixiang.com>
2023-12-18 20:38:00 -08:00
yuanyongjian 9483729328 syslog/ramlog.c:Syslog add BIOC_FLUSH supports clearing log cache
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2023-12-14 20:50:44 -08:00
Xiang Xiao a0813b808f syslog/ramlog: Replace mutex with spinlock
and optimize the critical section usage
1.Remove the unnecessary critical section in ramlog_readnotify
2.Move the enter/leave critical section out of ramlog_pollnotify loop
3.Move the critical section of ramlog_addchar to caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-14 20:50:44 -08:00
yuanyongjian 046dd38c55 syslog/ramlog: Syslog supports multi-readers.
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2023-12-14 20:50:44 -08:00
yuanyongjian 0da8755fbc syslog/ramlog:Add tags to distinguish between hot start and cold start
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2023-12-14 20:50:44 -08:00
Xiang Xiao e920883458 syslog/ramlog: Prepare to support the multiple reader
1.Remove RAMLOG_OVERWRITE option and related code
2.Broadcast the readability to all reader and poller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-14 20:50:44 -08:00
Xiang Xiao eddd90de78 poll: pollsetup should notify only one fd passd by caller
since it's redundant to iterate the whole fds array in setup

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-21 09:07:17 +01:00
raiden00pl 5b87fdfb9d Documentation: remove all migrated READMEs 2023-10-29 21:03:54 -03:00
raiden00pl b565e28da3 Kconfigs: rename {Rpmsg|rpmsg} to RPMGS 2023-10-28 13:58:56 +08:00
chao an 2b06142232 kernel: replace all sem_* to nxsem_*: in kernel space
syscall cannot be called from kernel space

Signed-off-by: chao an <anchao@xiaomi.com>
2023-10-25 15:46:03 +08:00
hujun5 4967de8621 ramlog: remove sched_[un]lock and rl_nwaiters
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-12 10:14:59 +08:00
wanggang26 e930476b4b enable O_CLOEXEC explicit
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-22 13:51:00 +08:00
Daniel Appiagyei 5bfda12634 c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
dongjiuzhu1 bfb0095ec7 driver/syslog: reset syslog buffer when syslog buffer include invalid data
When the machine is cold started, the psram area where the syslog
buffer is located contains some random values, so it will cause
loss of valid log.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-07 11:42:24 +03:00
chao an 664927c86e mm/alloc: remove all unnecessary cast for alloc
Fix the minor style issue and remove unnecessary cast

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-30 14:34:20 +08:00
chao an b60f01a55b inode/i_private: remove all unnecessary cast for i_private
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 08:58:07 +02:00
chao an 7aa45305b7 fs/inode: remove all unnecessary check for filep/inode
Since VFS layer already contains sanity checks, so remove unnecessary lower half checks

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 09:47:11 +08:00
ligd b743d62703 syslog: remove unsed check
To simplify the code

Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-25 17:31:31 +08:00
Jiuzhu Dong 904ca21a00 syslog & ramlog: add BOARDIOC_RESET_CAUSE for syslog & ramlog
cold boot should clear syslog & ramlog buffer

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-25 17:31:31 +08:00