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 <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1295298
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Terje Bergstrom
2017-01-27 08:38:55 -08:00
committed by mobile promotions
parent 707ea45e0f
commit d6ff5ef649
5 changed files with 18 additions and 12 deletions

View File

@@ -111,6 +111,14 @@ config GK20A_PCI
help help
Enable support for GPUs on PCIe bus. 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 config GK20A_VIDMEM
bool "Support separate video memory on nvgpu" bool "Support separate video memory on nvgpu"
depends on GK20A depends on GK20A

View File

@@ -417,9 +417,10 @@ void gk20a_debug_init(struct device *dev, const char *debugfs_symlink)
debugfs_create_bool("disable_syncpoints", S_IRUGO|S_IWUSR, debugfs_create_bool("disable_syncpoints", S_IRUGO|S_IWUSR,
platform->debugfs, &platform->disable_syncpoints); platform->debugfs, &platform->disable_syncpoints);
#if defined(GK20A_DEBUG)
debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR,
platform->debugfs, &gk20a_dbg_mask); platform->debugfs, &gk20a_dbg_mask);
#ifdef CONFIG_GK20A_TRACE_PRINTK
debugfs_create_u32("dbg_ftrace", S_IRUGO|S_IWUSR, debugfs_create_u32("dbg_ftrace", S_IRUGO|S_IWUSR,
platform->debugfs, &gk20a_dbg_ftrace); platform->debugfs, &gk20a_dbg_ftrace);
#endif #endif

View File

@@ -89,8 +89,8 @@
#define GK20A_NUM_CDEVS 7 #define GK20A_NUM_CDEVS 7
#if defined(GK20A_DEBUG)
u32 gk20a_dbg_mask = GK20A_DEFAULT_DBG_MASK; u32 gk20a_dbg_mask = GK20A_DEFAULT_DBG_MASK;
#ifdef CONFIG_GK20A_TRACE_PRINTK
u32 gk20a_dbg_ftrace; u32 gk20a_dbg_ftrace;
#endif #endif

View File

@@ -1108,12 +1108,10 @@ struct gk20a_cyclestate_buffer_elem {
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
/* debug info, default is compiled-in but effectively disabled (0 mask) */ /* debug info, default is compiled-in but effectively disabled (0 mask) */
#define GK20A_DEBUG
/*e.g: echo 1 > /d/gk20a.0/dbg_mask */ /*e.g: echo 1 > /d/gk20a.0/dbg_mask */
#define GK20A_DEFAULT_DBG_MASK 0 #define GK20A_DEFAULT_DBG_MASK 0
#else #else
/* manually enable and turn it on the mask */ /* manually enable and turn it on the mask */
/*#define NVGPU_DEBUG*/
#define GK20A_DEFAULT_DBG_MASK (dbg_info) #define GK20A_DEFAULT_DBG_MASK (dbg_info)
#endif #endif
@@ -1141,8 +1139,8 @@ enum gk20a_dbg_categories {
gpu_dbg_mem = BIT(31), /* memory accesses, very verbose */ gpu_dbg_mem = BIT(31), /* memory accesses, very verbose */
}; };
#if defined(GK20A_DEBUG)
extern u32 gk20a_dbg_mask; extern u32 gk20a_dbg_mask;
#ifdef CONFIG_GK20A_TRACE_PRINTK
extern u32 gk20a_dbg_ftrace; extern u32 gk20a_dbg_ftrace;
#define gk20a_dbg(dbg_mask, format, arg...) \ #define gk20a_dbg(dbg_mask, format, arg...) \
do { \ do { \
@@ -1154,14 +1152,14 @@ do { \
__func__, ##arg); \ __func__, ##arg); \
} \ } \
} while (0) } while (0)
#else
#else /* GK20A_DEBUG */
#define gk20a_dbg(dbg_mask, format, arg...) \ #define gk20a_dbg(dbg_mask, format, arg...) \
do { \ do { \
if (0) \ if (unlikely((dbg_mask) & gk20a_dbg_mask)) { \
pr_info("gk20a %s: " format "\n", __func__, ##arg);\ pr_info("gk20a %s: " format "\n", \
__func__, ##arg); \
} \
} while (0) } while (0)
#endif #endif
#define gk20a_err(d, fmt, arg...) \ #define gk20a_err(d, fmt, arg...) \

View File

@@ -129,14 +129,13 @@ static int gp10b_populate_scatter_buffer(struct gk20a *g,
if ((page & 7) != 0) if ((page & 7) != 0)
scatter_buffer[page >> 3] = d; scatter_buffer[page >> 3] = d;
#if defined(GK20A_DEBUG)
if (unlikely(gpu_dbg_cde & gk20a_dbg_mask)) { if (unlikely(gpu_dbg_cde & gk20a_dbg_mask)) {
gk20a_dbg(gpu_dbg_cde, "scatterBuffer content:"); gk20a_dbg(gpu_dbg_cde, "scatterBuffer content:");
for (i=0; i < page>>3; i++) { for (i=0; i < page>>3; i++) {
gk20a_dbg(gpu_dbg_cde, " %x", scatter_buffer[i]); gk20a_dbg(gpu_dbg_cde, " %x", scatter_buffer[i]);
} }
} }
#endif
return 0; return 0;
} }