2018-09-17 14:54:05

by Haakon Bugge

[permalink] [raw]
Subject: [PATCH 0/2] IB/mlx4: Enable debug print of SMPs and enhance output for MADs

SMPs were not printed at all. Added printing of port number and TID to
all MADs





Håkon Bugge (2):
IB/mlx4: Enable debug print of SMPs
IB/mlx4: Add port and TID to MAD debug print

drivers/infiniband/hw/mlx4/mad.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

--
2.14.3



2018-09-17 14:54:20

by Haakon Bugge

[permalink] [raw]
Subject: [PATCH 1/2] IB/mlx4: Enable debug print of SMPs

IB Subnet Management Packets (SMPs) were excluded from debug prints.

Fixed by enabling print even on QP0 MADs.

Signed-off-by: Håkon Bugge <[email protected]>
---
drivers/infiniband/hw/mlx4/mad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index e5466d786bb1..1718715cc094 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -807,7 +807,7 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
int err;
struct ib_port_attr pattr;

- if (in_wc && in_wc->qp->qp_num) {
+ if (in_wc && in_wc->qp) {
pr_debug("received MAD: slid:%d sqpn:%d "
"dlid_bits:%d dqpn:%d wc_flags:0x%x, cls %x, mtd %x, atr %x\n",
in_wc->slid, in_wc->src_qp,
--
2.14.3


2018-09-17 14:54:54

by Haakon Bugge

[permalink] [raw]
Subject: [PATCH 2/2] IB/mlx4: Add port and TID to MAD debug print

Add said information and make the debug print format consistent.

Signed-off-by: Håkon Bugge <[email protected]>
---
drivers/infiniband/hw/mlx4/mad.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 1718715cc094..2b3e8a959dd9 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -808,14 +808,16 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
struct ib_port_attr pattr;

if (in_wc && in_wc->qp) {
- pr_debug("received MAD: slid:%d sqpn:%d "
- "dlid_bits:%d dqpn:%d wc_flags:0x%x, cls %x, mtd %x, atr %x\n",
- in_wc->slid, in_wc->src_qp,
- in_wc->dlid_path_bits,
- in_wc->qp->qp_num,
- in_wc->wc_flags,
- in_mad->mad_hdr.mgmt_class, in_mad->mad_hdr.method,
- be16_to_cpu(in_mad->mad_hdr.attr_id));
+ pr_debug("received MAD: port:%d slid:%d sqpn:%d "
+ "dlid_bits:%d dqpn:%d wc_flags:0x%x tid:%08x cls:%x mtd:%x atr:%x\n",
+ port_num,
+ in_wc->slid, in_wc->src_qp,
+ in_wc->dlid_path_bits,
+ in_wc->qp->qp_num,
+ in_wc->wc_flags,
+ be64_to_cpu(in_mad->mad_hdr.tid),
+ in_mad->mad_hdr.mgmt_class, in_mad->mad_hdr.method,
+ be16_to_cpu(in_mad->mad_hdr.attr_id));
if (in_wc->wc_flags & IB_WC_GRH) {
pr_debug("sgid_hi:0x%016llx sgid_lo:0x%016llx\n",
be64_to_cpu(in_grh->sgid.global.subnet_prefix),
--
2.14.3


2018-09-17 16:06:40

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 2/2] IB/mlx4: Add port and TID to MAD debug print

Hi H?kon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.19-rc4 next-20180913]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/H-kon-Bugge/IB-mlx4-Enable-debug-print-of-SMPs/20180917-232956
config: i386-randconfig-x002-201837 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:14:0,
from include/linux/list.h:9,
from include/rdma/ib_mad.h:40,
from drivers/infiniband//hw/mlx4/mad.c:33:
drivers/infiniband//hw/mlx4/mad.c: In function 'ib_process_mad':
>> include/linux/kern_levels.h:5:18: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'long long unsigned int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/printk.h:136:10: note: in definition of macro 'no_printk'
printk(fmt, ##__VA_ARGS__); \
^~~
include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
^~~~~~~~
include/linux/printk.h:346:12: note: in expansion of macro 'KERN_DEBUG'
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~
>> drivers/infiniband//hw/mlx4/mad.c:811:3: note: in expansion of macro 'pr_debug'
pr_debug("received MAD: port:%d slid:%d sqpn:%d "
^~~~~~~~
drivers/infiniband//hw/mlx4/mad.c:812:48: note: format string is defined here
"dlid_bits:%d dqpn:%d wc_flags:0x%x tid:%08x cls:%x mtd:%x atr:%x\n",
~~~^
%08llx
--
In file included from include/linux/kernel.h:14:0,
from include/linux/list.h:9,
from include/rdma/ib_mad.h:40,
from drivers/infiniband/hw/mlx4/mad.c:33:
drivers/infiniband/hw/mlx4/mad.c: In function 'ib_process_mad':
>> include/linux/kern_levels.h:5:18: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'long long unsigned int' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/printk.h:136:10: note: in definition of macro 'no_printk'
printk(fmt, ##__VA_ARGS__); \
^~~
include/linux/kern_levels.h:15:20: note: in expansion of macro 'KERN_SOH'
#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
^~~~~~~~
include/linux/printk.h:346:12: note: in expansion of macro 'KERN_DEBUG'
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~
drivers/infiniband/hw/mlx4/mad.c:811:3: note: in expansion of macro 'pr_debug'
pr_debug("received MAD: port:%d slid:%d sqpn:%d "
^~~~~~~~
drivers/infiniband/hw/mlx4/mad.c:812:48: note: format string is defined here
"dlid_bits:%d dqpn:%d wc_flags:0x%x tid:%08x cls:%x mtd:%x atr:%x\n",
~~~^
%08llx

vim +/pr_debug +811 drivers/infiniband//hw/mlx4/mad.c

801
802 static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
803 const struct ib_wc *in_wc, const struct ib_grh *in_grh,
804 const struct ib_mad *in_mad, struct ib_mad *out_mad)
805 {
806 u16 slid, prev_lid = 0;
807 int err;
808 struct ib_port_attr pattr;
809
810 if (in_wc && in_wc->qp) {
> 811 pr_debug("received MAD: port:%d slid:%d sqpn:%d "
812 "dlid_bits:%d dqpn:%d wc_flags:0x%x tid:%08x cls:%x mtd:%x atr:%x\n",
813 port_num,
814 in_wc->slid, in_wc->src_qp,
815 in_wc->dlid_path_bits,
816 in_wc->qp->qp_num,
817 in_wc->wc_flags,
818 be64_to_cpu(in_mad->mad_hdr.tid),
819 in_mad->mad_hdr.mgmt_class, in_mad->mad_hdr.method,
820 be16_to_cpu(in_mad->mad_hdr.attr_id));
821 if (in_wc->wc_flags & IB_WC_GRH) {
822 pr_debug("sgid_hi:0x%016llx sgid_lo:0x%016llx\n",
823 be64_to_cpu(in_grh->sgid.global.subnet_prefix),
824 be64_to_cpu(in_grh->sgid.global.interface_id));
825 pr_debug("dgid_hi:0x%016llx dgid_lo:0x%016llx\n",
826 be64_to_cpu(in_grh->dgid.global.subnet_prefix),
827 be64_to_cpu(in_grh->dgid.global.interface_id));
828 }
829 }
830
831 slid = in_wc ? ib_lid_cpu16(in_wc->slid) : be16_to_cpu(IB_LID_PERMISSIVE);
832
833 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP && slid == 0) {
834 forward_trap(to_mdev(ibdev), port_num, in_mad);
835 return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;
836 }
837
838 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED ||
839 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) {
840 if (in_mad->mad_hdr.method != IB_MGMT_METHOD_GET &&
841 in_mad->mad_hdr.method != IB_MGMT_METHOD_SET &&
842 in_mad->mad_hdr.method != IB_MGMT_METHOD_TRAP_REPRESS)
843 return IB_MAD_RESULT_SUCCESS;
844
845 /*
846 * Don't process SMInfo queries -- the SMA can't handle them.
847 */
848 if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO)
849 return IB_MAD_RESULT_SUCCESS;
850 } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT ||
851 in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS1 ||
852 in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS2 ||
853 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_CONG_MGMT) {
854 if (in_mad->mad_hdr.method != IB_MGMT_METHOD_GET &&
855 in_mad->mad_hdr.method != IB_MGMT_METHOD_SET)
856 return IB_MAD_RESULT_SUCCESS;
857 } else
858 return IB_MAD_RESULT_SUCCESS;
859
860 if ((in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED ||
861 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) &&
862 in_mad->mad_hdr.method == IB_MGMT_METHOD_SET &&
863 in_mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO &&
864 !ib_query_port(ibdev, port_num, &pattr))
865 prev_lid = ib_lid_cpu16(pattr.lid);
866
867 err = mlx4_MAD_IFC(to_mdev(ibdev),
868 (mad_flags & IB_MAD_IGNORE_MKEY ? MLX4_MAD_IFC_IGNORE_MKEY : 0) |
869 (mad_flags & IB_MAD_IGNORE_BKEY ? MLX4_MAD_IFC_IGNORE_BKEY : 0) |
870 MLX4_MAD_IFC_NET_VIEW,
871 port_num, in_wc, in_grh, in_mad, out_mad);
872 if (err)
873 return IB_MAD_RESULT_FAILURE;
874
875 if (!out_mad->mad_hdr.status) {
876 smp_snoop(ibdev, port_num, in_mad, prev_lid);
877 /* slaves get node desc from FW */
878 if (!mlx4_is_slave(to_mdev(ibdev)->dev))
879 node_desc_override(ibdev, out_mad);
880 }
881
882 /* set return bit in status of directed route responses */
883 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
884 out_mad->mad_hdr.status |= cpu_to_be16(1 << 15);
885
886 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS)
887 /* no response for trap repress */
888 return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;
889
890 return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
891 }
892

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (7.72 kB)
.config.gz (33.09 kB)
Download all attachments

2018-09-17 17:54:16

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [PATCH 2/2] IB/mlx4: Add port and TID to MAD debug print

On Mon, Sep 17, 2018 at 04:53:09PM +0200, H?kon Bugge wrote:
> Add said information and make the debug print format consistent.
>
> Signed-off-by: H?kon Bugge <[email protected]>
> ---
> drivers/infiniband/hw/mlx4/mad.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>

Thanks,
Acked-by: Leon Romanovsky <[email protected]>


Attachments:
(No filename) (373.00 B)
signature.asc (817.00 B)
Download all attachments

2018-09-17 17:54:33

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [PATCH 1/2] IB/mlx4: Enable debug print of SMPs

On Mon, Sep 17, 2018 at 04:53:08PM +0200, H?kon Bugge wrote:
> IB Subnet Management Packets (SMPs) were excluded from debug prints.
>
> Fixed by enabling print even on QP0 MADs.
>
> Signed-off-by: H?kon Bugge <[email protected]>
> ---
> drivers/infiniband/hw/mlx4/mad.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks,
Acked-by: Leon Romanovsky <[email protected]>


Attachments:
(No filename) (405.00 B)
signature.asc (817.00 B)
Download all attachments

2018-09-17 20:16:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 2/2] IB/mlx4: Add port and TID to MAD debug print

Hi H?kon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.19-rc4 next-20180913]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/H-kon-Bugge/IB-mlx4-Enable-debug-print-of-SMPs/20180917-232956
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

