Skip to content

Commit bce61d5

Browse files
bwicaksononvwilldeacon
authored andcommitted
perf: arm_cspmu: nvidia: monitor all ports by default
Some NVIDIA PMUs like the NVLINK-C2C, CNVLINK, and PCIE PMU provide port filtering. If the port filter is set to zero, the counter of these PMUs will not capture any event. To avoid meaningless experiment, the driver sets the port filter value to a default non-zero value. Signed-off-by: Besar Wicaksono <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent ca26df4 commit bce61d5

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ Example usage:
8989
The NVLink-C2C has two ports that can be connected to one GPU (occupying both
9090
ports) or to two GPUs (one GPU per port). The user can use "port" bitmap
9191
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.
92+
e.g. "port=0x1" corresponds to port 0 and "port=0x3" is for port 0 and 1. The
93+
PMU will monitor both ports by default if not specified.
9394

9495
Example for port filtering:
9596

@@ -134,7 +135,8 @@ Example usage:
134135
The NVLink-C2C has two ports that can be connected to one GPU (occupying both
135136
ports) or to two GPUs (one GPU per port). The user can use "port" bitmap
136137
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+
e.g. "port=0x1" corresponds to port 0 and "port=0x3" is for port 0 and 1. The
139+
PMU will monitor both ports by default if not specified.
138140

139141
Example for port filtering:
140142

@@ -160,7 +162,8 @@ see /sys/bus/event_source/devices/nvidia_cnvlink_pmu_<socket-id>.
160162
Each SoC socket can be connected to one or more sockets via CNVLink. The user can
161163
use "rem_socket" bitmap parameter to select the remote socket(s) to monitor.
162164
Each bit represents the socket number, e.g. "rem_socket=0xE" corresponds to
163-
socket 1 to 3.
165+
socket 1 to 3. The PMU will monitor all remote sockets by default if not
166+
specified.
164167
/sys/bus/event_source/devices/nvidia_cnvlink_pmu_<socket-id>/format/rem_socket
165168
shows the valid bits that can be set in the "rem_socket" parameter.
166169

@@ -199,7 +202,8 @@ see /sys/bus/event_source/devices/nvidia_pcie_pmu_<socket-id>.
199202

200203
Each SoC socket can support multiple root ports. The user can use
201204
"root_port" bitmap parameter to select the port(s) to monitor, i.e.
202-
"root_port=0xF" corresponds to root port 0 to 3.
205+
"root_port=0xF" corresponds to root port 0 to 3. The PMU will monitor all root
206+
ports by default if not specified.
203207
/sys/bus/event_source/devices/nvidia_pcie_pmu_<socket-id>/format/root_port
204208
shows the valid bits that can be set in the "root_port" parameter.
205209

drivers/perf/arm_cspmu/nvidia_cspmu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,12 @@ static u32 nv_cspmu_event_filter(const struct perf_event *event)
175175
const struct nv_cspmu_ctx *ctx =
176176
to_nv_cspmu_ctx(to_arm_cspmu(event->pmu));
177177

178-
if (ctx->filter_mask == 0)
178+
const u32 filter_val = event->attr.config1 & ctx->filter_mask;
179+
180+
if (filter_val == 0)
179181
return ctx->filter_default_val;
180182

181-
return event->attr.config1 & ctx->filter_mask;
183+
return filter_val;
182184
}
183185

184186
enum nv_cspmu_name_fmt {

0 commit comments

Comments
 (0)