From 0f5818b89ebf444cb9562b32e809def5c55bc195 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 20 Jul 2020 17:11:05 -0500 Subject: [PATCH] gpu: nvgpu: Condition debug dump on recovery profiling If recovery sequence profiling is enabled skip the debug dump that happens during an MMU fault. This prevents the debug dump from dominating the time spent by the recovery sequence. The debug dump is severly limited in speed by the (lack of) UART bandwidth. JIRA NVGPU-5606 Change-Id: Ifc7c326d33d9115d58b13c0fa42ec4bb7acb3075 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2382591 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/common/swdebug/profile.c | 14 ++++++++++++++ drivers/gpu/nvgpu/hal/rc/rc_gv11b.c | 4 +++- drivers/gpu/nvgpu/include/nvgpu/swprofile.h | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/swdebug/profile.c b/drivers/gpu/nvgpu/common/swdebug/profile.c index a00ab6d44..53c632214 100644 --- a/drivers/gpu/nvgpu/common/swdebug/profile.c +++ b/drivers/gpu/nvgpu/common/swdebug/profile.c @@ -44,6 +44,20 @@ static inline u32 matrix_to_linear_index(struct nvgpu_swprofiler *p, return (row * p->psample_len) + col; } +/* + * Just check the samples field; it'll be allocated for an enabled profiler. + * This is an intrisically racy call; don't rely on it to determine whether the + * underlying pointers/fields really are initialized or not. + * + * However, since this doesn't take the profiler lock, if you use it under the + * profiler lock, you can be sure the state won't change while you hold the + * lock. + */ +bool nvgpu_swprofile_is_enabled(struct nvgpu_swprofiler *p) +{ + return p->samples != NULL; +} + void nvgpu_swprofile_initialize(struct gk20a *g, struct nvgpu_swprofiler *p, const char *col_names[]) diff --git a/drivers/gpu/nvgpu/hal/rc/rc_gv11b.c b/drivers/gpu/nvgpu/hal/rc/rc_gv11b.c index c8133bbd4..49a99970c 100644 --- a/drivers/gpu/nvgpu/hal/rc/rc_gv11b.c +++ b/drivers/gpu/nvgpu/hal/rc/rc_gv11b.c @@ -232,7 +232,9 @@ void gv11b_fifo_recover(struct gk20a *g, u32 act_eng_bitmask, #endif if (rc_type == RC_TYPE_MMU_FAULT) { - gk20a_debug_dump(g); + if (!nvgpu_swprofile_is_enabled(prof)) { + gk20a_debug_dump(g); + } #ifdef CONFIG_NVGPU_DEBUGGER client_type = mmufault->client_type; #endif diff --git a/drivers/gpu/nvgpu/include/nvgpu/swprofile.h b/drivers/gpu/nvgpu/include/nvgpu/swprofile.h index 5ec496e18..e726e2cab 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/swprofile.h +++ b/drivers/gpu/nvgpu/include/nvgpu/swprofile.h @@ -129,6 +129,24 @@ int nvgpu_swprofile_open(struct gk20a *g, struct nvgpu_swprofiler *p); */ void nvgpu_swprofile_close(struct nvgpu_swprofiler *p); +/** + * @brief Check if a profiler is enabled. + * + * @param[in] p The profiler to check. + * + * Returns true if the profiler is currently enabled. Do not rely on this + * to ensure that the underlying data and fields remain initialized. This does + * not take the profiler's lock. + * + * However, you can rely on the profiler's state not changing if you take the + * profiler's lock before calling this. In that scenario the profiler's state + * (but not necessarily the actual data) will be unchanged until you release + * the lock. + * + * @return %true if the profiler is enabled; %false otherwise. + */ +bool nvgpu_swprofile_is_enabled(struct nvgpu_swprofiler *p); + /** * @brief Begin a series of timestamp samples. *