1. 27 7月, 2017 2 次提交
  2. 28 6月, 2017 4 次提交
  3. 16 6月, 2017 1 次提交
    • J
      networking: make skb_put & friends return void pointers · 4df864c1
      Johannes Berg 提交于
      It seems like a historic accident that these return unsigned char *,
      and in many places that means casts are required, more often than not.
      
      Make these functions (skb_put, __skb_put and pskb_put) return void *
      and remove all the casts across the tree, adding a (u8 *) cast only
      where the unsigned char pointer was used directly, all done with the
      following spatch:
      
          @@
          expression SKB, LEN;
          typedef u8;
          identifier fn = { skb_put, __skb_put };
          @@
          - *(fn(SKB, LEN))
          + *(u8 *)fn(SKB, LEN)
      
          @@
          expression E, SKB, LEN;
          identifier fn = { skb_put, __skb_put };
          type T;
          @@
          - E = ((T *)(fn(SKB, LEN)))
          + E = fn(SKB, LEN)
      
      which actually doesn't cover pskb_put since there are only three
      users overall.
      
      A handful of stragglers were converted manually, notably a macro in
      drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
      instances in net/bluetooth/hci_sock.c. In the former file, I also
      had to fix one whitespace problem spatch introduced.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4df864c1
  4. 25 5月, 2017 1 次提交
    • M
      scsi: bnx2fc: fix race condition in bnx2fc_get_host_stats() · c2dd893a
      Maurizio Lombardi 提交于
      If multiple tasks attempt to read the stats, it may happen that the
      start_req_done completion is re-initialized while still being used by
      another task, causing a list corruption.
      
      This patch fixes the bug by adding a mutex to serialize the calls to
      bnx2fc_get_host_stats().
      
      WARNING: at lib/list_debug.c:48 list_del+0x6e/0xa0() (Not tainted)
      Hardware name: PowerEdge R820
      list_del corruption. prev->next should be ffff882035627d90, but was ffff884069541588
      
      Pid: 40267, comm: perl Not tainted 2.6.32-642.3.1.el6.x86_64 #1
      Call Trace:
       [<ffffffff8107c691>] ? warn_slowpath_common+0x91/0xe0
       [<ffffffff8107c796>] ? warn_slowpath_fmt+0x46/0x60
       [<ffffffff812ad16e>] ? list_del+0x6e/0xa0
       [<ffffffff81547eed>] ? wait_for_common+0x14d/0x180
       [<ffffffff8106c4a0>] ? default_wake_function+0x0/0x20
       [<ffffffff81547fd3>] ? wait_for_completion_timeout+0x13/0x20
       [<ffffffffa05410b1>] ? bnx2fc_get_host_stats+0xa1/0x280 [bnx2fc]
       [<ffffffffa04cf630>] ? fc_stat_show+0x90/0xc0 [scsi_transport_fc]
       [<ffffffffa04cf8b6>] ? show_fcstat_tx_frames+0x16/0x20 [scsi_transport_fc]
       [<ffffffff8137c647>] ? dev_attr_show+0x27/0x50
       [<ffffffff8113b9be>] ? __get_free_pages+0xe/0x50
       [<ffffffff812170e1>] ? sysfs_read_file+0x111/0x200
       [<ffffffff8119a305>] ? vfs_read+0xb5/0x1a0
       [<ffffffff8119b0b6>] ? fget_light_pos+0x16/0x50
       [<ffffffff8119a651>] ? sys_read+0x51/0xb0
       [<ffffffff810ee1fe>] ? __audit_syscall_exit+0x25e/0x290
       [<ffffffff8100b0d2>] ? system_call_fastpath+0x16/0x1b
      Signed-off-by: NMaurizio Lombardi <mlombard@redhat.com>
      Acked-by: NChad Dupuis <chad.dupuis@cavium.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c2dd893a
  5. 07 2月, 2017 2 次提交
  6. 25 12月, 2016 1 次提交
  7. 09 11月, 2016 1 次提交
  8. 09 9月, 2016 2 次提交
  9. 14 7月, 2016 1 次提交
  10. 13 7月, 2016 1 次提交
    • S
      fcoe: convert to kworker · 4b9bc86d
      Sebastian Andrzej Siewior 提交于
      The driver creates its own per-CPU threads which are updated based on
      CPU hotplug events. It is also possible to use kworkers and remove some
      of the kthread infrastrucure.
      
      The code checked ->thread to decide if there is an active per-CPU
      thread. By using the kworker infrastructure this is no longer
      possible (or required). The thread pointer is saved in `kthread' instead
      of `thread' so anything trying to use thread is caught by the
      compiler. Currently only the bnx2fc driver is using struct fcoe_percpu_s
      and the kthread member.
      
      After a CPU went offline, we may still enqueue items on the "offline"
      CPU. This isn't much of a problem. The work will be done on a random
      CPU. The allocated crc_eof_page page won't be cleaned up. It is probably
      expected that the CPU comes up at some point so it should not be a
      problem. The crc_eof_page memory is released of course once the module
      is removed.
      
      This patch was only compile-tested due to -ENODEV.
      
      Cc: Vasu Dev <vasu.dev@intel.com>
      Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: fcoe-devel@open-fcoe.org
      Cc: linux-scsi@vger.kernel.org
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Tested-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      4b9bc86d
  11. 16 4月, 2016 3 次提交
  12. 24 2月, 2016 1 次提交
  13. 10 11月, 2015 5 次提交
  14. 27 10月, 2015 1 次提交
  15. 07 8月, 2015 1 次提交
  16. 04 12月, 2014 1 次提交
  17. 24 11月, 2014 2 次提交
  18. 21 11月, 2014 1 次提交
    • M
      bnx2fc: do not add shared skbs to the fcoe_rx_list · 01a4cc4d
      Maurizio Lombardi 提交于
      In some cases, the fcoe_rx_list may contains multiple instances
      of the same skb (the so called "shared skbs").
      
      the bnx2fc_l2_rcv thread is a loop that extracts a skb from the list,
      modifies (and destroys) its content and then proceed to the next one.
      The problem is that if the skb is shared, the remaining instances will
      be corrupted.
      
      The solution is to use skb_share_check() before adding the skb to the
      fcoe_rx_list.
      
      [ 6286.808725] ------------[ cut here ]------------
      [ 6286.808729] WARNING: at include/scsi/fc_frame.h:173 bnx2fc_l2_rcv_thread+0x425/0x450 [bnx2fc]()
      [ 6286.808748] Modules linked in: bnx2x(-) mdio dm_service_time bnx2fc cnic uio fcoe libfcoe 8021q garp stp mrp libfc llc scsi_transport_fc scsi_tgt sg iTCO_wdt iTCO_vendor_support coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul crc32c_intel e1000e ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper ptp cryptd hpilo serio_raw hpwdt lpc_ich pps_core ipmi_si pcspkr mfd_core ipmi_msghandler shpchp pcc_cpufreq mperf nfsd auth_rpcgss nfs_acl lockd sunrpc dm_multipath xfs libcrc32c ata_generic pata_acpi sd_mod crc_t10dif crct10dif_common mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit ata_piix drm_kms_helper ttm drm libata i2c_core hpsa dm_mirror dm_region_hash dm_log dm_mod [last unloaded: mdio]
      [ 6286.808750] CPU: 3 PID: 1304 Comm: bnx2fc_l2_threa Not tainted 3.10.0-121.el7.x86_64 #1
      [ 6286.808750] Hardware name: HP ProLiant DL120 G7, BIOS J01 07/01/2013
      [ 6286.808752]  0000000000000000 000000000b36e715 ffff8800deba1e00 ffffffff815ec0ba
      [ 6286.808753]  ffff8800deba1e38 ffffffff8105dee1 ffffffffa05618c0 ffff8801e4c81888
      [ 6286.808754]  ffffe8ffff663868 ffff8801f402b180 ffff8801f56bc000 ffff8800deba1e48
      [ 6286.808754] Call Trace:
      [ 6286.808759]  [<ffffffff815ec0ba>] dump_stack+0x19/0x1b
      [ 6286.808762]  [<ffffffff8105dee1>] warn_slowpath_common+0x61/0x80
      [ 6286.808763]  [<ffffffff8105e00a>] warn_slowpath_null+0x1a/0x20
      [ 6286.808765]  [<ffffffffa054f415>] bnx2fc_l2_rcv_thread+0x425/0x450 [bnx2fc]
      [ 6286.808767]  [<ffffffffa054eff0>] ? bnx2fc_disable+0x90/0x90 [bnx2fc]
      [ 6286.808769]  [<ffffffff81085aef>] kthread+0xcf/0xe0
      [ 6286.808770]  [<ffffffff81085a20>] ? kthread_create_on_node+0x140/0x140
      [ 6286.808772]  [<ffffffff815fc76c>] ret_from_fork+0x7c/0xb0
      [ 6286.808773]  [<ffffffff81085a20>] ? kthread_create_on_node+0x140/0x140
      [ 6286.808774] ---[ end trace c6cdb939184ccb4e ]---
      Signed-off-by: NMaurizio Lombardi <mlombard@redhat.com>
      Acked-by: NChad Dupuis <chad.dupuis@qlogic.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org
      01a4cc4d
  19. 12 11月, 2014 4 次提交
  20. 26 7月, 2014 1 次提交
  21. 25 6月, 2014 1 次提交
    • N
      bnx2fc: Improve stats update mechanism · d576a5e8
      Neil Horman 提交于
      Recently had this warning reported:
      
      [  290.489047] Call Trace:
      [  290.489053]  [<ffffffff8169efec>] dump_stack+0x19/0x1b
      [  290.489055]  [<ffffffff810ac7a9>] __might_sleep+0x179/0x230
      [  290.489057]  [<ffffffff816a4ad5>] mutex_lock_nested+0x55/0x520
      [  290.489061]  [<ffffffffa01b9905>] ? bnx2fc_l2_rcv_thread+0xc5/0x4c0 [bnx2fc]
      [  290.489065]  [<ffffffffa0174c1a>] fc_vport_id_lookup+0x3a/0xa0 [libfc]
      [  290.489068]  [<ffffffffa01b9a6c>] bnx2fc_l2_rcv_thread+0x22c/0x4c0 [bnx2fc]
      [  290.489070]  [<ffffffffa01b9840>] ? bnx2fc_vport_destroy+0x110/0x110 [bnx2fc]
      [  290.489073]  [<ffffffff8109e0cd>] kthread+0xed/0x100
      [  290.489075]  [<ffffffff8109dfe0>] ? insert_kthread_work+0x80/0x80
      [  290.489077]  [<ffffffff816b2fec>] ret_from_fork+0x7c/0xb0
      [  290.489078]  [<ffffffff8109dfe0>] ? insert_kthread_work+0x80/0x80
      
      Its due to the fact that we call a potentially sleeping function from the bnx2fc
      rcv path with preemption disabled (via the get_cpu call embedded in the per-cpu
      variable stats lookup in bnx2fc_l2_rcv_thread.
      
      Easy enough fix, we can just move the stats collection later in the function
      where we are sure we won't preempt or sleep.  This also allows us to not have to
      enable pre-emption when doing a per-cpu lookup, since we're certain not to get
      rescheduled.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Acked-by: NEddie Wai <eddie.wai@broadcom.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      d576a5e8
  22. 18 4月, 2014 1 次提交
  23. 20 3月, 2014 1 次提交
    • S
      scsi, bnx2fc: Fix CPU hotplug callback registration · 7229b6d0
      Srivatsa S. Bhat 提交于
      Subsystems that want to register CPU hotplug callbacks, as well as perform
      initialization for the CPUs that are already online, often do it as shown
      below:
      
      	get_online_cpus();
      
      	for_each_online_cpu(cpu)
      		init_cpu(cpu);
      
      	register_cpu_notifier(&foobar_cpu_notifier);
      
      	put_online_cpus();
      
      This is wrong, since it is prone to ABBA deadlocks involving the
      cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
      with CPU hotplug operations).
      
      Instead, the correct and race-free way of performing the callback
      registration is:
      
      	cpu_notifier_register_begin();
      
      	for_each_online_cpu(cpu)
      		init_cpu(cpu);
      
      	/* Note the use of the double underscored version of the API */
      	__register_cpu_notifier(&foobar_cpu_notifier);
      
      	cpu_notifier_register_done();
      
      Fix the bnx2fc code in scsi by using this latter form of callback
      registration.
      
      Cc: Eddie Wai <eddie.wai@broadcom.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7229b6d0
  24. 16 3月, 2014 1 次提交