sysfsutils fail to tweak all sysfs.conf directives

Bug #184783 reported by aldebx
8
Affects Status Importance Assigned to Milestone
sysfsutils (Debian)
Fix Released
Unknown
sysfsutils (Ubuntu)
Fix Released
Low
Martin Pitt

Bug Description

Binary package hint: sysfsutils

if I set sysfs.conf as follows
# this enables lowest power state for SATA link host nr. 0,1,2
class/scsi_host/host2/link_power_management_policy = min_power
class/scsi_host/host3/link_power_management_policy = min_power
class/scsi_host/host4/link_power_management_policy = min_power

and run sysfsutils none of the scsi_host link are set to min_power.
Checking with 'cat' confirms the following output.

$ sudo sh -ex /etc/init.d/sysfsutils start

+ CONFFILE=/etc/sysfs.conf
+ [ -r /etc/sysfs.conf ]
+ echo -n Setting sysfs variables...
Setting sysfs variables...+ sed s/#.*$//; /^[[:space:]]*$/d;
              s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/ /etc/sysfs.conf
+ read f1 f2 f3
+ [ class/scsi_host/host2/link_power_management_policy = mode -a -n min_power -a -n ]
+ [ class/scsi_host/host2/link_power_management_policy = owner -a -n min_power -a -n ]
+ [ class/scsi_host/host2/link_power_management_policy -a -n min_power -a -z ]
+ [ -f /sys/class/scsi_host/host0/link_power_management_policy ]
+ echo -n min_power
$

ls -l /sys/class/scsi_host/host3/link_power_management_policy
-rw-r--r-- 1 root root 0 2008-02-21 17:43 /sys/class/scsi_host/host3/link_power_management_policy
ls -l /sys/class/scsi_host/host2/link_power_management_policy
-rw-r--r-- 1 root root 0 2008-02-21 17:45 /sys/class/scsi_host/host2/link_power_management_policy
ls -l /sys/class/scsi_host/host4/link_power_management_policy
-rw-r--r-- 1 root root 4096 2008-02-21 17:42 /sys/class/scsi_host/host4/link_power_management_policy

cat /sys/class/scsi_host/host2/link_power_management_policy max_performance
and so on for the other two.

As far as I managed to understand the presence of other tweaks (for instance tweaks to cpu governor and sound card) did not affect this bug.
The only blocking tweak is the scsi_host link.
All tweaks that in sysfs.conf follow the first scsi_host link directive are ignored. However if they are put above to be executed first they are carried out fine.

Changing the first scsi_host link doesn't positively affect the bug (host2, host3 and so on always cause the bug to appear).

Revision history for this message
Martin Pitt (pitti) wrote :

Please copy&paste the output of

  sudo sh -ex /etc/init.d/sysfsutils start

Thanks!

Changed in sysfsutils:
status: New → Incomplete
assignee: nobody → pitti
Revision history for this message
aldebx (aldebx) wrote :

Sorry for the late response:

$ sudo sh -ex /etc/init.d/sysfsutils start

+ CONFFILE=/etc/sysfs.conf
+ [ -r /etc/sysfs.conf ]
+ echo -n Setting sysfs variables...
Setting sysfs variables...+ sed s/#.*$//; /^[[:space:]]*$/d;
              s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/ /etc/sysfs.conf
+ read f1 f2 f3
+ [ class/scsi_host/host0/link_power_management_policy = mode -a -n min_power -a -n ]
+ [ class/scsi_host/host0/link_power_management_policy = owner -a -n min_power -a -n ]
+ [ class/scsi_host/host0/link_power_management_policy -a -n min_power -a -z ]
+ [ -f /sys/class/scsi_host/host0/link_power_management_policy ]
+ echo -n min_power

Please note that sysfsutils actually set the host0 link to min_power, however it simply stopped here, whereas the sysfs.conf I set is this:

# this enables lowest power state for SATA link host nr. 0,1,2
class/scsi_host/host0/link_power_management_policy = min_power
class/scsi_host/host1/link_power_management_policy = min_power
class/scsi_host/host2/link_power_management_policy = min_power
# this enables low power state for Realtek HD Audio HDA audio switch
module/snd_hda_intel/parameters/power_save = 15

In fact, manually checking via 'cat' neither host1, host2 nor the snd_hda_intel module are tweaked accordingly.

Revision history for this message
aldebx (aldebx) wrote :

I tried to change the order in which I requested the changes in sysfc.conf and it seems that sysfs cannot process any command after the first class/scsi_host/etc

This is with latest Hardy snapshot clean install and up-to-date (while the previous post was with gutsy partially updated)

 sh -ex /etc/init.d/sysfsutils start
