1. 06 11月, 2014 1 次提交
  2. 15 7月, 2014 1 次提交
    • A
      libata: EH should handle AMNF error condition as a media error · eec7e1c1
      Alexey Asemov 提交于
      libata-eh.c should handle AMNF error condition (error byte bit 0,
      usually code 0x01) in libata-eh.c along with UNC as a media error so
      SCSI stack can handle it properly (translation code 0x01 is already
      present in libata-scsi.c) but was never passed down due to lack of
      handling in EH.
      
      While using linux-based machine (AMD 6550M-based notebook, PCI IDs for the
      controller are 1022:7801 subsys 1025:059d) and ddrescue to salvage data
      from failing hard drive (WD7500BPVT 2.5" 750G SATA2), I've found that pure
      AMNF 0x01 error code generates generic "device error" that is retried
      several times by SCSI stack instead of "media error" that is passed up to
      software.
      
      So we may assume deprecated AMNF error code is surely not dead yet, and
      it's better for it to be handled properly. As we may see it is used by
      modern enough devices, and used properly: drive returned AMNF only when IDs
      for track cannot be read completely due to dying head or positioning,
      otherwise it returned UNC(orrectables).
      
      Not handling it causes wrong generic error code ("device error") reporting
      down the stack, can damage failing drives further because of excessive
      retries, and slows salvaging down a lot. Also, there is handling code in
      libata-scsi.c for 0x01 AMNF error already.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=80031
      
      tj: Shortened $SUBJ and moved its content to the first paragraph.
      Signed-off-by: NAlexey Asemov <alex@alex-at.ru>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      eec7e1c1
  3. 19 3月, 2014 1 次提交
    • D
      libata, libsas: kill pm_result and related cleanup · bc6e7c4b
      Dan Williams 提交于
      Tejun says:
        "At least for libata, worrying about suspend/resume failures don't make
         whole lot of sense.  If suspend failed, just proceed with suspend.  If
         the device can't be woken up afterwards, that's that.  There isn't
         anything we could have done differently anyway.  The same for resume, if
         spinup fails, the device is dud and the following commands will invoke
         EH actions and will eventually fail.  Again, there really isn't any
         *choice* to make.  Just making sure the errors are handled gracefully
         (ie. don't crash) and the following commands are handled correctly
         should be enough."
      
      The only libata user that actually cares about the result from a suspend
      operation is libsas.  However, it only cares about whether queuing a new
      operation collides with an in-flight one.  All libsas does with the
      error is retry, but we can just let libata wait for the previous
      operation before continuing.
      
      Other cleanups include:
      1/ Unifying all ata port pm operations on an ata_port_pm_ prefix
      2/ Marking all ata port pm helper routines as returning void, only
         ata_port_pm_ entry points need to fake a 0 return value.
      3/ Killing ata_port_{suspend|resume}_common() in favor of calling
         ata_port_request_pm() directly
      4/ Killing the wrappers that just do a to_ata_port() conversion
      5/ Clearly marking the entry points that do async operations with an
        _async suffix.
      
      Reference: http://marc.info/?l=linux-scsi&m=138995409532286&w=2
      
      Cc: Phillip Susi <psusi@ubuntu.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Suggested-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NTodd Brandt <todd.e.brandt@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      bc6e7c4b
  4. 08 3月, 2014 1 次提交
    • D
      libata: end the r-word · 35bf8821
      Dan Williams 提交于
      Prompted by the social effort in the US to discourage usage of the
      adjective "retarded".
      
      In this case we needlessly anthropomorphize hard drives.  The
      implication is that due to design deficiencies in the device reset
      recovery time is negatively impacted.  We can simply clearly state that
      fact.  "Exceptional devices cause outliers in reset recovery time." This
      steers clear of any unintended comparison of such devices to humans with
      cognitive disabilities.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      35bf8821
  5. 23 11月, 2013 1 次提交
  6. 15 11月, 2013 1 次提交
  7. 27 10月, 2013 1 次提交
  8. 08 10月, 2013 1 次提交
    • G
      libata: make ata_eh_qc_retry() bump scmd->allowed on bogus failures · f13e2201
      Gwendal Grignou 提交于
      libata EH decrements scmd->retries when the command failed for reasons
      unrelated to the command itself so that, for example, commands aborted
      due to suspend / resume cycle don't get penalized; however,
      decrementing scmd->retries isn't enough for ATA passthrough commands.
      
      Without this fix, ATA passthrough commands are not resend to the
      drive, and no error is signalled to the caller because:
      
      - allowed retry count is 1
      - ata_eh_qc_complete fill the sense data, so result is valid
      - sense data is filled with untouched ATA registers.
      Signed-off-by: NGwendal Grignou <gwendal@google.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      f13e2201
  9. 15 5月, 2013 1 次提交
  10. 26 1月, 2013 1 次提交
    • A
      [libata] pm: differentiate system and runtime pm for ata port · a7ff60db
      Aaron Lu 提交于
      We need to do different things for system PM and runtime PM, e.g. we do
      not need to enable runtime wake for ZPODD when we are doing system
      suspend, etc.
      
      Currently, we use PMSG_SUSPEND for both system suspend and runtime
      suspend and PMSG_ON for both system resume and runtime resume. Change
      this by using PMSG_AUTO_SUSPEND for runtime suspend and PMSG_AUTO_RESUME
      for runtime resume. And since PMSG_ON means no transition, it is changed
      to PMSG_RESUME for ata port's system resume.
      
      The ata_acpi_set_state is modified accordingly, and the sata case and
      pata case is seperated for easy reading.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      a7ff60db
  11. 22 1月, 2013 2 次提交
    • A
      libata: handle power transition of ODD · 21334205
      Aaron Lu 提交于
      When ata port is runtime suspended, it will check if the ODD attched to
      it is a zero power(ZP) capable ODD and if the ZP capable ODD is in zero
      power ready state. And if this is not the case, the highest acpi state
      will be limited to ACPI_STATE_D3_HOT to avoid powering off the ODD. And
      if the ODD can be powered off, runtime wake capability needs to be
      enabled and powered_off flag will be set to let resume code knows that
      the ODD was in powered off state.
      
      And on resume, before it is powered on, if it was powered off during
      suspend, runtime wake capability needs to be disabled. After it is
      recovered, the ODD is considered functional, post power on processing
      like eject tray if the ODD is drawer type is done, and several ZPODD
      related fields will also be reset.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      21334205
    • A
      libata: check zero power ready status for ZPODD · 3dc67440
      Aaron Lu 提交于
      Per the Mount Fuji spec, the ODD is considered zero power ready when:
        - For slot type ODD, no media inside;
        - For tray type ODD, no media inside and tray closed.
      
      The information can be retrieved by either the returned information of
      command GET_EVENT_STATUS_NOTIFICATION(the command is used to poll for
      media event) or sense code.
      
      The information provided by the media status byte is not accurate, it
      is possible that after a new disc is just inserted, the status byte
      still returns media not present. So this information can not be used as
      the deciding factor, we use sense code to decide if zpready status is
      true.
      
      When we first sensed the ODD in the zero power ready state, the
      zp_sampled will be set and timestamp will be recoreded. And after ODD
      stayed in this state for some pre-defined period, the ODD is considered
      as power off ready and the zp_ready flag will be set. The zp_ready flag
      serves as the deciding factor other code will use to see if power off is
      OK for the ODD.
      
      The Mount Fuji spec suggests a delay should be used here, to avoid the
      case user ejects the ODD and then instantly inserts a new one again, so
      that we can avoid a power transition. And some ODDs may be slow to place
      its head to the home position after disc is ejected, so a delay here is
      generally a good idea. And the delay time can be changed via the module
      param zpodd_poweroff_delay.
      
      The zero power ready status check is performed in the ata port's runtime
      suspend code path, when port is not frozen yet, as we need to issue some
      IOs to the ODD.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3dc67440
  12. 15 1月, 2013 1 次提交
  13. 03 12月, 2012 1 次提交
  14. 13 9月, 2012 1 次提交
    • S
      ahci: implement aggressive SATA device sleep support · 65fe1f0f
      Shane Huang 提交于
      Device Sleep is a feature as described in AHCI 1.3.1 Technical Proposal.
      This feature enables an HBA and SATA storage device to enter the DevSleep
      interface state, enabling lower power SATA-based systems.
      
      Aggressive Device Sleep enables the HBA to assert the DEVSLP signal as
      soon as there are no commands outstanding to the device and the port
      specific Device Sleep idle timer has expired. This enables autonomous
      entry into the DevSleep interface state without waiting for software
      in power sensitive systems.
      
      This patch enables Aggressive Device Sleep only if both host controller
      and device support it.
      
      Tested on AMD reference board together with Device Sleep supported device
      sample.
      Signed-off-by: NShane Huang <shane.huang@amd.com>
      Reviewed-by: NAaron Lu <aaron.lwe@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      65fe1f0f
  15. 24 8月, 2012 1 次提交
  16. 26 7月, 2012 1 次提交
  17. 20 7月, 2012 1 次提交
  18. 08 5月, 2012 1 次提交
  19. 04 5月, 2012 1 次提交
    • L
      libata: skip old error history when counting probe trials · 6868225e
      Lin Ming 提交于
      Commit d9027470("[libata] Add ATA transport class") introduced
      ATA_EFLAG_OLD_ER to mark entries in the error ring as cleared.
      
      But ata_count_probe_trials_cb() didn't check this flag and it still
      counts the old error history. So wrong probe trials count is returned
      and it causes problem, for example, SATA link speed is slowed down from
      3.0Gbps to 1.5Gbps.
      
      Fix it by checking ATA_EFLAG_OLD_ER in ata_count_probe_trials_cb().
      
      Cc: stable <stable@vger.kernel.org> # 2.6.37+
      Signed-off-by: NLin Ming <ming.m.lin@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6868225e
  20. 20 2月, 2012 1 次提交
    • D
      [SCSI] libsas: execute transport link resets with libata-eh via host workqueue · 81c757bc
      Dan Williams 提交于
      Link resets leave ata affiliations intact, so arrange for libsas to make
      an effort to avoid dropping the device due to a slow-to-recover link.
      Towards this end carry out reset in the host workqueue so that it can
      check for ata devices and kick the reset request to libata.  Hard
      resets, in contrast, bypass libata since they are meant for associating
      an ata device with another initiator in the domain (tears down
      affiliations).
      
      Need to add a new transport_sas_phy_reset() since the current
      sas_phy_reset() is a utility function to libsas lldds.  They are not
      prepared for it to loop back into eh.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      81c757bc
  21. 09 11月, 2011 1 次提交
  22. 01 11月, 2011 1 次提交
  23. 08 10月, 2011 1 次提交
  24. 24 7月, 2011 2 次提交
    • T
      libata: leave port thawed after reset failure · 8ea7645c
      Tejun Heo 提交于
      libata EH intentionally left a port frozen if it failed
      ata_eh_reset().  The intention was avoiding continuous loop of resets
      when the controller or attached device is flaky and reporting spurious
      hotplug events.  Once port enters this state, it can be recovered with
      manual rescan, which seemed reasonable.
      
      However, outside of my convoluted test setup, there have been very few
      reports justifying this choice while there have been more cases where
      the automatic freezing of the port after hotplug attempt of a faulty
      device caused confusion and led to unnecessary resets.
      
      This patch changes the behavior so that the port is thawed after reset
      failure.  This change doesn't necessarily solve but makes it easier
      and more intuitive to work around hotplug related problems
      (ie. re-pluggin or power cycling the device) as reported in the
      followings.
      
        https://bugzilla.kernel.org/show_bug.cgi?id=34712
        http://thread.gmane.org/gmane.linux.kernel/1123265/focus=49548Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NReartes Guillermo <rtguille@gmail.com>
      Reported-by: NBruce Stenning <b.stenning@indigovision.com>
      Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
      8ea7645c
    • 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
  25. 08 6月, 2011 1 次提交
    • T
      libata: fix unexpectedly frozen port after ata_eh_reset() · 8c56cacc
      Tejun Heo 提交于
      To work around controllers which can't properly plug events while
      reset, ata_eh_reset() clears error states and ATA_PFLAG_EH_PENDING
      after reset but before RESET is marked done.  As reset is the final
      recovery action and full verification of devices including onlineness
      and classfication match is done afterwards, this shouldn't lead to
      lost devices or missed hotplug events.
      
      Unfortunately, it forgot to thaw the port when clearing EH_PENDING, so
      if the condition happens after resetting an empty port, the port could
      be left frozen and EH will end without thawing it, making the port
      unresponsive to further hotplug events.
      
      Thaw if the port is frozen after clearing EH_PENDING.  This problem is
      reported by Bruce Stenning in the following thread.
      
       http://thread.gmane.org/gmane.linux.kernel/1123265
      
      stable: I think we should weather this patch a bit longer in -rcX
      	before sending it to -stable.  Please wait at least a month
      	after this patch makes upstream.  Thanks.
      
      -v2: Fixed spelling in the comment per Dave Howorth.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NBruce Stenning <b.stenning@indigovision.com>
      Cc: stable@kernel.org
      Cc: Dave Howorth <dhoworth@mrc-lmb.cam.ac.uk>
      Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
      8c56cacc
  26. 20 5月, 2011 1 次提交
  27. 15 5月, 2011 1 次提交
    • T
      libata: fix oops when LPM is used with PMP · 5f6f12cc
      Tejun Heo 提交于
      ae01b249 (libata: Implement ATA_FLAG_NO_DIPM and apply it to mcp65)
      added ATA_FLAG_NO_DIPM and made ata_eh_set_lpm() check the flag.
      However, @ap is NULL if @link points to a PMP link and thus the
      unconditional @ap->flags dereference leads to the following oops.
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
        IP: [<ffffffff813f98e1>] ata_eh_recover+0x9a1/0x1510
        ...
        Pid: 295, comm: scsi_eh_4 Tainted: P            2.6.38.5-core2 #1 System76, Inc. Serval Professional/Serval Professional
        RIP: 0010:[<ffffffff813f98e1>]  [<ffffffff813f98e1>] ata_eh_recover+0x9a1/0x1510
        RSP: 0018:ffff880132defbf0  EFLAGS: 00010246
        RAX: 0000000000000000 RBX: ffff880132f40000 RCX: 0000000000000000
        RDX: ffff88013377c000 RSI: ffff880132f40000 RDI: 0000000000000000
        RBP: ffff880132defce0 R08: ffff88013377dc58 R09: ffff880132defd98
        R10: 0000000000000000 R11: 00000000ffffffff R12: 0000000000000000
        R13: 0000000000000000 R14: ffff88013377c000 R15: 0000000000000000
        FS:  0000000000000000(0000) GS:ffff8800bf700000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
        CR2: 0000000000000018 CR3: 0000000001a03000 CR4: 00000000000406e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
        Process scsi_eh_4 (pid: 295, threadinfo ffff880132dee000, task ffff880133b416c0)
        Stack:
         0000000000000000 ffff880132defcc0 0000000000000000 ffff880132f42738
         ffffffff813ee8f0 ffffffff813eefe0 ffff880132defd98 ffff88013377f190
         ffffffffa00b3e30 ffffffff813ef030 0000000032defc60 ffff880100000000
        Call Trace:
         [<ffffffff81400867>] sata_pmp_error_handler+0x607/0xc30
         [<ffffffffa00b273f>] ahci_error_handler+0x1f/0x70 [libahci]
         [<ffffffff813faade>] ata_scsi_error+0x5be/0x900
         [<ffffffff813cf724>] scsi_error_handler+0x124/0x650
         [<ffffffff810834b6>] kthread+0x96/0xa0
         [<ffffffff8100cd64>] kernel_thread_helper+0x4/0x10
        Code: 8b 95 70 ff ff ff b8 00 00 00 00 48 3b 9a 10 2e 00 00 48 0f 44 c2 48 89 85 70 ff ff ff 48 8b 8d 70 ff ff ff f6 83 69 02 00 00 01 <48> 8b 41 18 0f 85 48 01 00 00 48 85 c9 74 12 48 8b 51 08 48 83
        RIP  [<ffffffff813f98e1>] ata_eh_recover+0x9a1/0x1510
         RSP <ffff880132defbf0>
        CR2: 0000000000000018
      
      Fix it by testing @link->ap->flags instead.
      
      stable: ATA_FLAG_NO_DIPM was added during 2.6.39 cycle but was
              backported to 2.6.37 and 38.  This is a fix for that and thus
              also applicable to 2.6.37 and 38.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: N"Nathan A. Mourey II" <nmoureyii@ne.rr.com>
      LKML-Reference: <1304555277.2059.2.camel@localhost.localdomain>
      Cc: Connor H <cmdkhh@gmail.com>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
      5f6f12cc
  28. 24 4月, 2011 1 次提交
  29. 31 3月, 2011 1 次提交
  30. 02 3月, 2011 3 次提交
    • J
      libata: separate error handler into usable components · 0e0b494c
      James Bottomley 提交于
      Right at the moment, the libata error handler is incredibly
      monolithic.  This makes it impossible to use from composite drivers
      like libsas and ipr which have to handle error themselves in the first
      instance.
      
      The essence of the change is to split the monolithic error handler
      into two components: one which handles a queue of ata commands for
      processing and the other which handles the back end of readying a
      port.  This allows the upper error handler fine grained control in
      calling libsas functions (and making sure they only get called for ATA
      commands whose lower errors have been fixed up).
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      0e0b494c
    • J
      libata: fix eh locking · c34aeebc
      James Bottomley 提交于
      The SCSI host eh_cmd_q should be protected by the host lock (not the
      port lock).  This probably doesn't matter that much at the moment,
      since we try to serialise the add and eh pieces, but it might matter
      in future for more convenient error handling.  Plus this switches
      libata to the standard eh pattern where you lock, remove from the cmd
      queue to a local list and unlock and then operate on the local list.
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c34aeebc
    • T
      libata: fix hotplug for drivers which don't implement LPM · eb0e85e3
      Tejun Heo 提交于
      ata_eh_analyze_serror() suppresses hotplug notifications if LPM is
      being used because LPM generates spurious hotplug events.  It compared
      whether link->lpm_policy was different from ATA_LPM_MAX_POWER to
      determine whether LPM is enabled; however, this is incorrect as for
      drivers which don't implement LPM, lpm_policy is always
      ATA_LPM_UNKNOWN.  This disabled hotplug detection for all drivers
      which don't implement LPM.
      
      Fix it by comparing whether lpm_policy is greater than
      ATA_LPM_MAX_POWER.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      eb0e85e3
  31. 14 2月, 2011 2 次提交
    • J
      [SCSI] libata: separate error handler into usable components · 64878c0e
      James Bottomley 提交于
      Right at the moment, the libata error handler is incredibly
      monolithic.  This makes it impossible to use from composite drivers
      like libsas and ipr which have to handle error themselves in the first
      instance.
      
      The essence of the change is to split the monolithic error handler
      into two components: one which handles a queue of ata commands for
      processing and the other which handles the back end of readying a
      port.  This allows the upper error handler fine grained control in
      calling libsas functions (and making sure they only get called for ATA
      commands whose lower errors have been fixed up).
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      64878c0e
    • J
      [SCSI] libata: fix eh locking · 4451ef63
      James Bottomley 提交于
      The SCSI host eh_cmd_q should be protected by the host lock (not the
      port lock).  This probably doesn't matter that much at the moment,
      since we try to serialise the add and eh pieces, but it might matter
      in future for more convenient error handling.  Plus this switches
      libata to the standard eh pattern where you lock, remove from the cmd
      queue to a local list and unlock and then operate on the local list.
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      4451ef63
  32. 25 12月, 2010 1 次提交
    • T
      libata: issue DIPM enable commands with LPM state updated · e5005b15
      Tejun Heo 提交于
      Low level drivers may behave differently depending on the current
      link->lpm_policy.  During ata_eh_set_lpm(), DIPM enable commands are
      issued after the successful completion of ap->ops->set_lpm(), which
      means that the controller is already in the target state.  This causes
      DIPM enable commands to be processed with mismatching controller power
      state and link->lpm_policy value.
      
      In ahci, link->lpm_policy is used to ignore certain PHY events if LPM
      is enabled; however, as DIPM commands are issued with stale
      link->lpm_policy, they sometimes end up triggering these conditions
      and get aborted leading to LPM configuration failure.
      
      Fix it by updating link->lpm_policy before issuing DIPM enable
      commands.
      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>
      e5005b15
  33. 22 10月, 2010 3 次提交
    • 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: implement LPM support for port multipliers · 6c8ea89c
      Tejun Heo 提交于
      Port multipliers can do DIPM on fan-out links fine.  Implement support
      for it.  Tested w/ SIMG 57xx and marvell PMPs.  Both the host and
      fan-out links enter power save modes nicely.
      
      SIMG 37xx and 47xx report link offline on SStatus causing EH to detach
      the devices.  Blacklisted.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6c8ea89c