Commit Graph

120 Commits

Author SHA1 Message Date
raiden00pl 3fb378a54d note_initialize.c: add debug messages 2023-08-02 08:05:37 -07:00
raiden00pl 7f6cb66dc0 note_driver.c: fix warning
CC:  note/note_driver.c note/note_driver.c:180:19: warning: 'g_note_lock' defined but not used [-Wunused-variable]
  180 | static spinlock_t g_note_lock;
      |
2023-08-02 08:05:37 -07:00
xiajizhong 7160849f63 new feature on trace dump support segger-rtt
Signed-off-by: xiajizhong <xiajizhong@xiaomi.com>
2023-07-16 14:37:21 +03:00
chao an f10b54a081 cmake: fix CMake build break
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +08:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Xiang Xiao 20ea607bd0 stream: Rename syslogstream to syslograwstream
to prepare a new stream implementation of syslog

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
Xiang Xiao 51dc67ad5f fs: Add g_ prefix for all global file_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
yinshengkai a297ff61f5 drivers/note: replace sched_note_filter_dump to sched_note_filter_tag
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-04-19 02:53:34 +08:00
wangming9 a7fc26124d arch/arm64: the arm64 perf interface supports pmu
Summary:
- Support arm64 pmu api, Currently only the cycle counter function is supported.
- Using ARM64 PMU hardware capability to implement perf interface, modify all
  perf interface related code.
- Support for pmu init under smp.

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-04-10 16:23:49 -03:00
yinshengkai b3e1004658 sched_note: add function auto-tracing
After enabling this option, you can automatically trace the function instrumentation without adding tracepoint manually.
This is similar to the Function Trace effect of the linux kernel

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-04-10 11:04:24 -03:00
yinshengkai 64e7e43f1f drivers/note: adjust the note_driver_ops definition
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-21 12:13:38 -03:00
yinshengkai 9ecaa022c8 note: fix assignment warning
note/note_driver.c:154:7: warning: unsigned conversion from ‘int’ to ‘unsigned char’ changes value from ‘65535’ to ‘255’ [-Woverflow]
  154 |     , CONFIG_SCHED_INSTRUMENTATION_CPUSET
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-21 12:13:38 -03:00
yinshengkai d73fb5ca21 note: fix sched_note_suspend logic error
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-21 12:13:38 -03:00
yinshengkai 6e35a51feb note: optimize noteram_add, copy as much content as possible at a time
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-02 22:55:50 +08:00
yinshengkai 67461175fe note: support note filtering at runtime
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-01 22:09:41 +08:00
yinshengkai aa6bffef83 drivers/note: dump the latest scheduling information when panic
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-25 18:39:27 +08:00
yinshengkai f9f0ab8dc4 drivers: add note driver backend for recording scheduling information
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-25 18:39:27 +08:00
yinshengkai 9ed1519cea note: handle tcb is empty, so that it can also record before the driver initialization
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-24 14:07:33 +08:00
yinshengkai 29a7d267fb note: correct systime with perf count
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-23 22:30:07 +08:00
yinshengkai 55ce5d0511 note: remove SCHED_INSTRUMENTATION_HIRES
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-23 22:30:07 +08:00
Xiang Xiao a841be9b9c drivers/note: Remove the warning of preemption and critical sections
since both aren't suitable after:
commit 98ab55ef68
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Fri Dec 30 12:02:47 2022 +0800

    drivers/note: Replace the scritical section with spin_xxx_wo_note

    to avoid to generate the unexpected schedule information

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-20 19:27:32 +08:00
chao an ee1e1108a7 drivers/note: fix build break by note rename change
Regression by:

