Re: [PATCH net-next v4 2/2] net: add driver for Netronome NFP4000/NFP6000 NIC VFs

David Miller
2015-11-30T15:42:27Z

From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Wed, 25 Nov 2015 15:39:04 +0000

> +config NFP_NET_DEBUG
> + bool "Debug support for Netronome(R) NFP3200/NFP6000 NIC drivers"
> + depends on NFP_NET || NFP_NETVF
> + ---help---
> + Enable extra sanity checks and debugfs support in
> + Netronome(R) NFP3200/NFP6000 NIC PF and VF drivers.
> + Note: selecting this option may adversely impact
> + performance.
...
> +#ifdef CONFIG_NFP_NET_DEBUG
> +#define nn_assert(cond, fmt, args...) \
> + do { \
> + if (unlikely(!(cond))) { \
> + pr_err("assertion %s failed\n", #cond); \
> + pr_err(fmt, ## args); \
> + BUG(); \
> + } \
> + } while (0)
> +#else
> +#define nn_assert(cond, fmt, args...) do { } while (0)
> +#endif

This is really not appropriate.

Use WARN_ON() et al. as appropriate to assert things, and in particular
_AVOID_ BUG() in pretty much all cases and attempt to continue running
somehow with error handling paths etc.

Use of BUG() is discouraged in all except the most extreme cases where
the kernel cannot continue to execute at all.

Thanks.