In file included from drivers/infiniband/hw/mlx4/mad.c:46:0:
drivers/infiniband/hw/mlx4/mad.c: In function 'ib_process_mad':
>> drivers/infiniband/hw/mlx4/mlx4_ib.h:57:21: warning: format '%x' expects argument of type 'unsigned int', but argument 10 has type 'long long unsigned int' [-Wformat=]
#define pr_fmt(fmt) "<" MLX4_IB_DRV_NAME "> %s: " fmt, __func__
^
include/linux/dynamic_debug.h:127:35: note: in expansion of macro 'pr_fmt'
__dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
^~~~~~
include/linux/printk.h:340:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/mad.c:811:3: note: in expansion of macro 'pr_debug'
pr_debug("received MAD: port:%d slid:%d sqpn:%d "
^~~~~~~~
drivers/infiniband/hw/mlx4/mad.c:812:48: note: format string is defined here
"dlid_bits:%d dqpn:%d wc_flags:0x%x tid:%08x cls:%x mtd:%x atr:%x\n",
~~~^
%08llx

vim +57 drivers/infiniband/hw/mlx4/mlx4_ib.h

b1d8eb5a Jack Morgenstein 2012-06-19 53
b1d8eb5a Jack Morgenstein 2012-06-19 54 #ifdef pr_fmt
b1d8eb5a Jack Morgenstein 2012-06-19 55 #undef pr_fmt
b1d8eb5a Jack Morgenstein 2012-06-19 56 #endif
b1d8eb5a Jack Morgenstein 2012-06-19 @57 #define pr_fmt(fmt) "<" MLX4_IB_DRV_NAME "> %s: " fmt, __func__
b1d8eb5a Jack Morgenstein 2012-06-19 58

:::::: The code at line 57 was first introduced by commit
:::::: b1d8eb5a213640f1be98a90e73a241d15b70045c IB/mlx4: Add debug prints

:::::: TO: Jack Morgenstein <[email protected]>
:::::: CC: Roland Dreier <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.52 kB)
.config.gz (63.67 kB)
Download all attachments