| commit ee24396d77
| Author: Xiang Xiao <xiaoxiang@xiaomi.com>
| Date:   Tue Feb 14 01:11:48 2023 +0800
|
|     drivers/note: Change DRIVER_NOTExxx to DRIVERS_NOTExxx
|
|     follow other driver config style
|
|     Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-20 16:19:57 +08:00
Xiang Xiao ee24396d77 drivers/note: Change DRIVER_NOTExxx to DRIVERS_NOTExxx
follow other driver config style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-20 14:30:59 +08:00
Xiang Xiao eafc80c055 drivers/note: Remove the dependence of noteram driver
since after the below commit, noteram driver can work even when
the instrumentation of csection, spinlock and smp is enabled

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-20 14:30:59 +08:00
Xiang Xiao 6b14ad9337 driver/note: Restore SCHED_INSTRUMENTATION config to sched/Konfig
since the chip/board vendor could disable dirvers/note and
provide the implementation of sched_note_xxx by self

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-20 14:30:59 +08:00
pengyiqiang b1773934fe note_driver: fix build error
note/note_driver.c: In function 'note_isenabled':
note/note_driver.c:278:7: error: invalid type argument of unary '*' (have 'int')
  278 |   if (CPU_ISSET(&g_note_filter.mode.cpuset, this_cpu()) == 0)
      |       ^~~~~~~~~