+ CONFFILE=/etc/sysfs.conf
+ [ -r /etc/sysfs.conf ]
+ echo -n Setting sysfs variables...
Setting sysfs variables...+ sed s/#.*$//; /^[[:space:]]*$/d;
              s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/ /etc/sysfs.conf
+ read f1 f2 f3
+ [ module/snd_hda_intel/parameters/power_save = mode -a -n 10 -a -n ]
+ [ module/snd_hda_intel/parameters/power_save = owner -a -n 10 -a -n ]
+ [ module/snd_hda_intel/parameters/power_save -a -n 10 -a -z ]
+ [ -f /sys/module/snd_hda_intel/parameters/power_save ]
+ echo -n 15
+ read f1 f2 f3
+ [ class/scsi_host/host1/link_power_management_policy = mode -a -n min_power -a -n ]
+ [ class/scsi_host/host1/link_power_management_policy = owner -a -n min_power -a -n ]
+ [ class/scsi_host/host1/link_power_management_policy -a -n min_power -a -z ]
+ [ -f /sys/class/scsi_host/host1/link_power_management_policy ]
+ echo -n min_power

Revision history for this message
aldebx (aldebx) wrote :

I updated the description and corrected the Bug title to reflect the new aspects of the bug I've found out:

sysfsutils 2.1.0-2 (hardy)

Sysfsutils manages to give a successful output only when sysfs.conf is set with only one scsi_host link tweak.
As far as I managed to understand the presence of other tweaks (for instance tweaks to cpu governor and sound card) did not affect this bug.
The only blocking tweak is the scsi_host link.
All tweaks that in sysfs.conf follow the first scsi_host link directive are ignored. However if they are put above to be executed first they are carried out fine.

Changing the first scsi_host link doesn't positively affect the bug (host0, host1 and so on always cause the bug to appear).

 sudo sh -ex /etc/init.d/sysfsutils start
+ CONFFILE=/etc/sysfs.conf
+ [ -r /etc/sysfs.conf ]
+ echo -n Setting sysfs variables...
Setting sysfs variables...+ sed s/#.*$//; /^[[:space:]]*$/d;
              s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/ /etc/sysfs.conf
+ read f1 f2 f3
+ [ class/scsi_host/host0/link_power_management_policy = mode -a -n min_power -a -n ]
+ [ class/scsi_host/host0/link_power_management_policy = owner -a -n min_power -a -n ]
+ [ class/scsi_host/host0/link_power_management_policy -a -n min_power -a -z ]
+ [ -f /sys/class/scsi_host/host0/link_power_management_policy ]
+ echo unknown attribute class/scsi_host/host0/link_power_management_policy
unknown attribute class/scsi_host/host0/link_power_management_policy
+ read f1 f2 f3
+ echo done.
done.
$

description: updated
Revision history for this message
aldebx (aldebx) wrote :

