diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:53:30 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:53:30 +0200 |
commit | c2da06c175b7ce286c2acdf44d891bfdf8cd8def (patch) | |
tree | c8a087a3fc67757076dad105f45ed86d618e2ae6 | |
download | meta-nohz-daisy.tar.gz |
initial commit for Enea Linux 4.0HEADdaisy-eneadaisy
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
12 files changed, 325 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..d43249e --- /dev/null +++ b/recipes-kernel/linux/files/patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 6f8a3d2a1ea680295815e5460fc13ca596893e3c Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Borg <martin.borg@enea.com> | ||
3 | Date: Mon, 3 Mar 2014 13:35:08 +0100 | ||
4 | Subject: [PATCH 2/2] nohz: Drop generic vtime obsolete dependency on | ||
5 | CONFIG_64BIT | ||
6 | |||
7 | --- | ||
8 | init/Kconfig | 2 +- | ||
9 | kernel/time/Kconfig | 1 - | ||
10 | 2 files changed, 1 insertion(+), 2 deletions(-) | ||
11 | |||
12 | diff --git a/init/Kconfig b/init/Kconfig | ||
13 | index 0b5d0c8..d7411e5 100644 | ||
14 | --- a/init/Kconfig | ||
15 | +++ b/init/Kconfig | ||
16 | @@ -325,7 +325,7 @@ config VIRT_CPU_ACCOUNTING_NATIVE | ||
17 | |||
18 | config VIRT_CPU_ACCOUNTING_GEN | ||
19 | bool "Full dynticks CPU time accounting" | ||
20 | - depends on HAVE_CONTEXT_TRACKING && 64BIT | ||
21 | + depends on HAVE_CONTEXT_TRACKING | ||
22 | select VIRT_CPU_ACCOUNTING | ||
23 | select CONTEXT_TRACKING | ||
24 | help | ||
25 | diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig | ||
26 | index 70f27e8..c270b48 100644 | ||
27 | --- a/kernel/time/Kconfig | ||
28 | +++ b/kernel/time/Kconfig | ||
29 | @@ -100,7 +100,6 @@ config NO_HZ_FULL | ||
30 | # RCU_USER_QS dependency | ||
31 | depends on HAVE_CONTEXT_TRACKING | ||
32 | # VIRT_CPU_ACCOUNTING_GEN dependency | ||
33 | - depends on 64BIT | ||
34 | select NO_HZ_COMMON | ||
35 | select RCU_USER_QS | ||
36 | select RCU_NOCB_CPU | ||
37 | -- | ||
38 | 1.7.10.4 | ||
39 | |||
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..0c60d55 --- /dev/null +++ b/recipes-kernel/linux/files/patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From 619480006f78ebf87d80b73d4085a52a1de56feb Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Borg <martin.borg@enea.com> | ||
3 | Date: Mon, 3 Mar 2014 13:34:43 +0100 | ||
4 | Subject: [PATCH 1/2] sched/nohz: Fix overflow error in | ||
5 | scheduler_tick_max_deferment() | ||
6 | |||
7 | --- | ||
8 | include/linux/jiffies.h | 4 ++++ | ||
9 | kernel/sched/core.c | 2 +- | ||
10 | 2 files changed, 5 insertions(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h | ||
13 | index 8fb8edf..ac69959 100644 | ||
14 | --- a/include/linux/jiffies.h | ||
15 | +++ b/include/linux/jiffies.h | ||
16 | @@ -290,6 +290,10 @@ extern unsigned long preset_lpj; | ||
17 | */ | ||
18 | extern unsigned int jiffies_to_msecs(const unsigned long j); | ||
19 | extern unsigned int jiffies_to_usecs(const unsigned long j); | ||
20 | +static inline u64 jiffies_to_nsecs(const unsigned long j) | ||
21 | +{ | ||
22 | + return (u64)jiffies_to_usecs(j) * NSEC_PER_USEC; | ||
23 | +} | ||
24 | extern unsigned long msecs_to_jiffies(const unsigned int m); | ||
25 | extern unsigned long usecs_to_jiffies(const unsigned int u); | ||
26 | extern unsigned long timespec_to_jiffies(const struct timespec *value); | ||
27 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c | ||
28 | index 59c7367..8c3d8bf 100644 | ||
29 | --- a/kernel/sched/core.c | ||
30 | +++ b/kernel/sched/core.c | ||
31 | @@ -2779,7 +2779,7 @@ u64 scheduler_tick_max_deferment(void) | ||
32 | if (time_before_eq(next, now)) | ||
33 | return 0; | ||
34 | |||
35 | - return jiffies_to_usecs(next - now) * NSEC_PER_USEC; | ||
36 | + return jiffies_to_nsecs(next - now); | ||
37 | } | ||
38 | |||
39 | static __init int sched_nohz_full_init_debug(void) | ||
40 | -- | ||
41 | 1.7.10.4 | ||
42 | |||
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..f6d7546 --- /dev/null +++ b/recipes-test/test-nohz-ticks/files/test-nohz-ticks | |||
@@ -0,0 +1,32 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd /opt/ltp >/dev/null | ||
4 | |||
5 | partitioning_done=false | ||
6 | |||
7 | # Perform partitioning, if not already done | ||
8 | if [ ! -d /sys/fs/cgroup/cpuset/rt ]; then | ||
9 | partrt create 0x$(list2mask --nohz) | ||
10 | partitioning_done=true | ||
11 | fi | ||
12 | |||
13 | logname=`date +"%Y_%m_%d_%H_%M_%S"`".log" | ||
14 | ./runltp -n -i 5 -p -d /tmp -l $logname -f partrt_nohz_full | ||
15 | |||
16 | if [ ! -d ./results ]; then | ||
17 | echo "FAIL: no result found" | ||
18 | $partitioning_done && partrt undo | ||
19 | exit 1 | ||
20 | fi | ||
21 | |||
22 | cat ./results/$logname | while read line | ||
23 | do | ||
24 | resultLine=`echo $line | grep -c -E "PASS|FAIL"` | ||
25 | if [ $resultLine -eq 1 ]; then | ||
26 | testcase=`echo $line | awk '{print $1}'` | ||
27 | result=`echo $line | awk '{print $2}'` | ||
28 | echo "$result: $testcase" | ||
29 | fi | ||
30 | done | ||
31 | |||
32 | $partitioning_done && partrt undo | ||
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" | ||