Commit Graph

64 Commits

Author SHA1 Message Date
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