Gosh I'm very sorry,
I realized too late that in the last comment the output was successful just because there was no link_power_management_policy file in host0 (I do not understand why, but some recent kernel update mush have moved the host having link_power_management_policy from host0 host1 & host2 to host2, host3 & host4). Anyway I corrected one more the report and the but is still there, no way to set those attributes via sysfsutils!
(still, however, other tweaks are possible and are done without issues
(in devices/system/cpu/cpu0/cpufreq/scaling_governor
and module/snd_hda_intel/parameters/power_save )

description: updated
Revision history for this message
aldebx (aldebx) wrote :

problem still occurs with Ubuntu Hardy Beta and sysfsutils 2.1.0-2

it still cannot change values on
class/scsi_host/host0/link_power_management_policy = min_power

Revision history for this message
Bernhard J. M. Grün (bernhard-gruen) wrote :

It seems deleting the '-n' in 'echo -n "$f2" > "/sys/$f1"' solves the problem. At least for me it seems to work then. Happy hacking eastern!

Changed in sysfsutils:
status: Unknown → New
Revision history for this message
Martin Pitt (pitti) wrote :

Debian bug has a patch I'll upload to Debian soon.

Changed in sysfsutils:
importance: Undecided → Low
status: Incomplete → In Progress
Martin Pitt (pitti)
Changed in sysfsutils:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysfsutils - 2.1.0-4

---------------
sysfsutils (2.1.0-4) unstable; urgency=low

  * debian/sysfsutils.init: Some attributes in sysfs need a terminating
    newline, some don't, so try both. Thanks to Stefan Monnier for the patch!
    (Closes: #459240, LP: #184783)

sysfsutils (2.1.0-3) unstable; urgency=low

  * debian/sysfsutils.init: Fix Default-Stop LSB header to not run in any
    level, since 'stop' does not do anything. (Closes: #458272, #427033)
  * debian/sysfsutils.init: Use LSB output commands. (Closes: #457662)
  * debian/sysfsutils.README.Debian: Fix script name. (Closes: #453312)
  * Bump Standards-Version (no changes necessary).
  * debian/control: Replace obsolete ${Source-Version} with ${binary:Version}.
  * debian/rules: Drop pointless rpath from systool binary. Add chrpath build
    dependency.

 -- Martin Pitt <email address hidden> Tue, 01 Apr 2008 17:55:53 +0100

Changed in sysfsutils:
status: Fix Committed → Fix Released
Changed in sysfsutils:
status: New → Fix Released
Revision history for this message
Patrick (patrick-voegeli) wrote :

Hi there

I'm having the exact same problem. I'm trying this:

sudo -s
echo min_power > /sys/class/scsi_host/host3/link_power_management_policy

after that, cat /sys/class/scsi_host/host3/link_power_management_policy still return max_performace.

My laptop is a Fujitsu-Siemens Esprimo U9200.

Any ideas? Anything to try?

Revision history for this message
aldebx (aldebx) wrote :

Just an advice, try not leaving any empty line in sysfs.conf.
It seems that empty lines now interfere with how the file is parsed.

You can always check what's happening with
$ sudo sh -ex /etc/init.d/sysfsutils start

Anyway I just switched to laptop-mode-tools feature for tweaking Intel SCSI host link power. Latest version has this feature.

Revision history for this message
Patrick (patrick-voegeli) wrote :

Switch to laptop-mode-tools? How can I do that? I already hade laptop-mode enabled en /etc/default/acpi-support, but nothing changed.

paptrick@patrick-laptop:~$ sudo -s
root@patrick-laptop:~# echo min_power > /sys/class/scsi_host/host2/link_power_management_policy
root@patrick-laptop:~# echo min_power > /sys/class/scsi_host/host3/link_power_management_policy
root@patrick-laptop:~# echo min_power > /sys/class/scsi_host/host4/link_power_management_policy
root@patrick-laptop:~# cat /sys/class/scsi_host/host2/link_power_management_policy
max_performance
root@patrick-laptop:~# cat /sys/class/scsi_host/host3/link_power_management_policy
max_performance
root@patrick-laptop:~# cat /sys/class/scsi_host/host4/link_power_management_policy
max_performance
root@patrick-laptop:~# sh -ex /etc/init.d/sysfsutils start
+ CONFFILE=/etc/sysfs.conf
+ [ -r /etc/sysfs.conf ]
+ . /lib/lsb/init-functions
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ . /etc/lsb-base-logging.sh
+ log_begin_msg Setting sysfs variables...
+ log_daemon_msg Setting sysfs variables...
+ [ -z Setting sysfs variables... ]
+ log_use_usplash
+ [ n = y ]
+ type usplash_write
+ usplash_write TEXT Setting sysfs variables...
+ log_to_console log_daemon_msg Setting sysfs variables...
+ [ n != y ]
+ [ no != yes ]
+ readlink /proc/self/fd/0
+ stdin=/dev/pts/0
+ [ /dev/pts/0 != /dev/pts/0 ]
+ return 0
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z ]
+ FANCYTTY=1
+ true
+ /usr/bin/tput xenl
+ /usr/bin/tput cols
+ COLS=80
+ [ 80 ]
+ [ 80 -gt 6 ]
+ /usr/bin/expr 80 - 7
+ COL=73
+ printf * Setting sysfs variables...
 * Setting sysfs variables... + /usr/bin/expr 80 - 1
+ /usr/bin/tput hpa 79
                                                                               + printf
 + sed s/#.*$//; /^[[:space:]]*$/d;
              s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/ /etc/sysfs.conf
+ read f1 f2 f3
+ [ class/scsi_host/host3/link_power_management_policy = mode -a -n min_power -a -n ]
+ [ class/scsi_host/host3/link_power_management_policy = owner -a -n min_power -a -n ]
+ [ class/scsi_host/host3/link_power_management_policy -a -n min_power -a -z ]
+ [ -f /sys/class/scsi_host/host3/link_power_management_policy ]
+ echo -n min_power
+ echo min_power
+ read f1 f2 f3
+ log_end_msg 0
+ [ -z 0 ]
+ log_use_usplash
+ [ n = y ]
+ type usplash_write
+ [ 0 -eq 0 ]
+ usplash_write SUCCESS OK
+ log_to_console log_end_msg 0
+ [ n != y ]
+ [ no != yes ]
+ readlink /proc/self/fd/0
+ stdin=/dev/pts/0
+ [ /dev/pts/0 != /dev/pts/0 ]
+ return 0
+ [ 73 ]
+ [ -x /usr/bin/tput ]
+ printf \r
+ /usr/bin/tput hpa 73
                                                                         + [ 0 -eq 0 ]
+ echo [ OK ]
[ OK ]
+ return 0
root@patrick-laptop:~#

Any thoughts?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.