1. 24 7月, 2011 2 次提交
    • J
      ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> · a9a79dfe
      Joe Perches 提交于
      Saves text by removing nearly duplicated text format strings by
      creating ata_<foo>_printk functions and printf extension %pV.
      
      ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB)
      
      Format string duplication comes from:
      
       #define ata_link_printk(link, lv, fmt, args...) do { \
             if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link)    \
                     printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id,   \
                            (link)->pmp , ##args); \
             else \
                     printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
             } while(0)
      
      Coalesce long formats.
      
      $ size drivers/ata/built-in.*
         text	   data	    bss	    dec	    hex	filename
       544969	  73893	 116584	 735446	  b38d6	drivers/ata/built-in.allyesconfig.ata.o
       558429	  73893	 117864	 750186	  b726a	drivers/ata/built-in.allyesconfig.dev_level.o
       141328	  14689	   4220	 160237	  271ed	drivers/ata/built-in.defconfig.ata.o
       149567	  14689	   4220	 168476	  2921c	drivers/ata/built-in.defconfig.dev_level.o
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
      a9a79dfe
    • J
      ata: Convert dev_printk(KERN_<LEVEL> to dev_<level>( · a44fec1f
      Joe Perches 提交于
      Saves a bit of text as the call takes fewer args.
      
      Coalesce a few formats.
      Convert a few bare printks to pr_cont.
      
      $ size drivers/ata/built-in.o*
         text	   data	    bss	    dec	    hex	filename
       558429	  73893	 117864	 750186	  b726a	drivers/ata/built-in.o.allyesconfig.new
       559574	  73893	 117888	 751355	  b76fb	drivers/ata/built-in.o.allyesconfig.old
       149567	  14689	   4220	 168476	  2921c	drivers/ata/built-in.o.defconfig.new
       149851	  14689	   4220	 168760	  29338	drivers/ata/built-in.o.defconfig.old
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
      a44fec1f
  2. 15 5月, 2011 1 次提交
  3. 31 3月, 2011 1 次提交
  4. 14 3月, 2011 1 次提交
  5. 02 3月, 2011 1 次提交
  6. 25 12月, 2010 1 次提交
    • T
      libata-sff: fix HSM_ST_ERR handling in __ata_sff_port_intr() · 687a9933
      Tejun Heo 提交于
      While separating out BMDMA irq handler from SFF, commit c3b28894
      (libata-sff: separate out BMDMA irq handler) incorrectly made
      __ata_sff_port_intr() consider an IRQ to be an idle one if the host
      state was transitioned to HSM_ST_ERR by ata_bmdma_port_intr().
      
      This makes BMDMA drivers ignore IRQs reporting host bus error which
      leads to timeouts instead of triggering EH immediately.  Fix it by
      making __ata_sff_port_intr() consider the IRQ to be an idle one iff
      the state is HSM_ST_IDLE.  This is equivalent to adding HSM_ST_ERR to
      the "break"ing case but less error-prone.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NAntonio Toma <antonio.toma@gmail.com>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      687a9933
  7. 15 12月, 2010 1 次提交
    • T
      workqueue: convert cancel_rearming_delayed_work[queue]() users to cancel_delayed_work_sync() · afe2c511
      Tejun Heo 提交于
      cancel_rearming_delayed_work[queue]() has been superceded by
      cancel_delayed_work_sync() quite some time ago.  Convert all the
      in-kernel users.  The conversions are completely equivalent and
      trivial.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: N"David S. Miller" <davem@davemloft.net>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Acked-by: NEvgeniy Polyakov <zbr@ioremap.net>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
      Cc: netdev@vger.kernel.org
      Cc: Anton Vorontsov <cbou@mail.ru>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Alex Elder <aelder@sgi.com>
      Cc: xfs-masters@oss.sgi.com
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: netfilter-devel@vger.kernel.org
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Cc: linux-nfs@vger.kernel.org
      afe2c511
  8. 22 10月, 2010 2 次提交
    • T
      libata: add @ap to ata_wait_register() and introduce ata_msleep() · 97750ceb
      Tejun Heo 提交于
      Add optional @ap argument to ata_wait_register() and replace msleep()
      calls with ata_msleep() which take optional @ap in addition to the
      duration.  These will be used to implement EH exclusion.
      
      This patch doesn't cause any behavior difference.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      97750ceb
    • L
      [libata] Fix section mismatch: ata_sff_exit · c43d559f
      Luck, Tony 提交于
      This build error showed up in linux-next tag next-20100820 for ia64:
      
      WARNING: vmlinux.o(.init.text+0x4a952): Section mismatch in reference from the function ata_init() to the function .exit.text:ata_sff_exit()
      The function __init ata_init() references
      a function __exit ata_sff_exit().
      This is often seen when error handling in the init function
      uses functionality in the exit path.
      The fix is often to remove the __exit annotation of
      ata_sff_exit() so it may be used outside an exit section.
      
      Sure enough, dropping the __exit fixes the problem.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c43d559f
  9. 11 10月, 2010 1 次提交
    • T
      workqueue: add and use WQ_MEM_RECLAIM flag · 6370a6ad
      Tejun Heo 提交于
      Add WQ_MEM_RECLAIM flag which currently maps to WQ_RESCUER, mark
      WQ_RESCUER as internal and replace all external WQ_RESCUER usages to
      WQ_MEM_RECLAIM.
      
      This makes the API users express the intent of the workqueue instead
      of indicating the internal mechanism used to guarantee forward
      progress.  This is also to make it cleaner to add more semantics to
      WQ_MEM_RECLAIM.  For example, if deemed necessary, memory reclaim
      workqueues can be made highpri.
      
      This patch doesn't introduce any functional change.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      6370a6ad
  10. 10 9月, 2010 2 次提交
  11. 26 8月, 2010 1 次提交
  12. 02 7月, 2010 1 次提交
    • T
      libata: take advantage of cmwq and remove concurrency limitations · ad72cf98
      Tejun Heo 提交于
      libata has two concurrency related limitations.
      
      a. ata_wq which is used for polling PIO has single thread per CPU.  If
         there are multiple devices doing polling PIO on the same CPU, they
         can't be executed simultaneously.
      
      b. ata_aux_wq which is used for SCSI probing has single thread.  In
         cases where SCSI probing is stalled for extended period of time
         which is possible for ATAPI devices, this will stall all probing.
      
      #a is solved by increasing maximum concurrency of ata_wq.  Please note
      that polling PIO might be used under allocation path and thus needs to
      be served by a separate wq with a rescuer.
      
      #b is solved by using the default wq instead and achieving exclusion
      via per-port mutex.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJeff Garzik <jgarzik@pobox.com>
      ad72cf98
  13. 26 5月, 2010 4 次提交
    • T
      libata-sff: make BMDMA optional · 9a7780c9
      Tejun Heo 提交于
      Make BMDMA optional depending on new config variable CONFIG_ATA_BMDMA.
      In Kconfig, drivers are grouped into five groups - non-SFF native, SFF
      w/ custom DMA interface, SFF w/ BMDMA, PIO-only SFF, and generic
      fallback / legacy ones.  Kconfig and Makefile are reorganized
      according to the groups and ordered alphabetically inside each group.
      
      ata_ioports.bmdma_addr and ata_port.bmdma_prd[_dma] are put into
      CONFIG_ATA_BMDMA, as are all bmdma related ops, variables and
      functions.
      
      This increase the binary size slightly when BMDMA is enabled but on
      both native-only and PIO-only configurations the size is slightly
      reduced.  Either way, the size difference is insignificant.  This
      change is more meaningful to signify the separation between SFF and
      BMDMA and as a tool to verify the separation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      9a7780c9
    • T
      libata-sff: separate out BMDMA init · 1c5afdf7
      Tejun Heo 提交于
      Separate out ata_pci_bmdma_prepare_host() and ata_pci_bmdma_init_one()
      from their SFF counterparts.  SFF ones no longer try to initialize
      BMDMA or set PCI master.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      1c5afdf7
    • T
      libata-sff: separate out BMDMA irq handler · c3b28894
      Tejun Heo 提交于
      Separate out BMDMA irq handler from SFF irq handler.  The misnamed
      host_intr() functions are renamed to ata_sff_port_intr() and
      ata_bmdma_port_intr().  Common parts are factored into
      __ata_sff_port_intr() and __ata_sff_interrupt() and used by sff and
      bmdma interrupt routines.
      
      All BMDMA drivers now use ata_bmdma_interrupt() or
      ata_bmdma_port_intr() while all non-BMDMA SFF ones use
      ata_sff_interrupt() or ata_sff_port_intr().
      
      For now, ata_pci_sff_init_one() uses ata_bmdma_interrupt() as it's
      used by both SFF and BMDMA drivers.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c3b28894
    • T
      libata-sff: ata_sff_irq_clear() is BMDMA specific · 37f65b8b
      Tejun Heo 提交于
      ata_sff_irq_clear() is BMDMA specific.  Rename it to
      ata_bmdma_irq_clear(), move it to ata_bmdma_port_ops and make
      ->sff_irq_clear() optional.
      
      Note: ata_bmdma_irq_clear() is actually only needed by ata_piix and
            possibly by sata_sil.  This should be moved to respective low
            level drivers later.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      37f65b8b
  14. 20 5月, 2010 9 次提交
    • T
      libata-sff: separate out BMDMA qc_issue · 360ff783
      Tejun Heo 提交于
      Separate out ata_bmdma_qc_issue() from ata_sff_qc_issue() such that
      ata_sff_qc_issue() only deals with non-BMDMA SFF protocols (PIO and
      nodata) while ata_bmdma_qc_issue() deals with the BMDMA protocols and
      uses ata_sff_qc_issue() for non-DMA commands.  All the users are
      updated accordingly.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      360ff783
    • T
      libata-sff: prd is BMDMA specific · f60d7011
      Tejun Heo 提交于
      struct ata_prd and ap->prd are BMDMA specific.  Add bmdma_ prefix to
      them and move them inside CONFIG_ATA_SFF.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f60d7011
    • T
      libata-sff: ata_sff_[dumb_]qc_prep are BMDMA specific · f47451c4
      Tejun Heo 提交于
      Both qc_prep functions deal only with BMDMA PRD setup and PIO only SFF
      drivers don't need them.  Rename to ata_bmdma_[dumb_]qc_prep() and
      relocate.
      
      All usages are renamed except for pdc_adma and sata_qstor.  Those two
      drivers are not BMDMA drivers and don't need to call BMDMA qc_prep
      functions.  Calls to ata_sff_qc_prep() in the two drivers are removed.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f47451c4
    • T
      libata-sff: separate out BMDMA EH · fe06e5f9
      Tejun Heo 提交于
      Some of error handling logic in ata_sff_error_handler() and all of
      ata_sff_post_internal_cmd() are for BMDMA.  Create
      ata_bmdma_error_handler() and ata_bmdma_post_internal_cmd() and move
      BMDMA part into those.
      
      While at it, change DMA protocol check to ata_is_dma(), fix
      post_internal_cmd to call ap->ops->bmdma_stop instead of directly
      calling ata_bmdma_stop() and open code hardreset selection so that
      ata_std_error_handler() doesn't have to know about sff hardreset.
      
      As these two functions are BMDMA specific, there's no reason to check
      for bmdma_addr before calling bmdma methods if the protocol of the
      failed command is DMA.  sata_mv and pata_mpc52xx now don't need to set
      .post_internal_cmd to ATA_OP_NULL and pata_icside and sata_qstor don't
      need to set it to their bmdma_stop routines.
      
      ata_sff_post_internal_cmd() becomes noop and is removed.
      
      This fixes p3 described in clean-up-BMDMA-initialization patch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      fe06e5f9
    • T
      libata-sff: port_task is SFF specific · c429137a
      Tejun Heo 提交于
      port_task is tightly bound to the standard SFF PIO HSM implementation.
      Using it for any other purpose would be error-prone and there's no
      such user and if some drivers need such feature, it would be much
      better off using its own.  Move it inside CONFIG_ATA_SFF and rename it
      to sff_pio_task.
      
      The only function which is exposed to the core layer is
      ata_sff_flush_pio_task() which is renamed from ata_port_flush_task()
      and now also takes care of resetting hsm_task_state to HSM_ST_IDLE,
      which is possible as it's now specific to PIO HSM.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c429137a
    • T
      libata-sff: ap->[last_]ctl are SFF specific · 5fe7454a
      Tejun Heo 提交于
      ap->[last_]ctl are specific to SFF controllers.  Put them inside
      CONFIG_ATA_SFF and move initialization into ata_sff_port_init().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      5fe7454a
    • T
      libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo() · 8244cd05
      Tejun Heo 提交于
      ->drain_fifo() is SFF specific.  Rename and relocate it.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      8244cd05
    • T
      libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init() · 270390e1
      Tejun Heo 提交于
      In preparation of proper SFF/BMDMA separation, introduce
      ata_sff_init/exit() and ata_sff_port_init().  These functions
      currently don't do anything.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      270390e1
    • T
      libata-sff: clean up BMDMA initialization · c7087652
      Tejun Heo 提交于
      When BMDMA initialization failed or BMDMA was not available for
      whatever reason, bmdma_addr was left at zero and used as an indication
      that BMDMA shouldn't be used.  This leads to the following problems.
      
      p1. For BMDMA drivers which don't use traditional BMDMA register,
          ata_bmdma_mode_filter() incorrectly inhibits DMA modes.  Those
          drivers either have to inherit from ata_sff_port_ops or clear
          ->mode_filter explicitly.
      
      p2. non-BMDMA drivers call into BMDMA PRD table allocation.  It
          doesn't actually allocate PRD table if bmdma_addr is not
          initialized but is still confusing.
      
      p3. For BMDMA drivers which don't use traditional BMDMA register, some
          methods might not be invoked as expected (e.g. bmdma_stop from
          ata_sff_post_internal_cmd()).
      
      p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
          worrying libata core might call into one of them.
      
      These problems are caused by the muddy line between SFF and BMDMA and
      the assumption that all BMDMA controllers initialize bmdma_addr.
      
      This patch fixes p1 and p2 by removing the bmdma_addr assumption and
      moving prd allocation to BMDMA port start.  Later patches will fix the
      remaining issues.
      
      This patch improves BMDMA initialization such that
      
      * When BMDMA register initialization fails, falls back to PIO instead
        of failing.  ata_pci_bmdma_init() never fails now.
      
      * When ata_pci_bmdma_init() falls back to PIO, it clears
        ap->mwdma_mask and udma_mask instead of depending on
        ata_bmdma_mode_filter().  This makes ata_bmdma_mode_filter()
        unnecessary thus resolving p1.
      
      * ata_port_start() which actually is BMDMA specific is moved to
        ata_bmdma_port_start().  ata_port_start() and ata_sff_port_start()
        are killed.
      
      * ata_sff_port_start32() is moved and renamed to
        ata_bmdma_port_start32().
      
      Drivers which no longer call into PRD table allocation are...
      
        pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all
        drivers which inherit from ata_sff_port_ops.
      
      pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD
      but is a BMDMA controller and doesn't have custom port_start like
      other such controllers.
      
      Note that with the previous patch which makes all and only BMDMA
      drivers inherit from ata_bmdma_port_ops, this change doesn't break
      drivers which need PRD table.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c7087652
  15. 18 5月, 2010 2 次提交
    • T
      libata-sff: reorder SFF/BMDMA functions · 9f2f7210
      Tejun Heo 提交于
      Reorder functions such that SFF and BMDMA functions are grouped.
      While at it, s/BMDMA/SFF in a few comments where it actually meant
      SFF.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      9f2f7210
    • T
      libata: kill ATA_FLAG_DISABLED · 3e4ec344
      Tejun Heo 提交于
      ATA_FLAG_DISABLED is only used by drivers which don't use
      ->error_handler framework and is largely broken.  Its only meaningful
      function is to make irq handlers skip processing if the flag is set,
      which is largely useless and even harmful as it makes those ports more
      likely to cause IRQ storms.
      
      Kill ATA_FLAG_DISABLED and makes the callers disable attached devices
      instead.  ata_port_probe() and ata_port_disable() which manipulate the
      flag are also killed.
      
      This simplifies condition check in IRQ handlers.  While updating IRQ
      handlers, remove ap NULL check as libata guarantees consecutive port
      allocation (unoccupied ports are initialized with dummies) and
      long-obsolete ATA_QCFLAG_ACTIVE check (checked by ata_qc_from_tag()).
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3e4ec344
  16. 15 5月, 2010 7 次提交
  17. 06 4月, 2010 1 次提交
  18. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  19. 23 3月, 2010 1 次提交
    • T
      libata-sff: fix spurious IRQ handling · 332ac7ff
      Tejun Heo 提交于
      Commit 27943620 introduced spurious
      IRQ handling but it has a race condition where valid completion can be
      lost while trying to clear spurious IRQ leading to occassional command
      timeouts.
      
      This patch improves SFF interrupt handler such that
      
      1. Once BMDMA HSM is stopped, the condition is never considered
         spurious.  As there's no way to resume stopped BMDMA HSM, if device
         status doesn't agree with BMDMA status, the only way out is
         aborting the command (otherwise, it will just end up timing out).
      
      2. ap->ops->sff_check_status() can be safely called to clear spurious
         device IRQ as it atomically returns completion status but BMDMA IRQ
         status can't be cleared in safe way if command is in flight.  After
         a spurious IRQ, call ap->ops->sff_irq_clear() only if the
         respective device is idle and retry completion if
         sff_check_status() indicates command completion.
      
      Please note that ata_piix uses bmdma_status for sff_irq_check() and #2
      won't weaken spurious IRQ handling even with in-flight command because
      if bmdma_status indicates IRQ pending but device status is not on
      spurious check, the next IRQ handler invocation will abort the command
      due to #1.
      
      This fixes bko#15537.
      
         https://bugzilla.kernel.org/show_bug.cgi?id=15537Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Andrew Benton <b3nton@gmail.com>
      Cc: Petr Uzel <petr.uzel@centrum.cz>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      332ac7ff