Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/mthca: Always build debugging code unless CONFIG_EMBEDDED=y

Change the mthca debugging trace output code so that it can enabled
and disabled at runtime with the debug_level module parameter in
sysfs. Also, don't allow CONFIG_INFINIBAND_MTHCA_DEBUG to be disabled
unless CONFIG_EMBEDDED is selected. We want users (and especially
distros) to have this turned on unless they really need to save space,
because by the time we want debugging output, it's usually too late to
rebuild a kernel.

Signed-off-by: Roland Dreier <rolandd@cisco.com>

+29 -11
+6 -5
drivers/infiniband/hw/mthca/Kconfig
··· 7 7 ("Tavor") and the MT25208 PCI Express HCA ("Arbel"). 8 8 9 9 config INFINIBAND_MTHCA_DEBUG 10 - bool "Verbose debugging output" 10 + bool "Verbose debugging output" if EMBEDDED 11 11 depends on INFINIBAND_MTHCA 12 - default n 12 + default y 13 13 ---help--- 14 - This option causes the mthca driver produce a bunch of debug 15 - messages. Select this is you are developing the driver or 16 - trying to diagnose a problem. 14 + This option causes debugging code to be compiled into the 15 + mthca driver. The output can be turned on via the 16 + debug_level module parameter (which can also be set after 17 + the driver is loaded through sysfs).
-4
drivers/infiniband/hw/mthca/Makefile
··· 1 - ifdef CONFIG_INFINIBAND_MTHCA_DEBUG 2 - EXTRA_CFLAGS += -DDEBUG 3 - endif 4 - 5 1 obj-$(CONFIG_INFINIBAND_MTHCA) += ib_mthca.o 6 2 7 3 ib_mthca-y := mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \
+15 -2
drivers/infiniband/hw/mthca/mthca_dev.h
··· 355 355 spinlock_t sm_lock; 356 356 }; 357 357 358 - #define mthca_dbg(mdev, format, arg...) \ 359 - dev_dbg(&mdev->pdev->dev, format, ## arg) 358 + #ifdef CONFIG_INFINIBAND_MTHCA_DEBUG 359 + extern int mthca_debug_level; 360 + 361 + #define mthca_dbg(mdev, format, arg...) \ 362 + do { \ 363 + if (mthca_debug_level) \ 364 + dev_printk(KERN_DEBUG, &mdev->pdev->dev, format, ## arg); \ 365 + } while (0) 366 + 367 + #else /* CONFIG_INFINIBAND_MTHCA_DEBUG */ 368 + 369 + #define mthca_dbg(mdev, format, arg...) do { (void) mdev; } while (0) 370 + 371 + #endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */ 372 + 360 373 #define mthca_err(mdev, format, arg...) \ 361 374 dev_err(&mdev->pdev->dev, format, ## arg) 362 375 #define mthca_info(mdev, format, arg...) \
+8
drivers/infiniband/hw/mthca/mthca_main.c
··· 52 52 MODULE_LICENSE("Dual BSD/GPL"); 53 53 MODULE_VERSION(DRV_VERSION); 54 54 55 + #ifdef CONFIG_INFINIBAND_MTHCA_DEBUG 56 + 57 + int mthca_debug_level = 0; 58 + module_param_named(debug_level, mthca_debug_level, int, 0644); 59 + MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0"); 60 + 61 + #endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */ 62 + 55 63 #ifdef CONFIG_PCI_MSI 56 64 57 65 static int msi_x = 0;