1. 20 8月, 2010 2 次提交
    • S
      firewire: sbp2: fix stall with "Unsolicited response" · a481e97d
      Stefan Richter 提交于
      Fix I/O stalls with some 4-bay RAID enclosures which are based on
      OXUF936QSE:
        - Onnto dataTale RSM4QO, old firmware (not anymore with current
          firmware),
        - inXtron Hydra Super-S LCM, old as well as current firmware
      when used in RAID-5 mode, perhaps also in other RAID modes.
      
      The stalls happen during heavy or moderate disk traffic in periods that
      are a multiple of 5 minutes, roughly twice per hour.  They are caused
      by the target responding too late to an ORB_Pointer register write:
      The target responds after Split_Timeout, hence firewire-core cancels
      the transaction, and firewire-sbp2 fails the SCSI request.  The SCSI
      core retries the request, that fails again (and again), hence SCSI core
      calls firewire-sbp2's abort handler (and even the Management_Agent
      register write in the abort handler has the transaction timeout
      problem).
      
      During all that, the process which issued the I/O is stalled in I/O
      wait state.
      
      Meanwhile, the target actually acts on the first failed SCSI request:
      It responds to the ORB_Pointer write later (seen in the kernel log as
      "firewire_core: Unsolicited response") and also finishes the SCSI
      request with proper status (seen in the kernel log as "firewire_sbp2:
      status write for unknown orb").
      
      So let's just ignore RCODE_CANCELLED in the transaction callback and
      wait for the target to complete the ORB nevertheless.  This requires
      a small modification is sbp2_cancel_orbs(); it now needs to call
      orb->callback() regardless whether fw_cancel_transaction() found the
      transaction unfinished or finished.
      
      A different solution is to increase Split_Timeout on the local node.
      (Tested: 2000ms timeout; maybe 1000ms or something like that works too.
      200ms is insufficient.  Standard is 100ms.)  However, I rather not do
      this because any software on any node could change the Split_Timeout to
      something unsuitable.  Or such a large Split_Timeout may be undesirable
      for other purposes.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      a481e97d
    • S
      firewire: sbp2: fix memory leak in sbp2_cancel_orbs or at send error · 6c74340b
      Stefan Richter 提交于
      When an ORB was canceled (Command ORB i.e. SCSI request timed out, or
      Management ORB timed out), or there was a send error in the initial
      transaction, we missed to drop one of the ORB's references and thus
      leaked memory.
      
      Background:
      In total, we hold 3 references to each Operation Request Block:
        - 1 during sbp2_scsi_queuecommand() or sbp2_send_management_orb()
          respectively,
        - 1 for the duration of the write transaction to the ORB_Pointer or
          Management_Agent register of the target,
        - 1 for as long as the ORB stays within the lu->orb_list, until
          the ORB is unlinked from the list and the orb->callback was
          executed.
      
      The latter one of these 3 references is finished
        - normally by sbp2_status_write() when the target wrote status
          for a pending ORB,
        - or by sbp2_cancel_orbs() in case of an ORB time-out,
        - or by complete_transaction() in case of a send error.
      Of them, the latter two lacked the kref_put.
      
      Add the missing kref_put()s.  Add comments to the gets and puts of
      references for transaction callbacks and ORB callbacks so that it is
      easier to see what is supposed to happen.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6c74340b
  2. 21 6月, 2010 1 次提交
    • S
      firewire: remove an unused function argument · 33e553fe
      Stefan Richter 提交于
      void (*fw_address_callback_t)(..., int speed, ...) is the speed that a
      remote node chose to transmit a request to us.  In case of split
      transactions, firewire-core will transmit the response at that speed.
      
      Upper layer drivers on the other hand (firewire-net, -sbp2, firedtv, and
      userspace drivers) cannot do anything useful with that speed datum,
      except log it for debug purposes.  But data that is merely potentially
      (not even actually) used for debug purposes does not belong into the API.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      33e553fe
  3. 19 6月, 2010 1 次提交
  4. 26 2月, 2010 1 次提交
  5. 30 12月, 2009 1 次提交
  6. 15 10月, 2009 2 次提交
    • S
      firewire: normalize style of queue_work wrappers · 9fb551bf
      Stefan Richter 提交于
      A few stylistic changes to unify some code patterns in the subsystem:
      
        - The similar queue_delayed_work helpers fw_schedule_bm_work,
          schedule_iso_resource, and sbp2_queue_work now have the same call
          convention.
        - Two conditional calls of schedule_iso_resource are factored into
          another small helper.
        - An sbp2_target_get helper is added as counterpart to
          sbp2_target_put.
      
      Object size of firewire-core is decreased a little bit, object size of
      firewire-sbp2 remains unchanged.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      9fb551bf
    • S
      firewire: sbp2: provide fallback if mgt_ORB_timeout is missing · eaf76e0d
      Stefan Richter 提交于
      The Unit_Characteristics entry of an SBP-2 unit directory is not
      mandatory as far as I can tell.  If it is missing, we would probably
      fail to log in into the target because firewire-sbp2 would not wait for
      status after it sent the login request.
      
      The fix moves the cleanup of tgt->mgt_orb_timeout into a place where it
      is executed exactly once before login, rather than 0..n times depending
      on the target's config ROM.  With targets with one or more
      Unit_Characteristics entries, the result is the same as before.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      eaf76e0d
  7. 12 9月, 2009 2 次提交
  8. 05 9月, 2009 1 次提交
  9. 03 7月, 2009 1 次提交
  10. 07 6月, 2009 1 次提交
  11. 05 6月, 2009 4 次提交
    • S
      firewire: rename source files · e71d31da
      Stefan Richter 提交于
      The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
       "drivers/firewire/fw-*.c"
      are renamed to
       "drivers/firewire/core-*.c",
       "drivers/firewire/ohci.c",
       "drivers/firewire/sbp2.c".
      
      The old fw- prefix was redundant to the directory name.  The new core-
      prefix distinguishes the files according to which driver they belong to.
      
      This change comes a little late, but still before further firewire
      drivers are added as anticipated RSN.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e71d31da
    • S
      firewire: reorganize header files · 77c9a5da
      Stefan Richter 提交于
      The three header files of firewire-core, i.e.
       "drivers/firewire/fw-device.h",
       "drivers/firewire/fw-topology.h",
       "drivers/firewire/fw-transaction.h",
      are replaced by
       "drivers/firewire/core.h",
       "include/linux/firewire.h".
      
      The latter includes everything which a firewire high-level driver (like
      firewire-sbp2) needs besides linux/firewire-constants.h, while core.h
      contains the rest which is needed by firewire-core itself and by low-
      level drivers (card drivers) like firewire-ohci.
      
      High-level drivers can now also reside outside of drivers/firewire
      without having to add drivers/firewire to the header file search path in
      makefiles.  At least the firedtv driver will be such a driver.
      
      I also considered to spread the contents of core.h over several files,
      one for each .c file where the respective implementation resides.  But
      it turned out that most core .c files will end up including most of the
      core .h files.  Also, the combined core.h isn't unreasonably big, and it
      will lose more of its contents to linux/firewire.h anyway soon when more
      firewire drivers are added.  (IP-over-1394, firedtv, and there are plans
      for one or two more.)
      
      Furthermore, fw-ohci.h is renamed to ohci.h.  The name of core.h and
      ohci.h is chosen with regard to name changes of the .c files in a
      follow-up change.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      77c9a5da
    • S
      firewire: clean up includes · e8ca9702
      Stefan Richter 提交于
      Include required headers which were only indirectly included.
      Remove unused includes and an unused constant.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e8ca9702
    • S
      firewire: share device ID table type with ieee1394 · b3b29888
      Stefan Richter 提交于
      That way, the new firedtv driver will be able to use a single ID table
      in builds against ieee1394 core and/or against firewire core.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      b3b29888
  12. 25 3月, 2009 1 次提交
  13. 30 1月, 2009 1 次提交
  14. 29 1月, 2009 3 次提交
  15. 05 1月, 2009 1 次提交
  16. 26 11月, 2008 1 次提交
  17. 31 10月, 2008 1 次提交
  18. 26 10月, 2008 2 次提交
    • J
      firewire: fw-sbp2: fix races · cd1f70fd
      Jay Fenlason 提交于
      1: There is a small race between queue_delayed_work() and its
         corresponding kref_get().  Do the kref_get first, and _put it again
         if the queue_delayed_work() failed, so there is no chance of the
         kref going to zero while the work is scheduled.
      2: An SBP2_LOGOUT_REQUEST could be sent out with a login_id full of
         garbage.  Initialize it to an invalid value so we can tell if we
         ever got a valid login_id.
      3: The node ID and generation may have changed but the new values may
         not yet have been recorded in lu and tgt when the final logout is
         attempted.  Use the latest values from the device in
         sbp2_release_target().
      Signed-off-by: NJay Fenlason <fenlason@redhat.com>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      cd1f70fd
    • S
      firewire: fw-sbp2: delay first login to avoid retries · 0dcfeb7e
      Stefan Richter 提交于
      This optimizes firewire-sbp2's device probe for the case that the local
      node and the SBP-2 node were discovered at the same time.  In this case,
      fw-core's bus management work and fw-sbp2's login and SCSI probe work
      are scheduled in parallel (in the globally shared workqueue and in
      fw-sbp2's workqueue, respectively).  The bus reset from fw-core may then
      disturb and extremely delay the login and SCSI probe because the latter
      fails with several command timeouts and retries and has to be retried
      from scratch.
      
      We avoid this particular situation of sbp2_login() and fw_card_bm_work()
      running in parallel by delaying the first sbp2_login() a little bit.
      
      This is meant to be a short-term fix for
      https://bugzilla.redhat.com/show_bug.cgi?id=466679.  In the long run,
      the SCSI probe, i.e. fw-sbp2's call of __scsi_add_device(), should be
      parallelized with sbp2_reconnect().
      
      Problem reported and fix tested and confirmed by Alex Kanavin.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0dcfeb7e
  19. 16 10月, 2008 3 次提交
    • S
      firewire: fw-sbp2: fix another small generation access bug · 4bbc1bdd
      Stefan Richter 提交于
      queuecommand() looked at the remote and local node IDs before it read
      the bus generation.  The corresponding race with sbp2_reconnect updating
      these data was probably impossible to happen though because the current
      code blocks the SCSI layer during reconnection.  However, better safe
      than sorry, especially if someone later improves the code to not block
      the SCSI layer.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4bbc1bdd
    • S
      firewire: fw-sbp2: enforce s/g segment size limit · 09b12dd4
      Stefan Richter 提交于
      1. We don't need to round the SBP-2 segment size limit down to a
         multiple of 4 kB (0xffff -> 0xf000).  It is only necessary to
         ensure quadlet alignment (0xffff -> 0xfffc).
      
      2. Use dma_set_max_seg_size() to tell the DMA mapping infrastructure
         and the block IO layer about the restriction.  This way we can
         remove the size checks and segment splitting in the queuecommand
         path.
      
         This assumes that no other code in the firewire stack uses
         dma_map_sg() with conflicting requirements.  It furthermore assumes
         that the controller device's platform actually allows us to set the
         segment size to our liking.  Assert the latter with a BUG_ON().
      
      3. Also use blk_queue_max_segment_size() to tell the block IO layer
         about it.  It cannot know it because our scsi_add_host() does not
         point to the FireWire controller's device.
      
      Thanks to Grant Grundler and FUJITA Tomonori for advice.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      09b12dd4
    • J
      firewire: fw_send_request_sync() · 1e119fa9
      Jay Fenlason 提交于
      Share code between fw_send_request + wait_for_completion callers.
      Signed-off-by: NJay Fenlason <fenlason@redhat.com>
      
      Addendum:
      Removes an unnecessary struct and an ununsed retry loop.
      Calls it fw_run_transaction() instead of fw_send_request_sync().
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: NKristian Høgsberg <krh@redhat.com>
      1e119fa9
  20. 27 7月, 2008 1 次提交
    • F
      dma-mapping: add the device argument to dma_mapping_error() · 8d8bb39b
      FUJITA Tomonori 提交于
      Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
      architecture does:
      
      This enables us to cleanly fix the Calgary IOMMU issue that some devices
      are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423).
      
      I think that per-device dma_mapping_ops support would be also helpful for
      KVM people to support PCI passthrough but Andi thinks that this makes it
      difficult to support the PCI passthrough (see the above thread).  So I
      CC'ed this to KVM camp.  Comments are appreciated.
      
      A pointer to dma_mapping_ops to struct dev_archdata is added.  If the
      pointer is non NULL, DMA operations in asm/dma-mapping.h use it.  If it's
      NULL, the system-wide dma_ops pointer is used as before.
      
      If it's useful for KVM people, I plan to implement a mechanism to register
      a hook called when a new pci (or dma capable) device is created (it works
      with hot plugging).  It enables IOMMUs to set up an appropriate
      dma_mapping_ops per device.
      
      The major obstacle is that dma_mapping_error doesn't take a pointer to the
      device unlike other DMA operations.  So x86 can't have dma_mapping_ops per
      device.  Note all the POWER IOMMUs use the same dma_mapping_error function
      so this is not a problem for POWER but x86 IOMMUs use different
      dma_mapping_error functions.
      
      The first patch adds the device argument to dma_mapping_error.  The patch
      is trivial but large since it touches lots of drivers and dma-mapping.h in
      all the architecture.
      
      This patch:
      
      dma_mapping_error() doesn't take a pointer to the device unlike other DMA
      operations.  So we can't have dma_mapping_ops per device.
      
      Note that POWER already has dma_mapping_ops per device but all the POWER
      IOMMUs use the same dma_mapping_error function.  x86 IOMMUs use device
      argument.
      
      [akpm@linux-foundation.org: fix sge]
      [akpm@linux-foundation.org: fix svc_rdma]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix bnx2x]
      [akpm@linux-foundation.org: fix s2io]
      [akpm@linux-foundation.org: fix pasemi_mac]
      [akpm@linux-foundation.org: fix sdhci]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix sparc]
      [akpm@linux-foundation.org: fix ibmvscsi]
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Muli Ben-Yehuda <muli@il.ibm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Avi Kivity <avi@qumranet.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8d8bb39b
  21. 14 7月, 2008 2 次提交
  22. 28 6月, 2008 1 次提交
  23. 02 5月, 2008 2 次提交
    • B
      [SCSI] Let scsi_cmnd->cmnd use request->cmd buffer · 64a87b24
      Boaz Harrosh 提交于
       - struct scsi_cmnd had a 16 bytes command buffer of its own.
         This is an unnecessary duplication and copy of request's
         cmd. It is probably left overs from the time that scsi_cmnd
         could function without a request attached. So clean that up.
      
       - Once above is done, few places, apart from scsi-ml, needed
         adjustments due to changing the data type of scsi_cmnd->cmnd.
      
       - Lots of drivers still use MAX_COMMAND_SIZE. So I have left
         that #define but equate it to BLK_MAX_CDB. The way I see it
         and is reflected in the patch below is.
         MAX_COMMAND_SIZE - means: The longest fixed-length (*) SCSI CDB
                            as per the SCSI standard and is not related
                            to the implementation.
         BLK_MAX_CDB.     - The allocated space at the request level
      
       - I have audit all ISA drivers and made sure none use ->cmnd in a DMA
         Operation. Same audit was done by Andi Kleen.
      
      (*)fixed-length here means commands that their size can be determined
         by their opcode and the CDB does not carry a length specifier, (unlike
         the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
         true and the SCSI standard also defines extended commands and
         vendor specific commands that can be bigger than 16 bytes. The kernel
         will support these using the same infrastructure used for VARLEN CDB's.
         So in effect MAX_COMMAND_SIZE means the maximum size command
         scsi-ml supports without specifying a cmd_len by ULD's
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      64a87b24
    • S
      firewire: fw-sbp2: log scsi_target ID at release · f32ddadd
      Stefan Richter 提交于
      Makes the good-by message more informative.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      f32ddadd
  24. 18 4月, 2008 4 次提交
    • S
      firewire: reread config ROM when device reset the bus · c9755e14
      Stefan Richter 提交于
      When a device changes its configuration ROM, it announces this with a
      bus reset.  firewire-core has to check which node initiated a bus reset
      and whether any unit directories went away or were added on this node.
      
      Tested with an IOI FWB-IDE01AB which has its link-on bit set if bus
      power is available but does not respond to ROM read requests if self
      power is off.  This implements
        - recognition of the units if self power is switched on after fw-core
          gave up the initial attempt to read the config ROM,
        - shutdown of the units when self power is switched off.
      
      Also tested with a second PC running Linux/ieee1394.  When the eth1394
      driver is inserted and removed on that node, fw-core now notices the
      addition and removal of the IPv4 unit on the ieee1394 node.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      c9755e14
    • J
      firewire: fw-sbp2: set dual-phase cycle_limit · 17cff9ff
      Jarod Wilson 提交于
      Try to write dual-phase retry protocol limits to BUSY_TIMEOUT register.
      - The dual-phase retry protocol is optional to implement, and if not 
        supported, writes to the dual-phase portion of the register will be
        ignored. We try to write the original 1394-1995 default here.
      - In the case of devices that are also SBP-3-compliant, all writes are 
        ignored, as the register is read-only, but contains single-phase retry of
        15, which is what we're trying to set for all SBP-2 device anyway, so this
        write attempt is safe and yields more consistent behavior for all devices.
      
      See section 8.3.2.3.5 of the 1394-1995 spec, section 6.2 of the SBP-2 spec,
      and section 6.4 of the SBP-3 spec for further details.
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      17cff9ff
    • S
      firewire: fw-sbp2: reduce log noise · a5fd9ec7
      Stefan Richter 提交于
      The block/unblock logic is now sufficiently tested.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      a5fd9ec7
    • S
      firewire: fw-sbp2: remove unnecessary memset · 6f73100c
      Stefan Richter 提交于
      orb came from kzalloc.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      6f73100c