diff options
author | Haiqing Bai <Haiqing.Bai@windriver.com> | 2018-12-06 17:55:01 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2018-12-06 08:11:52 -0800 |
commit | 646bbf10ea8a395765a73891150b41f1780113c5 (patch) | |
tree | e600eccf55732fab45e8a53aa164a2789d578ad1 /meta-networking | |
parent | 23c01539423e6e32e86f8730195d294377a22b80 (diff) | |
download | meta-openembedded-646bbf10ea8a395765a73891150b41f1780113c5.tar.gz |
ptpd: fixed the issue of ptpd2 daemon takes 100% CPU
The ptpd2 daemon consumes 100% CPU (of a single core) after
some amount of stable runtime. This fix added minimum POSIX
timer interval to prevent from timers firing to quickly for
the process to handle, resulting in 100% CPU and endless signal queue.
Reference: https://github.com/ptpd/ptpd/blob/master/ChangeLog
Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r-- | meta-networking/recipes-daemons/ptpd/ptpd/Fixed-100-CPU-using-issue-by-adding-minimum-POSIX-ti.patch | 68 | ||||
-rw-r--r-- | meta-networking/recipes-daemons/ptpd/ptpd_2.3.1.bb | 1 |
2 files changed, 69 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/ptpd/ptpd/Fixed-100-CPU-using-issue-by-adding-minimum-POSIX-ti.patch b/meta-networking/recipes-daemons/ptpd/ptpd/Fixed-100-CPU-using-issue-by-adding-minimum-POSIX-ti.patch new file mode 100644 index 000000000..1d2a5368c --- /dev/null +++ b/meta-networking/recipes-daemons/ptpd/ptpd/Fixed-100-CPU-using-issue-by-adding-minimum-POSIX-ti.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | From e00d3f52ccc6496a60992ac5a9d771b1d067eceb Mon Sep 17 00:00:00 2001 | ||
2 | From: Haiqing Bai <Haiqing.Bai@windriver.com> | ||
3 | Date: Thu, 22 Nov 2018 08:42:48 +0000 | ||
4 | Subject: [PATCH] Fixed 100% CPU using issue by adding minimum POSIX timer | ||
5 | interval | ||
6 | |||
7 | Added minimum POSIX timer interval to prevent from timers firing | ||
8 | to quickly for the process to handle, resulting in 100% CPU and | ||
9 | endless signal queue. | ||
10 | |||
11 | Upstream-status: Backport | ||
12 | [From commit 1f0baae98a7b23e85f2bfd8f5de64795421c270e: | ||
13 | - critical: added minimum POSIX timer interval to prevent from | ||
14 | timers firing to quickly for the process to handle, | ||
15 | resulting in 100% CPU and endless signal queue] | ||
16 | |||
17 | Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com> | ||
18 | --- | ||
19 | src/dep/eventtimer.h | 3 ++- | ||
20 | src/dep/eventtimer_itimer.c | 2 +- | ||
21 | src/dep/eventtimer_posix.c | 4 ++++ | ||
22 | 3 files changed, 7 insertions(+), 2 deletions(-) | ||
23 | |||
24 | diff --git a/src/dep/eventtimer.h b/src/dep/eventtimer.h | ||
25 | index 64e483a..0a21318 100644 | ||
26 | --- a/src/dep/eventtimer.h | ||
27 | +++ b/src/dep/eventtimer.h | ||
28 | @@ -30,7 +30,8 @@ | ||
29 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | */ | ||
31 | |||
32 | -#define EVENTTIMER_MAX_DESC 20 | ||
33 | +#define EVENTTIMER_MAX_DESC 20 | ||
34 | +#define EVENTTIMER_MIN_INTERVAL_US 250 /* 4000/sec */ | ||
35 | |||
36 | typedef struct EventTimer EventTimer; | ||
37 | |||
38 | diff --git a/src/dep/eventtimer_itimer.c b/src/dep/eventtimer_itimer.c | ||
39 | index cf3c6db..3bb7ec6 100644 | ||
40 | --- a/src/dep/eventtimer_itimer.c | ||
41 | +++ b/src/dep/eventtimer_itimer.c | ||
42 | @@ -53,7 +53,7 @@ | ||
43 | |||
44 | #include "../ptpd.h" | ||
45 | |||
46 | -#define US_TIMER_INTERVAL (62500) | ||
47 | +#define US_TIMER_INTERVAL (31250) | ||
48 | |||
49 | static volatile unsigned int elapsed; | ||
50 | |||
51 | diff --git a/src/dep/eventtimer_posix.c b/src/dep/eventtimer_posix.c | ||
52 | index 637eef3..f4a702d 100644 | ||
53 | --- a/src/dep/eventtimer_posix.c | ||
54 | +++ b/src/dep/eventtimer_posix.c | ||
55 | @@ -100,6 +100,10 @@ eventTimerStart_posix(EventTimer *timer, double interval) | ||
56 | ts.tv_sec = interval; | ||
57 | ts.tv_nsec = (interval - ts.tv_sec) * 1E9; | ||
58 | |||
59 | + if(!ts.tv_sec && ts.tv_nsec < EVENTTIMER_MIN_INTERVAL_US * 1000) { | ||
60 | + ts.tv_nsec = EVENTTIMER_MIN_INTERVAL_US * 1000; | ||
61 | + } | ||
62 | + | ||
63 | DBGV("Timer %s start requested at %d.%4d sec interval\n", timer->id, ts.tv_sec, ts.tv_nsec); | ||
64 | |||
65 | its.it_interval = ts; | ||
66 | -- | ||
67 | 2.11.0 | ||
68 | |||
diff --git a/meta-networking/recipes-daemons/ptpd/ptpd_2.3.1.bb b/meta-networking/recipes-daemons/ptpd/ptpd_2.3.1.bb index e13619320..58625c809 100644 --- a/meta-networking/recipes-daemons/ptpd/ptpd_2.3.1.bb +++ b/meta-networking/recipes-daemons/ptpd/ptpd_2.3.1.bb | |||
@@ -23,6 +23,7 @@ def get_sub(d): | |||
23 | 23 | ||
24 | SRC_URI = "http://downloads.sourceforge.net/project/ptpd/ptpd/${@get_sub(d)}/ptpd-${PV}.tar.gz \ | 24 | SRC_URI = "http://downloads.sourceforge.net/project/ptpd/ptpd/${@get_sub(d)}/ptpd-${PV}.tar.gz \ |
25 | file://ptpd-use-pkgconfig.patch \ | 25 | file://ptpd-use-pkgconfig.patch \ |
26 | file://Fixed-100-CPU-using-issue-by-adding-minimum-POSIX-ti.patch \ | ||
26 | file://ptpd.service \ | 27 | file://ptpd.service \ |
27 | file://ptpd.conf \ | 28 | file://ptpd.conf \ |
28 | " | 29 | " |