From d6ff5ef649ead7cf7caded5c7742efd7ad569a8a Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 27 Jan 2017 08:38:55 -0800 Subject: gpu: nvgpu: Disable trace_printk use by default trace_printk() does an extra stringify operation before calling do_trace_printk(). The string ends up unused. This has an impact to kernel even if we never end up using trace_printk(). Disable use of trace_printk() and introduce a Kconfig option for re-enabling it. Change-Id: I2e1014f5231f2089d7dc3cb2539e3eb5f4d58361 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1295298 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Kconfig.nvgpu | 8 ++++++++ drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 3 ++- drivers/gpu/nvgpu/gk20a/gk20a.c | 2 +- drivers/gpu/nvgpu/gk20a/gk20a.h | 14 ++++++-------- drivers/gpu/nvgpu/gp10b/cde_gp10b.c | 3 +-- 5 files changed, 18 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/Kconfig.nvgpu b/drivers/gpu/nvgpu/Kconfig.nvgpu index 8baf6897..d15a9fd0 100644 --- a/drivers/gpu/nvgpu/Kconfig.nvgpu +++ b/drivers/gpu/nvgpu/Kconfig.nvgpu @@ -111,6 +111,14 @@ config GK20A_PCI help Enable support for GPUs on PCIe bus. +config GK20A_TRACE_PRINTK + bool "Support trace_printk debugging" + depends on CONFIG_FTRACE_PRINTK + default n + help + Enable nvgpu debug facility to redirect debug spew to ftrace. This + affects kernel memory use, so should not be enabled by default. + config GK20A_VIDMEM bool "Support separate video memory on nvgpu" depends on GK20A diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c index 6341a962..7c7d7ae6 100644 --- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c @@ -417,9 +417,10 @@ void gk20a_debug_init(struct device *dev, const char *debugfs_symlink) debugfs_create_bool("disable_syncpoints", S_IRUGO|S_IWUSR, platform->debugfs, &platform->disable_syncpoints); -#if defined(GK20A_DEBUG) debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, platform->debugfs, &gk20a_dbg_mask); + +#ifdef CONFIG_GK20A_TRACE_PRINTK debugfs_create_u32("dbg_ftrace", S_IRUGO|S_IWUSR, platform->debugfs, &gk20a_dbg_ftrace); #endif diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 6b026ee2..583e77b4 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -89,8 +89,8 @@ #define GK20A_NUM_CDEVS 7 -#if defined(GK20A_DEBUG) u32 gk20a_dbg_mask = GK20A_DEFAULT_DBG_MASK; +#ifdef CONFIG_GK20A_TRACE_PRINTK u32 gk20a_dbg_ftrace; #endif diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 69528c1f..b27b36d3 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1108,12 +1108,10 @@ struct gk20a_cyclestate_buffer_elem { #ifdef CONFIG_DEBUG_FS /* debug info, default is compiled-in but effectively disabled (0 mask) */ - #define GK20A_DEBUG /*e.g: echo 1 > /d/gk20a.0/dbg_mask */ #define GK20A_DEFAULT_DBG_MASK 0 #else /* manually enable and turn it on the mask */ - /*#define NVGPU_DEBUG*/ #define GK20A_DEFAULT_DBG_MASK (dbg_info) #endif @@ -1141,8 +1139,8 @@ enum gk20a_dbg_categories { gpu_dbg_mem = BIT(31), /* memory accesses, very verbose */ }; -#if defined(GK20A_DEBUG) extern u32 gk20a_dbg_mask; +#ifdef CONFIG_GK20A_TRACE_PRINTK extern u32 gk20a_dbg_ftrace; #define gk20a_dbg(dbg_mask, format, arg...) \ do { \ @@ -1154,14 +1152,14 @@ do { \ __func__, ##arg); \ } \ } while (0) - -#else /* GK20A_DEBUG */ +#else #define gk20a_dbg(dbg_mask, format, arg...) \ do { \ - if (0) \ - pr_info("gk20a %s: " format "\n", __func__, ##arg);\ + if (unlikely((dbg_mask) & gk20a_dbg_mask)) { \ + pr_info("gk20a %s: " format "\n", \ + __func__, ##arg); \ + } \ } while (0) - #endif #define gk20a_err(d, fmt, arg...) \ diff --git a/drivers/gpu/nvgpu/gp10b/cde_gp10b.c b/drivers/gpu/nvgpu/gp10b/cde_gp10b.c index 4a16abd1..56700211 100644 --- a/drivers/gpu/nvgpu/gp10b/cde_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/cde_gp10b.c @@ -129,14 +129,13 @@ static int gp10b_populate_scatter_buffer(struct gk20a *g, if ((page & 7) != 0) scatter_buffer[page >> 3] = d; -#if defined(GK20A_DEBUG) if (unlikely(gpu_dbg_cde & gk20a_dbg_mask)) { gk20a_dbg(gpu_dbg_cde, "scatterBuffer content:"); for (i=0; i < page>>3; i++) { gk20a_dbg(gpu_dbg_cde, " %x", scatter_buffer[i]); } } -#endif + return 0; } -- cgit v1.2.2