1. 05 8月, 2014 2 次提交
  2. 03 6月, 2014 1 次提交
    • O
      IB: Add a QP creation flag to use GFP_NOIO allocations · 09b93088
      Or Gerlitz 提交于
      This addresses a problem where NFS client writes over IPoIB connected
      mode may deadlock on memory allocation/writeback.
      
      The problem is not directly memory reclamation.  There is an indirect
      dependency between network filesystems writing back pages and
      ipoib_cm_tx_init() due to how a kworker is used.  Page reclaim cannot
      make forward progress until ipoib_cm_tx_init() succeeds and it is
      stuck in page reclaim itself waiting for network transmission.
      Ordinarily this situation may be avoided by having the caller use
      GFP_NOFS but ipoib_cm_tx_init() does not have that information.
      
      To address this, take a general approach and add a new QP creation
      flag that tells the low-level hardware driver to use GFP_NOIO for the
      memory allocations related to the new QP.
      
      Use the new flag in the ipoib connected mode path, and if the driver
      doesn't support it, re-issue the QP creation without the flag.
      Signed-off-by: NMel Gorman <mgorman@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      09b93088
  3. 14 5月, 2014 1 次提交
  4. 23 1月, 2014 1 次提交
    • M
      IPoIB: Report operstate consistently when brought up without a link · 437708c4
      Michal Schmidt 提交于
      After booting without a working link, "ip link" shows:
      
       5: mlx4_ib1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 2044 qdisc pfifo_fast
       state DOWN qlen 256
          ...
       7: mlx4_ib1.8003@mlx4_ib1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 2044 qdisc
       pfifo_fast state DOWN qlen 256
          ...
      
      Then after connecting and disconnecting the link, which should result
      in exactly the same state as before, it shows:
      
       5: mlx4_ib1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 2044 qdisc pfifo_fast
       state DOWN qlen 256
          ...
       7: mlx4_ib1.8003@mlx4_ib1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 2044 qdisc
       pfifo_fast state LOWERLAYERDOWN qlen 256
          ...
      
      Notice the (now correct) LOWERLAYERDOWN operstate shown for the
      mlx4_ib1.8003 interface. Ideally the identical state would be shown
      right after boot.
      
      The problem is related to the calling of netif_carrier_off() in
      network drivers.  For a long time it was known that doing
      netif_carrier_off() before registering the netdevice would result in
      the interface's operstate being shown as UNKNOWN if the device was
      brought up without a working link. This problem was fixed in commit
      8f4cccbb ('net: Set device operstate at registration time'), but
      still there remains the minor inconsistency demonstrated above.
      
      This patch fixes it by moving ipoib's call to netif_carrier_off() into
      the .ndo_open method, which is where network drivers ordinarily do it.
      With the patch when doing the same test as above, the operstate of
      mlx4_ib1.8003 is shown as LOWERLAYERDOWN right after boot.
      Signed-off-by: NMichal Schmidt <mschmidt@redhat.com>
      Acked-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      437708c4
  5. 15 1月, 2014 1 次提交
  6. 04 1月, 2014 1 次提交
  7. 09 11月, 2013 8 次提交
    • M
      IPoIB: lower NAPI weight · 7f1a3867
      Michal Schmidt 提交于
      Since commit 82dc3c63 ("net: introduce NAPI_POLL_WEIGHT")
      netif_napi_add() produces an error message if a NAPI poll weight
      greater than 64 is requested.
      
      Use the standard NAPI weight.
      Signed-off-by: NMichal Schmidt <mschmidt@redhat.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      7f1a3867
    • E
      IPoIB: Start multicast join process only on active ports · 94232d9c
      Erez Shitrit 提交于
      The driver starts the mcast_join task whenever the netdev interface is
      UP without relation to the underlying IB port state.
      
      Until the port state is ACTIVE all the join requests are irrelevant,
      and the IB core returns -EINVAL. So the user will see errors such as:
      "multicast join failed for ff12:401b:... , status -22".
      
      Instead, have ipoib_mcast_join_task() return when the port is not active.
      
      It will be called again when the port state is changed and the
      low-level driver triggers the IB_EVENT_PORT_ACTIVE event or the
      IB_EVENT_CLIENT_REREGISTER event.
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      94232d9c
    • E
      IPoIB: Add path query flushing in ipoib_ib_dev_cleanup · a39c52ab
      Erez Shitrit 提交于
      The path_rec_completion() callback may be invoked asynchronously even
      at the middle of "driver uninit" process.  This can lead to scheduling
      a task that tries to touch members of the priv object that are no
      longer valid.  For example the function cm_create_tx_qp can attempt to
      create qp with no valid priv->pd object.
      
      The following crash is one of the results:
      RIP: 0010:[<ffffffffa021bb47>]  [<ffffffffa021bb47>] ipoib_cm_create_tx_qp+0x57/0x90 [ib_ipoib]
      Process ipoib (pid: 5916, threadinfo ffff8803786e4000, task ffff8804150e1500)
      Stack:
      Call Trace:
      [<ffffffff81309ef0>] ? get_random_bytes+0x20/0x30
      [<ffffffffa021be2a>] ipoib_cm_tx_init+0xca/0x340 [ib_ipoib]
      [<ffffffffa021f765>] ipoib_cm_tx_start+0x215/0x3f0 [ib_ipoib]
      [<ffffffffa021f550>] ? ipoib_cm_tx_start+0x0/0x3f0 [ib_ipoib]
      [<ffffffff8108b2b0>] worker_thread+0x170/0x2a0
      [<ffffffff81090bf0>] ? autoremove_wake_function+0x0/0x40
      [<ffffffff8108b140>] ? worker_thread+0x0/0x2a0
      [<ffffffff81090886>] kthread+0x96/0xa0
      [<ffffffff8100c14a>] child_rip+0xa/0x20
      [<ffffffff810907f0>] ? kthread+0x0/0xa0
      [<ffffffff8100c140>] ? child_rip+0x0/0x20
      
      Fix that by flushing all pending path queries at this point.
      Signed-off-by: NAlex Markuze <markuze@mellanox.com>
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      a39c52ab
    • E
      IPoIB: Fix usage of uninitialized multicast objects · a9c8ba58
      Erez Shitrit 提交于
      The driver should avoid calling ib_sa_free_multicast on the mcast->mc
      object until it finishes its initialization state.  Otherwise we can
      crash when ipoib_mcast_dev_flush() attempts to use the uninitialized
      multicast object.
      
      Instead, only call wait_for_completion() for multicast entries that
      started the join process, meaning that ib_sa_join_multicast() finished.
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      a9c8ba58
    • E
      IPoIB: Avoid flushing the driver workqueue on dev_down · aede2501
      Erez Shitrit 提交于
      The driver should not flush the whole workqueue when only one work (the
      pkey poll one) needs to be cancelled.  Use cancel_delayed_work_sync()
      instead.
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      aede2501
    • E
      IPoIB: Fix deadlock between dev_change_flags() and __ipoib_dev_flush() · f47944cc
      Erez Shitrit 提交于
      When ipoib interface is going down it takes all of its children with
      it, under mutex.
      
      For each child, dev_change_flags() is called.  That function calls
      ipoib_stop() via the ndo, and causes flush of the workqueue.
      Sometimes in the workqueue an __ipoib_dev_flush work() is waiting and
      when invoked tries to get the same mutex, which leads to a deadlock,
      as seen below.
      
      The solution is to switch to rw-sem instead of mutex.
      
      The deadlock:
      [11028.165303]  [<ffffffff812b0977>] ? vgacon_scroll+0x107/0x2e0
      [11028.171844]  [<ffffffff814eaac5>] schedule_timeout+0x215/0x2e0
      [11028.178465]  [<ffffffff8105a5c3>] ? perf_event_task_sched_out+0x33/0x80
      [11028.185962]  [<ffffffff814ea743>] wait_for_common+0x123/0x180
      [11028.192491]  [<ffffffff8105fa40>] ? default_wake_function+0x0/0x20
      [11028.199504]  [<ffffffff814ea85d>] wait_for_completion+0x1d/0x20
      [11028.206224]  [<ffffffff8108b4f1>] flush_cpu_workqueue+0x61/0x90
      [11028.212948]  [<ffffffff8108b5a0>] ? wq_barrier_func+0x0/0x20
      [11028.219375]  [<ffffffff8108bfc4>] flush_workqueue+0x54/0x80
      [11028.225712]  [<ffffffffa05a0576>] ipoib_mcast_stop_thread+0x66/0x90 [ib_ipoib]
      [11028.233988]  [<ffffffffa059ccea>] ipoib_ib_dev_down+0x6a/0x100 [ib_ipoib]
      [11028.241678]  [<ffffffffa059849a>] ipoib_stop+0x8a/0x140 [ib_ipoib]
      [11028.248692]  [<ffffffff8142adf1>] dev_close+0x71/0xc0
      [11028.254447]  [<ffffffff8142a631>] dev_change_flags+0xa1/0x1d0
      [11028.261062]  [<ffffffffa059851b>] ipoib_stop+0x10b/0x140 [ib_ipoib]
      [11028.268172]  [<ffffffff8142adf1>] dev_close+0x71/0xc0
      [11028.273922]  [<ffffffff8142a631>] dev_change_flags+0xa1/0x1d0
      [11028.280452]  [<ffffffff8148f20b>] devinet_ioctl+0x5eb/0x6a0
      [11028.286786]  [<ffffffff814903b8>] inet_ioctl+0x88/0xa0
      [11028.292633]  [<ffffffff8141591a>] sock_ioctl+0x7a/0x280
      [11028.298576]  [<ffffffff81189012>] vfs_ioctl+0x22/0xa0
      [11028.304326]  [<ffffffff81140540>] ? unmap_region+0x110/0x130
      [11028.310756]  [<ffffffff811891b4>] do_vfs_ioctl+0x84/0x580
      [11028.316897]  [<ffffffff81189731>] sys_ioctl+0x81/0xa0
      
      and
      
      11028.017533]  [<ffffffff8105a5c3>] ? perf_event_task_sched_out+0x33/0x80
      [11028.025030]  [<ffffffff8100bb8e>] ? apic_timer_interrupt+0xe/0x20
      [11028.031945]  [<ffffffff814eb2ae>] __mutex_lock_slowpath+0x13e/0x180
      [11028.039053]  [<ffffffff814eb14b>] mutex_lock+0x2b/0x50
      [11028.044910]  [<ffffffffa059f7e7>] __ipoib_ib_dev_flush+0x37/0x210 [ib_ipoib]
      [11028.052894]  [<ffffffffa059fa00>] ? ipoib_ib_dev_flush_light+0x0/0x20 [ib_ipoib]
      [11028.061363]  [<ffffffffa059fa17>] ipoib_ib_dev_flush_light+0x17/0x20 [ib_ipoib]
      [11028.069738]  [<ffffffff8108b120>] worker_thread+0x170/0x2a0
      [11028.076068]  [<ffffffff81090990>] ? autoremove_wake_function+0x0/0x40
      [11028.083374]  [<ffffffff8108afb0>] ? worker_thread+0x0/0x2a0
      [11028.089709]  [<ffffffff81090626>] kthread+0x96/0xa0
      [11028.095266]  [<ffffffff8100c0ca>] child_rip+0xa/0x20
      [11028.100921]  [<ffffffff81090590>] ? kthread+0x0/0xa0
      [11028.106573]  [<ffffffff8100c0c0>] ? child_rip+0x0/0x20
      [11028.112423] INFO: task ifconfig:23640 blocked for more than 120 seconds.
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      f47944cc
    • T
      IPoIB: Change CM skb memory allocation to be non-atomic during init · 22252b4e
      Tal Alon 提交于
      Change CM skb memory allocation to use GFP_KERNEL when possible.
      
      During device init there's no need to use GFP_ATOMIC when allocating
      memory for the CM skbs -- use GFP_KERNEL instead.
      Signed-off-by: NTal Alon <talal@mellanox.com>
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      22252b4e
    • E
      IPoIB: Fix crash in dev_open error flow · c2bb5628
      Erez Shitrit 提交于
      If napi has never been enabled when calling ipoib_ib_dev_stop, a
      kernel crash occurs, because the verbs layer completion handler
      (ipoib_ib_completion) calls napi_schedule unconditionally.
      
      If the napi structure passed in the napi_schedule call has not
      been initialized, napi will crash.
      
      The cleanest solution is to simply enable napi before calling
      ipoib_ib_dev_stop in the dev_open error flow. (dev_stop then
      immediately disables napi).
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      c2bb5628
  8. 14 8月, 2013 1 次提交
    • J
      IPoIB: Fix race in deleting ipoib_neigh entries · 49b8e744
      Jim Foraker 提交于
      In several places, this snippet is used when removing neigh entries:
      
      	list_del(&neigh->list);
      	ipoib_neigh_free(neigh);
      
      The list_del() removes neigh from the associated struct ipoib_path, while
      ipoib_neigh_free() removes neigh from the device's neigh entry lookup
      table.  Both of these operations are protected by the priv->lock
      spinlock.  The table however is also protected via RCU, and so naturally
      the lock is not held when doing reads.
      
      This leads to a race condition, in which a thread may successfully look
      up a neigh entry that has already been deleted from neigh->list.  Since
      the previous deletion will have marked the entry with poison, a second
      list_del() on the object will cause a panic:
      
        #5 [ffff8802338c3c70] general_protection at ffffffff815108c5
           [exception RIP: list_del+16]
           RIP: ffffffff81289020  RSP: ffff8802338c3d20  RFLAGS: 00010082
           RAX: dead000000200200  RBX: ffff880433e60c88  RCX: 0000000000009e6c
           RDX: 0000000000000246  RSI: ffff8806012ca298  RDI: ffff880433e60c88
           RBP: ffff8802338c3d30   R8: ffff8806012ca2e8   R9: 00000000ffffffff
           R10: 0000000000000001  R11: 0000000000000000  R12: ffff8804346b2020
           R13: ffff88032a3e7540  R14: ffff8804346b26e0  R15: 0000000000000246
           ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0000
        #6 [ffff8802338c3d38] ipoib_cm_tx_handler at ffffffffa066fe0a [ib_ipoib]
        #7 [ffff8802338c3d98] cm_process_work at ffffffffa05149a7 [ib_cm]
        #8 [ffff8802338c3de8] cm_work_handler at ffffffffa05161aa [ib_cm]
        #9 [ffff8802338c3e38] worker_thread at ffffffff81090e10
       #10 [ffff8802338c3ee8] kthread at ffffffff81096c66
       #11 [ffff8802338c3f48] kernel_thread at ffffffff8100c0ca
      
      We move the list_del() into ipoib_neigh_free(), so that deletion happens
      only once, after the entry has been successfully removed from the lookup
      table.  This same behavior is already used in ipoib_del_neighs_by_gid()
      and __ipoib_reap_neigh().
      Signed-off-by: NJim Foraker <foraker1@llnl.gov>
      Reviewed-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: NJack Wang <jinpu.wang@profitbricks.com>
      Reviewed-by: NShlomo Pongratz <shlomop@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      49b8e744
  9. 01 8月, 2013 2 次提交
    • E
      IPoIB: Fix pkey change flow for virtualization environments · c2904141
      Erez Shitrit 提交于
      IPoIB's required behaviour w.r.t to the pkey used by the device is the following:
      
      - For "parent" interfaces (e.g ib0, ib1, etc) who are created
        automatically as a result of hot-plug events from the IB core, the
        driver needs to take whatever pkey vlaue it finds in index 0, and
        stick to that index.
      
      - For child interfaces (e.g ib0.8001, etc) created by admin directive,
        the driver needs to use and stick to the value provided during its
        creation.
      
      In SR-IOV environment its possible for the VF probe to take place
      before the cloud management software provisions the suitable pkey for
      the VF in the paravirtualed PKEY table index 0. When this is the case,
      the VF IB stack will find in index 0 an invalide pkey, which is all
      zeros.
      
      Moreover, the cloud managment can assign the pkey value at index 0 at
      any time of the guest life cycle.
      
      The correct behavior for IPoIB to address these requirements for
      parent interfaces is to use PKEY_CHANGE event as trigger to optionally
      re-init the device pkey value and re-create all the relevant resources
      accordingly, if the value of the pkey in index 0 has changed (from
      invalid to valid or from valid value X to invalid value Y).
      
      This patch enhances the heavy flushing code which is triggered by pkey
      change event, to behave correctly for parent devices. For child
      devices, the code remains the same, namely chases pkey value and not
      index.
      Signed-off-by: NErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      c2904141
    • O
      IPoIB: Make sure child devices use valid/proper pkeys · 3d790a4c
      Or Gerlitz 提交于
      Make sure that the IB invalid pkey (0x0000 or 0x8000) isn't used for
      child devices.
      
      Also, make sure to always set the full membership bit for the pkey of
      devices created by rtnl link ops.
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      3d790a4c
  10. 08 5月, 2013 1 次提交
  11. 18 4月, 2013 1 次提交
    • P
      IPoIB: add support for TIPC protocol · dc850b0e
      Patrick McHardy 提交于
      Support TIPC in the IPoIB driver. Since IPoIB now keeps track of its own
      neighbour entries and doesn't require the packet to have a dst_entry
      anymore, the only necessary changes are to:
      
      - not drop multicast TIPC packets because of the unknown ethernet type
      - handle unicast TIPC packets similar to IPv4/IPv6 unicast packets
      
      in ipoib_start_xmit().
      
      An alternative would be to remove all ethertype limitations since they're
      not necessary anymore, all TIPC needs to know about is ARP and RARP since
      it wants to always perform "path find", even if a path is already known.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dc850b0e
  12. 17 4月, 2013 2 次提交
  13. 23 3月, 2013 1 次提交
    • M
      IPoIB: Fix send lockup due to missed TX completion · 1ee9e2aa
      Mike Marciniszyn 提交于
      Commit f0dc117a ("IPoIB: Fix TX queue lockup with mixed UD/CM
      traffic") attempts to solve an issue where unprocessed UD send
      completions can deadlock the netdev.
      
      The patch doesn't fully resolve the issue because if more than half
      the tx_outstanding's were UD and all of the destinations are RC
      reachable, arming the CQ doesn't solve the issue.
      
      This patch uses the IB_CQ_REPORT_MISSED_EVENTS on the
      ib_req_notify_cq().  If the rc is above 0, the UD send cq completion
      callback is called directly to re-arm the send completion timer.
      
      This issue is seen in very large parallel filesystem deployments
      and the patch has been shown to correct the issue.
      
      Cc: <stable@vger.kernel.org>
      Reviewed-by: NDean Luick <dean.luick@intel.com>
      Signed-off-by: NMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      1ee9e2aa
  14. 26 2月, 2013 1 次提交
    • R
      IPoIB: Free ipoib neigh on path record failure so path rec queries are retried · f72dd566
      Roland Dreier 提交于
      If IPoIB fails to look up a path record (eg if it tries during an SM
      failover when one SM is dead but the new one hasn't taken over yet), the
      driver ends up with a neighbour structure but no address handle (AH).
      There's no mechanism to recover from this: any further packets sent to
      this destination will be silently dumped in ipoib_start_xmit().
      
      Fix this by freeing the neighbour structures when a path rec query
      fails, so that the next packet queued to be sent will trigger a new path
      record query.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      f72dd566
  15. 20 2月, 2013 3 次提交
  16. 06 2月, 2013 1 次提交
    • S
      IPoIB: Fix crash due to skb double destruct · 7e5a90c2
      Shlomo Pongratz 提交于
      After commit b13912bb ("IPoIB: Call skb_dst_drop() once skb is
      enqueued for sending"), using connected mode and running multithreaded
      iperf for long time, ie
      
          iperf -c <IP> -P 16 -t 3600
      
      results in a crash.
      
      After the above-mentioned patch, the driver is calling skb_orphan() and
      skb_dst_drop() after calling post_send() in ipoib_cm.c::ipoib_cm_send()
      (also in ipoib_ib.c::ipoib_send())
      
      The problem with this is, as is written in a comment in both routines,
      "it's entirely possible that the completion handler will run before we
      execute anything after the post_send()."  This leads to running the
      skb cleanup routines simultaneously in two different contexts.
      
      The solution is to always perform the skb_orphan() and skb_dst_drop()
      before queueing the send work request.  If an error occurs, then it
      will be no different than the regular case where dev_free_skb_any() in
      the completion path, which is assumed to be after these two routines.
      Signed-off-by: NShlomo Pongratz <shlomop@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      7e5a90c2
  17. 07 1月, 2013 1 次提交
  18. 20 12月, 2012 1 次提交
    • R
      IPoIB: Call skb_dst_drop() once skb is enqueued for sending · b13912bb
      Roland Dreier 提交于
      Currently, IPoIB delays collecting send completions for TX packets in
      order to batch work more efficiently.  It does skb_orphan() right after
      queuing the packets so that destructors run early, to avoid problems
      like holding socket send buffers for too long (since we might not
      collect a send completion until a long time after the packet is
      actually sent).
      
      However, IPoIB clears IFF_XMIT_DST_RELEASE because it actually looks
      at skb_dst() to update the PMTU when it gets a too-long packet.  This
      means that the packets sitting in the TX ring with uncollected send
      completions are holding a reference on the dst.  We've seen this lead
      to pathological behavior with respect to route and neighbour GC.  The
      easy fix for this is to call skb_dst_drop() when we call skb_orphan().
      
      Also, give packets sent via connected mode (CM) the same skb_orphan()
      / skb_dst_drop() treatment that packets sent via datagram mode get.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      b13912bb
  19. 03 10月, 2012 1 次提交
  20. 02 10月, 2012 1 次提交
    • O
      IB/ipoib: Add more rtnl_link_ops callbacks · 862096a8
      Or Gerlitz 提交于
      Add the rtnl_link_ops changelink and fill_info callbacks, through
      which the admin can now set/get the driver mode, etc policies.
      Maintain the proprietary sysfs entries only for legacy childs.
      
      For child devices, set dev->iflink to point to the parent
      device ifindex, such that user space tools can now correctly
      show the uplink relation as done for vlan, macvlan, etc
      devices. Pointed out by Patrick McHardy <kaber@trash.net>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      862096a8
  21. 01 10月, 2012 1 次提交
    • P
      IPoIB: Fix use-after-free of multicast object · bea1e22d
      Patrick McHardy 提交于
      Fix a crash in ipoib_mcast_join_task().  (with help from Or Gerlitz)
      
      Commit c8c2afe3 ("IPoIB: Use rtnl lock/unlock when changing device
      flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which
      is run from the ipoib_workqueue, and hence the workqueue can't be
      flushed from the context of ipoib_stop().
      
      In the current code, ipoib_stop() (which doesn't flush the workqueue)
      calls ipoib_mcast_dev_flush(), which goes and deletes all the
      multicast entries.  This takes place without any synchronization with
      a possible running instance of ipoib_mcast_join_task() for the same
      ipoib device, leading to a crash due to NULL pointer dereference.
      
      Fix this by making sure that the workqueue is flushed before
      ipoib_mcast_dev_flush() is called.  To make that possible, we move the
      RTNL-lock wrapped code to ipoib_mcast_join_finish().
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      bea1e22d
  22. 21 9月, 2012 1 次提交
    • O
      IB/ipoib: Add rtnl_link_ops support · 9baa0b03
      Or Gerlitz 提交于
      Add rtnl_link_ops to IPoIB, with the first usage being child device
      create/delete through them. Childs devices are now either legacy ones,
      created/deleted through the ipoib sysfs entries, or RTNL ones.
      
      Adding support for RTNL childs involved refactoring of ipoib_vlan_add
      which is now used by both the sysfs and the link_ops code.
      
      Also, added ndo_uninit entry to support calling unregister_netdevice_queue
      from the rtnl dellink entry. This required removal of calls to
      ipoib_dev_cleanup from the driver in flows which use unregister_netdevice,
      since the networking core will invoke ipoib_uninit which does exactly that.
      Signed-off-by: NErez Shitrit <erezsh@mellanox.co.il>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9baa0b03
  23. 13 9月, 2012 2 次提交
  24. 15 8月, 2012 2 次提交
  25. 30 7月, 2012 1 次提交
    • S
      IPoIB: Use a private hash table for path lookup in xmit path · b63b70d8
      Shlomo Pongratz 提交于
      Dave Miller <davem@davemloft.net> provided a detailed description of
      why the way IPoIB is using neighbours for its own ipoib_neigh struct
      is buggy:
      
          Any time an ipoib_neigh is changed, a sequence like the following is made:
      
          			spin_lock_irqsave(&priv->lock, flags);
          			/*
          			 * It's safe to call ipoib_put_ah() inside
          			 * priv->lock here, because we know that
          			 * path->ah will always hold one more reference,
          			 * so ipoib_put_ah() will never do more than
          			 * decrement the ref count.
          			 */
          			if (neigh->ah)
          				ipoib_put_ah(neigh->ah);
          			list_del(&neigh->list);
          			ipoib_neigh_free(dev, neigh);
          			spin_unlock_irqrestore(&priv->lock, flags);
          			ipoib_path_lookup(skb, n, dev);
      
          This doesn't work, because you're leaving a stale pointer to the freed up
          ipoib_neigh in the special neigh->ha pointer cookie.  Yes, it even fails
          with all the locking done to protect _changes_ to *ipoib_neigh(n), and
          with the code in ipoib_neigh_free() that NULLs out the pointer.
      
          The core issue is that read side calls to *to_ipoib_neigh(n) are not
          being synchronized at all, they are performed without any locking.  So
          whether we hold the lock or not when making changes to *ipoib_neigh(n)
          you still can have threads see references to freed up ipoib_neigh
          objects.
      
          	cpu 1			cpu 2
          	n = *ipoib_neigh()
          				*ipoib_neigh() = NULL
          				kfree(n)
          	n->foo == OOPS
      
          [..]
      
          Perhaps the ipoib code can have a private path database it manages
          entirely itself, which holds all the necessary information and is
          looked up by some generic key which is available easily at transmit
          time and does not involve generic neighbour entries.
      
      See <http://marc.info/?l=linux-rdma&m=132812793105624&w=2> and
      <http://marc.info/?l=linux-rdma&w=2&r=1&s=allows+references+to+freed+memory&q=b>
      for the full discussion.
      
      This patch aims to solve the race conditions found in the IPoIB driver.
      
      The patch removes the connection between the core networking neighbour
      structure and the ipoib_neigh structure.  In addition to avoiding the
      race described above, it allows us to handle SKBs carrying IP packets
      that don't have any associated neighbour.
      
      We add an ipoib_neigh hash table with N buckets where the key is the
      destination hardware address.  The ipoib_neigh is fetched from the
      hash table and instead of the stashed location in the neighbour
      structure. The hash table uses both RCU and reference counting to
      guarantee that no ipoib_neigh instance is ever deleted while in use.
      
      Fetching the ipoib_neigh structure instance from the hash also makes
      the special code in ipoib_start_xmit that handles remote and local
      bonding failover redundant.
      
      Aged ipoib_neigh instances are deleted by a garbage collection task
      that runs every M seconds and deletes every ipoib_neigh instance that
      was idle for at least 2*M seconds. The deletion is safe since the
      ipoib_neigh instances are protected using RCU and reference count
      mechanisms.
      
      The number of buckets (N) and frequency of running the GC thread (M),
      are taken from the exported arb_tbl.
      Signed-off-by: NShlomo Pongratz <shlomop@mellanox.com>
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      b63b70d8
  26. 17 7月, 2012 1 次提交
    • D
      net: Pass optional SKB and SK arguments to dst_ops->{update_pmtu,redirect}() · 6700c270
      David S. Miller 提交于
      This will be used so that we can compose a full flow key.
      
      Even though we have a route in this context, we need more.  In the
      future the routes will be without destination address, source address,
      etc. keying.  One ipv4 route will cover entire subnets, etc.
      
      In this environment we have to have a way to possess persistent storage
      for redirects and PMTU information.  This persistent storage will exist
      in the FIB tables, and that's why we'll need to be able to rebuild a
      full lookup flow key here.  Using that flow key will do a fib_lookup()
      and create/update the persistent entry.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6700c270