From 7ac6af29202ec27dcdbf1ed5131a141be9958590 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Fri, 10 Oct 2014 03:19:52 +0200 Subject: initial commit for Enea Linux 4.0-140929 Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea --- ...eneric-vtime-obsolete-dependency-on-CONFI.patch | 50 ++++++++++++++ ...Fix-overflow-error-in-scheduler_tick_max_.patch | 76 ++++++++++++++++++++++ ...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 +++ 5 files changed, 208 insertions(+) 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 (limited to 'recipes-kernel') 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 @@ +From 3b2566af2c0ef888f95920f69e9a7e0ebc13ddff Mon Sep 17 00:00:00 2001 +From: Kevin Hilman +Date: Mon, 16 Sep 2013 15:28:19 -0700 +Subject: [PATCH] nohz: Drop generic vtime obsolete dependency on CONFIG_64BIT + +The CONFIG_64BIT requirement on vtime can finally be removed +since we now depend on HAVE_VIRT_CPU_ACCOUNTING_GEN which +already takes care of the arch ability to handle nsecs based +cputime_t safely. + +Signed-off-by: Kevin Hilman +Cc: Ingo Molnar +Cc: Russell King +Cc: Paul E. McKenney +Cc: Arm Linux +Signed-off-by: Frederic Weisbecker +Signed-off-by: Mats Liljegren +--- + 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.9.1 + 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 @@ +From 189a149dfc3ab55282b38d2194a0d7def74d8dfa Mon Sep 17 00:00:00 2001 +From: Kevin Hilman +Date: Wed, 15 Jan 2014 14:51:38 +0100 +Subject: [PATCH] sched/nohz: Fix overflow error in + scheduler_tick_max_deferment() + +While calculating the scheduler tick max deferment, the delta is +converted from microseconds to nanoseconds through a multiplication +against NSEC_PER_USEC. + +But this microseconds operand is an unsigned int, thus the result may +likely overflow. The result is cast to u64 but only once the operation +is completed, which is too late to avoid overflown result. + +This is currently not a problem because the scheduler tick max deferment +is 1 second. But this may become an issue as we plan to make this +value tunable. + +So lets fix this by casting the usecs value to u64 before multiplying by +NSECS_PER_USEC. + +Also to prevent from this kind of mistake to happen again, move this +ad-hoc jiffies -> nsecs conversion to a new helper. + +Signed-off-by: Kevin Hilman +Cc: Thomas Gleixner +Cc: Ingo Molnar +Cc: Peter Zijlstra +Cc: Alex Shi +Cc: Steven Rostedt +Cc: Paul E. McKenney +Cc: John Stultz +Cc: Kevin Hilman +Link: http://lkml.kernel.org/r/1387315388-31676-2-git-send-email-khilman@linaro.org +[move ad-hoc conversion to jiffies_to_nsecs helper] +Signed-off-by: Frederic Weisbecker + +Signed-off-by: Mats Liljegren +--- + include/linux/jiffies.h | 6 ++++++ + kernel/sched/core.c | 2 +- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h +index 8fb8edf..4df91d4 100644 +--- a/include/linux/jiffies.h ++++ b/include/linux/jiffies.h +@@ -290,6 +290,12 @@ 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 e8b3350..45c2cf1 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -2774,7 +2774,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); + } + #endif + +-- +1.9.1 + 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 \ + " -- cgit v1.2.3-54-g00ecf