Browse code

For VM env, arm watchdog timer more frequently

Change-Id: I77344cb46d3cf2dac235ed713e69a8ce54c1d0e1
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1998
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Vinay Kulkarni authored on 2017/01/23 02:33:19
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,37 @@
0
+diff -uNr systemd-228/src/libsystemd/sd-event/sd-event.c systemd-228-new/src/libsystemd/sd-event/sd-event.c
1
+--- systemd-228/src/libsystemd/sd-event/sd-event.c	2017-01-22 15:47:20.840228663 +0000
2
+@@ -40,6 +40,7 @@
3
+ #include "string-util.h"
4
+ #include "time-util.h"
5
+ #include "util.h"
6
++#include "virt.h"
7
+ 
8
+ #define DEFAULT_ACCURACY_USEC (250 * USEC_PER_MSEC)
9
+ 
10
+@@ -2381,14 +2382,21 @@
11
+ static int arm_watchdog(sd_event *e) {
12
+         struct itimerspec its = {};
13
+         usec_t t;
14
+-        int r;
15
++        int r, v;
16
+ 
17
+         assert(e);
18
+         assert(e->watchdog_fd >= 0);
19
+ 
20
+-        t = sleep_between(e,
21
+-                          e->watchdog_last + (e->watchdog_period / 2),
22
+-                          e->watchdog_last + (e->watchdog_period * 3 / 4));
23
++        v = detect_virtualization();
24
++
25
++        if (VIRTUALIZATION_IS_VM(v))
26
++            t = sleep_between(e,
27
++                              e->watchdog_last + (e->watchdog_period * 1 / 4),
28
++                              e->watchdog_last + (e->watchdog_period / 2));
29
++        else
30
++            t = sleep_between(e,
31
++                              e->watchdog_last + (e->watchdog_period / 2),
32
++                              e->watchdog_last + (e->watchdog_period * 3 / 4));
33
+ 
34
+         timespec_store(&its.it_value, t);
35
+ 
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:          Systemd-228
2 2
 Name:             systemd
3 3
 Version:          228
4
-Release:          32%{?dist}
4
+Release:          33%{?dist}
5 5
 License:          LGPLv2+ and GPLv2+ and MIT
6 6
 URL:              http://www.freedesktop.org/wiki/Software/systemd/
7 7
 Group:            System Environment/Security
... ...
@@ -34,6 +34,7 @@ Patch18:          systemd-228-dns-transaction-pending-fix.patch
34 34
 Patch19:          02-install-general-aliases.patch
35 35
 Patch20:          systemd-228-CVE-notify-socket-DOS-fix.patch
36 36
 Patch21:          systemd-macros.patch
37
+Patch22:          systemd-228-vm-watchdog-timer.patch
37 38
 Requires:         Linux-PAM
38 39
 Requires:         libcap
39 40
 Requires:         xz
... ...
@@ -88,6 +89,7 @@ sed -i "s:blkid/::" $(grep -rl "blkid/blkid.h")
88 88
 %patch19 -p1
89 89
 %patch20 -p1
90 90
 %patch21 -p1
91
+%patch22 -p1
91 92
 sed -i "s#\#DefaultTasksMax=512#DefaultTasksMax=infinity#g" src/core/system.conf
92 93
 
93 94
 %build
... ...
@@ -197,6 +199,8 @@ rm -rf %{buildroot}/*
197 197
 %dir %{_localstatedir}/log/journal
198 198
 
199 199
 %changelog
200
+*    Sat Jan 21 2017 Vinay Kulkarni <kulkarniv@vmware.com>  228-33
201
+-    Arm watchdog timer more frequently for virtual machine env.
200 202
 *    Thu Nov 3 2016 Divya Thaluru <dthaluru@vmware.com>  228-32
201 203
 -    Added logic to reload services incase of rpm upgrade
202 204
 *    Thu Sep 29 2016 Vinay Kulkarni <kulkarniv@vmware.com>  228-31