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. *