Add patch for slow shutdown

epel9
Mystro256 8 years ago
parent 292d5f4d21
commit 4dfb5182d0

@ -0,0 +1,100 @@
commit dabd0e900f6e10c358436c584c51dd1f55c320d2
Author: Thomas Koch <linrunner@gmx.net>
Date: Sun Mar 12 20:53:32 2017 +0100
Issue #242: mitigate slow shutdown
Rationale: 'systemctl stop tlp' invokes 'nmcli radio on <device>' in systemd
context. This causes nmcli to hang for ~20 sec after switching the device.
The cause is unknown when invoking nmcli directly it doesn't hang.
Workaround:
* Execute radio switching last in 'tlp init [start|stop]'
* Add TimeoutStopSec=3 to tlp.service so systemd will kill the hanging
stop task after 3 secs.
Caveat: does not cover all cases yet. When two radios (e.g. wifi and
wwan) are to be switched, the second switch never happens.
diff --git a/tlp.in b/tlp.in
index bc2f852..fd0486c 100644
--- a/tlp.in
+++ b/tlp.in
@@ -96,23 +96,21 @@ case "$mode" in
# do init business ...
case $mode2 in
start)
- # apply radio states
- set_radio_device_states start
-
- # apply power save settings -- but only if not previously run
- # (by the udev rule) for the same power state
- if compare_and_save_power_state $pwrmode; then
- echo -n "Applying power save settings..."
- apply_common_settings $pwrmode
- [ "$pwrmode" = "1" ] && poweroff_drivebay 0
- [ "$X_TLP_USB_MODE" = "1" ] && set_usb_suspend 0 auto
- echo "done."
- fi
+ # apply power save settings
+ compare_and_save_power_state $pwrmode
+ echo -n "Applying power save settings..."
+ apply_common_settings $pwrmode
+ poweroff_drivebay $pwrmode 0
+ [ "$X_TLP_USB_MODE" = "1" ] && set_usb_suspend 0 auto
+ echo "done."
# apply battery settings
echo -n "Setting battery charge thresholds..."
set_charge_thresholds
echo "done."
+
+ # apply radio states
+ set_radio_device_states start
;;
restart|force-reload)
@@ -131,14 +129,6 @@ case "$mode" in
;;
stop)
- set_radio_device_states stop
-
- if [ "$USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN" = "1" ]; then
- echo -n "Disabling usb autosuspend..."
- set_usb_suspend 0 on
- echo "done."
- fi
-
# remove usb startup flag
[ -f $USB_DONE ] && rm $USB_DONE
@@ -149,6 +139,16 @@ case "$mode" in
echo -n "Applying power save settings..."
apply_common_settings 0
echo "done."
+
+ # disable usb autosuspend if configured
+ if [ "$USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN" = "1" ]; then
+ echo -n "Disabling usb autosuspend..."
+ set_usb_suspend 0 on
+ echo "done."
+ fi
+
+ # apply radio states
+ set_radio_device_states stop
;;
*)
diff --git a/tlp.service.in b/tlp.service.in
index 7dc4b2c..67c131c 100644
--- a/tlp.service.in
+++ b/tlp.service.in
@@ -15,6 +15,7 @@ Type=oneshot
RemainAfterExit=yes
ExecStart=@TLP_SBIN@/tlp init start
ExecStop=@TLP_SBIN@/tlp init stop
+TimeoutStopSec=3
[Install]
WantedBy=multi-user.target

@ -1,6 +1,6 @@
Name: tlp Name: tlp
Version: 0.9 Version: 0.9
Release: 4%{?dist} Release: 5%{?dist}
Summary: Advanced power management tool for Linux Summary: Advanced power management tool for Linux
License: GPLv2+ License: GPLv2+
URL: http://linrunner.de/tlp URL: http://linrunner.de/tlp
@ -8,9 +8,11 @@ Source0: https://github.com/linrunner/TLP/archive/%{version}.tar.gz
#Provided by Andreas Roederer <tlp~at~warpnine~dot~de>: #Provided by Andreas Roederer <tlp~at~warpnine~dot~de>:
Source1: 50-tlp.preset Source1: 50-tlp.preset
#Cherry-pick upstream fix to tlp-stat: #Cherry-pick upstream fixes to tlp-stat:
#https://github.com/linrunner/TLP/commit/9498a85d1cedb78a38b54f243c9c4a3daad5bcc6 #https://github.com/linrunner/TLP/commit/9498a85d1cedb78a38b54f243c9c4a3daad5bcc6
Patch0: tlp-stat-fix.patch Patch0: tlp-stat-fix.patch
#https://github.com/linrunner/TLP/commit/dabd0e900f6e10c358436c584c51dd1f55c320d2
Patch1: tlp-mitigate-slowshutdown.patch
BuildRequires: perl-generators BuildRequires: perl-generators
BuildRequires: systemd BuildRequires: systemd
@ -103,6 +105,9 @@ fi
/bin/systemctl enable NetworkManager-dispatcher.service >/dev/null 2>&1 || : /bin/systemctl enable NetworkManager-dispatcher.service >/dev/null 2>&1 || :
%changelog %changelog
* Mon Mar 20 2017 Jeremy Newton <alexjnewt at hotmail dot com> - 0.9-5
- Cherry-pick upstream fix for mitigate slow shutdown
* Thu Mar 02 2017 Jeremy Newton <alexjnewt at hotmail dot com> - 0.9-4 * Thu Mar 02 2017 Jeremy Newton <alexjnewt at hotmail dot com> - 0.9-4
- Cherry-pick upstream fix for tlp-stat - Cherry-pick upstream fix for tlp-stat

Loading…
Cancel
Save