1. 10 May, 2011 9 commits
    • Stefan Richter's avatar
      firewire: sbp2: parallelize login, reconnect, logout · 105e53f8
      Stefan Richter authored
      The struct sbp2_logical_unit.work items can all be executed in parallel
      but are not reentrant.  Furthermore, reconnect or re-login work must be
      executed in a WQ_MEM_RECLAIM workqueue.
      
      Hence replace the old single-threaded firewire-sbp2 workqueue by a
      concurrency-managed but non-reentrant workqueue with rescuer.
      firewire-core already maintains one, hence use this one.
      
      In earlier versions of this change, I observed occasional failures of
      parallel INQUIRY to an Initio INIC-2430 FireWire 800 to dual IDE bridge.
      More testing indicates that parallel INQUIRY is not actually a problem,
      but too quick successions of logout and login + INQUIRY, e.g. a quick
      sequence of cable plugout and plugin, can result in failed INQUIRY.
      This does not seem to be something that should or could be addressed by
      serialization.
      
      Another dual-LU device to which I currently have access to, an
      OXUF924DSB FireWire 800 to dual SATA bridge with firmware from MacPower,
      has been successfully tested with this too.
      
      This change is beneficial to environments with two or more FireWire
      storage devices, especially if they are located on the same bus.
      Management tasks that should be performed as soon and as quickly as
      possible, especially reconnect, are no longer held up by tasks on other
      devices that may take a long time, especially login with INQUIRY and sd
      or sr driver probe.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      105e53f8
    • Stefan Richter's avatar
      firewire: sbp2: octlet AT payloads can be stack-allocated · 81bf52d8
      Stefan Richter authored
      We do not need slab allocations for ORB pointer write transactions
      anymore in order to satisfy streaming DMA mapping constraints, thanks to
      commit da28947e "firewire: ohci: avoid separate DMA mapping for
      small AT payloads".
      
      (Besides, the slab-allocated buffers that firewire-sbp2 used to provide
      for 8-byte write requests were still not fully portable since they
      shared a cacheline with unrelated CPU-accessed data.)
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      81bf52d8
    • Stefan Richter's avatar
      firewire: sbp2: omit Scsi_Host lock from queuecommand · b75ca5ea
      Stefan Richter authored
      firewire-sbp2 already takes care for internal serialization where
      required (ORB list accesses), and it does not use cmd->serial_number
      internally.  Hence it is safe to not grab the shost lock around
      queuecommand.
      
      While we are at housekeeping, drop a redundant struct member:
      sbp2_command_orb.done is set once in a hot path and dereferenced once in
      a hot path.  We can as well dereference sbp2_command_orb.cmd->scsi_done
      instead.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      b75ca5ea
    • Stefan Richter's avatar
      firewire: core: use non-reentrant workqueue with rescuer · 6ea9e7bb
      Stefan Richter authored
      firewire-core manages the following types of work items:
      
      fw_card.br_work:
        - resets the bus on a card and possibly sends a PHY packet before that
        - does not sleep for long or not at all
        - is scheduled via fw_schedule_bus_reset() by
            - firewire-ohci's pci_probe method
            - firewire-ohci's set_config_rom method, called by kernelspace
              protocol drivers and userspace drivers which add/remove
      	Configuration ROM descriptors
            - userspace drivers which use the bus reset ioctl
            - itself if the last reset happened less than 2 seconds ago
      
      fw_card.bm_work:
        - performs bus management duties
        - usually does not (but may in corner cases) sleep for long
        - is scheduled via fw_schedule_bm_work() by
            - firewire-ohci's self-ID-complete IRQ handler tasklet
            - firewire-core's fw_device.work instances whenever the root node
              device was (successfully or unsuccessfully) discovered,
      	refreshed, or rediscovered
            - itself in case of resource allocation failures or in order to
              obey the 125ms bus manager arbitration interval
      
      fw_device.work:
        - performs node probe, update, shutdown, revival, removal; including
          kernel driver probe, update, shutdown and bus reset notification to
          userspace drivers
        - usually sleeps moderately long, in corner cases very long
        - is scheduled by
            - firewire-ohci's self-ID-complete IRQ handler tasklet via the
              core's fw_node_event
            - firewire-ohci's pci_remove method via core's fw_destroy_nodes/
              fw_node_event
            - itself during retries, e.g. while a node is powering up
      
      iso_resource.work:
        - accesses registers at the Isochronous Resource Manager node
        - usually does not (but may in corner cases) sleep for long
        - is scheduled via schedule_iso_resource() by
            - the owning userspace driver at addition and removal of the
              resource
            - firewire-core's fw_device.work instances after bus reset
            - itself in case of resource allocation if necessary to obey the
              1000ms reallocation period after bus reset
      
      fw_card.br_work instances should not, and instances of the others must
      not, be executed in parallel by multiple CPUs -- but were not protected
      against that.  Hence allocate a non-reentrant workqueue for them.
      
      fw_device.work may be used in the memory reclaim path in case of SBP-2
      device updates.  Hence we need a workqueue with rescuer and cannot use
      system_nrt_wq.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Reviewed-by: default avatarTejun Heo <tj@kernel.org>
      6ea9e7bb
    • Clemens Ladisch's avatar
      firewire: optimize iso queueing by setting wake only after the last packet · 13882a82
      Clemens Ladisch authored
      When queueing iso packets, the run time is dominated by the two
      MMIO accesses that set the DMA context's wake bit.  Because most
      drivers submit packets in batches, we can save much time by
      removing all but the last wakeup.
      
      The internal kernel API is changed to require a call to
      fw_iso_context_queue_flush() after a batch of queued packets.
      The user space API does not change, so one call to
      FW_CDEV_IOC_QUEUE_ISO must specify multiple packets to take
      advantage of this optimization.
      
      In my measurements, this patch reduces the time needed to queue
      fifty skip packets from userspace to one sixth on a 2.5 GHz CPU,
      or to one third at 800 MHz.
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      13882a82
    • Stefan Richter's avatar
      firewire: octlet AT payloads can be stack-allocated · f30e6d3e
      Stefan Richter authored
      We do not need slab allocations anymore in order to satisfy
      streaming DMA mapping constraints, thanks to commit da28947e
      "firewire: ohci: avoid separate DMA mapping for small AT payloads".
      
      (Besides, the slab-allocated buffers that firewire-core, firewire-sbp2,
      and firedtv used to provide for 8-byte write and lock requests were
      still not fully portable since they crossed cacheline boundaries or
      shared a cacheline with unrelated CPU-accessed data.  snd-firewire-lib
      got this aspect right by using an extra kmalloc/ kfree just for the
      8-byte transaction buffer.)
      
      This change replaces kmalloc'ed lock transaction scratch buffers in
      firewire-core, firedtv, and snd-firewire-lib by local stack allocations.
      Perhaps the most notable result of the change is simpler locking because
      there is no need to serialize usages of preallocated per-device buffers
      anymore.  Also, allocations and deallocations are simpler.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: default avatarClemens Ladisch <clemens@ladisch.de>
      f30e6d3e
    • Stefan Richter's avatar
      Merge tag 'v2.6.39-rc7' · 020abf03
      Stefan Richter authored
      in order to pull in changes in drivers/media/dvb/firewire/ and
      sound/firewire/.
      020abf03
    • Linus Torvalds's avatar
      Linux 2.6.39-rc7 · 693d92a1
      Linus Torvalds authored
      693d92a1
    • Hugh Dickins's avatar
      vm: fix vm_pgoff wrap in upward expansion · 42c36f63
      Hugh Dickins authored
      Commit a626ca6a ("vm: fix vm_pgoff wrap in stack expansion") fixed
      the case of an expanding mapping causing vm_pgoff wrapping when you had
      downward stack expansion.  But there was another case where IA64 and
      PA-RISC expand mappings: upward expansion.
      
      This fixes that case too.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      42c36f63
  2. 09 May, 2011 27 commits
  3. 08 May, 2011 4 commits