diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:19:52 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:19:52 +0200 |
commit | 7ac6af29202ec27dcdbf1ed5131a141be9958590 (patch) | |
tree | a20c0be935ea685b3b737471e691d39289c2333f | |
download | meta-nohz-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
12 files changed, 373 insertions, 0 deletions
@@ -0,0 +1,31 @@ | |||
1 | Enea Linux support for tickless operation | ||
2 | ========================================= | ||
3 | |||
4 | This layer provides support for tickless operation in Enea Linux. | ||
5 | Kernel patches and configurations are applied to be able to turn off the 1 Hz | ||
6 | periodic tick that remains in CONFIG_NO_HZ_FULL mode. | ||
7 | |||
8 | Supported Platforms | ||
9 | ------------------- | ||
10 | x86, ARM (Keystone) | ||
11 | |||
12 | Dependencies | ||
13 | ------------ | ||
14 | meta-enea: | ||
15 | URI: git://git.enea.com/linux/meta-enea | ||
16 | branch: daisy | ||
17 | |||
18 | Maintenance | ||
19 | ----------- | ||
20 | Maintainers: Enea Linux Team <linux-maintainers@enea.com> | ||
21 | |||
22 | Contributing | ||
23 | ------------ | ||
24 | Contributions and patches can be sent to the Enea Linux following mailing list: | ||
25 | enealinux@lists.enea.com | ||
26 | |||
27 | License | ||
28 | ------- | ||
29 | All metadata is MIT licensed unless otherwise stated. Source code | ||
30 | included in tree for individual recipes is under the LICENSE stated | ||
31 | in each recipe (.bb file) unless otherwise stated. | ||
diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..b0dd027 --- /dev/null +++ b/conf/layer.conf | |||
@@ -0,0 +1,13 @@ | |||
1 | # We have a packages directory, add to BBFILES | ||
2 | BBPATH .= ":${LAYERDIR}" | ||
3 | |||
4 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb*" | ||
5 | BBFILES += "${LAYERDIR}/images/*.bb*" | ||
6 | BBFILES += "${LAYERDIR}/images-append/*.bb*" | ||
7 | |||
8 | BBFILE_COLLECTIONS += "enea-nohz" | ||
9 | BBFILE_PATTERN_enea-nohz := "^${LAYERDIR}/" | ||
10 | BBFILE_PRIORITY_enea-nohz = "7" | ||
11 | LAYERDEPENDS_enea-nohz = "enea" | ||
12 | |||
13 | BB_DANGLINGAPPENDS_WARNONLY = "yes" | ||
diff --git a/images-append/enea-image-test-bash.bbappend b/images-append/enea-image-test-bash.bbappend new file mode 100644 index 0000000..680959d --- /dev/null +++ b/images-append/enea-image-test-bash.bbappend | |||
@@ -0,0 +1,7 @@ | |||
1 | IMAGE_FSTYPES += "cpio.gz" | ||
2 | |||
3 | IMAGE_INSTALL += " \ | ||
4 | test-nohz-ticks \ | ||
5 | test-nohz-stability \ | ||
6 | stress \ | ||
7 | " | ||
diff --git a/recipes-kernel/linux/files/patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch b/recipes-kernel/linux/files/patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch new file mode 100644 index 0000000..4c0fb89 --- /dev/null +++ b/recipes-kernel/linux/files/patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From 3b2566af2c0ef888f95920f69e9a7e0ebc13ddff Mon Sep 17 00:00:00 2001 | ||
2 | From: Kevin Hilman <khilman@linaro.org> | ||
3 | Date: Mon, 16 Sep 2013 15:28:19 -0700 | ||
4 | Subject: [PATCH] nohz: Drop generic vtime obsolete dependency on CONFIG_64BIT | ||
5 | |||
6 | The CONFIG_64BIT requirement on vtime can finally be removed | ||
7 | since we now depend on HAVE_VIRT_CPU_ACCOUNTING_GEN which | ||
8 | already takes care of the arch ability to handle nsecs based | ||
9 | cputime_t safely. | ||
10 | |||
11 | Signed-off-by: Kevin Hilman <khilman@linaro.org> | ||
12 | Cc: Ingo Molnar <mingo@kernel.org> | ||
13 | Cc: Russell King <rmk@arm.linux.org.uk> | ||
14 | Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
15 | Cc: Arm Linux <linux-arm-kernel@lists.infradead.org> | ||
16 | Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> | ||
17 | Signed-off-by: Mats Liljegren <mats.liljegren@enea.com> | ||
18 | --- | ||
19 | init/Kconfig | 2 +- | ||
20 | kernel/time/Kconfig | 1 - | ||
21 | 2 files changed, 1 insertion(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/init/Kconfig b/init/Kconfig | ||
24 | index 0b5d0c8..d7411e5 100644 | ||
25 | --- a/init/Kconfig | ||
26 | +++ b/init/Kconfig | ||
27 | @@ -325,7 +325,7 @@ config VIRT_CPU_ACCOUNTING_NATIVE | ||
28 | |||
29 | config VIRT_CPU_ACCOUNTING_GEN | ||
30 | bool "Full dynticks CPU time accounting" | ||
31 | - depends on HAVE_CONTEXT_TRACKING && 64BIT | ||
32 | + depends on HAVE_CONTEXT_TRACKING | ||
33 | select VIRT_CPU_ACCOUNTING | ||
34 | select CONTEXT_TRACKING | ||
35 | help | ||
36 | diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig | ||
37 | index 70f27e8..c270b48 100644 | ||
38 | --- a/kernel/time/Kconfig | ||
39 | +++ b/kernel/time/Kconfig | ||
40 | @@ -100,7 +100,6 @@ config NO_HZ_FULL | ||
41 | # RCU_USER_QS dependency | ||
42 | depends on HAVE_CONTEXT_TRACKING | ||
43 | # VIRT_CPU_ACCOUNTING_GEN dependency | ||
44 | - depends on 64BIT | ||
45 | select NO_HZ_COMMON | ||
46 | select RCU_USER_QS | ||
47 | select RCU_NOCB_CPU | ||
48 | -- | ||
49 | 1.9.1 | ||
50 | |||
diff --git a/recipes-kernel/linux/files/patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch b/recipes-kernel/linux/files/patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch new file mode 100644 index 0000000..c279422 --- /dev/null +++ b/recipes-kernel/linux/files/patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch | |||
@@ -0,0 +1,76 @@ | |||
1 | From 189a149dfc3ab55282b38d2194a0d7def74d8dfa Mon Sep 17 00:00:00 2001 | ||
2 | From: Kevin Hilman <khilman@linaro.org> | ||
3 | Date: Wed, 15 Jan 2014 14:51:38 +0100 | ||
4 | Subject: [PATCH] sched/nohz: Fix overflow error in | ||
5 | scheduler_tick_max_deferment() | ||
6 | |||
7 | While calculating the scheduler tick max deferment, the delta is | ||
8 | converted from microseconds to nanoseconds through a multiplication | ||
9 | against NSEC_PER_USEC. | ||
10 | |||
11 | But this microseconds operand is an unsigned int, thus the result may | ||
12 | likely overflow. The result is cast to u64 but only once the operation | ||
13 | is completed, which is too late to avoid overflown result. | ||
14 | |||
15 | This is currently not a problem because the scheduler tick max deferment | ||
16 | is 1 second. But this may become an issue as we plan to make this | ||
17 | value tunable. | ||
18 | |||
19 | So lets fix this by casting the usecs value to u64 before multiplying by | ||
20 | NSECS_PER_USEC. | ||
21 | |||
22 | Also to prevent from this kind of mistake to happen again, move this | ||
23 | ad-hoc jiffies -> nsecs conversion to a new helper. | ||
24 | |||
25 | Signed-off-by: Kevin Hilman <khilman@linaro.org> | ||
26 | Cc: Thomas Gleixner <tglx@linutronix.de> | ||
27 | Cc: Ingo Molnar <mingo@kernel.org> | ||
28 | Cc: Peter Zijlstra <peterz@infradead.org> | ||
29 | Cc: Alex Shi <alex.shi@linaro.org> | ||
30 | Cc: Steven Rostedt <rostedt@goodmis.org> | ||
31 | Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | ||
32 | Cc: John Stultz <john.stultz@linaro.org> | ||
33 | Cc: Kevin Hilman <khilman@linaro.org> | ||
34 | Link: http://lkml.kernel.org/r/1387315388-31676-2-git-send-email-khilman@linaro.org | ||
35 | [move ad-hoc conversion to jiffies_to_nsecs helper] | ||
36 | Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> | ||
37 | |||
38 | Signed-off-by: Mats Liljegren <mats.liljegren@enea.com> | ||
39 | --- | ||
40 | include/linux/jiffies.h | 6 ++++++ | ||
41 | kernel/sched/core.c | 2 +- | ||
42 | 2 files changed, 7 insertions(+), 1 deletion(-) | ||
43 | |||
44 | diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h | ||
45 | index 8fb8edf..4df91d4 100644 | ||
46 | --- a/include/linux/jiffies.h | ||
47 | +++ b/include/linux/jiffies.h | ||
48 | @@ -290,6 +290,12 @@ extern unsigned long preset_lpj; | ||
49 | */ | ||
50 | extern unsigned int jiffies_to_msecs(const unsigned long j); | ||
51 | extern unsigned int jiffies_to_usecs(const unsigned long j); | ||
52 | + | ||
53 | +static inline u64 jiffies_to_nsecs(const unsigned long j) | ||
54 | +{ | ||
55 | + return (u64)jiffies_to_usecs(j) * NSEC_PER_USEC; | ||
56 | +} | ||
57 | + | ||
58 | extern unsigned long msecs_to_jiffies(const unsigned int m); | ||
59 | extern unsigned long usecs_to_jiffies(const unsigned int u); | ||
60 | extern unsigned long timespec_to_jiffies(const struct timespec *value); | ||
61 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c | ||
62 | index e8b3350..45c2cf1 100644 | ||
63 | --- a/kernel/sched/core.c | ||
64 | +++ b/kernel/sched/core.c | ||
65 | @@ -2774,7 +2774,7 @@ u64 scheduler_tick_max_deferment(void) | ||
66 | if (time_before_eq(next, now)) | ||
67 | return 0; | ||
68 | |||
69 | - return jiffies_to_usecs(next - now) * NSEC_PER_USEC; | ||
70 | + return jiffies_to_nsecs(next - now); | ||
71 | } | ||
72 | #endif | ||
73 | |||
74 | -- | ||
75 | 1.9.1 | ||
76 | |||
diff --git a/recipes-kernel/linux/files/patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch b/recipes-kernel/linux/files/patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch new file mode 100644 index 0000000..349604c --- /dev/null +++ b/recipes-kernel/linux/files/patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch | |||
@@ -0,0 +1,61 @@ | |||
1 | From 92f0d4f695198fcb935cf0360f93a15bf0a6af1e Mon Sep 17 00:00:00 2001 | ||
2 | From: Kevin Hilman <khilman@linaro.org> | ||
3 | Date: Mon, 16 Sep 2013 15:43:48 -0700 | ||
4 | Subject: [PATCH 3/3] sched/nohz: add debugfs control over | ||
5 | sched_tick_max_deferment | ||
6 | |||
7 | Allow debugfs override of sched_tick_max_deferment in order to ease | ||
8 | finding/fixing the remaining issues with full nohz. | ||
9 | |||
10 | The value to be written is in jiffies, and -1 means the max deferment | ||
11 | is disabled (scheduler_tick_max_deferment() returns KTIME_MAX.) | ||
12 | |||
13 | Cc: Frederic Weisbecker <fweisbec@gmail.com> | ||
14 | Signed-off-by: Kevin Hilman <khilman@linaro.org> | ||
15 | --- | ||
16 | kernel/sched/core.c | 16 +++++++++++++++- | ||
17 | 1 file changed, 15 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c | ||
20 | index e8b3350..59c7367 100644 | ||
21 | --- a/kernel/sched/core.c | ||
22 | +++ b/kernel/sched/core.c | ||
23 | @@ -2753,6 +2753,8 @@ void scheduler_tick(void) | ||
24 | } | ||
25 | |||
26 | #ifdef CONFIG_NO_HZ_FULL | ||
27 | +static u32 sched_tick_max_deferment = HZ; | ||
28 | + | ||
29 | /** | ||
30 | * scheduler_tick_max_deferment | ||
31 | * | ||
32 | @@ -2769,13 +2771,25 @@ u64 scheduler_tick_max_deferment(void) | ||
33 | struct rq *rq = this_rq(); | ||
34 | unsigned long next, now = ACCESS_ONCE(jiffies); | ||
35 | |||
36 | - next = rq->last_sched_tick + HZ; | ||
37 | + if (sched_tick_max_deferment == -1) | ||
38 | + return KTIME_MAX; | ||
39 | + | ||
40 | + next = rq->last_sched_tick + sched_tick_max_deferment; | ||
41 | |||
42 | if (time_before_eq(next, now)) | ||
43 | return 0; | ||
44 | |||
45 | return jiffies_to_usecs(next - now) * NSEC_PER_USEC; | ||
46 | } | ||
47 | + | ||
48 | +static __init int sched_nohz_full_init_debug(void) | ||
49 | +{ | ||
50 | + debugfs_create_u32("sched_tick_max_deferment", 0644, NULL, | ||
51 | + &sched_tick_max_deferment); | ||
52 | + | ||
53 | + return 0; | ||
54 | +} | ||
55 | +late_initcall(sched_nohz_full_init_debug); | ||
56 | #endif | ||
57 | |||
58 | notrace unsigned long get_parent_ip(unsigned long addr) | ||
59 | -- | ||
60 | 1.7.10.4 | ||
61 | |||
diff --git a/recipes-kernel/linux/linux-keystone_3.10.bbappend b/recipes-kernel/linux/linux-keystone_3.10.bbappend new file mode 100644 index 0000000..b7f72dc --- /dev/null +++ b/recipes-kernel/linux/linux-keystone_3.10.bbappend | |||
@@ -0,0 +1,12 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
2 | |||
3 | SRC_URI += "\ | ||
4 | file://cfg/00039-nohz.cfg \ | ||
5 | file://patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch \ | ||
6 | file://patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch \ | ||
7 | file://patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch \ | ||
8 | " | ||
9 | |||
10 | KERNEL_FEATURES += " \ | ||
11 | cfg/00039-nohz \ | ||
12 | " | ||
diff --git a/recipes-kernel/linux/linux-yocto_3.10.bbappend b/recipes-kernel/linux/linux-yocto_3.10.bbappend new file mode 100644 index 0000000..c7365b1 --- /dev/null +++ b/recipes-kernel/linux/linux-yocto_3.10.bbappend | |||
@@ -0,0 +1,9 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
2 | |||
3 | SRC_URI += "\ | ||
4 | file://cfg/00038-hotplug_cpu.cfg \ | ||
5 | file://cfg/00039-nohz.cfg \ | ||
6 | file://patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch \ | ||
7 | file://patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch \ | ||
8 | file://patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch \ | ||
9 | " | ||
diff --git a/recipes-test/test-nohz-stability/files/test-nohz-stability b/recipes-test/test-nohz-stability/files/test-nohz-stability new file mode 100755 index 0000000..b65fd96 --- /dev/null +++ b/recipes-test/test-nohz-stability/files/test-nohz-stability | |||
@@ -0,0 +1,37 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | partitioning_done=false | ||
4 | |||
5 | cleanup () { | ||
6 | $partitioning_done && partrt undo | ||
7 | exit $1 | ||
8 | } | ||
9 | |||
10 | cd /opt/ltp || cleanup 1 | ||
11 | |||
12 | # Perform partitioning, if not already done | ||
13 | if [ ! -d /sys/fs/cgroup/cpuset/rt ]; then | ||
14 | partrt create $(list2mask --nohz) || cleanup 1 | ||
15 | partitioning_done=true | ||
16 | fi | ||
17 | |||
18 | echo | ||
19 | echo "*******" | ||
20 | echo "* NRT *" | ||
21 | echo "*******" | ||
22 | echo | ||
23 | |||
24 | partrt run rt stress -i 1 || cleanup 1 & | ||
25 | CHILD_PID=$! | ||
26 | partrt run nrt systest-runner || cleanup 1 | ||
27 | kill $CHILD_PID || cleanup 1 | ||
28 | |||
29 | echo | ||
30 | echo "******" | ||
31 | echo "* RT *" | ||
32 | echo "******" | ||
33 | echo | ||
34 | |||
35 | partrt run rt systest-runner || cleanup 1 | ||
36 | |||
37 | cleanup 0 | ||
diff --git a/recipes-test/test-nohz-stability/test-nohz-stability.bb b/recipes-test/test-nohz-stability/test-nohz-stability.bb new file mode 100644 index 0000000..5c2405a --- /dev/null +++ b/recipes-test/test-nohz-stability/test-nohz-stability.bb | |||
@@ -0,0 +1,21 @@ | |||
1 | |||
2 | LICENSE = "BSD" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" | ||
4 | INHIBIT_DEFAULT_DEPS = "1" | ||
5 | |||
6 | SRC_URI = "file://${PN} \ | ||
7 | " | ||
8 | |||
9 | FILES_${PN} += "${bindir}/${PN}" | ||
10 | |||
11 | RDEPENDS_${PN} = "ltp packagegroup-enea-rt-tools systest-runner" | ||
12 | |||
13 | do_install () { | ||
14 | install -D ${WORKDIR}/${PN} ${D}${bindir}/${PN} | ||
15 | } | ||
16 | |||
17 | # Only a script, no need for patch, configure, compile or build | ||
18 | do_patch[noexec] = "1" | ||
19 | do_configure[noexec] = "1" | ||
20 | do_compile[noexec] = "1" | ||
21 | do_build[noexec] = "1" | ||
diff --git a/recipes-test/test-nohz-ticks/files/test-nohz-ticks b/recipes-test/test-nohz-ticks/files/test-nohz-ticks new file mode 100755 index 0000000..edf71d4 --- /dev/null +++ b/recipes-test/test-nohz-ticks/files/test-nohz-ticks | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd /opt/ltp >/dev/null | ||
4 | |||
5 | partitioning_done=false | ||
6 | |||
7 | echo "BEGIN: nohz" | ||
8 | |||
9 | # Perform partitioning, if not already done | ||
10 | if [ ! -d /sys/fs/cgroup/cpuset/rt ]; then | ||
11 | partrt create 0x$(list2mask --nohz) | ||
12 | partitioning_done=true | ||
13 | fi | ||
14 | |||
15 | logname=`date +"%Y_%m_%d_%H_%M_%S"`".log" | ||
16 | ./runltp -n -i 5 -p -d /tmp -l $logname -f partrt_nohz_full | ||
17 | |||
18 | if [ ! -d ./results ]; then | ||
19 | echo "FAIL: no result found" | ||
20 | $partitioning_done && partrt undo | ||
21 | exit 1 | ||
22 | fi | ||
23 | |||
24 | cat ./results/$logname | while read line | ||
25 | do | ||
26 | resultLine=`echo $line | grep -c -E "PASS|FAIL"` | ||
27 | if [ $resultLine -eq 1 ]; then | ||
28 | testcase=`echo $line | awk '{print $1}'` | ||
29 | result=`echo $line | awk '{print $2}'` | ||
30 | echo "$result: $testcase" | ||
31 | fi | ||
32 | done | ||
33 | |||
34 | $partitioning_done && partrt undo | ||
35 | echo "END: nohz" | ||
diff --git a/recipes-test/test-nohz-ticks/test-nohz-ticks.bb b/recipes-test/test-nohz-ticks/test-nohz-ticks.bb new file mode 100644 index 0000000..047cffd --- /dev/null +++ b/recipes-test/test-nohz-ticks/test-nohz-ticks.bb | |||
@@ -0,0 +1,21 @@ | |||
1 | |||
2 | LICENSE = "BSD" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" | ||
4 | INHIBIT_DEFAULT_DEPS = "1" | ||
5 | |||
6 | SRC_URI = "file://${PN} \ | ||
7 | " | ||
8 | |||
9 | FILES_${PN} += "${bindir}/${PN}" | ||
10 | |||
11 | RDEPENDS_${PN} = "ltp packagegroup-enea-rt-tools" | ||
12 | |||
13 | do_install () { | ||
14 | install -D ${WORKDIR}/${PN} ${D}${bindir}/${PN} | ||
15 | } | ||
16 | |||
17 | # Only a script, no need for patch, configure, compile or build | ||
18 | do_patch[noexec] = "1" | ||
19 | do_configure[noexec] = "1" | ||
20 | do_compile[noexec] = "1" | ||
21 | do_build[noexec] = "1" | ||