Blocking while running a signal handler is not advisable, instead write
the log string character by character.
There is also a potential for a deadlock, as discussed in #6618
Note: querying for rtcb->sigdeliver is not 100% ideal, as it only tells
_if_ a signal handler has been queued, not if it is running. However, it
makes syslog safe / usable which is a debug feature anyhow.
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>
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>
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>
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>
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>
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>
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>
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>
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>