diff --git a/drivers/gpu/nvgpu/common/posix/nvgpu.c b/drivers/gpu/nvgpu/common/posix/nvgpu.c index 6f2a5fe9c..a275f2de2 100644 --- a/drivers/gpu/nvgpu/common/posix/nvgpu.c +++ b/drivers/gpu/nvgpu/common/posix/nvgpu.c @@ -67,6 +67,13 @@ int nvgpu_current_tid(struct gk20a *g) return (int)pthread_self(); } +void __nvgpu_print_current(struct gk20a *g, const char *func_name, int line, + void *ctx, enum nvgpu_log_type type) +{ + __nvgpu_log_msg(g, func_name, line, type, + "Current process: (nvgpu userspace)"); +} + /* * Somewhat meaningless in userspace... */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/os_sched.h b/drivers/gpu/nvgpu/include/nvgpu/os_sched.h index 97dc9a570..d1e44b061 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/os_sched.h +++ b/drivers/gpu/nvgpu/include/nvgpu/os_sched.h @@ -23,6 +23,8 @@ #ifndef __NVGPU_OS_SCHED_H__ #define __NVGPU_OS_SCHED_H__ +#include + struct gk20a; /** @@ -37,4 +39,13 @@ int nvgpu_current_tid(struct gk20a *g); */ int nvgpu_current_pid(struct gk20a *g); +void __nvgpu_print_current(struct gk20a *g, const char *func_name, int line, + void *ctx, enum nvgpu_log_type type); +/** + * nvgpu_print_current - print the name of current calling process + * + */ +#define nvgpu_print_current(g, ctx, type) \ + __nvgpu_print_current(g, __func__, __LINE__, ctx, type) + #endif /* __NVGPU_OS_SCHED_H__ */ diff --git a/drivers/gpu/nvgpu/os/linux/channel.c b/drivers/gpu/nvgpu/os/linux/channel.c index e09939e9e..cc2d525d6 100644 --- a/drivers/gpu/nvgpu/os/linux/channel.c +++ b/drivers/gpu/nvgpu/os/linux/channel.c @@ -890,8 +890,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, err = gk20a_busy(g); if (err) { nvgpu_err(g, - "failed to host gk20a to submit gpfifo, process %s", - current->comm); + "failed to host gk20a to submit gpfifo"); + nvgpu_print_current(g, NULL, NVGPU_ERROR); return err; } } diff --git a/drivers/gpu/nvgpu/os/linux/os_sched.c b/drivers/gpu/nvgpu/os/linux/os_sched.c index 586b35ebe..9a25da18f 100644 --- a/drivers/gpu/nvgpu/os/linux/os_sched.c +++ b/drivers/gpu/nvgpu/os/linux/os_sched.c @@ -24,3 +24,9 @@ int nvgpu_current_pid(struct gk20a *g) { return current->tgid; } + +void __nvgpu_print_current(struct gk20a *g, const char *func_name, int line, + void *ctx, enum nvgpu_log_type type) +{ + __nvgpu_log_msg(g, func_name, line, type, current->comm); +}