Skip to content

Commit ca26df4

Browse files
bwicaksononvwilldeacon
authored andcommitted
perf: arm_cspmu: nvidia: enable NVLINK-C2C port filtering
Enable NVLINK-C2C port filtering to distinguish traffic from different GPUs connected to NVLINK-C2C. Signed-off-by: Besar Wicaksono <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 5f7cd0d commit ca26df4

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

Documentation/admin-guide/perf/nvidia-pmu.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ Example usage:
8686

8787
perf stat -a -e nvidia_nvlink_c2c0_pmu_3/event=0x0/
8888

89+
The NVLink-C2C has two ports that can be connected to one GPU (occupying both
90+
ports) or to two GPUs (one GPU per port). The user can use "port" bitmap
91+
parameter to select the port(s) to monitor. Each bit represents the port number,
92+
e.g. "port=0x1" corresponds to port 0 and "port=0x3" is for port 0 and 1.
93+
94+
Example for port filtering:
95+
96+
* Count event id 0x0 from the GPU connected with socket 0 on port 0::
97+
98+
perf stat -a -e nvidia_nvlink_c2c0_pmu_0/event=0x0,port=0x1/
99+
100+
* Count event id 0x0 from the GPUs connected with socket 0 on port 0 and port 1::
101+
102+
perf stat -a -e nvidia_nvlink_c2c0_pmu_0/event=0x0,port=0x3/
103+
89104
NVLink-C2C1 PMU
90105
-------------------
91106

@@ -116,6 +131,21 @@ Example usage:
116131

117132
perf stat -a -e nvidia_nvlink_c2c1_pmu_3/event=0x0/
118133

134+
The NVLink-C2C has two ports that can be connected to one GPU (occupying both
135+
ports) or to two GPUs (one GPU per port). The user can use "port" bitmap
136+
parameter to select the port(s) to monitor. Each bit represents the port number,
137+
e.g. "port=0x1" corresponds to port 0 and "port=0x3" is for port 0 and 1.
138+
139+
Example for port filtering:
140+
141+
* Count event id 0x0 from the GPU connected with socket 0 on port 0::
142+
143+
perf stat -a -e nvidia_nvlink_c2c1_pmu_0/event=0x0,port=0x1/
144+
145+
* Count event id 0x0 from the GPUs connected with socket 0 on port 0 and port 1::
146+
147+
perf stat -a -e nvidia_nvlink_c2c1_pmu_0/event=0x0,port=0x3/
148+
119149
CNVLink PMU
120150
---------------
121151

drivers/perf/arm_cspmu/nvidia_cspmu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ static struct attribute *pcie_pmu_format_attrs[] = {
130130

131131
static struct attribute *nvlink_c2c_pmu_format_attrs[] = {
132132
ARM_CSPMU_FORMAT_EVENT_ATTR,
133+
ARM_CSPMU_FORMAT_ATTR(port, "config1:0-1"),
133134
NULL,
134135
};
135136

@@ -210,7 +211,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
210211
{
211212
.prodid = 0x104,
212213
.prodid_mask = NV_PRODID_MASK,
213-
.filter_mask = 0x0,
214+
.filter_mask = NV_NVL_C2C_FILTER_ID_MASK,
214215
.filter_default_val = NV_NVL_C2C_FILTER_ID_MASK,
215216
.name_pattern = "nvidia_nvlink_c2c1_pmu_%u",
216217
.name_fmt = NAME_FMT_SOCKET,
@@ -220,7 +221,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
220221
{
221222
.prodid = 0x105,
222223
.prodid_mask = NV_PRODID_MASK,
223-
.filter_mask = 0x0,
224+
.filter_mask = NV_NVL_C2C_FILTER_ID_MASK,
224225
.filter_default_val = NV_NVL_C2C_FILTER_ID_MASK,
225226
.name_pattern = "nvidia_nvlink_c2c0_pmu_%u",
226227
.name_fmt = NAME_FMT_SOCKET,

0 commit comments

Comments
 (0)