1. 12 10月, 2016 1 次提交
    • P
      kthread: kthread worker API cleanup · 3989144f
      Petr Mladek 提交于
      A good practice is to prefix the names of functions by the name
      of the subsystem.
      
      The kthread worker API is a mix of classic kthreads and workqueues.  Each
      worker has a dedicated kthread.  It runs a generic function that process
      queued works.  It is implemented as part of the kthread subsystem.
      
      This patch renames the existing kthread worker API to use
      the corresponding name from the workqueues API prefixed by
      kthread_:
      
      __init_kthread_worker()		-> __kthread_init_worker()
      init_kthread_worker()		-> kthread_init_worker()
      init_kthread_work()		-> kthread_init_work()
      insert_kthread_work()		-> kthread_insert_work()
      queue_kthread_work()		-> kthread_queue_work()
      flush_kthread_work()		-> kthread_flush_work()
      flush_kthread_worker()		-> kthread_flush_worker()
      
      Note that the names of DEFINE_KTHREAD_WORK*() macros stay
      as they are. It is common that the "DEFINE_" prefix has
      precedence over the subsystem names.
      
      Note that INIT() macros and init() functions use different
      naming scheme. There is no good solution. There are several
      reasons for this solution:
      
        + "init" in the function names stands for the verb "initialize"
          aka "initialize worker". While "INIT" in the macro names
          stands for the noun "INITIALIZER" aka "worker initializer".
      
        + INIT() macros are used only in DEFINE() macros
      
        + init() functions are used close to the other kthread()
          functions. It looks much better if all the functions
          use the same scheme.
      
        + There will be also kthread_destroy_worker() that will
          be used close to kthread_cancel_work(). It is related
          to the init() function. Again it looks better if all
          functions use the same naming scheme.
      
        + there are several precedents for such init() function
          names, e.g. amd_iommu_init_device(), free_area_init_node(),
          jump_label_init_type(),  regmap_init_mmio_clk(),
      
        + It is not an argument but it was inconsistent even before.
      
      [arnd@arndb.de: fix linux-next merge conflict]
       Link: http://lkml.kernel.org/r/20160908135724.1311726-1-arnd@arndb.de
      Link: http://lkml.kernel.org/r/1470754545-17632-3-git-send-email-pmladek@suse.comSuggested-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NPetr Mladek <pmladek@suse.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3989144f
  2. 03 4月, 2015 1 次提交
  3. 23 12月, 2014 1 次提交
  4. 03 9月, 2014 1 次提交
  5. 19 9月, 2012 1 次提交
  6. 16 8月, 2012 1 次提交
  7. 16 1月, 2012 1 次提交
  8. 03 3月, 2011 1 次提交
    • M
      [media] ivtv: Fix corrective action taken upon DMA ERR interrupt to avoid hang · d213ad08
      Michael 提交于
      After upgrading the kernel from stock Ubuntu 7.10 to
      10.04, with no hardware changes, I started getting the dreaded DMA
      TIMEOUT errors, followed by inability to encode until the machine was
      rebooted.
      
      I came across a post from Andy in March
      (http://www.gossamer-threads.com/lists/ivtv/users/40943#40943) where he
      speculates that perhaps the corrective actions being taken after a DMA
      ERROR are not sufficient to recover the situation.  After some testing
      I suspect that this is indeed the case, and that in fact the corrective
      action may be what hangs the card's DMA engine, rather than the
      original error.
      
      Specifically these DMA ERROR IRQs seem to present with two different
      values in the IVTV_REG_DMASTATUS register: 0x11 and 0x13.  The current
      corrective action is to clear that status register back to 0x01 or
      0x03, and then issue the next DMA request.  In the case of a 0x13 this
      seems to result in a minor glitch in the encoded stream due to the
      failed transfer that was not retried, but otherwise things continue OK.
      In the case of a 0x11 the card's DMA write engine is never heard from
      again, and a DMA TIMEOUT follows shortly after.  0x11 is the killer.
      
      I suspect that the two cases need to be handled differently.  The
      difference is in bit 1 (0x02), which is set when the error is about to
      be successfully recovered, and clear when things are about to go bad.
      
      Bit 1 of DMASTATUS is described differently in different places either
      as a positive "write finished", or an inverted "write busy".  If we
      take the first definition, then when an error arises with state 0x11,
      it means that the write did not complete.   It makes sense to start a
      new transfer, as in the current code.  But if we take the second
      definition, then 0x11 means "an error but the write engine is still
      busy".  Trying to feed it a new transfer in this situation might not be
      a good idea.
      
      As an experiment, I added code to ignore the DMA ERROR IRQ if DMASTATUS
      is 0x11.  I.e., don't start a new transfer, don't clear our flags, etc.
      The hope was that the card would complete the transfer and issue a ENC
      DMA COMPLETE, either successfully or with an error condition there.
      However the card still hung.
      
      The only remaining corrective action being taken with a 0x11 status was
      then the write back to the status register to clear the error, i.e.
      DMASTATUS = DMASTATUS & ~3.  This would have the effect of clearing the
      error bit 4, while leaving the lower bits indicating DMA write busy.
      
      Strangely enough, removing this write to the status register solved the
      problem!  If the DMA ERROR IRQ with DMASTATUS=0x11 is completely
      ignored, with no corrective action at all, then the card will complete
      the transfer and issue a new IRQ.  If the status register is written to
      when it has the value 0x11, then the DMA engine hangs.  Perhaps it's
      illegal to write to
      DMASTATUS while the read or write busy bit is set?  At any rate, it
      appears that the current corrective action is indeed making things
      worse rather than better.
      
      I put together a patch that modifies ivtv_irq_dma_err to do the
      following:
      
      - Don't write back to IVTV_REG_DMASTATUS.
      - If write-busy is asserted, leave the card alone.  Just extend the
      timeout slightly.
      - If write-busy is de-asserted, retry the current transfer.
      
      This has completely fixed my DMA TIMEOUT woes.  DMA ERR events still
      occur, but now they seem to be correctly handled.  0x11 events no
      longer hang the card, and 0x13 events no longer result in a glitch in
      the stream, as the failed transfer is retried.  I'm happy.
      
      I've inlined the patch below in case it is of interest.  As described
      above, I have a theory about why it works (based on a different
      interpretation of bit 1 of DMASTATUS), but I can't guarantee that my
      theory is correct.  There may be another explanation, or it may be a
      fluke.  Maybe ignoring that IRQ entirely would be equally effective?
      Maybe the status register read/writeback sequence is race condition if
      the card changes it in the mean time?  Also as I am using a PVR-150
      only, I have not been able to test it on other cards, which may be
      especially relevant for 350s that support concurrent decoding.
      Hopefully the patch does not break the DMA READ path.
      
      Mike
      
      [awalls@md.metrocast.net: Modified patch to add a verbose comment, make minor
      brace reformats, and clear the error flags in the IVTV_REG_DMASTATUS iff both
      read and write DMA were not in progress.  Mike's conjecture about a race
      condition with the writeback is correct; it can confuse the DMA engine.]
      
      [Comment and analysis from the ML post by Michael <mike@rsy.com>]
      Signed-off-by: NAndy Walls <awalls@md.metrocast.net>
      Cc: stable@kernel.org
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      d213ad08
  9. 29 6月, 2010 1 次提交
    • T
      ivtv: use kthread_worker instead of workqueue · 7bc46560
      Tejun Heo 提交于
      Upcoming workqueue updates will no longer guarantee fixed workqueue to
      worker kthread association, so giving RT priority to the irq worker
      won't work.  Use kthread_worker which guarantees specific kthread
      association instead.  This also makes setting the priority cleaner.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Andy Walls <awalls@md.metrocast.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: ivtv-devel@ivtvdriver.org
      Cc: linux-media@vger.kernel.org
      7bc46560
  10. 19 5月, 2010 1 次提交
  11. 18 5月, 2010 1 次提交
  12. 27 2月, 2010 2 次提交
  13. 10 5月, 2009 1 次提交
  14. 30 3月, 2009 1 次提交
  15. 13 10月, 2008 1 次提交
  16. 04 9月, 2008 1 次提交
  17. 05 6月, 2008 1 次提交
  18. 30 4月, 2008 1 次提交
  19. 25 4月, 2008 1 次提交
  20. 26 1月, 2008 7 次提交
  21. 11 10月, 2007 1 次提交
  22. 10 10月, 2007 10 次提交
  23. 21 7月, 2007 2 次提交