13 Jan, 2012

1 commit


09 Oct, 2011

1 commit


17 Sep, 2011

3 commits

  • sbp2_release_target() is folded into its primary user, sbp2_remove().
    The only other caller, a failure path in sbp2_probe(), now uses
    sbp2_remove(). This adds unnecessary cancel_delayed_work_sync() calls
    to that failure path but results in less code and text.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Implement sbp2_queue_work(), which is now a very simple accessor to one
    of the struct sbp2_logical_unit members, right after the definition of
    struct sbp2_logical_unit.

    Put the sbp2_reconnect() implementation right after the sbp2_login()
    implementation. They are both part of the SBP-2 access protocol.

    Implement the driver methods sbp2_probe(), spp2_update(), sbp2_remove()
    in this order, reflecting the lifetime of an SBP-2 target.

    Place the sbp2_release_target() implementation right next to
    sbp2_remove() which is its primary user, and after sbp2_probe() which is
    the counterpart to sbp2_release_target().

    There are no changes to the implementations here, or at least not meant
    to be.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • Since commit 0278ccd9d53e07c4e699432b2fed9de6c56f506c "firewire: sbp2:
    fix panic after rmmod with slow targets", the lifetime of an sbp2_target
    instance does no longer extent past the return of sbp2_remove().
    Therefore it is no longer necessary to call fw_unit_get/put() and
    fw_device_get/put() in sbp2_probe/remove().

    Furthermore, said commit also ensures that lu->work is not going to be
    executed or requeued at a time when the sbp2_target is no longer in use.
    Hence there is no need for sbp2_target reference counting for lu->work.

    Other concurrent contexts:

    - Processes which access the sysfs of the SCSI host device or of one
    of its subdevices are safe because these interfaces are all removed
    by scsi_remove_device/host() in sbp2_release_target().

    - SBP-2 command block ORB transactions are finished when
    scsi_remove_device() in sbp2_release_target() returns.

    - SBP-2 management ORB transactions are finished when
    cancel_delayed_work_sync(&lu->work) before sbp2_release_target()
    returns.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

23 Aug, 2011

1 commit

  • If firewire-sbp2 starts a login to a target that doesn't complete ORBs
    in a timely manner (and has to retry the login), and the module is
    removed before the operation times out, you end up with a null-pointer
    dereference and a kernel panic.

    [SR: This happens because sbp2_target_get/put() do not maintain
    module references. scsi_device_get/put() do, but at occasions like
    Chris describes one, nobody holds a reference to an SBP-2 sdev.]

    This patch cancels pending work for each unit in sbp2_remove(), which
    hopefully means there are no extra references around that prevent us
    from unloading. This fixes my crash.

    Signed-off-by: Chris Boot
    Signed-off-by: Stefan Richter

    Chris Boot
     

11 May, 2011

3 commits

  • 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: Stefan Richter

    Stefan Richter
     
  • We do not need slab allocations for ORB pointer write transactions
    anymore in order to satisfy streaming DMA mapping constraints, thanks to
    commit da28947e7e36 "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: Stefan Richter

    Stefan Richter
     
  • 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: Stefan Richter

    Stefan Richter
     

20 Mar, 2011

1 commit


17 Nov, 2010

1 commit

  • Move the mid-layer's ->queuecommand() invocation from being locked
    with the host lock to being unlocked to facilitate speeding up the
    critical path for drivers who don't need this lock taken anyway.

    The patch below presents a simple SCSI host lock push-down as an
    equivalent transformation. No locking or other behavior should change
    with this patch. All existing bugs and locking orders are preserved.

    Additionally, add one parameter to queuecommand,
    struct Scsi_Host *
    and remove one parameter from queuecommand,
    void (*done)(struct scsi_cmnd *)

    Scsi_Host* is a convenient pointer that most host drivers need anyway,
    and 'done' is redundant to struct scsi_cmnd->scsi_done.

    Minimal code disturbance was attempted with this change. Most drivers
    needed only two one-line modifications for their host lock push-down.

    Signed-off-by: Jeff Garzik
    Acked-by: James Bottomley
    Signed-off-by: Linus Torvalds

    Jeff Garzik
     

20 Aug, 2010

2 commits

  • 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: Stefan Richter

    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: Stefan Richter

    Stefan Richter
     

02 Aug, 2010

1 commit


21 Jun, 2010

1 commit

  • 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: Stefan Richter

    Stefan Richter
     

19 Jun, 2010

1 commit

  • In case of fw_card_bm_work()'s lock request, the present sizeof
    expression is going to be wrong if somebody changes the fw_card's DMA
    scratch buffer's size in the future.

    In case of quadlet write requests, sizeof(u32) is just silly; it's 4.

    In case of SBP-2 ORB pointer write requests, 8 is arguably quicker to
    understand as the correct and only possible value than
    sizeof(some_datum).

    Signed-off-by: Stefan Richter

    Stefan Richter
     

04 Mar, 2010

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: (23 commits)
    firewire: ohci: extend initialization log message
    firewire: ohci: fix IR/IT context mask mixup
    firewire: ohci: add module parameter to activate quirk fixes
    firewire: ohci: use an ID table for quirks detection
    firewire: ohci: reorder struct fw_ohci for better cache efficiency
    firewire: ohci: remove unused dualbuffer IR code
    firewire: core: combine a bit of repeated code
    firewire: core: change type of a data buffer
    firewire: cdev: increment ABI version number
    firewire: cdev: add more flexible cycle timer ioctl
    firewire: core: rename an internal function
    firewire: core: fix an information leak
    firewire: core: increase stack size of config ROM reader
    firewire: core: don't fail device creation in case of too large config ROM blocks
    firewire: core: fix "giving up on config rom" with Panasonic AG-DV2500
    firewire: remove incomplete Bus_Time CSR support
    firewire: get_cycle_timer optimization and cleanup
    firewire: ohci: enable cycle timer fix on ALi and NEC controllers
    firewire: ohci: work around cycle timer bugs on VIA controllers
    firewire: make PCI device id constant
    ...

    Linus Torvalds
     

26 Feb, 2010

1 commit

  • The block layer calling convention is blk_queue_.
    blk_queue_max_sectors predates this practice, leading to some confusion.
    Rename the function to appropriately reflect that its intended use is to
    set max_hw_sectors.

    Also introduce a temporary wrapper for backwards compability. This can
    be removed after the merge window is closed.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: Jens Axboe

    Martin K. Petersen
     

30 Dec, 2009

1 commit


15 Oct, 2009

2 commits

  • 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: Stefan Richter

    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: Stefan Richter

    Stefan Richter
     

12 Sep, 2009

2 commits


06 Sep, 2009

1 commit


05 Sep, 2009

1 commit


07 Jul, 2009

1 commit


03 Jul, 2009

1 commit


17 Jun, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
    firewire: core: use more outbound tlabels
    firewire: core: don't update Broadcast_Channel if RFC 2734 conditions aren't met
    firewire: core: prepare for non-core children of card devices
    firewire: core: include linux/uaccess.h instead of asm/uaccess.h
    firewire: add parent-of-unit accessor
    firewire: rename source files
    firewire: reorganize header files
    firewire: clean up includes
    firewire: ohci: access bus_seconds atomically
    firewire: also use vendor ID in root directory for driver matches
    firewire: share device ID table type with ieee1394
    firewire: core: add sysfs attribute for easier udev rules
    firewire: core: check for missing struct update at build time, not run time
    firewire: core: improve check for local node

    Linus Torvalds
     

07 Jun, 2009

1 commit


05 Jun, 2009

1 commit

  • 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: Stefan Richter

    Stefan Richter