1. 21 Oct, 2008 5 commits
    • Jeremy Kerr's avatar
      powerpc/spufs: Don't spu_acquire_saved unnecessarily in regs read · f027faa2
      Jeremy Kerr authored
      With most file readers (eg cat, dd), reading a context's regs file will
      result in two reads: the first to read the data, and the second to
      return EOF. Because each read performs a spu_acquire_saved, we end up
      descheduling and re-scheduling the context twice.
      
      This change does a simple check to see if we'd return EOF before
      calling spu_acquire_saved(), saving the extra schedule operation.
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      f027faa2
    • Jeremy Kerr's avatar
      powerpc/spufs: Don't require full buffer in switch_log read · 14f693ee
      Jeremy Kerr authored
      Currently, read() on the sputrace log will block until the read buffer
      is full. This makes it difficult to retrieve the end of the buffer, as
      the user will need to read with the right-sized buffer.
      
      In a similar method as 91553a1b5e0df006a3573a88d98ee7cd48a3818a, this
      change makes the switch_log return if there has already been data
      read.
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      14f693ee
    • Jeremy Kerr's avatar
      powerpc/spufs: Use state_mutex for switch_log locking, and prevent multiple openers · f5ed0eb6
      Jeremy Kerr authored
      Currently, we use ctx->mapping_lock and ctx->switch_log->lock for the
      context switch log. The mapping lock only prevents concurrent open()s,
      so we require the switch_lock->lock for reads.
      
      Since writes to the switch log buffer occur on context switches, we're
      better off synchronising with the state_mutex, which is held during a
      switch. Since we're serialised througout the buffer reads and writes,
      we can use the state mutex to protect open and release too, and
      can now kfree() the log buffer on release. This allows us to perform
      the switch log notify without taking any extra locks.
      
      Because the buffer is only present while the file is open, we can use
      it to prevent multiple simultaneous openers.
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      f5ed0eb6
    • Jeremy Kerr's avatar
      powerpc/spufs: sputrace: Don't block until the read buffer is full · e869446b
      Jeremy Kerr authored
      Currently, read() on the sputrace buffer will only return data when
      the user buffer is exhausted. This may mean that we never see the
      end of the event log, unless we read() with exactly the right-sized
      buffer.
      
      This change makes sputrace_read not block if we have data ready to
      return.
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      e869446b
    • Jeremy Kerr's avatar
      powerpc/spufs: sputrace: Only enable logging on open(), prevent multiple openers · baf39927
      Jeremy Kerr authored
      Currently, sputrace will start logging to the event buffer before the
      log buffer has been open()ed. This results in a heap of "lost samples"
      warnings if the sputrace file hasn't yet been opened.
      
      Since the buffer is reset on open() anyway, there's no need to enable
      logging when no-one has opened the log.
      
      Because open clears the log, make it return EBUSY for mutliple open
      calls.
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      baf39927
  2. 15 Oct, 2008 23 commits
  3. 14 Oct, 2008 12 commits