When CONFIG_ARCH_INSTRUMENT_ALL is enabled, the note driver functions
get instrumented, which causes infinite recursion because
sched_note_event_ip is called by __cyg_profile_func_enter/exit callbacks.
Use nuttx_add_aux_library to create a separate object library with
-fno-instrument-functions flag to prevent this recursion.
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
Since the functionality of storing notes in snap is already in place,this is simply a registration of a crash print callback.so rename notesnap_register to notesnap_notify_register
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Although g_ramnote_buffer is a global shared buffer, and spinlock already
inside buffer. the upper user may use poll like behavior, should make it
percpu noteram for BMP update, and isolate the open/poll API.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
For BMP case, other core may direct access the ramlog buffer, and did
not do kick, at this case, need a timeout method to polling check if
there is any poll waiter, to update the other core updated log.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
FDX needs to be sent once upon initial device connection. The initial implementation used packet loss statistics, which could lead to two scenarios: first, continuous packet loss occupies the buffer, causing further packet loss; second, no packet loss occurs, resulting in no task name record, and the script cannot parse it.
Meanwhile, the task name in FDX must be sent using blocking, not polling, otherwise it might fail to be sent. Without a callback, the design of the `notefdx_add` function would be more complex.
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
The value used to mark CPU ID in the note data. When SMP or BMP is
disabled, CPU ID is always 0. In order to distinguish between valid CPU
ID and invalid CPU ID in the note data, this option can be used to set a specific value as the CPU ID mark.
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
caused we can't do context swith again while caller
in special position like:
thread_suspend
thread_resume
enter_critical_section
leave_critical_section
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
The sched_note_taskname function is often used to print the system's existing character information at a fixed time. However, in the g_note_taskname cache, it often sets a pid equal to INVALID_PROCESS_ID at the end to manage the blank area of the buffer. This part is not needed when printing and should be skipped.
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
The currently used spin_lock_irqsave does not support recursive calls and does not support automatic acquisition and release of spin locks, so developers need to pay attention to the correct use of spinlocks, such as not being able to schedule in spinlocks.
Two functions:
1. check if switchout when holding spinlock.
2. check if re-lock when holding non-recursion spinlock
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>