1. 14 2月, 2011 1 次提交
    • J
      [SCSI] libata: plumb sas port scan into standard libata paths · 1f723867
      James Bottomley 提交于
      The function ata_sas_port_init() has always really done its own thing.
      However, as a precursor to moving to the libata new eh, it has to be
      properly using the standard libata scan paths.  This means separating
      the current libata scan paths into pieces which can be shared with
      libsas and pieces which cant (really just the async call and the host
      scan).
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      1f723867
  2. 25 12月, 2010 1 次提交
    • T
      libata: no special completion processing for EH commands · f08dc1ac
      Tejun Heo 提交于
      ata_qc_complete() contains special handling for certain commands.  For
      example, it schedules EH for device revalidation after certain
      configurations are changed.  These shouldn't be applied to EH
      commands but they were.
      
      In most cases, it doesn't cause an actual problem because EH doesn't
      issue any command which would trigger special handling; however, ACPI
      can issue such commands via _GTF which can cause weird interactions.
      
      Restructure ata_qc_complete() such that EH commands are always passed
      on to __ata_qc_complete().
      
      stable: Please apply to -stable only after 2.6.38 is released.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NKyle McMartin <kyle@mcmartin.ca>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f08dc1ac
  3. 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
  4. 02 11月, 2010 1 次提交
  5. 22 10月, 2010 7 次提交
    • T
      libata: implement cross-port EH exclusion · c0c362b6
      Tejun Heo 提交于
      In libata, the non-EH code paths should always take and release
      ap->lock explicitly when accessing hardware or shared data structures.
      However, once EH is active, it's assumed that the port is owned by EH
      and EH methods don't explicitly take ap->lock unless race from irq
      handler or other code paths are expected.  However, libata EH didn't
      guarantee exclusion among EHs for ports of the same host.  IOW,
      multiple EHs may execute in parallel on multiple ports of the same
      controller.
      
      In many cases, especially in SATA, the ports are completely
      independent of each other and this doesn't cause problems; however,
      there are cases where different ports share the same resource, which
      lead to obscure timing related bugs such as the one fixed by commit
      213373cf (ata_piix: fix locking around SIDPR access).
      
      This patch implements exclusion among EHs of the same host.  When EH
      begins, it acquires per-host EH ownership by calling ata_eh_acquire().
      When EH finishes, the ownership is released by calling
      ata_eh_release().  EH ownership is also released whenever the EH
      thread goes to sleep from ata_msleep() or explicitly and reacquired
      after waking up.
      
      This ensures that while EH is actively accessing the hardware, it has
      exclusive access to it while allowing EHs to interleave and progress
      in parallel as they hit waiting stages, which dominate the time spent
      in EH.  This achieves cross-port EH exclusion without pervasive and
      fragile changes while still allowing parallel EH for the most part.
      
      This was first reported by yuanding02@gmail.com more than three years
      ago in the following bugzilla.  :-)
      
        https://bugzilla.kernel.org/show_bug.cgi?id=8223Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Reported-by: yuanding02@gmail.com
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c0c362b6
    • 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
    • T
      libata: reimplement link power management · 6b7ae954
      Tejun Heo 提交于
      The current LPM implementation has the following issues.
      
      * Operation order isn't well thought-out.  e.g. HIPM should be
        configured after IPM in SControl is properly configured.  Not the
        other way around.
      
      * Suspend/resume paths call ata_lpm_enable/disable() which must only
        be called from EH context directly.  Also, ata_lpm_enable/disable()
        were called whether LPM was in use or not.
      
      * Implementation is per-port when it should be per-link.  As a result,
        it can't be used for controllers with slave links or PMP.
      
      * LPM state isn't managed consistently.  After a link reset for
        whatever reason including suspend/resume the actual LPM state would
        be reset leaving ap->lpm_policy inconsistent.
      
      * Generic/driver-specific logic boundary isn't clear.  Currently,
        libahci has to mangle stuff which libata EH proper should be
        handling.  This makes the implementation unnecessarily complex and
        fragile.
      
      * Tied to ALPM.  Doesn't consider DIPM only cases and doesn't check
        whether the device allows HIPM.
      
      * Error handling isn't implemented.
      
      Given the extent of mismatch with the rest of libata, I don't think
      trying to fix it piecewise makes much sense.  This patch reimplements
      LPM support.
      
      * The new implementation is per-link.  The target policy is still
        port-wide (ap->target_lpm_policy) but all the mechanisms and states
        are per-link and integrate well with the rest of link abstraction
        and can work with slave and PMP links.
      
      * Core EH has proper control of LPM state.  LPM state is reconfigured
        when and only when reconfiguration is necessary.  It makes sure that
        LPM state is reset when probing for new device on the link.
        Controller agnostic logic is now implemented in libata EH proper and
        driver implementation only has to deal with controller specifics.
      
      * Proper error handling.  LPM config failure is attributed to the
        device on the link and LPM is disabled for the link if it fails
        repeatedly.
      
      * ops->enable/disable_pm() are replaced with single ops->set_lpm()
        which takes @policy and @hints.  This simplifies driver specific
        implementation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6b7ae954
    • T
      libata: implement sata_link_scr_lpm() and make ata_dev_set_feature() global · 1152b261
      Tejun Heo 提交于
      Link power management is about to be reimplemented.  Prepare for it.
      
      * Implement sata_link_scr_lpm().
      
      * Drop static from ata_dev_set_feature() and make it available to
        other libata files.
      
      * Trivial whitespace adjustments.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      1152b261
    • T
      libata: clean up lpm related symbols and sysfs show/store functions · c93b263e
      Tejun Heo 提交于
      Link power management related symbols are in confusing state w/ mixed
      usages of lpm, ipm and pm.  This patch cleans up lpm related symbols
      and sysfs show/store functions as follows.
      
      * lpm states - NOT_AVAILABLE, MIN_POWER, MAX_PERFORMANCE and
        MEDIUM_POWER are renamed to ATA_LPM_UNKNOWN and
        ATA_LPM_{MIN|MAX|MED}_POWER.
      
      * Pre/postfixes are unified to lpm.
      
      * sysfs show/store functions for link_power_management_policy were
        curiously named get/put and unnecessarily complex.  Renamed to
        show/store and simplified.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c93b263e
    • T
      libata: always use ata_qc_complete_multiple() for NCQ command completions · 1aadf5c3
      Tejun Heo 提交于
      Currently, sata_fsl, mv and nv call ata_qc_complete() multiple times
      from their interrupt handlers to indicate completion of NCQ commands.
      This limits the visibility the libata core layer has into how commands
      are being executed and completed, which is necessary to support IRQ
      expecting in generic way.  libata already has an interface to complete
      multiple commands at once - ata_qc_complete_multiple() which ahci and
      sata_sil24 already use.
      
      This patch updates the three drivers to use ata_qc_complete_multiple()
      too and updates comments on ata_qc_complete[_multiple]() regarding
      their usages with NCQ completions.  This change not only provides
      better visibility into command execution to the core layer but also
      simplifies low level drivers.
      
      * sata_fsl: It already builds done_mask.  Conversion is straight
        forward.
      
      * sata_mv: mv_process_crpb_response() no longer checks for illegal
        completions, it just returns whether the tag is completed or not.
        mv_process_crpb_entries() builds done_mask from it and passes it to
        ata_qc_complete_multiple() which will check for illegal completions.
      
      * sata_nv adma: Similar to sata_mv.  nv_adma_check_cpb() now just
        returns the tag status and nv_adma_interrupt() builds done_mask from
        it and passes it to ata_qc_complete_multiple().
      
      * sata_nv swncq: It already builds done_mask.  Drop unnecessary
        illegal transition checks and call ata_qc_complete_multiple().
      
      In the long run, it might be a good idea to make ata_qc_complete()
      whine if called when multiple NCQ commands are in flight.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Ashish Kalra <ashish.kalra@freescale.com>
      Cc: Saeed Bishara <saeed@marvell.com>
      Cc: Mark Lord <liml@rtr.ca>
      Cc: Robert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      1aadf5c3
    • G
      [libata] Add ATA transport class · d9027470
      Gwendal Grignou 提交于
      This is a scheleton for libata transport class.
      All information is read only, exporting information from libata:
      - ata_port class: one per ATA port
      - ata_link class: one per ATA port or 15 for SATA Port Multiplier
      - ata_device class: up to 2 for PATA link, usually one for SATA.
      Signed-off-by: NGwendal Grignou <gwendal@google.com>
      Reviewed-by: NGrant Grundler <grundler@google.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d9027470
  6. 10 9月, 2010 1 次提交
  7. 26 8月, 2010 1 次提交
  8. 11 8月, 2010 1 次提交
    • R
      docbook: fix fatal error from libata · 3d2be54b
      Randy Dunlap 提交于
      'make htmldocs' has a fatal error when processing libata.xml, as seen
      below.  The string "Example patterns:" (or any string with "example.*:"
      in it AFAIK) causes some part of the doc generation tool chain to try to
      produce an <informalexample> block without a beginning <para>, but
      there is an ending </para> generated, which throws things out of kilter.
      
      I don't even know where (what program) this is happening in.
      I searched in docproc and xmlto and in some XML stylesheets without
      finding anything.  If anyone can give me pointers about this, please do.
      Until this is fixed, let's just spell "Example" as "Sample"
      and match up the double quotation marks while there.
      
        Documentation/DocBook/libata.xml:6575: parser error : Opening and ending tag mismatch: programlisting line 6573 and para
           </para><para>
                  ^
        Documentation/DocBook/libata.xml:6580: parser error : Opening and ending tag mismatch: para line 6575 and programlisting
        </programlisting></informalexample>
                         ^
        unable to parse Documentation/DocBook/libata.xml
        make[2]: *** [Documentation/DocBook/libata.html] Error 1
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3d2be54b
  9. 02 8月, 2010 5 次提交
  10. 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
  11. 03 6月, 2010 2 次提交
  12. 26 5月, 2010 2 次提交
    • T
      libata: implement dump_id force param · 43c9c591
      Tejun Heo 提交于
      Add dump_id libata.force parameter.  If specified, libata dumps full
      IDENTIFY data during device configuration.  This is to aid debugging.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Larry Baker <baker@usgs.gov>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      43c9c591
    • T
      libata: disable ATAPI AN by default · e7ecd435
      Tejun Heo 提交于
      There are ATAPI devices which raise AN when hit by commands issued by
      open().  This leads to infinite loop of AN -> MEDIA_CHANGE uevent ->
      udev open() to check media -> AN.
      
      Both ACS and SerialATA standards don't define in which case ATAPI
      devices are supposed to raise or not raise AN.  They both list media
      insertion event as a possible use case for ATAPI ANs but there is no
      clear description of what constitutes such events.  As such, it seems
      a bit too naive to export ANs directly to userland as MEDIA_CHANGE
      events without further verification (which should behave similarly to
      windows as it apparently is the only thing that some hardware vendors
      are testing against).
      
      This patch adds libata.atapi_an module parameter and disables ATAPI AN
      by default for now.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Nick Bowler <nbowler@elliptictech.com>
      Cc: David Zeuthen <david@fubar.dk>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e7ecd435
  13. 20 5月, 2010 4 次提交
    • 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: 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
  14. 18 5月, 2010 1 次提交
    • 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
  15. 15 5月, 2010 2 次提交
    • A
      libata: use __ratelimit · 9990b6f3
      Akinobu Mita 提交于
      Use __ratelimit() instead of its own private rate limit implementation.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: linux-ide@vger.kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      9990b6f3
    • T
      libata: use longer 0xff wait if parallel scan is enabled · b48d58f5
      Tejun Heo 提交于
      There are some SATA devices which take relatively long to get out of
      0xff status after reset.  In libata, this timeout is determined by
      ATA_TMOUT_FF_WAIT.  Quantum GoVault is the worst requring about 2s for
      reliable detection.  However, because 2s 0xff timeout can introduce
      rather long spurious delay during boot, libata has been compromising
      at the next longest timeout of 800ms for HHD424020F7SV00 iVDR drive.
      
      Now that parallel scan is in place for common drivers, libata can
      afford 2s 0xff timeout.  Use 2s 0xff timeout if parallel scan is
      enabled.
      
      Please note that the chance of spurious wait is pretty slim w/ working
      SCR access so this will only affect SATA controllers w/o SCR access
      which isn't too common these days.
      
      Please read the following thread for more information on the GoVault
      drive.
      
        http://thread.gmane.org/gmane.linux.ide/14545/focus=14663Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Gary Hade <garyhade@us.ibm.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b48d58f5
  16. 06 4月, 2010 2 次提交
    • T
      libata: unlock HPA if device shrunk · 445d211b
      Tejun Heo 提交于
      Some BIOSes don't configure HPA during boot but do so while resuming.
      This causes harddrives to shrink during resume making libata detach
      and reattach them.  This can be worked around by unlocking HPA if old
      size equals native size.
      
      Add ATA_DFLAG_UNLOCK_HPA so that HPA unlocking can be controlled
      per-device and update ata_dev_revalidate() such that it sets
      ATA_DFLAG_UNLOCK_HPA and fails with -EIO when the above condition is
      detected.
      
      This patch fixes the following bug.
      
        https://bugzilla.kernel.org/show_bug.cgi?id=15396Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NOleksandr Yermolenko <yaa.bta@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      445d211b
    • T
      libata: disable NCQ on Crucial C300 SSD · 68b0ddb2
      Tejun Heo 提交于
      Crucial said,
      
        Thank you for contacting us. We know that with our M225 line of SSDs
        you sometimes need to disable NCQ (native command queuing) to avoid
        just the type of errors you're seeing. Our recommendation for the
        M225 is to add libata.force=noncq to your Linux kernel boot options,
        under the kernel ATA library option.
      
        I have sent your feedback to the engineers working on the C300, and
        asked them to please pass it on to the firmware team. I have been
        notified that they are in the process of testing and finalizing a
        new firmware version, that you can expect to see released around the
        end of April. We’ll keep you posted as to when it will be available
        for download.
      
      So, turn off NCQ on the drive w/ the current firmware revision.
      
      Reported in the following bug.
      
        https://bugzilla.kernel.org/show_bug.cgi?id=15573Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: lethalwp@scarlet.be
      Reported-by: NLuke Macken <lmacken@redhat.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      68b0ddb2
  17. 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
  18. 02 3月, 2010 1 次提交
  19. 05 2月, 2010 1 次提交
  20. 13 1月, 2010 1 次提交
  21. 04 12月, 2009 1 次提交
  22. 04 11月, 2009 1 次提交
  23. 16 10月, 2009 1 次提交
    • T
      libata: fix internal command failure handling · f4b31db9
      Tejun Heo 提交于
      When an internal command fails, it should be failed directly without
      invoking EH.  In the original implemetation, this was accomplished by
      letting internal command bypass failure handling in ata_qc_complete().
      However, later changes added post-successful-completion handling to
      that code path and the success path is no longer adequate as internal
      command failure path.  One of the visible problems is that internal
      command failure due to timeout or other freeze conditions would
      spuriously trigger WARN_ON_ONCE() in the success path.
      
      This patch updates failure path such that internal command failure
      handling is contained there.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f4b31db9