1. 02 10月, 2013 1 次提交
    • N
      tcm_fc: Convert to per-cpu command map pre-allocation of ft_cmd · 5f544cfa
      Nicholas Bellinger 提交于
      This patch converts tcm_fc to use transport_init_session_tags()
      pre-allocation logic for struct ft_cmd descriptors using per-cpu
      session tag pooling in order to effectively avoid memory allocation
      + release for each received I/O.
      
      It adds percpu_ida_alloc() in ft_recv_cmd() to obtain an tag and
      locate ft_cmd from se_sess->sess_cmd_map[], and percpu_ida_free()
      in ft_free_cmd() to release the tag based upon se_cmd->map_tag id.
      
      It also uses a TCM_FC_DEFAULT_TAGS value of 512, that puts the
      per se_sess->sess_cmd_map allocation at ~360K on 64-bit.
      
      v2 changes:
      
        - Handle possible tag < 0 failure with GFP_ATOMIC
      
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      5f544cfa
  2. 25 4月, 2013 1 次提交
  3. 28 2月, 2013 1 次提交
    • S
      hlist: drop the node parameter from iterators · b67bfe0d
      Sasha Levin 提交于
      I'm not sure why, but the hlist for each entry iterators were conceived
      
              list_for_each_entry(pos, head, member)
      
      The hlist ones were greedy and wanted an extra parameter:
      
              hlist_for_each_entry(tpos, pos, head, member)
      
      Why did they need an extra pos parameter? I'm not quite sure. Not only
      they don't really need it, it also prevents the iterator from looking
      exactly like the list iterator, which is unfortunate.
      
      Besides the semantic patch, there was some manual work required:
      
       - Fix up the actual hlist iterators in linux/list.h
       - Fix up the declaration of other iterators based on the hlist ones.
       - A very small amount of places were using the 'node' parameter, this
       was modified to use 'obj->member' instead.
       - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
       properly, so those had to be fixed up manually.
      
      The semantic patch which is mostly the work of Peter Senna Tschudin is here:
      
      @@
      iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
      
      type T;
      expression a,c,d,e;
      identifier b;
      statement S;
      @@
      
      -T b;
          <+... when != b
      (
      hlist_for_each_entry(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue(a,
      - b,
      c) S
      |
      hlist_for_each_entry_from(a,
      - b,
      c) S
      |
      hlist_for_each_entry_rcu(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_rcu_bh(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue_rcu_bh(a,
      - b,
      c) S
      |
      for_each_busy_worker(a, c,
      - b,
      d) S
      |
      ax25_uid_for_each(a,
      - b,
      c) S
      |
      ax25_for_each(a,
      - b,
      c) S
      |
      inet_bind_bucket_for_each(a,
      - b,
      c) S
      |
      sctp_for_each_hentry(a,
      - b,
      c) S
      |
      sk_for_each(a,
      - b,
      c) S
      |
      sk_for_each_rcu(a,
      - b,
      c) S
      |
      sk_for_each_from
      -(a, b)
      +(a)
      S
      + sk_for_each_from(a) S
      |
      sk_for_each_safe(a,
      - b,
      c, d) S
      |
      sk_for_each_bound(a,
      - b,
      c) S
      |
      hlist_for_each_entry_safe(a,
      - b,
      c, d, e) S
      |
      hlist_for_each_entry_continue_rcu(a,
      - b,
      c) S
      |
      nr_neigh_for_each(a,
      - b,
      c) S
      |
      nr_neigh_for_each_safe(a,
      - b,
      c, d) S
      |
      nr_node_for_each(a,
      - b,
      c) S
      |
      nr_node_for_each_safe(a,
      - b,
      c, d) S
      |
      - for_each_gfn_sp(a, c, d, b) S
      + for_each_gfn_sp(a, c, d) S
      |
      - for_each_gfn_indirect_valid_sp(a, c, d, b) S
      + for_each_gfn_indirect_valid_sp(a, c, d) S
      |
      for_each_host(a,
      - b,
      c) S
      |
      for_each_host_safe(a,
      - b,
      c, d) S
      |
      for_each_mesh_entry(a,
      - b,
      c, d) S
      )
          ...+>
      
      [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
      [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
      [akpm@linux-foundation.org: checkpatch fixes]
      [akpm@linux-foundation.org: fix warnings]
      [akpm@linux-foudnation.org: redo intrusive kvm changes]
      Tested-by: NPeter Senna Tschudin <peter.senna@gmail.com>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b67bfe0d
  4. 11 1月, 2013 2 次提交
  5. 13 12月, 2012 1 次提交
    • Y
      target/tcm_fc: fix the lockdep warning due to inconsistent lock state · 9f4ad44b
      Yi Zou 提交于
      The lockdep warning below is in theory correct but it will be in really weird
      rare situation that ends up that deadlock since the tcm fc session is hashed
      based the rport id. Nonetheless, the complaining below is about rcu callback
      that does the transport_deregister_session() is happening in softirq, where
      transport_register_session() that happens earlier is not. This triggers the
      lockdep warning below. So, just fix this to make lockdep happy by disabling
      the soft irq before calling transport_register_session() in ft_prli.
      
      BTW, this was found in FCoE VN2VN over two VMs, couple of create and destroy
      would get this triggered.
      
      v1: was enforcing register to be in softirq context which was not righ. See,
      http://www.spinics.net/lists/target-devel/msg03614.html
      
      v2: following comments from Roland&Nick (thanks), it seems we don't have to
      do transport_deregister_session() in rcu callback, so move it into ft_sess_free()
      but still do kfree() of the corresponding ft_sess struct in rcu callback to
      make sure the ft_sess is not freed till the rcu callback.
      
      ...
      [ 1328.370592] scsi2 : FCoE Driver
      [ 1328.383429] fcoe: No FDMI support.
      [ 1328.384509] host2: libfc: Link up on port (000000)
      [ 1328.934229] host2: Assigned Port ID 00a292
      [ 1357.232132] host2: rport 00a393: Remove port
      [ 1357.232568] host2: rport 00a393: Port sending LOGO from Ready state
      [ 1357.233692] host2: rport 00a393: Delete port
      [ 1357.234472] host2: rport 00a393: work event 3
      [ 1357.234969] host2: rport 00a393: callback ev 3
      [ 1357.235979] host2: rport 00a393: Received a LOGO response closed
      [ 1357.236706] host2: rport 00a393: work delete
      [ 1357.237481]
      [ 1357.237631] =================================
      [ 1357.238064] [ INFO: inconsistent lock state ]
      [ 1357.238450] 3.7.0-rc7-yikvm+ #3 Tainted: G           O
      [ 1357.238450] ---------------------------------
      [ 1357.238450] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
      [ 1357.238450] ksoftirqd/0/3 [HC0[0]:SC1[1]:HE0:SE0] takes:
      [ 1357.238450]  (&(&se_tpg->session_lock)->rlock){+.?...}, at: [<ffffffffa01eacd4>] transport_deregister_session+0x41/0x148 [target_core_mod]
      [ 1357.238450] {SOFTIRQ-ON-W} state was registered at:
      [ 1357.238450]   [<ffffffff810834f5>] mark_held_locks+0x6d/0x95
      [ 1357.238450]   [<ffffffff8108364a>] trace_hardirqs_on_caller+0x12d/0x197
      [ 1357.238450]   [<ffffffff810836c1>] trace_hardirqs_on+0xd/0xf
      [ 1357.238450]   [<ffffffff8149caba>] _raw_spin_unlock_irq+0x2d/0x45
      [ 1357.238450]   [<ffffffffa01e8d10>] __transport_register_session+0xb8/0x122 [target_core_mod]
      [ 1357.238450]   [<ffffffffa01e8dbe>] transport_register_session+0x44/0x5a [target_core_mod]
      [ 1357.238450]   [<ffffffffa018e32c>] ft_prli+0x1e3/0x275 [tcm_fc]
      [ 1357.238450]   [<ffffffffa0160e8d>] fc_rport_recv_req+0x95e/0xdc5 [libfc]
      [ 1357.238450]   [<ffffffffa015be88>] fc_lport_recv_els_req+0xc4/0xd5 [libfc]
      [ 1357.238450]   [<ffffffffa015c778>] fc_lport_recv_req+0x12f/0x18f [libfc]
      [ 1357.238450]   [<ffffffffa015a6d7>] fc_exch_recv+0x8ba/0x981 [libfc]
      [ 1357.238450]   [<ffffffffa0176d7a>] fcoe_percpu_receive_thread+0x47a/0x4e2 [fcoe]
      [ 1357.238450]   [<ffffffff810549f1>] kthread+0xb1/0xb9
      [ 1357.238450]   [<ffffffff814a40ec>] ret_from_fork+0x7c/0xb0
      [ 1357.238450] irq event stamp: 275411
      [ 1357.238450] hardirqs last  enabled at (275410): [<ffffffff810bb6a0>] rcu_process_callbacks+0x229/0x42a
      [ 1357.238450] hardirqs last disabled at (275411): [<ffffffff8149c2f7>] _raw_spin_lock_irqsave+0x22/0x8e
      [ 1357.238450] softirqs last  enabled at (275394): [<ffffffff8103d669>] __do_softirq+0x246/0x26f
      [ 1357.238450] softirqs last disabled at (275399): [<ffffffff8103d6bb>] run_ksoftirqd+0x29/0x62
      [ 1357.238450]
      [ 1357.238450] other info that might help us debug this:
      [ 1357.238450]  Possible unsafe locking scenario:
      [ 1357.238450]
      [ 1357.238450]        CPU0
      [ 1357.238450]        ----
      [ 1357.238450]   lock(&(&se_tpg->session_lock)->rlock);
      [ 1357.238450]   <Interrupt>
      [ 1357.238450]     lock(&(&se_tpg->session_lock)->rlock);
      [ 1357.238450]
      [ 1357.238450]  *** DEADLOCK ***
      [ 1357.238450]
      [ 1357.238450] no locks held by ksoftirqd/0/3.
      [ 1357.238450]
      [ 1357.238450] stack backtrace:
      [ 1357.238450] Pid: 3, comm: ksoftirqd/0 Tainted: G           O 3.7.0-rc7-yikvm+ #3
      [ 1357.238450] Call Trace:
      [ 1357.238450]  [<ffffffff8149399a>] print_usage_bug+0x1f5/0x206
      [ 1357.238450]  [<ffffffff8100da59>] ? save_stack_trace+0x2c/0x49
      [ 1357.238450]  [<ffffffff81082aae>] ? print_irq_inversion_bug.part.14+0x1ae/0x1ae
      [ 1357.238450]  [<ffffffff81083336>] mark_lock+0x106/0x258
      [ 1357.238450]  [<ffffffff81084e34>] __lock_acquire+0x2e7/0xe53
      [ 1357.238450]  [<ffffffff8102903d>] ? pvclock_clocksource_read+0x48/0xb4
      [ 1357.238450]  [<ffffffff810ba6a3>] ? rcu_process_gp_end+0xc0/0xc9
      [ 1357.238450]  [<ffffffffa01eacd4>] ? transport_deregister_session+0x41/0x148 [target_core_mod]
      [ 1357.238450]  [<ffffffff81085ef1>] lock_acquire+0x119/0x143
      [ 1357.238450]  [<ffffffffa01eacd4>] ? transport_deregister_session+0x41/0x148 [target_core_mod]
      [ 1357.238450]  [<ffffffff8149c329>] _raw_spin_lock_irqsave+0x54/0x8e
      [ 1357.238450]  [<ffffffffa01eacd4>] ? transport_deregister_session+0x41/0x148 [target_core_mod]
      [ 1357.238450]  [<ffffffffa01eacd4>] transport_deregister_session+0x41/0x148 [target_core_mod]
      [ 1357.238450]  [<ffffffff810bb6a0>] ? rcu_process_callbacks+0x229/0x42a
      [ 1357.238450]  [<ffffffffa018ddc5>] ft_sess_rcu_free+0x17/0x24 [tcm_fc]
      [ 1357.238450]  [<ffffffffa018ddae>] ? ft_sess_free+0x1b/0x1b [tcm_fc]
      [ 1357.238450]  [<ffffffff810bb6d7>] rcu_process_callbacks+0x260/0x42a
      [ 1357.238450]  [<ffffffff8103d55d>] __do_softirq+0x13a/0x26f
      [ 1357.238450]  [<ffffffff8149b34e>] ? __schedule+0x65f/0x68e
      [ 1357.238450]  [<ffffffff8103d6bb>] run_ksoftirqd+0x29/0x62
      [ 1357.238450]  [<ffffffff8105c83c>] smpboot_thread_fn+0x1a5/0x1aa
      [ 1357.238450]  [<ffffffff8105c697>] ? smpboot_unregister_percpu_thread+0x47/0x47
      [ 1357.238450]  [<ffffffff810549f1>] kthread+0xb1/0xb9
      [ 1357.238450]  [<ffffffff8149b49d>] ? wait_for_common+0xbb/0x10a
      [ 1357.238450]  [<ffffffff81054940>] ? __init_kthread_worker+0x59/0x59
      [ 1357.238450]  [<ffffffff814a40ec>] ret_from_fork+0x7c/0xb0
      [ 1357.238450]  [<ffffffff81054940>] ? __init_kthread_worker+0x59/0x59
      [ 1417.440099]  rport-2:0-0: blocked FC remote port time out: removing rport
      Signed-off-by: NYi Zou <yi.zou@intel.com>
      Cc: Open-FCoE <devel@open-fcoe.org>
      Cc: Nicholas A. Bellinger <nab@risingtidesystems.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9f4ad44b
  6. 18 9月, 2012 1 次提交
  7. 21 8月, 2012 1 次提交
  8. 07 7月, 2012 1 次提交
  9. 16 3月, 2012 1 次提交
  10. 11 3月, 2012 1 次提交
  11. 22 2月, 2012 1 次提交
  12. 14 12月, 2011 1 次提交
  13. 11 10月, 2011 1 次提交
  14. 15 9月, 2011 1 次提交
  15. 22 7月, 2011 1 次提交
    • A
      target: Follow up core updates from AGrover and HCH (round 4) · 6708bb27
      Andy Grover 提交于
      This patch contains the squashed version of forth round series cleanups
      from Andy and Christoph following the post heavy lifting in the preceeding:
      'Eliminate usage of struct se_mem' and 'Make all control CDBs scatter-gather'
      changes.  This also includes a conversion of target core and the v3.0
      mainline fabric modules (loopback and tcm_fc) to use pr_debug and the
      CONFIG_DYNAMIC_DEBUG infrastructure!
      
      These have been squashed into this third and final round for v3.1.
      
      target: Remove ifdeffed code in t_g_process_write
      target: Remove direct ramdisk code
      target: Rename task_sg_num to task_sg_nents
      target: Remove custom debug macros for pr_debug. Use pr_err().
      target: Remove custom debug macros in mainline fabrics
      target: Set WSNZ=1 in block limits VPD. Abort if WRITE_SAME sectors = 0
      target: Remove transport do_se_mem_map callback
      target: Further simplify transport_free_pages
      target: Redo task allocation return value handling
      target: Remove extra parentheses
      target: change alloc_task call to take *cdb, not *cmd
      
      (nab: Fix bogus struct file assignments in fd_do_readv and fd_do_writev)
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6708bb27
  16. 24 6月, 2011 2 次提交
  17. 20 6月, 2011 1 次提交
  18. 17 5月, 2011 1 次提交