1. 14 Jul, 2008 11 commits
    • Stefan Richter's avatar
      firewire: fully initialize fw_transaction before marking it pending · e9aeb46c
      Stefan Richter authored
      In theory, card->flush_timer could already access a transaction between
      fw_send_request()'s spin_unlock_irqrestore and the rest of what happens
      in fw_send_request().  This would happen if the process which sends the
      request is preempted and put to sleep right after spin_unlock_irqrestore
      for longer than 100ms.
      
      Therefore we fill in everything in struct fw_transaction at which the
      flush_timer might look at before we lift the lock.
      
      To do:  Ensure that the timer does not pick up the transaction before
      the time of the AT request event plus split transaction timeout.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e9aeb46c
    • Stefan Richter's avatar
      firewire: fix race of bus reset with request transmission · 792a6102
      Stefan Richter authored
      Reported by Jay Fenlason:  A bus reset tasklet may call
      fw_flush_transactions and touch transactions (call their callback which
      will free them) while the context which submitted the transaction is
      still inserting it into the transmission queue.
      
      A simple solution to this problem is to _not_ "flush" the transactions
      because of a bus reset (complete the transcations as 'cancelled').  They
      will now simply time out (completed as 'cancelled' by the split-timeout
      timer).
      
      Jay Fenlason thought of this fix too but I was quicker to type it out.
      :-)
      
      Background:
      Contexts which access an instance of struct fw_transaction are:
       1. the submitter, until it inserted the packet which is embedded in the
          transaction into the AT req DMA,
       2. the AsReqTrContext tasklet when the request packet was acked by the
          responder node or transmission to the responder failed,
       3. the AsRspRcvContext tasklet when it found a request which matched
          an incoming response,
       4. the card->flush_timer when it picks up timed-out transactions to
          cancel them,
       5. the bus reset tasklet when it cancels transactions (this access is
          eliminated by this patch),
       6. a process which shuts down an fw_card (unregisters it from fw-core
          when the controller is unbound from fw-ohci) --- although in this
          case there shouldn't really be any transactions anymore because we
          wait until all card users finished their business with the card.
      
      All of these contexts run concurrently (except for the 6th, presumably).
      The 1st is safe against the 2nd and 3rd because of the way how a request
      packet is carefully submitted to the hardware.  A race between 2nd and
      3rd has been fixed a while ago (bug 9617).  The 4th is almost safe
      against 1st, 2nd, 3rd;  there are issues with it if huge scheduling
      latencies occur, to be fixed separately.  The 5th looks safe against
      2nd, 3rd, and 4th but is unsafe against 1st.  Maybe this could be fixed
      with an explicit state variable in struct fw_transaction.  But this
      would require fw_transaction to be rewritten as only dynamically
      allocatable object with reference counting --- not a good solution if we
      also can simply kill this 5th accessing context (replace it by the 4th).
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      792a6102
    • Stefan Richter's avatar
      firewire: don't respond to broadcast write requests · a7ea6782
      Stefan Richter authored
      Contrary to a comment in the source, request->ack of a broadcast write
      request can be ACK_PENDING.  Hence the existing check is insufficient.
      
      Debug dmesg before:
      AR spd 0 tl 00, ffc0 -> ffff, ack_pending , QW req, fffff0000234 = ffffffff
      AT spd 0 tl 00, ffff -> ffc0, ack_complete, W resp
      And the requesting node (linux1394) reports an unsolicited response.
      
      Debug dmesg after:
      AR spd 0 tl 00, ffc0 -> ffff, ack_pending , QW req, fffff0000234 = ffffffff
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      a7ea6782
    • Stefan Richter's avatar
      firewire: clean up fw_card reference counting · 459f7923
      Stefan Richter authored
      This is a functionally equivalent replacement of the current reference
      counting of struct fw_card instances.  It only converts it to common
      idioms as suggested by Kristian Høgsberg:
        - struct kref replaces atomic_t as the counter.
        - wait_for_completion is used to wait for all card users to complete.
      
      BTW, it may make sense to count card->flush_timer and card->work as
      card users too.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      459f7923
    • Stefan Richter's avatar
      2147ef20
    • Stefan Richter's avatar
      bbf094cf
    • Stefan Richter's avatar
      firewire: implement broadcast_channel CSR for 1394a compliance · e534fe16
      Stefan Richter authored
      See IEEE 1394a clause 8.3.2.3.11.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e534fe16
    • Philippe De Muyter's avatar
      ieee1394: dump mmapped iso buffers in core files · 435f9726
      Philippe De Muyter authored
      Currently, core files do not contain the mmapped memory of the video1394
      or dv1394 devices, which contain the actual video input, making it
      impossible to analyse the cause of abnormal program termination for
      image analysis or (de)compression software.  Fix that.
      Signed-off-by: default avatarPhilippe De Muyter <phdm@macqel.be>
      
      Also affects users of the rawiso ioctl API of raw1394.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      435f9726
    • Alan Cox's avatar
      ieee1394: raw1394: Push the BKL down into the driver ioctls · 3aea50a3
      Alan Cox authored
      Actually in this case wrap the function for now.
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      
      Added raw1394_compat_ioctl hunk.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      3aea50a3
    • Stefan Richter's avatar
      ieee1394: video1394: reorder module init, prepare BKL removal · 055a7da0
      Stefan Richter authored
      This prepares video1394 for removal of the BKL (big kernel lock):
      It allows video1394_open() to be called while video1394_init_module()
      is still in progress.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      055a7da0
    • Stefan Richter's avatar
      ieee1394: reduce log noise about config ROM CRC errors · fde675fa
      Stefan Richter authored
      This avoids redundant messages about a special and usually harmless
      firmware flaw.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      fde675fa
  2. 13 Jul, 2008 6 commits
  3. 12 Jul, 2008 17 commits
  4. 11 Jul, 2008 6 commits