note/note_driver.c:278:7: error: invalid operands to binary << (have 'int' and 'volatile cpu_set_t *' {aka 'volatile unsigned char *'})
  278 |   if (CPU_ISSET(&g_note_filter.mode.cpuset, this_cpu()) == 0)
      |       ^~~~~~~~~
      |                 |
      |                 volatile cpu_set_t * {aka volatile unsigned char *}

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2023-02-01 14:30:33 +08:00
yinshengkai 6064aa8bb5 drivers/note: remove choice in Kconfig
To support multiple note drivers to be used at the same time

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-06 16:23:00 +08:00
yinshengkai 8f823ce320 sergger: add note_ prefix to sysview
change 1: rename sysview.c to note_sysview.c
change 2: add note_ prefix to sysview's public function

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-05 22:04:52 +08:00
yinshengkai 77466742c7 drivers/segger: register sysview to note drivers list
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-05 22:04:52 +08:00
Xiang Xiao 779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Xiang Xiao 1815f8b731 drivers/note: Add const to g_notelog_ops
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:21:18 +02:00
Xiang Xiao 98ab55ef68 drivers/note: Replace the scritical section with spin_xxx_wo_note
to avoid to generate the unexpected schedule information

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:21:18 +02:00
yinshengkai 1cee890aa7 drivers/note: unify the spinlock operation in noteram
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-02 22:29:01 +08:00
Xiang Xiao cc9166274a drivers/note: Fix the mismatch of va_end call
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-31 14:57:47 +02:00
yinshengkai f85102d81b drivers/note: adjust note kconfig order
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-30 15:50:30 -03:00
yinshengkai ca5fcc58c2 sched: move SCHED_INSTRUMENTATION_xxx to note Kconfig
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-30 15:50:30 -03:00
yinshengkai 64b6df42a4 drivers/note: register notelog device
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-30 22:21:12 +08:00
yinshengkai 376e30193b drivers/note: remove sched_note_syscall_xxx in notelog
syslog is a system call, which will cause recursion after turning on SCHED_INSTRUMENTATION_SYSCALL

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-30 22:21:12 +08:00
yinshengkai bc7c520eca drivers/note: add note_syscall_enter parameter list
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-29 09:25:54 -03:00
yinshengkai dd32eccfc3 drivers/note: Move taskname related functions to note_driver.c
so all note drivers can retrieve the task name even after the task exit

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-26 15:03:57 +08:00
yinshengkai 6f66c0ea0b drivers/note: sched_note support mulit-channel
call callbacks for different channels in sched_note_*
noteram channel is enabled by default

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-17 19:41:21 +08:00
Xiang Xiao 06842c824a sched/note: Change sched_note_[begin|end] to macro
improve the speed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-16 12:20:53 +02:00
yinshengkai 552cf4b549 merge sched_note_spinxx into sched_note_spincommon
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-16 17:03:53 +08:00
yinshengkai 2460ff4f78 drivers/note: rename /dev/note to /dev/note/ram
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-15 15:53:49 +08:00
Xiang Xiao 03f07effc9 drivers/note: Fix the style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-14 21:24:13 +02:00
Xiang Xiao c36640e205 drivers/segger: Rename nuttx/note/note_sysview.h to nuttx/segger/sysview.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-14 21:24:13 +02:00
Xiang Xiao 126c93015f drivers/node: Rename sched_note.c to to note_driver.c
prepare to support the multiple note driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-14 21:24:13 +02:00
Xiang Xiao d7307ef26c drivers/node: Rename note_register to note_initialize
prepare to support the multiple note driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-14 21:24:13 +02:00
yinshengkai 026c8eede0 drivers/note: unify spinlock related functions
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-10 02:30:24 +08:00
yinshengkai 09814831b8 sched: move sched_note.c to drivers/note
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-09 23:36:11 +08:00
Huang Qi e4e3208180 Replace all strncpy with strlcpy for safety
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-25 13:38:36 +08:00
Petro Karashchenko 98ba65c422 c89: get rid of designated initializers in common code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-28 13:39:27 +08:00
Huang Qi 7d58e6263f drivers/note: Add macro guard for instrumention switch
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-14 10:52:48 +08:00
chao.an e04ccba78a note/sysview: add Segger System View support
Reference:
https://www.segger.com/products/development-tools/systemview
https://github.com/SEGGERMicro/SystemView
https://github.com/SEGGERMicro/RTT

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-29 17:26:04 +08:00
Petro Karashchenko a743fed63d file_operations: get back C89 compatible initializer
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-11 02:14:00 +08:00
zhanghu6 84019b9170 noteram: when the buffer overflow happen and give the asan report
READ of size 1 at 0x5ec78f90 thread T0
0 0x59682d7a in noteram_remove note/noteram_driver.c:432
1 0x59683c43 in sched_note_add note/noteram_driver.c:854
0x5ec78f90 is located 0 bytes to the right of global variable 'g_noteram_info' defined in 'note/noteram_driver.c:95:30' (0x5ec78780) of size 2064
0x5ec78f90 is located 48 bytes to the left of global variable '*.Lubsan_type0' defined in 'note/noteram_driver.c' (0x5ec78fc0) of size 10
reason: that read pos is tail of g_noteram_info.ni_buffer causes overflow
2021-12-10 12:33:14 -06:00
Abdelatif Guettouche 9b1d4de3be drivers/note: Fix typos.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-11-12 16:50:41 -03:00
Xiang Xiao 8fe701c8ae note/notelog: Implement more sched_note callback
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 18:52:32 -03:00
Xiang Xiao 0941bad877 note: Move up_schednote.c to drivers/note folder
since it is general enough to work on other target

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 18:52:32 -03:00
Xiang Xiao 5f3a98b5a8 libc/assert: Reference the expression in all case
to avoid the warning "defined but not used"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55b7c092d0f2e5882fc1784987657c10cdf2d90b
2021-04-03 21:00:41 +01:00
Alin Jerpelea e5b6305f4a drivers: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Nakamura, Yuuichi 7905ee17d4 Add task name recording for note RAM driver 2020-11-02 01:12:08 -08:00
Masayuki Ishikawa 822497d021 drivers: note: Fix compile errors in noteram_driver.c
Summary:
- This commit fixes compile errors if CONFIG_DEBUG_ASSERTIONS=y

Impact:
- Affects noteram_driver only

Testing:
- Tested with spresense:wifi_smp with CONFIG_DEBUG_ASSERTIONS=y

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-06 16:42:40 +08:00
Nakamura, Yuuichi 89ea234af8 Add on-boot instrumentation support for note filter 2020-10-06 03:26:46 +08:00
Nakamura, Yuuichi a373079a94 Fix /dev/note driver for task trace support 2020-10-06 03:26:46 +08:00
Nakamura, Yuuichi 6efecd2105 Add notectl driver 2020-10-06 03:26:46 +08:00
Xiang Xiao 77ae03788a note: Rename note driver to noteram driver
to reflect this is just a normal note driver with ram buffer

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-15 14:55:22 +08:00
Xiang Xiao 0c3930ba11 sched: Rename note_add to sched_note_add
to better match other sched_note_* function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-12 08:42:30 -07:00
Xiang Xiao 952af92690 sched/note: Move the circle buffer code to driver
so the format code can be shared by different transport

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-07 11:54:10 +08:00
Xiang Xiao f99719e260 Move note driver from drivers/syslog to drivers/note
it's better to put the note transport layer into a common folder

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-07 11:54:10 +08:00