Hello All,
I am testing an kernel module which creates perf events on every core and count the total number of L2D_CACHE_REFILL.
System details are : NVIDIA Jetson nano,
OS: Ubuntu 18.04.6 LTS,
Kernel: 4.9.255, L4T: 32.7.3,
Jetpack: 4.6.3
insmod
is inserting module in kernel space. But throws WARNING
message in kernel log file. The screenshot of dmesg
command is :
This warning states that at line no. 199, the function armpmu_start()
is throwing an warning.
I tried checking the kernel source code. The kernel code snippet for armpmu_start
function from drivers/perf/arm_pmu
file is as below:
Also when I try to remove the module with rmmod
command my jetson nano board is restarting.
Here are the few perf APIs the kernel module is using:
- Creating attributes structure of the perf event
struct perf_event_attr sched_perf_hw_attr = { .type = PERF_TYPE_RAW, .config = 0x17, .size = sizeof (struct perf_event_attr), .pinned = 1, .disabled = 1, .exclude_kernel = 1, .sample_period = budget };
- Creating perf event with
event_overflow_callback
function
event = perf_event_create_kernel_counter (&sched_perf_hw_attr,
cpu,
NULL,
event_overflow_callback,
NULL
);
- Code to start the counter
perf_event_enable (event); event->pmu->add (event, PERF_EF_START);
- Code to stop the counter
event->pmu->stop (event, PERF_EF_UPDATE);
event->pmu->del(event,0);
- In the
event_overflow_callback
function following activities are performed.
Stopping counter
event->pmu->stop (event, PERF_EF_UPDATE);
Enable performance counter
event->pmu->start (event, PERF_EF_RELOAD);
The same kernel module is working fine on Jetson Nvidia Xavier NX without any warning messages.
Any help in diagnosing the issue is highly appreciated.
Also kindly suggest a methods of debugging Linux kernel modules on embedded devices like Nvidia jetson boards. That will help me in gaining more knowledge.
Thank in advance.