You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refine documentation for building and profiling Linux kernel modules with Arm Streamline, enhancing clarity in setup instructions, package requirements, and profiling steps.
Copy file name to clipboardExpand all lines: content/learning-paths/embedded-and-microcontrollers/streamline-kernel-module/2_build_kernel_image.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ weight: 3
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Prepare your development environment for Buildroot on Arm
9
+
## Prepare to build Linux image with Buildroot
10
10
11
-
Before you build a Linux image with Buildroot, make sure your development environment includes all required packages. These tools and libraries are essential for compiling, configuring, and assembling embedded Linux images on Arm platforms. Installing them now helps you avoid build errors and ensures a smooth workflow.
11
+
Before you build a Linux image with [Buildroot](https://github.com/buildroot/buildroot), make sure your development environment includes all the required packages. These tools and libraries are essential for compiling, configuring, and assembling embedded Linux images on Arm platforms. Installing them now helps you avoid build errors and ensures a smooth workflow.
12
12
13
-
## Install required packages for Buildroot on Arm
13
+
## Install required packages for Buildroot
14
14
15
15
Run the following commands on your aarch64-based Linux system to update your package list and install the necessary dependencies:
16
16
@@ -26,9 +26,9 @@ These packages ensure that Buildroot can configure, compile, and assemble all th
26
26
27
27
## Build a debuggable kernel image
28
28
29
-
For this Learning Path you'll be using [Buildroot](https://github.com/buildroot/buildroot) to build a Linux image for Raspberry Pi 3B+ with a debuggable Linux kernel. You'll profile Linux kernel modules built out-of-tree and Linux device drivers built in the Linux source code tree.
29
+
For this Learning Path you'll build a Linux image for Raspberry Pi 3B+ with a debuggable Linux kernel. You'll profile Linux kernel modules built out-of-tree and Linux device drivers built in the Linux source code tree.
30
30
31
-
Start by cloning the Buildroot Repository and initialize the build system with the default configurations:
31
+
Start by cloning the Buildroot repository and initialize the build system with the default configurations:

47
47
48
-
Change Buildroot configurations to enable debugging symbols and SSH access:
48
+
Change the Buildroot configuration to enable debugging symbols and SSH access:
49
49
50
50
```plaintext
51
51
Build options --->
@@ -72,7 +72,7 @@ You might need to update your default `sshd_config` file to match your network r
72
72
73
73
By default, Linux kernel images are stripped of debugging information. To make the image debuggable for profiling, you need to adjust the kernel build settings.
74
74
75
-
Open the kernel configuration menu with:
75
+
Open the kernel configuration menu using the following:
76
76
77
77
```bash
78
78
make linux-menuconfig
@@ -111,7 +111,7 @@ sdcard.img
111
111
112
112
If you see `sdcard.img` listed, your image is ready to be flashed to your SD card. You can now flash this image to your SD card and boot your Raspberry Pi with a debuggable Linux kernel.
113
113
114
-
For details on flashing the SD card image, see [this helpful article](https://www.ev3dev.org/docs/tutorials/writing-sd-card-image-ubuntu-disk-image-writer/).
114
+
For details on flashing the SD card image, see the article [Writing an SD Card Image Using Ubuntu Disk Image Writer](https://www.ev3dev.org/docs/tutorials/writing-sd-card-image-ubuntu-disk-image-writer/).
Copy file name to clipboardExpand all lines: content/learning-paths/embedded-and-microcontrollers/streamline-kernel-module/3_oot_module.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Build out-of-tree kernel module
2
+
title: Build the out-of-tree kernel module
3
3
weight: 4
4
4
5
5
### FIXED, DO NOT MODIFY
@@ -8,11 +8,11 @@ layout: learningpathall
8
8
9
9
## Create an out-of-tree Linux kernel module
10
10
11
-
You will now create an example Linux kernel module (Character device) that demonstrates a cache miss issue caused by traversing a 2D array in column-major order. This access pattern is not cache-friendly, as it skips over most of the neighboring elements in memory during each iteration.
11
+
You'll now create an example Linux kernel module (character device) that demonstrates a cache miss issue caused by traversing a 2D array in column-major order. This access pattern is not cache-friendly, as it skips over most of the neighboring elements in memory during each iteration.
12
12
13
13
To build the Linux kernel module, start by creating a new directory, for example `example_module`. Inside this directory, add two files: `mychardrv.c` and `Makefile`.
14
14
15
-
**Makefile**
15
+
## Makefile
16
16
17
17
```makefile
18
18
obj-m += mychardrv.o
@@ -29,10 +29,10 @@ clean:
29
29
```
30
30
31
31
{{% notice Note %}}
32
-
Change **BUILDROOT_OUT** to the correct buildroot output directory on your host machine.
32
+
Change `BUILDROOT_OUT` to the correct buildroot output directory on your host machine.
8. In the Capture settings dialog, selectAdd image, add the absolut path of your kernel module file `mychardrv.ko` and click Save.
74
74

@@ -85,21 +85,21 @@ Once the capture is stopped, Streamline automatically analyzes the collected dat
85
85
<!--
86
86
Alt text: Screenshot of the Streamline profiling tool interface showing the process of selecting a data sourcefor counters. The main panel displays a list of available data sources with one highlighted, and a sidebar provides navigation options. The environment is a typical software profiling application window with a neutral, professional tone. Visible text includes Counter selection and labels for different data sources.
2. In the Functions tab, observe that the function`char_dev_cache_traverse()` has the highest L1 Cache refill rate, which is expected.
91
91
Also notice the Image name on the right, which is our module file name `mychardrv.ko`:
92
92
93
-

93
+

94
94
95
95
3. To view the call path of this function, right click on the functionname and choose *Select in Call Paths*.
96
96
97
97
4. You can now see the exact functionthat called `char_dev_cache_traverse()`. In the Locations column, notice that the functioncalls started in the userspace (`echo` command) and terminated in the kernel space module `mychardrv.ko`:
98
-

98
+

99
99
100
100
5. Since you compiled the kernel module with debug info, you will be able to see the exact code lines that are causing these cache misses.
101
101
To do so, double-click on the functionname and the *Code tab* opens. This view shows you how much each code line contributed to the cache misses and in bottom half of the code view, you can also see the disassembly of these lines with the counter values of each assembly instruction:
102
-

102
+

103
103
104
104
{{% notice Note %}}
105
105
You may need to configure path prefix substitution in the Code tab to view the source code correctly. For details on how to set this up and for more information about code analysis, please refer to [Streamline user guide](https://developer.arm.com/documentation/101816/latest/Analyze-your-capture/Analyze-your-code?lang=en)

Copy file name to clipboardExpand all lines: content/learning-paths/embedded-and-microcontrollers/streamline-kernel-module/7_sl_spe.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Using Streamline with Statistical Profiling Extension
2
+
title: Using Streamline with the Statistical Profiling Extension
3
3
weight: 8
4
4
5
5
### FIXED, DO NOT MODIFY
@@ -25,4 +25,7 @@ To view SPE counter values, Select SPE in the data source drop-down in the Call
25
25
26
26
As shown in the image, SPE provides much more data about the profiled code than Event-Based Sampling (EBS), which provides us with deep insights into the CPU performance bottlenecks with very low overhead. It's also possible to view or hide columns from the table in Call paths or Functions views by menu-clicking on the table header and choosing from the list of columns.
27
27
28
-

28
+

29
+
<!--
30
+
Alt text: Streamline application window displaying the Statistical Profiling Extension (SPE) function tab. The main area lists functions with columns for metrics such as sample count, percentage, and address. The user interface highlights the SPE data source in the drop-down menu. The environment is a typical developer desktop with a focus on performance profiling results. The tone is technical and informative.
Copy file name to clipboardExpand all lines: content/learning-paths/embedded-and-microcontrollers/streamline-kernel-module/8_summary.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,6 @@ layout: learningpathall
7
7
---
8
8
## Summary
9
9
10
-
In this learning path, you learned how to build and profile Linux kernel modules step by step. You started with an out-of-tree character driver that had a cache performance issue and then used Arm Streamline to spot where the problem was. Later, you tried the same idea with an in-tree driver and saw how profiling works with the full kernel. Although the example problem was simple, the same methods apply to complex, real-world drivers and scenarios.
10
+
In this Learning Path, you learned how to build and profile Linux kernel modules one step at a time. You started with an out-of-tree character driver that had a cache performance issue. Using Arm Streamline, you found where the problem was. Then, you applied the same profiling approach to an in-tree driver and saw how it works with the full kernel. While the example was simple, you can use these methods for more complex, real-world drivers and situations.
11
11
12
-
The key takeaway is that profiling isn’t just about making code faster—it’s about understanding how your code talks to the hardware. Streamline gives us a clear picture of what’s happening inside the CPU so you can write better, more efficient drivers. By learning to identify bottlenecks, you will be more confident in fixing them and avoiding common mistakes in kernel programming.
12
+
The key takeaway is that profiling isn’t just about making code faster.It’s about understanding how your code talks to the hardware. Streamline provides a clear picture of what’s happening inside the CPU so that you can write better, more efficient drivers. By learning to identify bottlenecks, you'll be more confident in fixing them and avoiding common mistakes in kernel programming.
0 commit comments