From c2da06c175b7ce286c2acdf44d891bfdf8cd8def Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 26 Jun 2014 13:53:30 +0200 Subject: initial commit for Enea Linux 4.0 Migrated from the internal git server on the daisy-enea branch Signed-off-by: Adrian Dudau --- README | 31 +++++++++++ conf/layer.conf | 13 +++++ images-append/enea-image-test-bash.bbappend | 7 +++ ...eneric-vtime-obsolete-dependency-on-CONFI.patch | 39 ++++++++++++++ ...Fix-overflow-error-in-scheduler_tick_max_.patch | 42 +++++++++++++++ ...add-debugfs-control-over-sched_tick_max_d.patch | 61 ++++++++++++++++++++++ recipes-kernel/linux/linux-keystone_3.10.bbappend | 12 +++++ recipes-kernel/linux/linux-yocto_3.10.bbappend | 9 ++++ .../test-nohz-stability/files/test-nohz-stability | 37 +++++++++++++ .../test-nohz-stability/test-nohz-stability.bb | 21 ++++++++ recipes-test/test-nohz-ticks/files/test-nohz-ticks | 32 ++++++++++++ recipes-test/test-nohz-ticks/test-nohz-ticks.bb | 21 ++++++++ 12 files changed, 325 insertions(+) create mode 100644 README create mode 100644 conf/layer.conf create mode 100644 images-append/enea-image-test-bash.bbappend create mode 100644 recipes-kernel/linux/files/patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch create mode 100644 recipes-kernel/linux/files/patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch create mode 100644 recipes-kernel/linux/files/patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch create mode 100644 recipes-kernel/linux/linux-keystone_3.10.bbappend create mode 100644 recipes-kernel/linux/linux-yocto_3.10.bbappend create mode 100755 recipes-test/test-nohz-stability/files/test-nohz-stability create mode 100644 recipes-test/test-nohz-stability/test-nohz-stability.bb create mode 100755 recipes-test/test-nohz-ticks/files/test-nohz-ticks create mode 100644 recipes-test/test-nohz-ticks/test-nohz-ticks.bb diff --git a/README b/README new file mode 100644 index 0000000..e822179 --- /dev/null +++ b/README @@ -0,0 +1,31 @@ +Enea Linux support for tickless operation +========================================= + +This layer provides support for tickless operation in Enea Linux. +Kernel patches and configurations are applied to be able to turn off the 1 Hz +periodic tick that remains in CONFIG_NO_HZ_FULL mode. + +Supported Platforms +------------------- +x86, ARM (Keystone) + +Dependencies +------------ +meta-enea: + URI: git://git.enea.com/linux/meta-enea + branch: daisy + +Maintenance +----------- +Maintainers: Enea Linux Team + +Contributing +------------ +Contributions and patches can be sent to the Enea Linux following mailing list: + enealinux@lists.enea.com + +License +------- +All metadata is MIT licensed unless otherwise stated. Source code +included in tree for individual recipes is under the LICENSE stated +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 @@ +# We have a packages directory, add to BBFILES +BBPATH .= ":${LAYERDIR}" + +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb*" +BBFILES += "${LAYERDIR}/images/*.bb*" +BBFILES += "${LAYERDIR}/images-append/*.bb*" + +BBFILE_COLLECTIONS += "enea-nohz" +BBFILE_PATTERN_enea-nohz := "^${LAYERDIR}/" +BBFILE_PRIORITY_enea-nohz = "7" +LAYERDEPENDS_enea-nohz = "enea" + +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 @@ +IMAGE_FSTYPES += "cpio.gz" + +IMAGE_INSTALL += " \ + test-nohz-ticks \ + test-nohz-stability \ + stress \ + " 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 @@ +From 6f8a3d2a1ea680295815e5460fc13ca596893e3c Mon Sep 17 00:00:00 2001 +From: Martin Borg +Date: Mon, 3 Mar 2014 13:35:08 +0100 +Subject: [PATCH 2/2] nohz: Drop generic vtime obsolete dependency on + CONFIG_64BIT + +--- + init/Kconfig | 2 +- + kernel/time/Kconfig | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/init/Kconfig b/init/Kconfig +index 0b5d0c8..d7411e5 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -325,7 +325,7 @@ config VIRT_CPU_ACCOUNTING_NATIVE + + config VIRT_CPU_ACCOUNTING_GEN + bool "Full dynticks CPU time accounting" +- depends on HAVE_CONTEXT_TRACKING && 64BIT ++ depends on HAVE_CONTEXT_TRACKING + select VIRT_CPU_ACCOUNTING + select CONTEXT_TRACKING + help +diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig +index 70f27e8..c270b48 100644 +--- a/kernel/time/Kconfig ++++ b/kernel/time/Kconfig +@@ -100,7 +100,6 @@ config NO_HZ_FULL + # RCU_USER_QS dependency + depends on HAVE_CONTEXT_TRACKING + # VIRT_CPU_ACCOUNTING_GEN dependency +- depends on 64BIT + select NO_HZ_COMMON + select RCU_USER_QS + select RCU_NOCB_CPU +-- +1.7.10.4 + 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 @@ +From 619480006f78ebf87d80b73d4085a52a1de56feb Mon Sep 17 00:00:00 2001 +From: Martin Borg +Date: Mon, 3 Mar 2014 13:34:43 +0100 +Subject: [PATCH 1/2] sched/nohz: Fix overflow error in + scheduler_tick_max_deferment() + +--- + include/linux/jiffies.h | 4 ++++ + kernel/sched/core.c | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h +index 8fb8edf..ac69959 100644 +--- a/include/linux/jiffies.h ++++ b/include/linux/jiffies.h +@@ -290,6 +290,10 @@ extern unsigned long preset_lpj; + */ + extern unsigned int jiffies_to_msecs(const unsigned long j); + extern unsigned int jiffies_to_usecs(const unsigned long j); ++static inline u64 jiffies_to_nsecs(const unsigned long j) ++{ ++ return (u64)jiffies_to_usecs(j) * NSEC_PER_USEC; ++} + extern unsigned long msecs_to_jiffies(const unsigned int m); + extern unsigned long usecs_to_jiffies(const unsigned int u); + extern unsigned long timespec_to_jiffies(const struct timespec *value); +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 59c7367..8c3d8bf 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -2779,7 +2779,7 @@ u64 scheduler_tick_max_deferment(void) + if (time_before_eq(next, now)) + return 0; + +- return jiffies_to_usecs(next - now) * NSEC_PER_USEC; ++ return jiffies_to_nsecs(next - now); + } + + static __init int sched_nohz_full_init_debug(void) +-- +1.7.10.4 + 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 @@ +From 92f0d4f695198fcb935cf0360f93a15bf0a6af1e Mon Sep 17 00:00:00 2001 +From: Kevin Hilman +Date: Mon, 16 Sep 2013 15:43:48 -0700 +Subject: [PATCH 3/3] sched/nohz: add debugfs control over + sched_tick_max_deferment + +Allow debugfs override of sched_tick_max_deferment in order to ease +finding/fixing the remaining issues with full nohz. + +The value to be written is in jiffies, and -1 means the max deferment +is disabled (scheduler_tick_max_deferment() returns KTIME_MAX.) + +Cc: Frederic Weisbecker +Signed-off-by: Kevin Hilman +--- + kernel/sched/core.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index e8b3350..59c7367 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -2753,6 +2753,8 @@ void scheduler_tick(void) + } + + #ifdef CONFIG_NO_HZ_FULL ++static u32 sched_tick_max_deferment = HZ; ++ + /** + * scheduler_tick_max_deferment + * +@@ -2769,13 +2771,25 @@ u64 scheduler_tick_max_deferment(void) + struct rq *rq = this_rq(); + unsigned long next, now = ACCESS_ONCE(jiffies); + +- next = rq->last_sched_tick + HZ; ++ if (sched_tick_max_deferment == -1) ++ return KTIME_MAX; ++ ++ next = rq->last_sched_tick + sched_tick_max_deferment; + + if (time_before_eq(next, now)) + return 0; + + return jiffies_to_usecs(next - now) * NSEC_PER_USEC; + } ++ ++static __init int sched_nohz_full_init_debug(void) ++{ ++ debugfs_create_u32("sched_tick_max_deferment", 0644, NULL, ++ &sched_tick_max_deferment); ++ ++ return 0; ++} ++late_initcall(sched_nohz_full_init_debug); + #endif + + notrace unsigned long get_parent_ip(unsigned long addr) +-- +1.7.10.4 + 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 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "\ + file://cfg/00039-nohz.cfg \ + file://patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch \ + file://patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch \ + file://patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch \ + " + +KERNEL_FEATURES += " \ + cfg/00039-nohz \ + " 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 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "\ + file://cfg/00038-hotplug_cpu.cfg \ + file://cfg/00039-nohz.cfg \ + file://patches/sched-nohz-add-debugfs-control-over-sched_tick_max_d.patch \ + file://patches/sched-nohz-Fix-overflow-error-in-scheduler_tick_max_.patch \ + file://patches/nohz-Drop-generic-vtime-obsolete-dependency-on-CONFI.patch \ + " 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 @@ +#!/bin/sh + +partitioning_done=false + +cleanup () { + $partitioning_done && partrt undo + exit $1 +} + +cd /opt/ltp || cleanup 1 + +# Perform partitioning, if not already done +if [ ! -d /sys/fs/cgroup/cpuset/rt ]; then + partrt create $(list2mask --nohz) || cleanup 1 + partitioning_done=true +fi + +echo +echo "*******" +echo "* NRT *" +echo "*******" +echo + +partrt run rt stress -i 1 || cleanup 1 & +CHILD_PID=$! +partrt run nrt systest-runner || cleanup 1 +kill $CHILD_PID || cleanup 1 + +echo +echo "******" +echo "* RT *" +echo "******" +echo + +partrt run rt systest-runner || cleanup 1 + +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 @@ + +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" +INHIBIT_DEFAULT_DEPS = "1" + +SRC_URI = "file://${PN} \ + " + +FILES_${PN} += "${bindir}/${PN}" + +RDEPENDS_${PN} = "ltp packagegroup-enea-rt-tools systest-runner" + +do_install () { + install -D ${WORKDIR}/${PN} ${D}${bindir}/${PN} +} + +# Only a script, no need for patch, configure, compile or build +do_patch[noexec] = "1" +do_configure[noexec] = "1" +do_compile[noexec] = "1" +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 @@ +#!/bin/sh + +cd /opt/ltp >/dev/null + +partitioning_done=false + +# Perform partitioning, if not already done +if [ ! -d /sys/fs/cgroup/cpuset/rt ]; then + partrt create 0x$(list2mask --nohz) + partitioning_done=true +fi + +logname=`date +"%Y_%m_%d_%H_%M_%S"`".log" +./runltp -n -i 5 -p -d /tmp -l $logname -f partrt_nohz_full + +if [ ! -d ./results ]; then + echo "FAIL: no result found" + $partitioning_done && partrt undo + exit 1 +fi + +cat ./results/$logname | while read line +do + resultLine=`echo $line | grep -c -E "PASS|FAIL"` + if [ $resultLine -eq 1 ]; then + testcase=`echo $line | awk '{print $1}'` + result=`echo $line | awk '{print $2}'` + echo "$result: $testcase" + fi +done + +$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 @@ + +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58" +INHIBIT_DEFAULT_DEPS = "1" + +SRC_URI = "file://${PN} \ + " + +FILES_${PN} += "${bindir}/${PN}" + +RDEPENDS_${PN} = "ltp packagegroup-enea-rt-tools" + +do_install () { + install -D ${WORKDIR}/${PN} ${D}${bindir}/${PN} +} + +# Only a script, no need for patch, configure, compile or build +do_patch[noexec] = "1" +do_configure[noexec] = "1" +do_compile[noexec] = "1" +do_build[noexec] = "1" -- cgit v1.2.3-54-g00ecf