1. 13 2月, 2019 2 次提交
    • J
      s390/qeth: consolidate filling of low-level cmd length fields · c2153277
      Julian Wiedmann 提交于
      The code to fill the IPA length fields is duplicated three times across
      the driver:
      1. qeth_send_ipa_cmd() sets IPA_CMD_LENGTH, which matches the defaults
         in the IPA_PDU_HEADER template.
      2. for OSN, qeth_osn_send_ipa_cmd() bypasses this logic and inserts the
         length passed by the caller.
      3. SNMP commands (that can outgrow IPA_CMD_LENGTH) have their own way
         of setting the length fields, via qeth_send_ipa_snmp_cmd().
      
      Consolidate this into qeth_prepare_ipa_cmd(), which all originators of
      IPA cmds already call during setup of their cmd. Let qeth_send_ipa_cmd()
      pull the length from the cmd instead of hard-coding IPA_CMD_LENGTH.
      
      For now, the SNMP code still needs to fix-up its length fields manually.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c2153277
    • J
      s390/qeth: reduce data length for ARP cache query · 84dbea46
      Julian Wiedmann 提交于
      qeth_l3_query_arp_cache_info() indicates a data length that's much
      larger than the actual length of its request (ie. the value passed to
      qeth_get_setassparms_cmd()). The confusion presumably comes from the
      fact that the cmd _response_ can be quite large - but that's no concern
      for the initial request IO.
      
      Fixing this up allows us to use the generic qeth_send_ipa_cmd()
      infrastructure.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      84dbea46
  2. 05 2月, 2019 4 次提交
  3. 29 1月, 2019 1 次提交
    • S
      scsi: zfcp: fix sysfs block queue limit output for max_segment_size · b6319569
      Steffen Maier 提交于
      Since v2.6.35 commit 68322984 ("[SCSI] zfcp: Report scatter-gather
      limits to SCSI and block layer"), zfcp set dma_parms.max_segment_size ==
      PAGE_SIZE (but without using the setter dma_set_max_seg_size()) and
      scsi_host_template.dma_boundary == PAGE_SIZE - 1.
      
      v5.0-rc1 commit 50c2e910 ("scsi: introduce a max_segment_size
      host_template parameters") introduced a new field
      scsi_host_template.max_segment_size. If an LLDD such as zfcp does not set
      it, scsi_host_alloc() uses BLK_MAX_SEGMENT_SIZE = 65536 for
      Scsi_Host.max_segment_size. __scsi_init_queue() announced the minimum of
      Scsi_Host.max_segment_size and dma_parms.max_segment_size to the block
      layer. For zfcp: min(65536, 4096) == 4096 which was still good.
      
      v5.0 commit a8cf59a6 ("scsi: communicate max segment size to the DMA
      mapping code") announces Scsi_Host.max_segment_size to the block layer and
      overwrites dma_parms.max_segment_size with Scsi_Host.max_segment_size.  For
      zfcp dma_parms.max_segment_size == Scsi_Host.max_segment_size == 65536
      which is also reflected in block queue limits.
      
      $ cd /sys/bus/ccw/drivers/zfcp
      $ cd 0.0.3c40/host5/rport-5:0-4/target5:0:4/5:0:4:10/block/sdi/queue
      $ cat max_segment_size
      65536
      
      Zfcp I/O still works because dma_boundary implicitly still keeps the
      effective max segment size <= PAGE_SIZE.  However, dma_boundary does not
      seem visible to user space, but max_segment_size is visible and shows a
      misleading wrong value.  Fix it and inherit the stable tag of a8cf59a6.
      
      Devices on our bus ccw support DMA but no DMA mapping. Of multiple device
      types on the ccw bus, only zfcp needs dma_parms for SCSI limits.  So, leave
      dma_parms setup in zfcp and do not move it to the bus.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Fixes: 50c2e910 ("scsi: introduce a max_segment_size host_template parameters")
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b6319569
  4. 26 1月, 2019 8 次提交
  5. 15 1月, 2019 1 次提交
  6. 12 1月, 2019 1 次提交
    • G
      s390/smp: fix CPU hotplug deadlock with CPU rescan · b7cb707c
      Gerald Schaefer 提交于
      smp_rescan_cpus() is called without the device_hotplug_lock, which can lead
      to a dedlock when a new CPU is found and immediately set online by a udev
      rule.
      
      This was observed on an older kernel version, where the cpu_hotplug_begin()
      loop was still present, and it resulted in hanging chcpu and systemd-udev
      processes. This specific deadlock will not show on current kernels. However,
      there may be other possible deadlocks, and since smp_rescan_cpus() can still
      trigger a CPU hotplug operation, the device_hotplug_lock should be held.
      
      For reference, this was the deadlock with the old cpu_hotplug_begin() loop:
      
              chcpu (rescan)                       systemd-udevd
      
       echo 1 > /sys/../rescan
       -> smp_rescan_cpus()
       -> (*) get_online_cpus()
          (increases refcount)
       -> smp_add_present_cpu()
          (new CPU found)
       -> register_cpu()
       -> device_add()
       -> udev "add" event triggered -----------> udev rule sets CPU online
                                               -> echo 1 > /sys/.../online
                                               -> lock_device_hotplug_sysfs()
                                                  (this is missing in rescan path)
                                               -> device_online()
                                               -> (**) device_lock(new CPU dev)
                                               -> cpu_up()
                                               -> cpu_hotplug_begin()
                                                  (loops until refcount == 0)
                                                  -> deadlock with (*)
       -> bus_probe_device()
       -> device_attach()
       -> device_lock(new CPU dev)
          -> deadlock with (**)
      
      Fix this by taking the device_hotplug_lock in the CPU rescan path.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      b7cb707c
  7. 08 1月, 2019 1 次提交
  8. 19 12月, 2018 1 次提交
  9. 13 12月, 2018 4 次提交
  10. 12 12月, 2018 1 次提交
  11. 08 12月, 2018 3 次提交
    • S
      scsi: zfcp: improve kdoc for return of zfcp_status_read_refill() · 71714553
      Steffen Maier 提交于
      Complements
      
      v2.6.35 commit 64deb6ef ("[SCSI] zfcp: Use status_read_buf_num
      provided by FCP channel") which replaced the hardcoded 16 with a
      variable value
      
      Also complements already existing fixups for above commit
      
      v2.6.35 commit 8d88cf3f ("[SCSI] zfcp: Update status read mempool")
      v3.10   commit 9edf7d75 ("[SCSI] zfcp: status read buffers on first adapter open with link down")
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: NJens Remus <jremus@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      71714553
    • S
      scsi: zfcp: fix posting too many status read buffers leading to adapter shutdown · 60a161b7
      Steffen Maier 提交于
      Suppose adapter (open) recovery is between opened QDIO queues and before
      (the end of) initial posting of status read buffers (SRBs). This time
      window can be seconds long due to FSF_PROT_HOST_CONNECTION_INITIALIZING
      causing by design looping with exponential increase sleeps in the function
      performing exchange config data during recovery
      [zfcp_erp_adapter_strat_fsf_xconf()]. Recovery triggered by local link up.
      
      Suppose an event occurs for which the FCP channel would send an unsolicited
      notification to zfcp by means of a previously posted SRB.  We saw it with
      local cable pull (link down) in multi-initiator zoning with multiple
      NPIV-enabled subchannels of the same shared FCP channel.
      
      As soon as zfcp_erp_adapter_strategy_open_fsf() starts posting the initial
      status read buffers from within the adapter's ERP thread, the channel does
      send an unsolicited notification.
      
      Since v2.6.27 commit d26ab06e ("[SCSI] zfcp: receiving an unsolicted
      status can lead to I/O stall"), zfcp_fsf_status_read_handler() schedules
      adapter->stat_work to re-fill the just consumed SRB from a work item.
      
      Now the ERP thread and the work item post SRBs in parallel.  Both contexts
      call the helper function zfcp_status_read_refill().  The tracking of
      missing (to be posted / re-filled) SRBs is not thread-safe due to separate
      atomic_read() and atomic_dec(), in order to depend on posting
      success. Hence, both contexts can see
      atomic_read(&adapter->stat_miss) == 1. One of the two contexts posts
      one too many SRB. Zfcp gets QDIO_ERROR_SLSB_STATE on the output queue
      (trace tag "qdireq1") leading to zfcp_erp_adapter_shutdown() in
      zfcp_qdio_handler_error().
      
      An obvious and seemingly clean fix would be to schedule stat_work from the
      ERP thread and wait for it to finish. This would serialize all SRB
      re-fills. However, we already have another work item wait on the ERP
      thread: adapter->scan_work runs zfcp_fc_scan_ports() which calls
      zfcp_fc_eval_gpn_ft(). The latter calls zfcp_erp_wait() to wait for all the
      open port recoveries during zfcp auto port scan, but in fact it waits for
      any pending recovery including an adapter recovery. This approach leads to
      a deadlock.  [see also v3.19 commit 18f87a67 ("zfcp: auto port scan
      resiliency"); v2.6.37 commit d3e1088d
      ("[SCSI] zfcp: No ERP escalation on gpn_ft eval");
      v2.6.28 commit fca55b6f
      ("[SCSI] zfcp: fix deadlock between wq triggered port scan and ERP")
      fixing v2.6.27 commit c57a39a4
      ("[SCSI] zfcp: wait until adapter is finished with ERP during auto-port");
      v2.6.27 commit cc8c2829
      ("[SCSI] zfcp: Automatically attach remote ports")]
      
      Instead make the accounting of missing SRBs atomic for parallel execution
      in both the ERP thread and adapter->stat_work.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Fixes: d26ab06e ("[SCSI] zfcp: receiving an unsolicted status can lead to I/O stall")
      Cc: <stable@vger.kernel.org> #2.6.27+
      Reviewed-by: NJens Remus <jremus@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      60a161b7
    • F
      scsi: zfcp: make DIX experimental, disabled, and independent of DIF · 636db60b
      Fedor Loshakov 提交于
      Introduce separate zfcp module parameters to individually select support
      for: DIF which should work (zfcp.dif, which used to be DIF+DIX, disabled)
      or DIX+DIF which can cause trouble (zfcp.dix, new, disabled).
      
      If DIX is enabled, we warn on zfcp driver initialization.  As before, this
      also reduces the maximum I/O request size to half, to support the worst
      case of merged single sector requests with one protection data scatter
      gather element per sector. This can impact the maximum throughput.
      
      In DIF-only mode (zfcp.dif=1 zfcp.dix=0), we can use the full maximum I/O
      request size as there is no protection data for zfcp.
      Signed-off-by: NSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: NFedor Loshakov <loshakov@linux.ibm.com>
      Reviewed-by: NJens Remus <jremus@linux.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      636db60b
  12. 07 12月, 2018 3 次提交
  13. 30 11月, 2018 2 次提交
  14. 29 11月, 2018 1 次提交
    • J
      s390/qeth: fix length check in SNMP processing · 9a764c1e
      Julian Wiedmann 提交于
      The response for a SNMP request can consist of multiple parts, which
      the cmd callback stages into a kernel buffer until all parts have been
      received. If the callback detects that the staging buffer provides
      insufficient space, it bails out with error.
      This processing is buggy for the first part of the response - while it
      initially checks for a length of 'data_len', it later copies an
      additional amount of 'offsetof(struct qeth_snmp_cmd, data)' bytes.
      
      Fix the calculation of 'data_len' for the first part of the response.
      This also nicely cleans up the memcpy code.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9a764c1e
  15. 27 11月, 2018 2 次提交
    • H
      s390/zcrypt: reinit ap queue state machine during device probe · 104f708f
      Harald Freudenberger 提交于
      Until the vfio-ap driver came into live there was a well known
      agreement about the way how ap devices are initialized and their
      states when the driver's probe function is called.
      
      However, the vfio device driver when receiving an ap queue device does
      additional resets thereby removing the registration for interrupts for
      the ap device done by the ap bus core code. So when later the vfio
      driver releases the device and one of the default zcrypt drivers takes
      care of the device the interrupt registration needs to get
      renewed. The current code does no renew and result is that requests
      send into such a queue will never see a reply processed - the
      application hangs.
      
      This patch adds a function which resets the aq queue state machine for
      the ap queue device and triggers the walk through the initial states
      (which are reset and registration for interrupts). This function is
      now called before the driver's probe function is invoked.
      
      When the association between driver and device is released, the
      driver's remove function is called. The current implementation calls a
      ap queue function ap_queue_remove(). This invokation has been moved to
      the ap bus function to make the probe / remove pair for ap bus and
      drivers more symmetric.
      
      Fixes: 7e0bdbe5 ("s390/zcrypt: AP bus support for alternate driver(s)")
      Cc: stable@vger.kernel.org # 4.19+
      Signed-off-by: NHarald Freudenberger <freude@linux.ibm.com>
      Reviewd-by: NTony Krowiak <akrowiak@linux.ibm.com>
      Reviewd-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      104f708f
    • T
      virtio_ring: disable packed ring on unsupported transports · 3a814fdf
      Tiwei Bie 提交于
      Currently, ccw, vop and remoteproc need some legacy virtio
      APIs to create or access virtio rings, which are not supported
      by packed ring. So disable packed ring on these transports
      for now.
      Signed-off-by: NTiwei Bie <tiwei.bie@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3a814fdf
  16. 16 11月, 2018 5 次提交