Ratelimited ibdev printk functions
Subsystems (2)
cover Ratelimited ibdev printk functions
Hello,
This implements ratelimited ibdev printk functions, similar to their dev_*_ratelimited counterparts.
I've submitted the first patch before [1] without usage, I'm now adding the corresponding EFA patch as well.
cxgb4, hfi1, mlx4, vmw_pvrdma, rdmavt and rxe could also benefit from this if they move to ibvdev prints:
$ git grep ratelimited -- drivers/infiniband/[hs]w
drivers/infiniband/hw/cxgb4/mem.c: pr_warn_ratelimited("%s: dma map failure (non fatal)\n",
drivers/infiniband/hw/cxgb4/resource.c: pr_warn_ratelimited("%s: Out of RQT memory\n",
drivers/infiniband/hw/hfi1/chip.c: dd_dev_info_ratelimited(dd, "DCC Error: fmconfig error: %s\n",
drivers/infiniband/hw/hfi1/chip.c: dd_dev_info_ratelimited(dd, "DCC Error: PortRcv error: %s\n"
drivers/infiniband/hw/hfi1/chip.c: dd_dev_info_ratelimited(dd, "8051 access to LCB blocked\n");
drivers/infiniband/hw/hfi1/chip.c: dd_dev_info_ratelimited(dd, "host access to LCB blocked\n");
drivers/infiniband/hw/hfi1/chip.c: dd_dev_info_ratelimited(dd, "DCC Error: %s\n",
drivers/infiniband/hw/hfi1/chip.c: dd_dev_info_ratelimited(dd, "%s: PortErrorAction bounce\n",
drivers/infiniband/hw/hfi1/chip.c: dd_dev_info_ratelimited(dd, "SDMA engine %u interrupt, but no status bits set\n",
drivers/infiniband/hw/hfi1/hfi.h:#define dd_dev_err_ratelimited(dd, fmt, ...) \
drivers/infiniband/hw/hfi1/hfi.h: dev_err_ratelimited(&(dd)->pcidev->dev, "%s: " fmt, \
drivers/infiniband/hw/hfi1/hfi.h:#define dd_dev_warn_ratelimited(dd, fmt, ...) \
drivers/infiniband/hw/hfi1/hfi.h: dev_warn_ratelimited(&(dd)->pcidev->dev, "%s: " fmt, \
drivers/infiniband/hw/hfi1/hfi.h:#define dd_dev_info_ratelimited(dd, fmt, ...) \
drivers/infiniband/hw/hfi1/hfi.h: dev_info_ratelimited(&(dd)->pcidev->dev, "%s: " fmt, \
drivers/infiniband/hw/hfi1/mad.c: pr_err_ratelimited("hfi1: Invalid trap 0x%0x dropped. Total dropped: %d\n",
drivers/infiniband/hw/hfi1/mad.c: pr_warn_ratelimited("hfi1: Maximum trap limit reached for 0x%0x traps\n",
drivers/infiniband/hw/mlx4/qp.c: pr_warn_ratelimited("Unexpected event type %d on WQ 0x%06x. Events are not supported for WQs\n",
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c: dev_warn_ratelimited(&dev->pdev->dev,
drivers/infiniband/sw/rdmavt/cq.c: rvt_pr_err_ratelimited(rdi, "CQ is full!\n");
drivers/infiniband/sw/rdmavt/vt.h:#define rvt_pr_err_ratelimited(rdi, fmt, ...) \
drivers/infiniband/sw/rdmavt/vt.h: __rvt_pr_err_ratelimited((rdi)->driver_f.get_pci_dev(rdi), \
drivers/infiniband/sw/rdmavt/vt.h:#define __rvt_pr_err_ratelimited(pdev, name, fmt, ...) \
drivers/infiniband/sw/rdmavt/vt.h: dev_err_ratelimited(&(pdev)->dev, "%s: " fmt, name, ##__VA_ARGS__)
drivers/infiniband/sw/rxe/rxe.h: pr_warn_ratelimited("failed crc calculation, err: %d\n", err);
drivers/infiniband/sw/rxe/rxe_net.c: pr_err_ratelimited("no route to %pI4\n", &daddr->s_addr);
drivers/infiniband/sw/rxe/rxe_net.c: pr_err_ratelimited("no route to %pI6\n", daddr);
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad qp type\n");
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad qp type\n");
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad qp type\n");
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("unsupported qp type\n");
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad pkey = 0x%x\n", pkey);
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad pkey = 0x%0x\n", pkey);
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad qkey, got 0x%x expected 0x%x for qpn 0x%x\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("port %d != qp port %d\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("dst addr %pI4 != qp source addr %pI4\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("source addr %pI4 != qp dst addr %pI4\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("dst addr %pI6 != qp source addr %pI6\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("source addr %pI6 != qp dst addr %pI6\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad tver\n");
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("no qp matches qpn 0x%x\n", qpn);
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("no grh for mcast qpn\n");
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("failed matching dgid\n");
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad ICRC from %pI6c\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad ICRC from %pI4\n",
drivers/infiniband/sw/rxe/rxe_recv.c: pr_warn_ratelimited("bad ICRC from unknown\n");
drivers/infiniband/sw/rxe/rxe_resp.c: pr_err_ratelimited("Failed sending ack\n");
drivers/infiniband/sw/rxe/rxe_resp.c: pr_err_ratelimited("Failed sending ack\n");[1] https://patchwork.kernel.org/patch/10926991/
Thanks,
Gal
Gal Pressman (2):
RDMA/core: Introduce ratelimited ibdev printk functions RDMA/efa: Rate limit admin queue error prints
drivers/infiniband/hw/efa/efa_com.c | 70 ++++++------ drivers/infiniband/hw/efa/efa_com_cmd.c | 136 ++++++++++++++---------- include/rdma/ib_verbs.h | 51 +++++++++ 3 files changed, 171 insertions(+), 86 deletions(-)
Signature · 1 line
2.22.0
PATCH 1/2 RDMA/core: Introduce ratelimited ibdev printk functions
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
include/rdma/ib_verbs.h +51 -0
@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \ + __dynamic_ibdev_dbg(&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG ) +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_printk(KERN_DEBUG, ibdev, fmt, ##__VA_ARGS__); \ +} while (0) +#else +__printf(2, 3) __cold +static inline +void ibdev_dbg_ratelimited (const struct ib_device *ibdev,const char *format, ...) {} +#endif +union ib_gid {u8 raw[16 ];struct {
Signature · 1 line
2.22.0
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 43 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +27
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \
include/rdma/ib_verbs.h static inline · line 146
Quoted 10 lines
include/rdma/ib_verbs.h +10
-0+do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ +DEFINE_DYNAMIC_DEBUG_METADATA (descriptor, fmt); \ +if (DYNAMIC_DEBUG_BRANCH (descriptor) &&__ratelimit (&_rs)) \ +__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )
When will you see this CONFIG_DEBUG set? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with this CONFIG_DEBUG and without CONFIG_DYNAMIC_DEBUG.
Thanks
Quoted 20 lines
include/rdma/ib_verbs.h +14
-1+#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_printk(KERN_DEBUG, ibdev, fmt, ##__VA_ARGS__); \ +} while (0) +#else +__printf(2, 3) __cold +static inline +void ibdev_dbg_ratelimited (const struct ib_device *ibdev,const char *format, ...) {} +#endif +union ib_gid {u8 raw[16 ];struct { --2.22.0
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \
Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 60 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.
Quoted 5 lines
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266
I'm more interested to know the real usage of this copy/paste and understand if it makes sense for drivers/infiniband/* or not.
Not everything in netdev is great and worth to borrow.
Thanks
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 67 lines · Leon Romanovsky
Quoted 60 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.Quoted 5 lines
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266
Quoted 4 lines
I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.Not everything in netdev is great and worth to borrow.
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
Regarding combination of both, I don't think DEBUG is related to CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) while CONFIG_DYNAMIC_DEBUG is specific to the dynamic debug prints infrastructure.
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 68 lines · Gal Pressman
Quoted 67 lines · Leon Romanovsky
Quoted 65 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266
Quoted 7 lines
Quoted 4 lines
I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.Not everything in netdev is great and worth to borrow.
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
It is gradually removed when it is spotted, I'll send a patch for mlx5 now.
Quoted 4 lines
Regarding combination of both, I don't think DEBUG is related to
CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) whileCONFIG_DYNAMIC_DEBUGis specific to the dynamic debug prints infrastructure.
I know exactly what DEBUG and CONFIG_DYNAMIC_DEBUG mean, but I'm asking YOU to provide us real and in-tree scenario where DEBUG will exists and CONFIG_DYNAMIC_DEBUG won't.
Thanks
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 72 lines · Leon Romanovsky
Quoted 71 lines · Gal Pressman
Quoted 70 lines · Leon Romanovsky
Quoted 60 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.Quoted 5 lines
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Not everything in netdev is great and worth to borrow.
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
It is gradually removed when it is spotted, I'll send a patch for mlx5 now.
Was there an on-list discussion regarding removal of DEBUG usage? Can you please share a link?
If so, I agree the DEBUG part should be removed.
Quoted 9 lines
Quoted 5 lines
Regarding combination of both, I don't think DEBUG is related to
CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) whileCONFIG_DYNAMIC_DEBUGis specific to the dynamic debug prints infrastructure.I know exactly what DEBUG and
CONFIG_DYNAMIC_DEBUGmean, but I'm asking YOU to provide us real and in-tree scenario where DEBUG will exists andCONFIG_DYNAMIC_DEBUGwon't.
What's any of this has to do with in-tree? This code and defines are part of the tree.
The use case doesn't matter, it's a valid permutation. Is there anything that stops a user from building the kernel this way?
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 75 lines · Gal Pressman
Quoted 74 lines · Leon Romanovsky
Quoted 73 lines · Gal Pressman
Quoted 71 lines · Leon Romanovsky
Quoted 60 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.Quoted 5 lines
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.Not everything in netdev is great and worth to borrow.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
It is gradually removed when it is spotted, I'll send a patch for mlx5 now.
Was there an on-list discussion regarding removal of DEBUG usage? Can you please share a link?
Sorry, but no, I didn't know that I need to save all discussions I see in the mailing lists.
Quoted 12 lines
If so, I agree the DEBUG part should be removed.
Quoted 9 lines
Quoted 5 lines
Regarding combination of both, I don't think DEBUG is related to
CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) whileCONFIG_DYNAMIC_DEBUGis specific to the dynamic debug prints infrastructure.I know exactly what DEBUG and
CONFIG_DYNAMIC_DEBUGmean, but I'm asking YOU to provide us real and in-tree scenario where DEBUG will exists andCONFIG_DYNAMIC_DEBUGwon't.
Quoted 5 lines
What's any of this has to do with in-tree? This code and defines are part of the tree.
The use case doesn't matter, it's a valid permutation. Is there anything that stops a user from building the kernel this way?
Like everything else, nothing stops from you to do any modifications to the source code, before you will build. We are talking about in-tree builds and distro kernels.
Thanks
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 79 lines · Leon Romanovsky
Quoted 78 lines · Gal Pressman
Quoted 77 lines · Leon Romanovsky
Quoted 75 lines · Gal Pressman
Quoted 67 lines · Leon Romanovsky
Quoted 60 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.Quoted 5 lines
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266Quoted 4 lines
I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.Not everything in netdev is great and worth to borrow.
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
It is gradually removed when it is spotted, I'll send a patch for mlx5 now.
Was there an on-list discussion regarding removal of DEBUG usage? Can you please share a link?
Sorry, but no, I didn't know that I need to save all discussions I see in the mailing lists.
Trying to understand whether "It is gradually removed when it is spotted" is a well known guideline by the community, should checkpatch produce a warning for this?
Quoted 16 lines
Quoted 16 lines
If so, I agree the DEBUG part should be removed.
Quoted 9 lines
Quoted 5 lines
Regarding combination of both, I don't think DEBUG is related to
CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) whileCONFIG_DYNAMIC_DEBUGis specific to the dynamic debug prints infrastructure.I know exactly what DEBUG and
CONFIG_DYNAMIC_DEBUGmean, but I'm asking YOU to provide us real and in-tree scenario where DEBUG will exists andCONFIG_DYNAMIC_DEBUGwon't.What's any of this has to do with in-tree? This code and defines are part of the tree.
Quoted 6 lines
Quoted 2 lines
The use case doesn't matter, it's a valid permutation. Is there anything that stops a user from building the kernel this way?
Like everything else, nothing stops from you to do any modifications to the source code, before you will build. We are talking about in-tree builds and distro kernels.
Last I checked turning on DEBUG doesn't require source code changes?
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 82 lines · Gal Pressman
Quoted 81 lines · Leon Romanovsky
Quoted 80 lines · Gal Pressman
Quoted 78 lines · Leon Romanovsky
Quoted 68 lines · Gal Pressman
Quoted 67 lines · Leon Romanovsky
Quoted 65 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266Quoted 7 lines
Quoted 4 lines
I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.Not everything in netdev is great and worth to borrow.
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
It is gradually removed when it is spotted, I'll send a patch for mlx5 now.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Was there an on-list discussion regarding removal of DEBUG usage? Can you please share a link?
Sorry, but no, I didn't know that I need to save all discussions I see in the mailing lists.
Trying to understand whether "It is gradually removed when it is spotted" is a well known guideline by the community, should checkpatch produce a warning for this?
I didn't see checks in checkpatch about tabs<->spaces mix either which you pointed for hns guys.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
If so, I agree the DEBUG part should be removed.
Quoted 9 lines
Quoted 5 lines
Regarding combination of both, I don't think DEBUG is related to
CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) whileCONFIG_DYNAMIC_DEBUGis specific to the dynamic debug prints infrastructure.I know exactly what DEBUG and
CONFIG_DYNAMIC_DEBUGmean, but I'm asking YOU to provide us real and in-tree scenario where DEBUG will exists andCONFIG_DYNAMIC_DEBUGwon't.What's any of this has to do with in-tree? This code and defines are part of the tree.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
The use case doesn't matter, it's a valid permutation. Is there anything that stops a user from building the kernel this way?
Like everything else, nothing stops from you to do any modifications to the source code, before you will build. We are talking about in-tree builds and distro kernels.
Last I checked turning on DEBUG doesn't require source code changes?
Exciting, how did you enable DEBUG without recompiling source code? Maybe you find a way to enable DEBUG on running kernel?
And how did it come that v5.3 kernel was compiled with DEBUG but without DYNAMIC_DEBUG?
Thanks
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 86 lines · Leon Romanovsky
Quoted 85 lines · Gal Pressman
Quoted 84 lines · Leon Romanovsky
Quoted 82 lines · Gal Pressman
Quoted 72 lines · Leon Romanovsky
Quoted 71 lines · Gal Pressman
Quoted 70 lines · Leon Romanovsky
Quoted 60 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.Quoted 5 lines
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Not everything in netdev is great and worth to borrow.
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
It is gradually removed when it is spotted, I'll send a patch for mlx5 now.
Was there an on-list discussion regarding removal of DEBUG usage? Can you please share a link?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Sorry, but no, I didn't know that I need to save all discussions I see in the mailing lists.
Trying to understand whether "It is gradually removed when it is spotted" is a well known guideline by the community, should checkpatch produce a warning for this?
I didn't see checks in checkpatch about tabs<->spaces mix either which you pointed for hns guys.
Ofcourse there are, this patch was full of checkpatch warnings. But that's not the point, you're avoiding answering a simple question: is DEBUG usage discouraged by the community?
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
If so, I agree the DEBUG part should be removed.
Quoted 9 lines
Quoted 5 lines
Regarding combination of both, I don't think DEBUG is related to
CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) whileCONFIG_DYNAMIC_DEBUGis specific to the dynamic debug prints infrastructure.I know exactly what DEBUG and
CONFIG_DYNAMIC_DEBUGmean, but I'm asking YOU to provide us real and in-tree scenario where DEBUG will exists andCONFIG_DYNAMIC_DEBUGwon't.What's any of this has to do with in-tree? This code and defines are part of the tree.
The use case doesn't matter, it's a valid permutation. Is there anything that stops a user from building the kernel this way?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Like everything else, nothing stops from you to do any modifications to the source code, before you will build. We are talking about in-tree builds and distro kernels.
Last I checked turning on DEBUG doesn't require source code changes?
Exciting, how did you enable DEBUG without recompiling source code?
Recompiling source code != changing source code.
You can turn on DEBUG when compiling the kernel (i.e running make) with no source code changes (again, last I checked, did this change lately?).
Quoted 4 lines
Maybe you find a way to enable DEBUG on running kernel?
And how did it come that v5.3 kernel was compiled with DEBUG but without
DYNAMIC_DEBUG?
Change CONFIG_DYNAMIC_DEBUG=n in your .config and pass DEBUG to make.
Re: [PATCH for-next 1/2] RDMA/core: Introduce ratelimited ibdev printk functions
Quoted 93 lines · Gal Pressman
Quoted 92 lines · Leon Romanovsky
Quoted 90 lines · Gal Pressman
Quoted 79 lines · Leon Romanovsky
Quoted 78 lines · Gal Pressman
Quoted 77 lines · Leon Romanovsky
Quoted 75 lines · Gal Pressman
Quoted 67 lines · Leon Romanovsky
Quoted 60 lines · Gal Pressman
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Gal Pressman
Add ratelimited helpers to the ibdev_* printk functions. Implementation inspired by counterpart dev_*_ratelimited functions.
Signed-off-by Gal Pressman <[email protected]>--- include/rdma/ib_verbs.h | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)include/rdma/ib_verbs.h +33
-0@@ -107,6 +107,57 @@ static inlinevoid ibdev_dbg (const struct ib_device *ibdev,const char *format, ...) {}#endif +#define ibdev_level_ratelimited (ibdev_level, ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + if (__ratelimit(&_rs)) \ + ibdev_level(ibdev, fmt, ##__VA_ARGS__); \ +} while (0) + +#define ibdev_emerg_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_emerg, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_alert_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_alert, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_crit_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_crit, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_err_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_err, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_warn_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_warn, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_notice_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_notice, ibdev, fmt, ##__VA_ARGS__) +#define ibdev_info_ratelimited (ibdev, fmt, ...) \ + ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) + +#if defined(CONFIG_DYNAMIC_DEBUG ) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) \Quoted 8 lines
include/rdma/ib_verbs.h static inline · line 146
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+__dynamic_ibdev_dbg (&descriptor, ibdev, fmt, \ + ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG )When will you see this
CONFIG_DEBUGset? I suspect only in private out-of-tree builds which we are not really care. Also I can't imagine system with thisCONFIG_DEBUGand withoutCONFIG_DYNAMIC_DEBUG.Quoted 5 lines
This is the common way to handle debug prints, see:
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/printk.h#L331
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/device.h#L1493
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/netdevice.h#L4743
https://elixir.bootlin.com/linux/v5.2.1/source/include/linux/net.h#L266Quoted 4 lines
I'm more interested to know the real usage of this copy/paste and understand if it makes sense for
drivers/infiniband/*or not.Not everything in netdev is great and worth to borrow.
DEBUG exists since the first commit in the tree, and is used in various parts of the kernel (mlx5 as well). Do you think it should be removed from the kernel?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
It is gradually removed when it is spotted, I'll send a patch for mlx5 now.
Was there an on-list discussion regarding removal of DEBUG usage? Can you please share a link?
Sorry, but no, I didn't know that I need to save all discussions I see in the mailing lists.
Trying to understand whether "It is gradually removed when it is spotted" is a well known guideline by the community, should checkpatch produce a warning for this?
Quoted 6 lines
Quoted 2 lines
I didn't see checks in checkpatch about tabs<->spaces mix either which you pointed for hns guys.
Ofcourse there are, this patch was full of checkpatch warnings. But that's not the point, you're avoiding answering a simple question: is DEBUG usage discouraged by the community?
Yes, I said it a couple of times, "community" is not excited to see debug code in final code. The expectation that submitted code works and doesn't need extra debug. If it is not true, such code is not ready to be merged.
Anyway, simple grep in our subsystem shows that this "DEBUG" in use in one place only (fmr) and it predates git era.
_ kernel git:(rdma-next) git grep DEBUG drivers/infiniband/ include/rdma/ | grep ifdef
There is no new code with this "DEBUG" flag.
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 16 lines
If so, I agree the DEBUG part should be removed.
Quoted 9 lines
Quoted 5 lines
Regarding combination of both, I don't think DEBUG is related to
CONFIG_DYNAMIC_DEBUG. DEBUG is a generic debug flag (not necessarily to prints) whileCONFIG_DYNAMIC_DEBUGis specific to the dynamic debug prints infrastructure.I know exactly what DEBUG and
CONFIG_DYNAMIC_DEBUGmean, but I'm asking YOU to provide us real and in-tree scenario where DEBUG will exists andCONFIG_DYNAMIC_DEBUGwon't.Quoted 5 lines
What's any of this has to do with in-tree? This code and defines are part of the tree.
The use case doesn't matter, it's a valid permutation. Is there anything that stops a user from building the kernel this way?
Like everything else, nothing stops from you to do any modifications to the source code, before you will build. We are talking about in-tree builds and distro kernels.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Last I checked turning on DEBUG doesn't require source code changes?
Exciting, how did you enable DEBUG without recompiling source code?
Recompiling source code != changing source code.
I'm as a kernel developer don't see the difference.
Quoted 9 lines
You can turn on DEBUG when compiling the kernel (i.e running make) with no source code changes (again, last I checked, did this change lately?).
Quoted 4 lines
Maybe you find a way to enable DEBUG on running kernel?
And how did it come that v5.3 kernel was compiled with DEBUG but without
DYNAMIC_DEBUG?Change
CONFIG_DYNAMIC_DEBUG=nin your .config and pass DEBUG to make.
I asked for a real example and not for allnoconfig compilation.
PATCH 2/2 RDMA/efa: Rate limit admin queue error prints
In reply to Gal PressmanAdmin queue error prints should never happen unless something wrong happened to the device. However, in the unfortunate case that it does, we should take extra care not to flood the log with error messages.
--- drivers/infiniband/hw/efa/efa_com.c | 70 ++++++------ drivers/infiniband/hw/efa/efa_com_cmd.c | 136 ++++++++++++++---------- 2 files changed, 120 insertions(+), 86 deletions(-)
drivers/infiniband/hw/efa/efa_com.c +39 -31
@@ -109,17 +109,19 @@ static u32 efa_com_reg_read32(struct efa_com_dev *edev, u16 offset) }while (time_is_after_jiffies (exp_time));if (read_resp->req_id != mmio_read->seq_num) { -ibdev_err (edev->efa_dev, -"Reading register timed out. expected: req id[%u] offset[%#x] actual: req id[%u] offset[%#x]\n" , - mmio_read->seq_num, offset, read_resp->req_id, - read_resp->reg_off); +ibdev_err_ratelimited ( + edev->efa_dev, +"Reading register timed out. expected: req id[%u] offset[%#x] actual: req id[%u] offset[%#x]\n" , + mmio_read->seq_num, offset, read_resp->req_id, + read_resp->reg_off); err =EFA_MMIO_READ_INVALID ; goto out; }if (read_resp->reg_off != offset) { -ibdev_err (edev->efa_dev, -"Reading register failed: wrong offset provided\n" ); +ibdev_err_ratelimited ( + edev->efa_dev, +"Reading register failed: wrong offset provided\n" ); err =EFA_MMIO_READ_INVALID ; goto out; }
@@ -293,9 +295,10 @@ static struct efa_comp_ctx *efa_com_get_comp_ctx(struct efa_com_admin_queue *aq,u16 ctx_id = cmd_id & (aq->depth -1 );if (aq->comp_ctx[ctx_id].occupied && capture) { -ibdev_err (aq->efa_dev, -"Completion context for command_id %#x is occupied\n" , - cmd_id); +ibdev_err_ratelimited ( + aq->efa_dev, +"Completion context for command_id %#x is occupied\n" , + cmd_id);return NULL ; }
@@ -401,7 +404,7 @@ static struct efa_comp_ctx *efa_com_submit_admin_cmd(struct efa_com_admin_queuespin_lock (&aq->sq.lock);if (!test_bit (EFA_AQ_STATE_RUNNING_BIT , &aq->state)) { -ibdev_err (aq->efa_dev,"Admin queue is closed\n" ); +ibdev_err_ratelimited (aq->efa_dev,"Admin queue is closed\n" );spin_unlock (&aq->sq.lock);return ERR_PTR (-ENODEV ); }
@@ -519,8 +522,9 @@ static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_cbreak ;if (time_is_before_jiffies (timeout)) { -ibdev_err (aq->efa_dev, -"Wait for completion (polling) timeout\n" ); +ibdev_err_ratelimited ( + aq->efa_dev, +"Wait for completion (polling) timeout\n" );/* EFA didn't have any completion */ atomic64_inc (&aq->stats.no_completion);
@@ -561,17 +565,19 @@ static int efa_com_wait_and_process_admin_cq_interrupts(struct efa_comp_ctx *comatomic64_inc (&aq->stats.no_completion);if (comp_ctx->status ==EFA_CMD_COMPLETED ) -ibdev_err (aq->efa_dev, -"The device sent a completion but the driver didn't receive any MSI-X interrupt for admin cmd %s(%d) status %d (ctx: 0x%p, sq producer: %d, sq consumer: %d, cq consumer: %d)\n" , -efa_com_cmd_str (comp_ctx->cmd_opcode), - comp_ctx->cmd_opcode, comp_ctx->status, - comp_ctx, aq->sq.pc, aq->sq.cc, aq->cq.cc); +ibdev_err_ratelimited ( + aq->efa_dev, +"The device sent a completion but the driver didn't receive any MSI-X interrupt for admin cmd %s(%d) status %d (ctx: 0x%p, sq producer: %d, sq consumer: %d, cq consumer: %d)\n" , +efa_com_cmd_str (comp_ctx->cmd_opcode), + comp_ctx->cmd_opcode, comp_ctx->status, + comp_ctx, aq->sq.pc, aq->sq.cc, aq->cq.cc);else -ibdev_err (aq->efa_dev, -"The device didn't send any completion for admin cmd %s(%d) status %d (ctx 0x%p, sq producer: %d, sq consumer: %d, cq consumer: %d)\n" , -efa_com_cmd_str (comp_ctx->cmd_opcode), - comp_ctx->cmd_opcode, comp_ctx->status, - comp_ctx, aq->sq.pc, aq->sq.cc, aq->cq.cc); +ibdev_err_ratelimited ( + aq->efa_dev, +"The device didn't send any completion for admin cmd %s(%d) status %d (ctx 0x%p, sq producer: %d, sq consumer: %d, cq consumer: %d)\n" , +efa_com_cmd_str (comp_ctx->cmd_opcode), + comp_ctx->cmd_opcode, comp_ctx->status, + comp_ctx, aq->sq.pc, aq->sq.cc, aq->cq.cc);clear_bit (EFA_AQ_STATE_RUNNING_BIT , &aq->state); err = -ETIME ;
@@ -633,10 +639,11 @@ int efa_com_cmd_exec(struct efa_com_admin_queue *aq, cmd->aq_common_descriptor.opcode); comp_ctx =efa_com_submit_admin_cmd (aq, cmd, cmd_size, comp, comp_size);if (IS_ERR (comp_ctx)) { -ibdev_err (aq->efa_dev, -"Failed to submit command %s (opcode %u) err %ld\n" , -efa_com_cmd_str (cmd->aq_common_descriptor.opcode), - cmd->aq_common_descriptor.opcode,PTR_ERR (comp_ctx)); +ibdev_err_ratelimited ( + aq->efa_dev, +"Failed to submit command %s (opcode %u) err %ld\n" , +efa_com_cmd_str (cmd->aq_common_descriptor.opcode), + cmd->aq_common_descriptor.opcode,PTR_ERR (comp_ctx));up (&aq->avail_cmds);return PTR_ERR (comp_ctx);
@@ -644,11 +651,12 @@ int efa_com_cmd_exec(struct efa_com_admin_queue *aq, err =efa_com_wait_and_process_admin_cq (comp_ctx, aq);if (err) -ibdev_err (aq->efa_dev, -"Failed to process command %s (opcode %u) comp_status %d err %d\n" , -efa_com_cmd_str (cmd->aq_common_descriptor.opcode), - cmd->aq_common_descriptor.opcode, - comp_ctx->comp_status, err); +ibdev_err_ratelimited ( + aq->efa_dev, +"Failed to process command %s (opcode %u) comp_status %d err %d\n" , +efa_com_cmd_str (cmd->aq_common_descriptor.opcode), + cmd->aq_common_descriptor.opcode, comp_ctx->comp_status, + err);up (&aq->avail_cmds);
drivers/infiniband/hw/efa/efa_com_cmd.c +81 -55
298 lines not on this page · raw message
Signature · 1 line
2.22.0