Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 33

Thread: Laptop Load Cycle Bug Finally Fixed!

  1. #21
    Join Date
    Aug 2005
    Beans
    27
    Distro
    Ubuntu

    Re: Laptop Load Cycle Bug Finally Fixed!

    Quote Originally Posted by Sealbhach View Post
    So for me,I don't think Intrepid has fixed it.
    Dito. For me neither.

  2. #22
    Join Date
    Nov 2006
    Location
    Chennai, India
    Beans
    121
    Distro
    Ubuntu

    Re: Laptop Load Cycle Bug Finally Fixed!

    Dito. Not fixed on my Dell Vostro 1500.

    Load_Cycle keeps increasing....

  3. #23
    Join Date
    Feb 2007
    Beans
    Hidden!

    Re: Laptop Load Cycle Bug Finally Fixed!

    (For those who are having problems with this fix but don't wish to wade through my analysis, please skip down about half way for some tests to run.)

    I was intrigued by all the reports that this fix doesn't work. So I decided to take a look at what is being done. I don't have an up-to-date Ubuntu system, so this was just downloading what I think is the right package and looking at the relevant scripts in it. It appears to me that it is basically the "ugly fix" with some sanity checks added. I'd appreciate if people who have Intrepid and are familiar with shell scripting double check me on this.

    I downloaded acpi-support_0.114_i386.deb. (Did I get the right package?)

    I then examined the following scripts (note the braces in the path) in it:
    /etc/acpi/{resume.d,start.d,ac.d,battery.d}/90-hdparm.sh

    These scripts are all identical. (Wouldn't a single script with symlinks be better?)

    If $CONTROL_HD_POWERMGMT in laptop-mode.conf is zero, and for drives that report "AdvancedPM=yes", these scripts set the disk APM value to 128 or 254 if the computer is on battery or AC, respectively. (Corrected: originally I wrote this backwards.)

    I see two possible points of failure with this scheme.

    • laptop-mode.conf is checked w/o actually checking to make sure that laptop-mode itself is running. My guess is this will work properly on a default install, but if a user has configured laptop-mode and either never enabled it or turned it back off, this test may erroneously refuse to adjust disk APM.
    • As noted in 90-hdparm.sh, some drives don't support HDIO_GET_IDENTITY (hdparm -i). I have such a drive. My reading of the script is that this is another case where it would refuse to adjust disk APM even though the disk may support doing so.


    Otherwise it looks like the "ugly fix" to me.

    That is my analysis. I would appreciate people comfortable with shell scripting to double check it. I have not considered whether this script should be in additional locations.

    For those that are reporting that this isn't working, I have a couple suggestions/requests.

    Check and see what your disk's APM state is both when on battery and when on AC. For example, right now mine reports:

    Code:
    Advance power management level:  254 (0xfe)
    Different disks may phrase this slightly differently, but the following command will probably get the desired info:

    Code:
    sudo hdparm -I /dev/sda | grep -i power
    Also check to see if the following command produces an error:

    Code:
    sudo hdparm -i /dev/sda
    Take care to note that the options for those two hdparm commands use different cases (first one is upper case, second one is lower case).
    Last edited by blackhole54; October 27th, 2008 at 07:58 AM. Reason: clarity

  4. #24
    Join Date
    Nov 2006
    Location
    Chennai, India
    Beans
    121
    Distro
    Ubuntu

    Re: Laptop Load Cycle Bug Finally Fixed!

    both on AC & batery power Vostro 150,

    Advanced power management level: 254

    but i did edit hdparm.conf, to set '254' value for /dev/sda

    before editing hdparm.cong load cycle on ubuntu 8.10 fresh install kept increasing every second

  5. #25
    Join Date
    Jun 2007
    Beans
    192

    Re: Laptop Load Cycle Bug Finally Fixed!

    I am too still affected by this bug... load cycle is still increasing
    Advanced power management level: 128

  6. #26
    Join Date
    Feb 2007
    Beans
    Hidden!

    Re: Laptop Load Cycle Bug Finally Fixed!

    @ linusr & Jay_Bee

    did you try

    Code:
    sudo hdparm -i /dev/sda
    to see if it produced an error?

    @ Jay_Bee

    is APM at 128 on both battery and AC?

    BTW, it sounds like linusr might have a work-around for you to stop the increase. Just be aware that (I think) that work-around leaves the APM at 254 even while on battery, which means the disk might be a bit more vulnerable to being bumped, etc than it would at 128.
    Last edited by blackhole54; October 27th, 2008 at 11:32 PM.

  7. #27
    Join Date
    Jun 2007
    Beans
    192

    Re: Laptop Load Cycle Bug Finally Fixed!

    Thanks for your help.
    Code:
    sudo hdparm -i /dev/sda
    Didn't produce an error, it showed various info about my hdd.
    Code:
    /dev/sda:
    
     Model=Hitachi HTS541616J9SA00                 , FwRev=SB4OC7BP, SerialNo=      SB2404GJHKJ5YE
     Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
     RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
     BuffType=DualPortCache, BuffSize=7516kB, MaxMultSect=16, MultSect=?16?
     CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=312581808
     IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
     PIO modes:  pio0 pio1 pio2 pio3 pio4 
     DMA modes:  mdma0 mdma1 mdma2 
     UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 
     AdvancedPM=yes: mode=0x80 (128) WriteCache=enabled
     Drive conforms to: ATA/ATAPI-7 T13 1532D revision 1:  ATA/ATAPI-2,3,4,5,6,7
    APM is 128 on both battery and AC...
    I'm thinking about installing the ugly-fix again because load cycle stops increasing when I set APM to 254.

  8. #28
    Join Date
    Nov 2006
    Location
    Chennai, India
    Beans
    121
    Distro
    Ubuntu

    Re: Laptop Load Cycle Bug Finally Fixed!

    Thanks blackhole54,

    no errors for sudo
    hdparm -i /dev/sda
    ,

    output,
    /dev/sda:

    Model=ST9160821AS , FwRev=3.CDD , SerialNo= 5MA4BP5H
    Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
    RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
    BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=?8?
    CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=312581808
    IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
    PIO modes: pio0 pio1 pio2 pio3 pio4
    DMA modes: mdma0 mdma1 mdma2
    UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
    AdvancedPM=yes: unknown setting WriteCache=enabled
    Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7

    * signifies the current active mode
    I dont see any noise or overheating at APM 254. so far works good.

  9. #29
    Join Date
    Feb 2007
    Beans
    Hidden!

    Re: Laptop Load Cycle Bug Finally Fixed!

    @ linusr & Jay_Bee

    Thanks for your replies. While I noted above what seems to be couple of weaknesses in the scripts that are supposed to control this, I don't see any reason why the scripts shouldn't be working for you two.

    @ Jay_Bee

    Since you (TMK) still have the default setup where it's not working, I wonder if you would mind trying to run the script manually (while on AC) and see if it switches your APM setting over to 254:

    Code:
    sudo /etc/acpi/ac.d/90-hdparm.sh
    sudo hdparm -I /dev/sda | grep -i power
    First make sure the file /etc/acpi/ac.d/90-hdparm.sh is actually there. (Remember I don't have Intrepid; I am just working from a downloaded .deb package.) If it still doesn't switch disk APM to 254 and if it doesn't spit out any errors, I wonder if you would do one more step of troubleshooting:

    Make an extra copy of that file to your home directory or the /tmp directory

    Code:
    #  To home directory (note the "space dot" at the end:
    cp /etc/acpi/ac.d/90-hdparm.sh .        
    
    #  Or to the /tmp directory.  If you do this, this copy
    #  of the file will vanish at the next bootup.
    cp /etc/acpi/ac.d/90-hdparm.sh /tmp
    Then use your favorite text editor (such as gedit, vi, etc.) on that file.
    1) First please verify the file looks like what I am posting below minus the line I've highlighted in red.
    2) If it looks the same, add the line I've highlighted and try running this modified file and post the output please. To run it, use the command below that is appropriate to where you copied the file.

    Code:
    #  If in your home directory:
    sudo ./90-hdparm.sh
    
    #  If in the temp directory:
    sudo /tmp/90-hdparm.sh
    Here is what I believe the file looks like, with that one extra line added. (That line will show what actually happens as the script executes and hopefully allow us to determine what is going wrong and maybe get this thing fixed.)

    Code:
    #! /bin/sh
    #
    # This script adjusts hard drive APM settings using hdparm. The hardware
    # defaults (usually hdparm -B 128) cause excessive head load/unload cycles
    # on many modern hard drives. We therefore set hdparm -B 254 while on AC
    # power. On battery we set hdparm -B 128, because the head parking is
    # very useful for shock protection.
    #
    
    . /usr/share/acpi-support/power-funcs
    
    set -x
    DO_HDPARM=y
    if [ -e /usr/sbin/laptop_mode ] ; then 
      LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
      if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] ; then
        # Laptop mode controls hdparm -B settings, we don't.
        DO_HDPARM=n
      fi
    fi
    
    if [ $DO_HDPARM = y ] ; then
      # Get the power state into STATE
      getState;
      
      for dev in /dev/sd? /dev/hd? ; do
        if [ -b $dev ] ; then
          # Check for APM support; discard errors since not all drives
          # support HDIO_GET_IDENTITY (-i).    
          if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
            if [ $STATE = "BATTERY" ] ; then
              hdparm -B 128 $dev
            else
              hdparm -B 254 $dev
            fi
          fi
        fi
      done
    fi
    Thanks for your patience with this.

    EDIT: Be aware that if you install the "ugly fix" w/o removing these new scripts you might have some intereaction between the two.
    Last edited by blackhole54; October 29th, 2008 at 06:06 AM. Reason: So many typos!

  10. #30
    Join Date
    Jun 2007
    Beans
    192

    Re: Laptop Load Cycle Bug Finally Fixed!

    I just noticed after the restart that APM is 254 but after resuming from suspend it resets to 128. All this time I am on AC.
    I apologize for the wrong information, but nevertheless the issue still exists.
    So, after resuming from suspend, I tried your modification and this is the output of the modified file...

    Code:
    $ ./90-hdparm.sh 
    + DO_HDPARM=y
    + [ -e /usr/sbin/laptop_mode ]
    + . /etc/laptop-mode/laptop-mode.conf
    + VERBOSE_OUTPUT=0
    + ENABLE_LAPTOP_MODE_ON_BATTERY=1
    + ENABLE_LAPTOP_MODE_ON_AC=0
    + ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=0
    + MINIMUM_BATTERY_CHARGE_PERCENT=3
    + DISABLE_LAPTOP_MODE_ON_CRITICAL_BATTERY_LEVEL=1
    + HD=/dev/[hs]d[abcdefgh]
    + PARTITIONS=auto /dev/mapper/*
    + ASSUME_SCSI_IS_SATA=1
    + LM_BATT_MAX_LOST_WORK_SECONDS=600
    + LM_AC_MAX_LOST_WORK_SECONDS=360
    + CONTROL_READAHEAD=1
    + LM_READAHEAD=3072
    + NOLM_READAHEAD=128
    + CONTROL_NOATIME=0
    + USE_RELATIME=1
    + CONTROL_HD_IDLE_TIMEOUT=1
    + LM_AC_HD_IDLE_TIMEOUT_SECONDS=60
    + LM_BATT_HD_IDLE_TIMEOUT_SECONDS=60
    + NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
    + CONTROL_HD_POWERMGMT=1
    + BATT_HD_POWERMGMT=1
    + LM_AC_HD_POWERMGMT=254
    + NOLM_AC_HD_POWERMGMT=254
    + CONTROL_HD_WRITECACHE=0
    + NOLM_AC_HD_WRITECACHE=1
    + NOLM_BATT_HD_WRITECACHE=0
    + LM_HD_WRITECACHE=0
    + CONTROL_MOUNT_OPTIONS=1
    + LM_DIRTY_RATIO=60
    + NOLM_DIRTY_RATIO=40
    + LM_DIRTY_BACKGROUND_RATIO=1
    + NOLM_DIRTY_BACKGROUND_RATIO=10
    + DEF_UPDATE=5
    + DEF_XFS_AGE_BUFFER=15
    + DEF_XFS_SYNC_INTERVAL=30
    + DEF_XFS_BUFD_INTERVAL=1
    + DEF_MAX_AGE=30
    + XFS_HZ=100
    + LM_SECONDS_BEFORE_SYNC=2
    + echo 1
    + LMT_CONTROL_HD_POWERMGMT=1
    + [ 1 != 0 ]
    + DO_HDPARM=n
    + [ n = y ]
    However after manually running the script the APM is still 128.
    Code:
    $ sudo hdparm -I /dev/sda | grep -i power
    	Advanced power management level: 128
    	   *	Power Management feature set
    	   *	Advanced Power Management feature set
    	    	Device-initiated interface power management
    I will now try and see what's the output when I run the modified script after the restart (when it apparently works)
    Thank you very much for your effort.

    EDIT: The output after restarting is the same...
    EDIT2: Hmmm... DO_HDPARM=n because CONTROL_HD_POWERMGMT=1 in laptop-mode.conf... Why set that as default?

    EDIT 3 :
    Sorry for the furious edits...
    I changed the CONTROL_HD_POWERMGMT to 0 and after resuming the value remained 128 but running your script did the trick
    Code:
    $ sudo ./90-hdparm.sh 
    + DO_HDPARM=y
    + [ -e /usr/sbin/laptop_mode ]
    + . /etc/laptop-mode/laptop-mode.conf
    + VERBOSE_OUTPUT=0
    + ENABLE_LAPTOP_MODE_ON_BATTERY=1
    + ENABLE_LAPTOP_MODE_ON_AC=0
    + ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=0
    + MINIMUM_BATTERY_CHARGE_PERCENT=3
    + DISABLE_LAPTOP_MODE_ON_CRITICAL_BATTERY_LEVEL=1
    + HD=/dev/[hs]d[abcdefgh]
    + PARTITIONS=auto /dev/mapper/*
    + ASSUME_SCSI_IS_SATA=1
    + LM_BATT_MAX_LOST_WORK_SECONDS=600
    + LM_AC_MAX_LOST_WORK_SECONDS=360
    + CONTROL_READAHEAD=1
    + LM_READAHEAD=3072
    + NOLM_READAHEAD=128
    + CONTROL_NOATIME=0
    + USE_RELATIME=1
    + CONTROL_HD_IDLE_TIMEOUT=1
    + LM_AC_HD_IDLE_TIMEOUT_SECONDS=60
    + LM_BATT_HD_IDLE_TIMEOUT_SECONDS=60
    + NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
    + CONTROL_HD_POWERMGMT=0
    + BATT_HD_POWERMGMT=1
    + LM_AC_HD_POWERMGMT=254
    + NOLM_AC_HD_POWERMGMT=254
    + CONTROL_HD_WRITECACHE=0
    + NOLM_AC_HD_WRITECACHE=1
    + NOLM_BATT_HD_WRITECACHE=0
    + LM_HD_WRITECACHE=0
    + CONTROL_MOUNT_OPTIONS=1
    + LM_DIRTY_RATIO=60
    + NOLM_DIRTY_RATIO=40
    + LM_DIRTY_BACKGROUND_RATIO=1
    + NOLM_DIRTY_BACKGROUND_RATIO=10
    + DEF_UPDATE=5
    + DEF_XFS_AGE_BUFFER=15
    + DEF_XFS_SYNC_INTERVAL=30
    + DEF_XFS_BUFD_INTERVAL=1
    + DEF_MAX_AGE=30
    + XFS_HZ=100
    + LM_SECONDS_BEFORE_SYNC=2
    + echo 0
    + LMT_CONTROL_HD_POWERMGMT=0
    + [ 0 != 0 ]
    + [ y = y ]
    + getState
    + /usr/bin/on_ac_power
    + [ 0 -eq 0 ]
    + STATE=AC
    + [ -b /dev/sda ]
    + hdparm -i /dev/sda
    + grep -q AdvancedPM=yes
    + [ AC = BATTERY ]
    + hdparm -B 254 /dev/sda
    
    /dev/sda:
     setting Advanced Power Management level to 0xfe (254)
    + [ -b /dev/hd? ]
    Now... how to make the script actually run on resume?
    Last edited by Jay_Bee; October 29th, 2008 at 01:16 PM.

Page 3 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •