1. 30 7月, 2020 2 次提交
  2. 03 6月, 2020 1 次提交
    • C
      RDMA/core: Move and rename trace_cm_id_create() · 278f74b3
      Chuck Lever 提交于
      The restrack ID for an rdma_cm_id is not assigned until it is
      associated with a device.
      
      Here's an example I captured while testing NFS/RDMA's support for
      DEVICE_REMOVAL. The new tracepoint name is "cm_id_attach".
      
                 <...>-4261  [001]   366.581299: cm_event_handler:     cm.id=0 src=0.0.0.0:45919 dst=192.168.2.55:20049 tos=0 ADDR_ERROR (1/-19)
                 <...>-4261  [001]   366.581304: cm_event_done:        cm.id=0 src=0.0.0.0:45919 dst=192.168.2.55:20049 tos=0 ADDR_ERROR consumer returns 0
                 <...>-1950  [000]   366.581309: cm_id_destroy:        cm.id=0 src=0.0.0.0:45919 dst=192.168.2.55:20049 tos=0
                 <...>-7     [001]   369.589400: cm_event_handler:     cm.id=0 src=0.0.0.0:49023 dst=192.168.2.55:20049 tos=0 ADDR_ERROR (1/-19)
                 <...>-7     [001]   369.589404: cm_event_done:        cm.id=0 src=0.0.0.0:49023 dst=192.168.2.55:20049 tos=0 ADDR_ERROR consumer returns 0
                 <...>-1950  [000]   369.589407: cm_id_destroy:        cm.id=0 src=0.0.0.0:49023 dst=192.168.2.55:20049 tos=0
                 <...>-4261  [001]   372.597650: cm_id_attach:         cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 device=mlx4_0
                 <...>-4261  [001]   372.597652: cm_event_handler:     cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 ADDR_RESOLVED (0/0)
                 <...>-4261  [001]   372.597654: cm_event_done:        cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 ADDR_RESOLVED consumer returns 0
                 <...>-4261  [001]   372.597738: cm_event_handler:     cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 ROUTE_RESOLVED (2/0)
                 <...>-4261  [001]   372.597740: cm_event_done:        cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 ROUTE_RESOLVED consumer returns 0
                 <...>-4691  [007]   372.600101: cm_qp_create:         cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 pd.id=2 qp_type=RC send_wr=4091 recv_wr=256 qp_num=530 rc=0
                 <...>-4691  [007]   372.600207: cm_send_req:          cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 qp_num=530
                 <...>-185   [002]   372.601212: cm_send_mra:          cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0
                 <...>-185   [002]   372.601362: cm_send_rtu:          cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0
                 <...>-185   [002]   372.601372: cm_event_handler:     cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 ESTABLISHED (9/0)
                 <...>-185   [002]   372.601379: cm_event_done:        cm.id=0 src=192.168.2.51:47492 dst=192.168.2.55:20049 tos=0 ESTABLISHED consumer returns 0
      
      Fixes: ed999f82 ("RDMA/cma: Add trace points in RDMA Connection Manager")
      Link: https://lore.kernel.org/r/20200530174934.21362.56754.stgit@manet.1015granger.netSigned-off-by: NChuck Lever <chuck.lever@oracle.com>
      Reviewed-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      278f74b3
  3. 28 5月, 2020 4 次提交
  4. 07 5月, 2020 1 次提交
  5. 06 5月, 2020 1 次提交
  6. 15 4月, 2020 1 次提交
  7. 27 3月, 2020 1 次提交
    • A
      RDMA/cm: Update num_paths in cma_resolve_iboe_route error flow · 987914ab
      Avihai Horon 提交于
      After a successful allocation of path_rec, num_paths is set to 1, but any
      error after such allocation will leave num_paths uncleared.
      
      This causes to de-referencing a NULL pointer later on. Hence, num_paths
      needs to be set back to 0 if such an error occurs.
      
      The following crash from syzkaller revealed it.
      
        kasan: CONFIG_KASAN_INLINE enabled
        kasan: GPF could be caused by NULL-ptr deref or user memory access
        general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
        CPU: 0 PID: 357 Comm: syz-executor060 Not tainted 4.18.0+ #311
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
        rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014
        RIP: 0010:ib_copy_path_rec_to_user+0x94/0x3e0
        Code: f1 f1 f1 f1 c7 40 0c 00 00 f4 f4 65 48 8b 04 25 28 00 00 00 48 89
        45 c8 31 c0 e8 d7 60 24 ff 48 8d 7b 4c 48 89 f8 48 c1 e8 03 <42> 0f b6
        14 30 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85
        RSP: 0018:ffff88006586f980 EFLAGS: 00010207
        RAX: 0000000000000009 RBX: 0000000000000000 RCX: 1ffff1000d5fe475
        RDX: ffff8800621e17c0 RSI: ffffffff820d45f9 RDI: 000000000000004c
        RBP: ffff88006586fa50 R08: ffffed000cb0df73 R09: ffffed000cb0df72
        R10: ffff88006586fa70 R11: ffffed000cb0df73 R12: 1ffff1000cb0df30
        R13: ffff88006586fae8 R14: dffffc0000000000 R15: ffff88006aff2200
        FS: 00000000016fc880(0000) GS:ffff88006d000000(0000)
        knlGS:0000000000000000
        CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000020000040 CR3: 0000000063fec000 CR4: 00000000000006b0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
        ? ib_copy_path_rec_from_user+0xcc0/0xcc0
        ? __mutex_unlock_slowpath+0xfc/0x670
        ? wait_for_completion+0x3b0/0x3b0
        ? ucma_query_route+0x818/0xc60
        ucma_query_route+0x818/0xc60
        ? ucma_listen+0x1b0/0x1b0
        ? sched_clock_cpu+0x18/0x1d0
        ? sched_clock_cpu+0x18/0x1d0
        ? ucma_listen+0x1b0/0x1b0
        ? ucma_write+0x292/0x460
        ucma_write+0x292/0x460
        ? ucma_close_id+0x60/0x60
        ? sched_clock_cpu+0x18/0x1d0
        ? sched_clock_cpu+0x18/0x1d0
        __vfs_write+0xf7/0x620
        ? ucma_close_id+0x60/0x60
        ? kernel_read+0x110/0x110
        ? time_hardirqs_on+0x19/0x580
        ? lock_acquire+0x18b/0x3a0
        ? finish_task_switch+0xf3/0x5d0
        ? _raw_spin_unlock_irq+0x29/0x40
        ? _raw_spin_unlock_irq+0x29/0x40
        ? finish_task_switch+0x1be/0x5d0
        ? __switch_to_asm+0x34/0x70
        ? __switch_to_asm+0x40/0x70
        ? security_file_permission+0x172/0x1e0
        vfs_write+0x192/0x460
        ksys_write+0xc6/0x1a0
        ? __ia32_sys_read+0xb0/0xb0
        ? entry_SYSCALL_64_after_hwframe+0x3e/0xbe
        ? do_syscall_64+0x1d/0x470
        do_syscall_64+0x9e/0x470
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: 3c86aa70 ("RDMA/cm: Add RDMA CM support for IBoE devices")
      Link: https://lore.kernel.org/r/20200318101741.47211-1-leon@kernel.orgSigned-off-by: NAvihai Horon <avihaih@mellanox.com>
      Reviewed-by: NMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      987914ab
  8. 11 3月, 2020 1 次提交
  9. 20 2月, 2020 1 次提交
  10. 12 2月, 2020 6 次提交
  11. 29 1月, 2020 1 次提交
  12. 08 1月, 2020 1 次提交
    • C
      RDMA/cma: Add trace points in RDMA Connection Manager · ed999f82
      Chuck Lever 提交于
      Record state transitions as each connection is established. The IP address
      of both peers and the Type of Service is reported. These trace points are
      not in performance hot paths.
      
      Also, record each cm_event_handler call to ULPs. This eliminates the need
      for each ULP to add its own similar trace point in its CM event handler
      function.
      
      These new trace points appear in a new trace subsystem called "rdma_cma".
      
      Sample events:
      
                 <...>-220   [004]   121.430733: cm_id_create:         cm.id=0
                 <...>-472   [003]   121.430991: cm_event_handler:     cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 ADDR_RESOLVED (0/0)
                 <...>-472   [003]   121.430995: cm_event_done:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 result=0
                 <...>-472   [003]   121.431172: cm_event_handler:     cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 ROUTE_RESOLVED (2/0)
                 <...>-472   [003]   121.431174: cm_event_done:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 result=0
                 <...>-220   [004]   121.433480: cm_qp_create:         cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 pd.id=2 qp_type=RC send_wr=4091 recv_wr=256 qp_num=521 rc=0
                 <...>-220   [004]   121.433577: cm_send_req:          cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 qp_num=521
           kworker/1:2-973   [001]   121.436190: cm_send_mra:          cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0
           kworker/1:2-973   [001]   121.436340: cm_send_rtu:          cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0
           kworker/1:2-973   [001]   121.436359: cm_event_handler:     cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 ESTABLISHED (9/0)
           kworker/1:2-973   [001]   121.436365: cm_event_done:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 result=0
                 <...>-1975  [005]   123.161954: cm_disconnect:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0
                 <...>-1975  [005]   123.161974: cm_sent_dreq:         cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0
                 <...>-220   [004]   123.162102: cm_disconnect:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0
           kworker/0:1-13    [000]   123.162391: cm_event_handler:     cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 DISCONNECTED (10/0)
           kworker/0:1-13    [000]   123.162393: cm_event_done:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 result=0
                 <...>-220   [004]   123.164456: cm_qp_destroy:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0 qp_num=521
                 <...>-220   [004]   123.165290: cm_id_destroy:        cm.id=0 src=192.168.2.51:35090 dst=192.168.2.55:20049 tos=0
      
      Some features to note:
      - restracker ID of the rdma_cm_id is tagged on each trace event
      - The source and destination IP addresses and TOS are reported
      - CM event upcalls are shown with decoded event and status
      - CM state transitions are reported
      - rdma_cm_id lifetime events are captured
      - The latency of ULP CM event handlers is reported
      - Lifetime events of associated QPs are reported
      - Device removal and insertion is reported
      
      This patch is based on previous work by:
      
      Saeed Mahameed <saeedm@mellanox.com>
      Mukesh Kacker <mukesh.kacker@oracle.com>
      Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
      Aron Silverton <aron.silverton@oracle.com>
      Avinash Repaka <avinash.repaka@oracle.com>
      Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
      
      Link: https://lore.kernel.org/r/20191218201810.30584.3052.stgit@manet.1015granger.netSigned-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      ed999f82
  13. 10 12月, 2019 1 次提交
  14. 17 11月, 2019 1 次提交
  15. 28 10月, 2019 1 次提交
  16. 23 10月, 2019 1 次提交
  17. 01 10月, 2019 1 次提交
    • B
      RDMA/iwcm: Fix a lock inversion issue · b66f31ef
      Bart Van Assche 提交于
      This patch fixes the lock inversion complaint:
      
      ============================================
      WARNING: possible recursive locking detected
      5.3.0-rc7-dbg+ #1 Not tainted
      --------------------------------------------
      kworker/u16:6/171 is trying to acquire lock:
      00000000035c6e6c (&id_priv->handler_mutex){+.+.}, at: rdma_destroy_id+0x78/0x4a0 [rdma_cm]
      
      but task is already holding lock:
      00000000bc7c307d (&id_priv->handler_mutex){+.+.}, at: iw_conn_req_handler+0x151/0x680 [rdma_cm]
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(&id_priv->handler_mutex);
        lock(&id_priv->handler_mutex);
      
       *** DEADLOCK ***
      
       May be due to missing lock nesting notation
      
      3 locks held by kworker/u16:6/171:
       #0: 00000000e2eaa773 ((wq_completion)iw_cm_wq){+.+.}, at: process_one_work+0x472/0xac0
       #1: 000000001efd357b ((work_completion)(&work->work)#3){+.+.}, at: process_one_work+0x476/0xac0
       #2: 00000000bc7c307d (&id_priv->handler_mutex){+.+.}, at: iw_conn_req_handler+0x151/0x680 [rdma_cm]
      
      stack backtrace:
      CPU: 3 PID: 171 Comm: kworker/u16:6 Not tainted 5.3.0-rc7-dbg+ #1
      Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      Workqueue: iw_cm_wq cm_work_handler [iw_cm]
      Call Trace:
       dump_stack+0x8a/0xd6
       __lock_acquire.cold+0xe1/0x24d
       lock_acquire+0x106/0x240
       __mutex_lock+0x12e/0xcb0
       mutex_lock_nested+0x1f/0x30
       rdma_destroy_id+0x78/0x4a0 [rdma_cm]
       iw_conn_req_handler+0x5c9/0x680 [rdma_cm]
       cm_work_handler+0xe62/0x1100 [iw_cm]
       process_one_work+0x56d/0xac0
       worker_thread+0x7a/0x5d0
       kthread+0x1bc/0x210
       ret_from_fork+0x24/0x30
      
      This is not a bug as there are actually two lock classes here.
      
      Link: https://lore.kernel.org/r/20190930231707.48259-3-bvanassche@acm.org
      Fixes: de910bd9 ("RDMA/cma: Simplify locking needed for serialization of callbacks")
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Reviewed-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      b66f31ef
  18. 14 9月, 2019 1 次提交
  19. 21 8月, 2019 1 次提交
  20. 03 5月, 2019 1 次提交
  21. 24 4月, 2019 1 次提交
  22. 04 4月, 2019 1 次提交
    • L
      RDMA/cma: Set proper port number as index · 061ccb52
      Leon Romanovsky 提交于
      Conversion from IDR to XArray missed the fact that idr_alloc() returned
      index as a return value, this index was saved in port variable and used as
      query index later on. This caused to the following error.
      
       BUG: KASAN: use-after-free in cma_check_port+0x86a/0xa20 [rdma_cm]
       Read of size 8 at addr ffff888069fde998 by task ucmatose/387
       CPU: 3 PID: 387 Comm: ucmatose Not tainted 5.1.0-rc2+ #253
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014
       Call Trace:
        dump_stack+0x7c/0xc0
        print_address_description+0x6c/0x23c
        ? cma_check_port+0x86a/0xa20 [rdma_cm]
        kasan_report.cold.3+0x1c/0x35
        ? cma_check_port+0x86a/0xa20 [rdma_cm]
        ? cma_check_port+0x86a/0xa20 [rdma_cm]
        cma_check_port+0x86a/0xa20 [rdma_cm]
        rdma_bind_addr+0x11bc/0x1b00 [rdma_cm]
        ? find_held_lock+0x33/0x1c0
        ? cma_ndev_work_handler+0x180/0x180 [rdma_cm]
        ? wait_for_completion+0x3d0/0x3d0
        ucma_bind+0x120/0x160 [rdma_ucm]
        ? ucma_resolve_addr+0x1a0/0x1a0 [rdma_ucm]
        ucma_write+0x1f8/0x2b0 [rdma_ucm]
        ? ucma_open+0x260/0x260 [rdma_ucm]
        vfs_write+0x157/0x460
        ksys_write+0xb8/0x170
        ? __ia32_sys_read+0xb0/0xb0
        ? trace_hardirqs_off_caller+0x5b/0x160
        ? do_syscall_64+0x18/0x3c0
        do_syscall_64+0x95/0x3c0
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        Allocated by task 381:
         __kasan_kmalloc.constprop.5+0xc1/0xd0
         cma_alloc_port+0x4d/0x160 [rdma_cm]
         rdma_bind_addr+0x14e7/0x1b00 [rdma_cm]
         ucma_bind+0x120/0x160 [rdma_ucm]
         ucma_write+0x1f8/0x2b0 [rdma_ucm]
         vfs_write+0x157/0x460
         ksys_write+0xb8/0x170
         do_syscall_64+0x95/0x3c0
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
        Freed by task 381:
         __kasan_slab_free+0x12e/0x180
         kfree+0xed/0x290
         rdma_destroy_id+0x6b6/0x9e0 [rdma_cm]
         ucma_close+0x110/0x300 [rdma_ucm]
         __fput+0x25a/0x740
         task_work_run+0x10e/0x190
         do_exit+0x85e/0x29e0
         do_group_exit+0xf0/0x2e0
         get_signal+0x2e0/0x17e0
         do_signal+0x94/0x1570
         exit_to_usermode_loop+0xfa/0x130
         do_syscall_64+0x327/0x3c0
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Reported-by: <syzbot+2e3e485d5697ea610460@syzkaller.appspotmail.com>
      Reported-by: NRan Rozenstein <ranro@mellanox.com>
      Fixes: 63826753 ("cma: Convert portspace IDRs to XArray")
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: NBart Van Assche <bvanassche@acm.org>
      Tested-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      061ccb52
  23. 29 3月, 2019 1 次提交
  24. 26 3月, 2019 1 次提交
  25. 20 2月, 2019 1 次提交
  26. 09 2月, 2019 3 次提交
  27. 06 2月, 2019 1 次提交
  28. 15 1月, 2019 1 次提交
  29. 09 1月, 2019 1 次提交