Re: [systemd-devel] systemd and power management

2014-11-11 Thread Lennart Poettering
On Wed, 29.10.14 13:00, Daniel Hollocher (danielholloc...@gmail.com) wrote:

 Hey folks,
 I'm a not expert here, so please forgive the low quality/interest of my
 question.
 
 I'm curious what the ideal systemd way is to set various power management
 settings in the /sys tree.  For me personally, I'm looking to set
 sampling_down_factor as without it, ondemand has terrible performance on my
 particular computer (a 10-30% loss compared to performance or conservative).
 
 Currently, Ubuntu uses a sysv init script to set ondemand after boot, and I
 could edit that.  It would be cool to know the ideal systemd way, that
 could also be aware of power saving stuff.
 
 From googling, it seems that tempfiles or sysctrl is not the way to go,
 since those only happen at boot.  Udev?  The examples I've found seem to
 make basic usage of udev to detect power changes, and then drop to a script
 to do the bulk of the work.  Is that it?

Yes, sysctl.d and tmpfiles.d (with the f option) are the way we
propose this is done.

Note that in general we try to follow the rule that what is good for
mobile use cannot hurt in plugged-in mode either, hence we have no
special support for reconfiguring the system depending on plug state.

systemd does not listen to power plug events. upower does however,
hence you could check if you can hook things into that.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd and power management

2014-10-29 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Oct 29, 2014 at 01:00:42PM -0400, Daniel Hollocher wrote:
 Hey folks,
 I'm a not expert here, so please forgive the low quality/interest of my
 question.
 
 I'm curious what the ideal systemd way is to set various power management
 settings in the /sys tree.  For me personally, I'm looking to set
 sampling_down_factor as without it, ondemand has terrible performance on my
 particular computer (a 10-30% loss compared to performance or conservative).
 
 Currently, Ubuntu uses a sysv init script to set ondemand after boot, and I
 could edit that.  It would be cool to know the ideal systemd way, that
 could also be aware of power saving stuff.
 
 From googling, it seems that tempfiles or sysctrl is not the way to go,
 since those only happen at boot.  Udev?  The examples I've found seem to
 make basic usage of udev to detect power changes, and then drop to a script
 to do the bulk of the work.  Is that it?

See sysctl.d(5).

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd and power management

2014-10-29 Thread Ivan Shapovalov
On Wednesday 29 October 2014 at 13:00:42, Daniel Hollocher wrote:   
 Hey folks,
 I'm a not expert here, so please forgive the low quality/interest of my
 question.
 
 I'm curious what the ideal systemd way is to set various power management
 settings in the /sys tree.  For me personally, I'm looking to set
 sampling_down_factor as without it, ondemand has terrible performance on my
 particular computer (a 10-30% loss compared to performance or conservative).
 
 Currently, Ubuntu uses a sysv init script to set ondemand after boot, and I
 could edit that.  It would be cool to know the ideal systemd way, that
 could also be aware of power saving stuff.
 
 From googling, it seems that tempfiles or sysctrl is not the way to go,
 since those only happen at boot.  Udev?  The examples I've found seem to
 make basic usage of udev to detect power changes, and then drop to a script
 to do the bulk of the work.  Is that it?

You could write a bunch of units pulled in by a target... well, two targets,
one for power-saving and second for performance mode. And then just start the
targets from an udev rule. Just remember to use `--no-block` as udev kills
workers after some time.

I've already done something along these lines for my own purposes, see
https://github.com/intelfx/power-management

However, I still want to know if I this is OK wrt systemd spirit.

-- 
Ivan Shapovalov / intelfx /

signature.asc
Description: This is a digitally signed message part.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd and power management

2014-10-29 Thread Daniel Hollocher
Yeah, it's tricky.

I don't think sysctl is the answer as that doesn't work with /sys

On Wed, Oct 29, 2014 at 1:06 PM, Ivan Shapovalov intelfx...@gmail.com
wrote:

 On Wednesday 29 October 2014 at 13:00:42, Daniel Hollocher wrote:
  Hey folks,
  I'm a not expert here, so please forgive the low quality/interest of my
  question.
 
  I'm curious what the ideal systemd way is to set various power management
  settings in the /sys tree.  For me personally, I'm looking to set
  sampling_down_factor as without it, ondemand has terrible performance on
 my
  particular computer (a 10-30% loss compared to performance or
 conservative).
 
  Currently, Ubuntu uses a sysv init script to set ondemand after boot,
 and I
  could edit that.  It would be cool to know the ideal systemd way, that
  could also be aware of power saving stuff.
 
  From googling, it seems that tempfiles or sysctrl is not the way to go,
  since those only happen at boot.  Udev?  The examples I've found seem to
  make basic usage of udev to detect power changes, and then drop to a
 script
  to do the bulk of the work.  Is that it?

 You could write a bunch of units pulled in by a target... well, two
 targets,
 one for power-saving and second for performance mode. And then just start
 the
 targets from an udev rule. Just remember to use `--no-block` as udev kills
 workers after some time.

 I've already done something along these lines for my own purposes, see
 https://github.com/intelfx/power-management

 However, I still want to know if I this is OK wrt systemd spirit.

 --
 Ivan Shapovalov / intelfx /
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel