From 63c3ff28705d06b93e40b25dc3d9bd0c46b8f61f Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Tue, 16 Apr 2019 03:50:24 +0200 Subject: linux-toradex-rt: fix it again Signed-off-by: Marcel Ziswiler (cherry picked from commit 850fb2c12f446023c3d186f6050c9a5fec998266) --- .../linux/linux-toradex-rt-4.9-2.3.x/001.patch | 11 - .../linux/linux-toradex-rt-4.9-2.3.x/001b.patch | 34 --- .../linux/linux-toradex-rt-4.9-2.3.x/002.patch | 95 -------- .../linux/linux-toradex-rt-4.9-2.3.x/002b.patch | 11 - .../linux/linux-toradex-rt-4.9-2.3.x/002c.patch | 116 ---------- .../linux/linux-toradex-rt-4.9-2.3.x/002d.patch | 18 -- .../linux/linux-toradex-rt-4.9-2.3.x/002e.patch | 58 ----- .../linux/linux-toradex-rt-4.9-2.3.x/002f.patch | 42 ---- .../linux/linux-toradex-rt-4.9-2.3.x/002g.patch | 53 ----- .../linux/linux-toradex-rt-4.9-2.3.x/002h.patch | 10 - .../linux/linux-toradex-rt-4.9-2.3.x/002i.patch | 114 ---------- .../linux/linux-toradex-rt-4.9-2.3.x/002j.patch | 239 --------------------- .../linux/linux-toradex-rt-4.9-2.3.x/002k.patch | 31 --- .../linux/linux-toradex-rt-4.9-2.3.x/002l.patch | 19 -- .../linux/linux-toradex-rt-4.9-2.3.x/003.patch | 39 ---- .../linux/linux-toradex-rt-4.9-2.3.x/004.patch | 86 -------- ...rt_aio_fix_spectre_gadget_in_lookup_ioctx.patch | 28 +++ ..._address_is_aligned_in_handle_futex_death.patch | 23 ++ ...ex_restructure_rt_mutex_finish_proxy_lock.patch | 132 ++++++++++++ recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb | 25 +-- 20 files changed, 189 insertions(+), 995 deletions(-) delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001b.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002b.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002c.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002d.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002e.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002f.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002g.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002h.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002i.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002j.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002k.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002l.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/003.patch delete mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/004.patch create mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch create mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch create mode 100644 recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001.patch deleted file mode 100644 index 538718a..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- b/init/main.c -+++ a/init/main.c -@@ -915,7 +915,7 @@ - - static noinline void __init kernel_init_freeable(void); - -+#if defined(CONFIG_DEBUG_RODATA) || defined(CONFIG_SET_MODULE_RONX) --#if defined(CONFIG_DEBUG_RODATA) || defined(CONFIG_DEBUG_SET_MODULE_RONX) - bool rodata_enabled __ro_after_init = true; - static int __init set_debug_rodata(char *str) - { diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001b.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001b.patch deleted file mode 100644 index 400f7fc..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/001b.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- b/include/linux/cpu.h -+++ a/include/linux/cpu.h -@@ -29,7 +29,7 @@ - }; - - extern void boot_cpu_init(void); -+extern void boot_cpu_state_init(void); --extern void boot_cpu_hotplug_init(void); - - extern int register_cpu(struct cpu *cpu, int num); - extern struct device *get_cpu_device(unsigned cpu); ---- b/init/main.c -+++ a/init/main.c -@@ -509,8 +509,8 @@ - setup_command_line(command_line); - setup_nr_cpu_ids(); - setup_per_cpu_areas(); -+ boot_cpu_state_init(); - smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ -- boot_cpu_hotplug_init(); - - build_all_zonelists(NULL, NULL); - page_alloc_init(); ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -1944,7 +1944,7 @@ - /* - * Must be called _AFTER_ setting up the per_cpu areas - */ -+void __init boot_cpu_state_init(void) --void __init boot_cpu_hotplug_init(void) - { - per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE; - } diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002.patch deleted file mode 100644 index a61c5e1..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- b/arch/x86/include/asm/idle.h -+++ a/arch/x86/include/asm/idle.h -@@ -1,6 +1,13 @@ - #ifndef _ASM_X86_IDLE_H - #define _ASM_X86_IDLE_H - -+#define IDLE_START 1 -+#define IDLE_END 2 -+ -+struct notifier_block; -+void idle_notifier_register(struct notifier_block *n); -+void idle_notifier_unregister(struct notifier_block *n); -+ - #ifdef CONFIG_X86_64 - void enter_idle(void); - void exit_idle(void); ---- b/arch/x86/kernel/process.c -+++ a/arch/x86/kernel/process.c -@@ -68,6 +68,19 @@ - - #ifdef CONFIG_X86_64 - static DEFINE_PER_CPU(unsigned char, is_idle); -+static ATOMIC_NOTIFIER_HEAD(idle_notifier); -+ -+void idle_notifier_register(struct notifier_block *n) -+{ -+ atomic_notifier_chain_register(&idle_notifier, n); -+} -+EXPORT_SYMBOL_GPL(idle_notifier_register); -+ -+void idle_notifier_unregister(struct notifier_block *n) -+{ -+ atomic_notifier_chain_unregister(&idle_notifier, n); -+} -+EXPORT_SYMBOL_GPL(idle_notifier_unregister); - #endif - - /* -@@ -384,14 +397,14 @@ - void enter_idle(void) - { - this_cpu_write(is_idle, 1); -+ atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); -- idle_notifier_call_chain(IDLE_START); - } - - static void __exit_idle(void) - { - if (x86_test_and_clear_bit_percpu(0, is_idle) == 0) - return; -+ atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); -- idle_notifier_call_chain(IDLE_END); - } - - /* Called from interrupts to signify idle end */ ---- b/include/linux/cpu.h -+++ a/include/linux/cpu.h -@@ -276,11 +276,4 @@ - static inline void cpu_smt_check_topology(void) { } - #endif - --#define IDLE_START 1 --#define IDLE_END 2 -- --void idle_notifier_register(struct notifier_block *n); --void idle_notifier_unregister(struct notifier_block *n); --void idle_notifier_call_chain(unsigned long val); -- - #endif /* _LINUX_CPU_H_ */ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -2206,23 +2206,3 @@ - #endif - this_cpu_write(cpuhp_state.state, CPUHP_ONLINE); - } -- --static ATOMIC_NOTIFIER_HEAD(idle_notifier); -- --void idle_notifier_register(struct notifier_block *n) --{ -- atomic_notifier_chain_register(&idle_notifier, n); --} --EXPORT_SYMBOL_GPL(idle_notifier_register); -- --void idle_notifier_unregister(struct notifier_block *n) --{ -- atomic_notifier_chain_unregister(&idle_notifier, n); --} --EXPORT_SYMBOL_GPL(idle_notifier_unregister); -- --void idle_notifier_call_chain(unsigned long val) --{ -- atomic_notifier_call_chain(&idle_notifier, val, NULL); --} --EXPORT_SYMBOL_GPL(idle_notifier_call_chain); diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002b.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002b.patch deleted file mode 100644 index 1463abf..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002b.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -2201,8 +2201,6 @@ - */ - void __init boot_cpu_hotplug_init(void) - { --#ifdef CONFIG_SMP - this_cpu_write(cpuhp_state.booted_once, true); --#endif - this_cpu_write(cpuhp_state.state, CPUHP_ONLINE); - } diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002c.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002c.patch deleted file mode 100644 index 27951a0..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002c.patch +++ /dev/null @@ -1,116 +0,0 @@ ---- b/arch/x86/kernel/cpu/bugs.c -+++ a/arch/x86/kernel/cpu/bugs.c -@@ -61,7 +61,7 @@ - * identify_boot_cpu() initialized SMT support information, let the - * core code know. - */ -+ cpu_smt_check_topology(); -- cpu_smt_check_topology_early(); - - if (!IS_ENABLED(CONFIG_SMP)) { - pr_info("CPU: "); ---- b/include/linux/cpu.h -+++ a/include/linux/cpu.h -@@ -267,12 +267,10 @@ - #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) - extern enum cpuhp_smt_control cpu_smt_control; - extern void cpu_smt_disable(bool force); --extern void cpu_smt_check_topology_early(void); - extern void cpu_smt_check_topology(void); - #else - # define cpu_smt_control (CPU_SMT_ENABLED) - static inline void cpu_smt_disable(bool force) { } --static inline void cpu_smt_check_topology_early(void) { } - static inline void cpu_smt_check_topology(void) { } - #endif - ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -360,8 +360,6 @@ - enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; - EXPORT_SYMBOL_GPL(cpu_smt_control); - --static bool cpu_smt_available __read_mostly; -- - void __init cpu_smt_disable(bool force) - { - if (cpu_smt_control == CPU_SMT_FORCE_DISABLED || -@@ -378,28 +376,14 @@ - - /* - * The decision whether SMT is supported can only be done after the full -+ * CPU identification. Called from architecture code. -- * CPU identification. Called from architecture code before non boot CPUs -- * are brought up. - */ -+void __init cpu_smt_check_topology(void) --void __init cpu_smt_check_topology_early(void) - { - if (!topology_smt_supported()) - cpu_smt_control = CPU_SMT_NOT_SUPPORTED; - } - --/* -- * If SMT was disabled by BIOS, detect it here, after the CPUs have been -- * brought online. This ensures the smt/l1tf sysfs entries are consistent -- * with reality. cpu_smt_available is set to true during the bringup of non -- * boot CPUs when a SMT sibling is detected. Note, this may overwrite -- * cpu_smt_control's previous setting. -- */ --void __init cpu_smt_check_topology(void) --{ -- if (!cpu_smt_available) -- cpu_smt_control = CPU_SMT_NOT_SUPPORTED; --} -- - static int __init smt_cmdline_disable(char *str) - { - cpu_smt_disable(str && !strcmp(str, "force")); -@@ -409,18 +393,10 @@ - - static inline bool cpu_smt_allowed(unsigned int cpu) - { -+ if (cpu_smt_control == CPU_SMT_ENABLED) -- if (topology_is_primary_thread(cpu)) - return true; - -+ if (topology_is_primary_thread(cpu)) -- /* -- * If the CPU is not a 'primary' thread and the booted_once bit is -- * set then the processor has SMT support. Store this information -- * for the late check of SMT support in cpu_smt_check_topology(). -- */ -- if (per_cpu(cpuhp_state, cpu).booted_once) -- cpu_smt_available = true; -- -- if (cpu_smt_control == CPU_SMT_ENABLED) - return true; - - /* -@@ -2087,6 +2063,15 @@ - - static int __init cpu_smt_state_init(void) - { -+ /* -+ * If SMT was disabled by BIOS, detect it here, after the CPUs have -+ * been brought online. This ensures the smt/l1tf sysfs entries are -+ * consistent with reality. Note this may overwrite cpu_smt_control's -+ * previous setting. -+ */ -+ if (topology_max_smt_threads() == 1) -+ cpu_smt_control = CPU_SMT_NOT_SUPPORTED; -+ - return sysfs_create_group(&cpu_subsys.dev_root->kobj, - &cpuhp_smt_attr_group); - } ---- b/kernel/smp.c -+++ a/kernel/smp.c -@@ -564,8 +564,6 @@ - cpu_up(cpu); - } - -- /* Final decision about SMT support */ -- cpu_smt_check_topology(); - /* Any cleanup work */ - smp_announce(); - smp_cpus_done(setup_max_cpus); diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002d.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002d.patch deleted file mode 100644 index 853223c..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002d.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -2063,15 +2063,6 @@ - - static int __init cpu_smt_state_init(void) - { -- /* -- * If SMT was disabled by BIOS, detect it here, after the CPUs have -- * been brought online. This ensures the smt/l1tf sysfs entries are -- * consistent with reality. Note this may overwrite cpu_smt_control's -- * previous setting. -- */ -- if (topology_max_smt_threads() == 1) -- cpu_smt_control = CPU_SMT_NOT_SUPPORTED; -- - return sysfs_create_group(&cpu_subsys.dev_root->kobj, - &cpuhp_smt_attr_group); - } diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002e.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002e.patch deleted file mode 100644 index 88419fc..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002e.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- b/arch/x86/kernel/cpu/bugs.c -+++ a/arch/x86/kernel/cpu/bugs.c -@@ -57,12 +57,6 @@ - { - identify_boot_cpu(); - -- /* -- * identify_boot_cpu() initialized SMT support information, let the -- * core code know. -- */ -- cpu_smt_check_topology(); -- - if (!IS_ENABLED(CONFIG_SMP)) { - pr_info("CPU: "); - print_cpu_info(&boot_cpu_data); ---- b/include/linux/cpu.h -+++ a/include/linux/cpu.h -@@ -267,11 +267,9 @@ - #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) - extern enum cpuhp_smt_control cpu_smt_control; - extern void cpu_smt_disable(bool force); --extern void cpu_smt_check_topology(void); - #else - # define cpu_smt_control (CPU_SMT_ENABLED) - static inline void cpu_smt_disable(bool force) { } --static inline void cpu_smt_check_topology(void) { } - #endif - - #endif /* _LINUX_CPU_H_ */ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -374,16 +374,6 @@ - } - } - --/* -- * The decision whether SMT is supported can only be done after the full -- * CPU identification. Called from architecture code. -- */ --void __init cpu_smt_check_topology(void) --{ -- if (!topology_smt_supported()) -- cpu_smt_control = CPU_SMT_NOT_SUPPORTED; --} -- - static int __init smt_cmdline_disable(char *str) - { - cpu_smt_disable(str && !strcmp(str, "force")); -@@ -2063,6 +2053,9 @@ - - static int __init cpu_smt_state_init(void) - { -+ if (!topology_smt_supported()) -+ cpu_smt_control = CPU_SMT_NOT_SUPPORTED; -+ - return sysfs_create_group(&cpu_subsys.dev_root->kobj, - &cpuhp_smt_attr_group); - } diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002f.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002f.patch deleted file mode 100644 index f50b1aa..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002f.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- b/include/linux/cpu.h -+++ a/include/linux/cpu.h -@@ -266,10 +266,8 @@ - - #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) - extern enum cpuhp_smt_control cpu_smt_control; --extern void cpu_smt_disable(bool force); - #else - # define cpu_smt_control (CPU_SMT_ENABLED) --static inline void cpu_smt_disable(bool force) { } - #endif - - #endif /* _LINUX_CPU_H_ */ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -360,23 +360,13 @@ - enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; - EXPORT_SYMBOL_GPL(cpu_smt_control); - -+static int __init smt_cmdline_disable(char *str) --void __init cpu_smt_disable(bool force) - { -+ cpu_smt_control = CPU_SMT_DISABLED; -+ if (str && !strcmp(str, "force")) { -- if (cpu_smt_control == CPU_SMT_FORCE_DISABLED || -- cpu_smt_control == CPU_SMT_NOT_SUPPORTED) -- return; -- -- if (force) { - pr_info("SMT: Force disabled\n"); - cpu_smt_control = CPU_SMT_FORCE_DISABLED; -- } else { -- cpu_smt_control = CPU_SMT_DISABLED; - } --} -- --static int __init smt_cmdline_disable(char *str) --{ -- cpu_smt_disable(str && !strcmp(str, "force")); - return 0; - } - early_param("nosmt", smt_cmdline_disable); diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002g.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002g.patch deleted file mode 100644 index 714e97f..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002g.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -1917,15 +1917,6 @@ - kobject_uevent(&dev->kobj, KOBJ_OFFLINE); - } - --static void cpuhp_online_cpu_device(unsigned int cpu) --{ -- struct device *dev = get_cpu_device(cpu); -- -- dev->offline = false; -- /* Tell user space about the state change */ -- kobject_uevent(&dev->kobj, KOBJ_ONLINE); --} -- - static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) - { - int cpu, ret = 0; -@@ -1958,24 +1949,11 @@ - return ret; - } - -+static void cpuhp_smt_enable(void) --static int cpuhp_smt_enable(void) - { -- int cpu, ret = 0; -- - cpu_maps_update_begin(); - cpu_smt_control = CPU_SMT_ENABLED; -- for_each_present_cpu(cpu) { -- /* Skip online CPUs and CPUs on offline nodes */ -- if (cpu_online(cpu) || !node_online(cpu_to_node(cpu))) -- continue; -- ret = _cpu_up(cpu, 0, CPUHP_ONLINE); -- if (ret) -- break; -- /* See comment in cpuhp_smt_disable() */ -- cpuhp_online_cpu_device(cpu); -- } - cpu_maps_update_done(); -- return ret; - } - - static ssize_t -@@ -2006,7 +1984,7 @@ - if (ctrlval != cpu_smt_control) { - switch (ctrlval) { - case CPU_SMT_ENABLED: -+ cpuhp_smt_enable(); -- ret = cpuhp_smt_enable(); - break; - case CPU_SMT_DISABLED: - case CPU_SMT_FORCE_DISABLED: diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002h.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002h.patch deleted file mode 100644 index 578a370..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002h.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -358,7 +358,6 @@ - - #ifdef CONFIG_HOTPLUG_SMT - enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; --EXPORT_SYMBOL_GPL(cpu_smt_control); - - static int __init smt_cmdline_disable(char *str) - { diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002i.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002i.patch deleted file mode 100644 index 0733908..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002i.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -54,7 +54,6 @@ - bool rollback; - bool single; - bool bringup; -- bool booted_once; - struct hlist_node *node; - enum cpuhp_state cb_state; - int result; -@@ -356,40 +355,6 @@ - EXPORT_SYMBOL_GPL(cpu_hotplug_enable); - #endif /* CONFIG_HOTPLUG_CPU */ - --#ifdef CONFIG_HOTPLUG_SMT --enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; -- --static int __init smt_cmdline_disable(char *str) --{ -- cpu_smt_control = CPU_SMT_DISABLED; -- if (str && !strcmp(str, "force")) { -- pr_info("SMT: Force disabled\n"); -- cpu_smt_control = CPU_SMT_FORCE_DISABLED; -- } -- return 0; --} --early_param("nosmt", smt_cmdline_disable); -- --static inline bool cpu_smt_allowed(unsigned int cpu) --{ -- if (cpu_smt_control == CPU_SMT_ENABLED) -- return true; -- -- if (topology_is_primary_thread(cpu)) -- return true; -- -- /* -- * On x86 it's required to boot all logical CPUs at least once so -- * that the init code can get a chance to set CR4.MCE on each -- * CPU. Otherwise, a broadacasted MCE observing CR4.MCE=0b on any -- * core will shutdown the machine. -- */ -- return !per_cpu(cpuhp_state, cpu).booted_once; --} --#else --static inline bool cpu_smt_allowed(unsigned int cpu) { return true; } --#endif -- - /* Need to know about CPUs going up/down? */ - int register_cpu_notifier(struct notifier_block *nb) - { -@@ -466,16 +431,6 @@ - stop_machine_unpark(cpu); - kthread_unpark(st->thread); - -- /* -- * SMT soft disabling on X86 requires to bring the CPU out of the -- * BIOS 'wait for SIPI' state in order to set the CR4.MCE bit. The -- * CPU marked itself as booted_once in cpu_notify_starting() so the -- * cpu_smt_allowed() check will now return false if this is not the -- * primary sibling. -- */ -- if (!cpu_smt_allowed(cpu)) -- return -ECANCELED; -- - /* Should we go further up ? */ - if (st->target > CPUHP_AP_ONLINE_IDLE) { - __cpuhp_kick_ap_work(st); -@@ -1023,6 +978,29 @@ - EXPORT_SYMBOL(cpu_down); - #endif /*CONFIG_HOTPLUG_CPU*/ - -+#ifdef CONFIG_HOTPLUG_SMT -+enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; -+ -+static int __init smt_cmdline_disable(char *str) -+{ -+ cpu_smt_control = CPU_SMT_DISABLED; -+ if (str && !strcmp(str, "force")) { -+ pr_info("SMT: Force disabled\n"); -+ cpu_smt_control = CPU_SMT_FORCE_DISABLED; -+ } -+ return 0; -+} -+early_param("nosmt", smt_cmdline_disable); -+ -+static inline bool cpu_smt_allowed(unsigned int cpu) -+{ -+ return cpu_smt_control == CPU_SMT_ENABLED || -+ topology_is_primary_thread(cpu); -+} -+#else -+static inline bool cpu_smt_allowed(unsigned int cpu) { return true; } -+#endif -+ - /** - * notify_cpu_starting(cpu) - Invoke the callbacks on the starting CPU - * @cpu: cpu that just started -@@ -1036,7 +1014,6 @@ - enum cpuhp_state target = min((int)st->target, CPUHP_AP_ONLINE); - - rcu_cpu_starting(cpu); /* Enables RCU usage on this CPU. */ -- st->booted_once = true; - while (st->state < target) { - st->state++; - cpuhp_invoke_callback(cpu, st->state, true, NULL); -@@ -2137,6 +2114,5 @@ - */ - void __init boot_cpu_hotplug_init(void) - { -+ per_cpu_ptr(&cpuhp_state, smp_processor_id())->state = CPUHP_ONLINE; -- this_cpu_write(cpuhp_state.booted_once, true); -- this_cpu_write(cpuhp_state.state, CPUHP_ONLINE); - } diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002j.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002j.patch deleted file mode 100644 index b98ae77..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002j.patch +++ /dev/null @@ -1,239 +0,0 @@ ---- b/arch/Kconfig -+++ a/arch/Kconfig -@@ -5,9 +5,6 @@ - config KEXEC_CORE - bool - --config HOTPLUG_SMT -- bool -- - config OPROFILE - tristate "OProfile system profiling" - depends on PROFILING ---- b/arch/x86/Kconfig -+++ a/arch/x86/Kconfig -@@ -147,7 +147,6 @@ - select HAVE_UID16 if X86_32 || IA32_EMULATION - select HAVE_UNSTABLE_SCHED_CLOCK - select HAVE_USER_RETURN_NOTIFIER -- select HOTPLUG_SMT if SMP - select IRQ_FORCED_THREADING - select MODULES_USE_ELF_RELA if X86_64 - select MODULES_USE_ELF_REL if X86_32 ---- b/include/linux/cpu.h -+++ a/include/linux/cpu.h -@@ -257,17 +257,4 @@ - static inline void cpuhp_report_idle_dead(void) { } - #endif /* #ifdef CONFIG_HOTPLUG_CPU */ - --enum cpuhp_smt_control { -- CPU_SMT_ENABLED, -- CPU_SMT_DISABLED, -- CPU_SMT_FORCE_DISABLED, -- CPU_SMT_NOT_SUPPORTED, --}; -- --#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) --extern enum cpuhp_smt_control cpu_smt_control; --#else --# define cpu_smt_control (CPU_SMT_ENABLED) --#endif -- - #endif /* _LINUX_CPU_H_ */ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -978,29 +978,6 @@ - EXPORT_SYMBOL(cpu_down); - #endif /*CONFIG_HOTPLUG_CPU*/ - --#ifdef CONFIG_HOTPLUG_SMT --enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; -- --static int __init smt_cmdline_disable(char *str) --{ -- cpu_smt_control = CPU_SMT_DISABLED; -- if (str && !strcmp(str, "force")) { -- pr_info("SMT: Force disabled\n"); -- cpu_smt_control = CPU_SMT_FORCE_DISABLED; -- } -- return 0; --} --early_param("nosmt", smt_cmdline_disable); -- --static inline bool cpu_smt_allowed(unsigned int cpu) --{ -- return cpu_smt_control == CPU_SMT_ENABLED || -- topology_is_primary_thread(cpu); --} --#else --static inline bool cpu_smt_allowed(unsigned int cpu) { return true; } --#endif -- - /** - * notify_cpu_starting(cpu) - Invoke the callbacks on the starting CPU - * @cpu: cpu that just started -@@ -1119,10 +1096,6 @@ - err = -EBUSY; - goto out; - } -- if (!cpu_smt_allowed(cpu)) { -- err = -EPERM; -- goto out; -- } - - err = _cpu_up(cpu, 0, target); - out: -@@ -1869,153 +1842,10 @@ - NULL - }; - --#ifdef CONFIG_HOTPLUG_SMT -- --static const char *smt_states[] = { -- [CPU_SMT_ENABLED] = "on", -- [CPU_SMT_DISABLED] = "off", -- [CPU_SMT_FORCE_DISABLED] = "forceoff", -- [CPU_SMT_NOT_SUPPORTED] = "notsupported", --}; -- --static ssize_t --show_smt_control(struct device *dev, struct device_attribute *attr, char *buf) --{ -- return snprintf(buf, PAGE_SIZE - 2, "%s\n", smt_states[cpu_smt_control]); --} -- --static void cpuhp_offline_cpu_device(unsigned int cpu) --{ -- struct device *dev = get_cpu_device(cpu); -- -- dev->offline = true; -- /* Tell user space about the state change */ -- kobject_uevent(&dev->kobj, KOBJ_OFFLINE); --} -- --static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) --{ -- int cpu, ret = 0; -- -- cpu_maps_update_begin(); -- for_each_online_cpu(cpu) { -- if (topology_is_primary_thread(cpu)) -- continue; -- ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE); -- if (ret) -- break; -- /* -- * As this needs to hold the cpu maps lock it's impossible -- * to call device_offline() because that ends up calling -- * cpu_down() which takes cpu maps lock. cpu maps lock -- * needs to be held as this might race against in kernel -- * abusers of the hotplug machinery (thermal management). -- * -- * So nothing would update device:offline state. That would -- * leave the sysfs entry stale and prevent onlining after -- * smt control has been changed to 'off' again. This is -- * called under the sysfs hotplug lock, so it is properly -- * serialized against the regular offline usage. -- */ -- cpuhp_offline_cpu_device(cpu); -- } -- if (!ret) -- cpu_smt_control = ctrlval; -- cpu_maps_update_done(); -- return ret; --} -- --static void cpuhp_smt_enable(void) --{ -- cpu_maps_update_begin(); -- cpu_smt_control = CPU_SMT_ENABLED; -- cpu_maps_update_done(); --} -- --static ssize_t --store_smt_control(struct device *dev, struct device_attribute *attr, -- const char *buf, size_t count) --{ -- int ctrlval, ret; -- -- if (sysfs_streq(buf, "on")) -- ctrlval = CPU_SMT_ENABLED; -- else if (sysfs_streq(buf, "off")) -- ctrlval = CPU_SMT_DISABLED; -- else if (sysfs_streq(buf, "forceoff")) -- ctrlval = CPU_SMT_FORCE_DISABLED; -- else -- return -EINVAL; -- -- if (cpu_smt_control == CPU_SMT_FORCE_DISABLED) -- return -EPERM; -- -- if (cpu_smt_control == CPU_SMT_NOT_SUPPORTED) -- return -ENODEV; -- -- ret = lock_device_hotplug_sysfs(); -- if (ret) -- return ret; -- -- if (ctrlval != cpu_smt_control) { -- switch (ctrlval) { -- case CPU_SMT_ENABLED: -- cpuhp_smt_enable(); -- break; -- case CPU_SMT_DISABLED: -- case CPU_SMT_FORCE_DISABLED: -- ret = cpuhp_smt_disable(ctrlval); -- break; -- } -- } -- -- unlock_device_hotplug(); -- return ret ? ret : count; --} --static DEVICE_ATTR(control, 0644, show_smt_control, store_smt_control); -- --static ssize_t --show_smt_active(struct device *dev, struct device_attribute *attr, char *buf) --{ -- bool active = topology_max_smt_threads() > 1; -- -- return snprintf(buf, PAGE_SIZE - 2, "%d\n", active); --} --static DEVICE_ATTR(active, 0444, show_smt_active, NULL); -- --static struct attribute *cpuhp_smt_attrs[] = { -- &dev_attr_control.attr, -- &dev_attr_active.attr, -- NULL --}; -- --static const struct attribute_group cpuhp_smt_attr_group = { -- .attrs = cpuhp_smt_attrs, -- .name = "smt", -- NULL --}; -- --static int __init cpu_smt_state_init(void) --{ -- if (!topology_smt_supported()) -- cpu_smt_control = CPU_SMT_NOT_SUPPORTED; -- -- return sysfs_create_group(&cpu_subsys.dev_root->kobj, -- &cpuhp_smt_attr_group); --} -- --#else --static inline int cpu_smt_state_init(void) { return 0; } --#endif -- - static int __init cpuhp_sysfs_init(void) - { - int cpu, ret; - -- ret = cpu_smt_state_init(); -- if (ret) -- return ret; -- - ret = sysfs_create_group(&cpu_subsys.dev_root->kobj, - &cpuhp_cpu_root_attr_group); - if (ret) diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002k.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002k.patch deleted file mode 100644 index 09c6527..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002k.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -955,19 +955,20 @@ - return ret; - } - --static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target) --{ -- if (cpu_hotplug_disabled) -- return -EBUSY; -- return _cpu_down(cpu, 0, target); --} -- - static int do_cpu_down(unsigned int cpu, enum cpuhp_state target) - { - int err; - - cpu_maps_update_begin(); -+ -+ if (cpu_hotplug_disabled) { -+ err = -EBUSY; -+ goto out; -+ } -+ -+ err = _cpu_down(cpu, 0, target); -+ -+out: -- err = cpu_down_maps_locked(cpu, target); - cpu_maps_update_done(); - return err; - } diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002l.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002l.patch deleted file mode 100644 index 1069057..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/002l.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- b/kernel/cpu.c -+++ a/kernel/cpu.c -@@ -817,6 +817,7 @@ - - /* Park the smpboot threads */ - kthread_park(per_cpu_ptr(&cpuhp_state, cpu)->thread); -+ smpboot_park_threads(cpu); - - /* - * Prevent irq alloc/free while the dying cpu reorganizes the -@@ -1388,7 +1389,7 @@ - [CPUHP_AP_SMPBOOT_THREADS] = { - .name = "smpboot/threads:online", - .startup.single = smpboot_unpark_threads, -+ .teardown.single = NULL, -- .teardown.single = smpboot_park_threads, - }, - [CPUHP_AP_PERF_ONLINE] = { - .name = "perf:online", diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/003.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/003.patch deleted file mode 100644 index a385ea0..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/003.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- b/kernel/softirq.c -+++ a/kernel/softirq.c -@@ -79,16 +79,12 @@ - - /* - * If ksoftirqd is scheduled, we do not want to process pending softirqs -+ * right now. Let ksoftirqd handle this at its own rate, to get fairness. -- * right now. Let ksoftirqd handle this at its own rate, to get fairness, -- * unless we're doing some of the synchronous softirqs. - */ -+static bool ksoftirqd_running(void) --#define SOFTIRQ_NOW_MASK ((1 << HI_SOFTIRQ) | (1 << TASKLET_SOFTIRQ)) --static bool ksoftirqd_running(unsigned long pending) - { - struct task_struct *tsk = __this_cpu_read(ksoftirqd); - -- if (pending & SOFTIRQ_NOW_MASK) -- return false; - return tsk && (tsk->state == TASK_RUNNING); - } - -@@ -328,7 +324,7 @@ - - pending = local_softirq_pending(); - -+ if (pending && !ksoftirqd_running()) -- if (pending && !ksoftirqd_running(pending)) - do_softirq_own_stack(); - - local_irq_restore(flags); -@@ -355,7 +351,7 @@ - - static inline void invoke_softirq(void) - { -+ if (ksoftirqd_running()) -- if (ksoftirqd_running(local_softirq_pending())) - return; - - if (!force_irqthreads) { diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/004.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/004.patch deleted file mode 100644 index bc2c859..0000000 --- a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/004.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- b/kernel/stop_machine.c -+++ a/kernel/stop_machine.c -@@ -36,7 +36,7 @@ - struct cpu_stopper { - struct task_struct *thread; - -+ spinlock_t lock; -- raw_spinlock_t lock; - bool enabled; /* is this stopper enabled? */ - struct list_head works; /* list of pending works */ - -@@ -78,13 +78,13 @@ - unsigned long flags; - bool enabled; - -+ spin_lock_irqsave(&stopper->lock, flags); -- raw_spin_lock_irqsave(&stopper->lock, flags); - enabled = stopper->enabled; - if (enabled) - __cpu_stop_queue_work(stopper, work); - else if (work->done) - cpu_stop_signal_done(work->done); -+ spin_unlock_irqrestore(&stopper->lock, flags); -- raw_spin_unlock_irqrestore(&stopper->lock, flags); - - return enabled; - } -@@ -231,8 +231,8 @@ - struct cpu_stopper *stopper2 = per_cpu_ptr(&cpu_stopper, cpu2); - int err; - retry: -+ spin_lock_irq(&stopper1->lock); -+ spin_lock_nested(&stopper2->lock, SINGLE_DEPTH_NESTING); -- raw_spin_lock_irq(&stopper1->lock); -- raw_spin_lock_nested(&stopper2->lock, SINGLE_DEPTH_NESTING); - - err = -ENOENT; - if (!stopper1->enabled || !stopper2->enabled) -@@ -255,8 +255,8 @@ - __cpu_stop_queue_work(stopper1, work1); - __cpu_stop_queue_work(stopper2, work2); - unlock: -+ spin_unlock(&stopper2->lock); -+ spin_unlock_irq(&stopper1->lock); -- raw_spin_unlock(&stopper2->lock); -- raw_spin_unlock_irq(&stopper1->lock); - - if (unlikely(err == -EDEADLK)) { - while (stop_cpus_in_progress) -@@ -448,9 +448,9 @@ - unsigned long flags; - int run; - -+ spin_lock_irqsave(&stopper->lock, flags); -- raw_spin_lock_irqsave(&stopper->lock, flags); - run = !list_empty(&stopper->works); -+ spin_unlock_irqrestore(&stopper->lock, flags); -- raw_spin_unlock_irqrestore(&stopper->lock, flags); - return run; - } - -@@ -461,13 +461,13 @@ - - repeat: - work = NULL; -+ spin_lock_irq(&stopper->lock); -- raw_spin_lock_irq(&stopper->lock); - if (!list_empty(&stopper->works)) { - work = list_first_entry(&stopper->works, - struct cpu_stop_work, list); - list_del_init(&work->list); - } -+ spin_unlock_irq(&stopper->lock); -- raw_spin_unlock_irq(&stopper->lock); - - if (work) { - cpu_stop_fn_t fn = work->fn; -@@ -541,7 +541,7 @@ - for_each_possible_cpu(cpu) { - struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu); - -+ spin_lock_init(&stopper->lock); -- raw_spin_lock_init(&stopper->lock); - INIT_LIST_HEAD(&stopper->works); - } - diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch new file mode 100644 index 0000000..c56c72f --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch @@ -0,0 +1,28 @@ +commit 2f7fbc052b632c0ae2d4a2bb5d5c928bbc24ca43 +Author: Marcel Ziswiler +Date: Tue Apr 9 04:12:18 2019 +0200 + + Revert "aio: fix spectre gadget in lookup_ioctx" + + This reverts commit 3a7bac902691cd92cb69f95d98dc675dea8b3228. + +diff --git a/fs/aio.c b/fs/aio.c +index c3fc80294397..b1170a7affe2 100644 +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -40,7 +40,6 @@ + #include + #include + #include +-#include + + #include + #include +@@ -1072,7 +1071,6 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) + if (!table || id >= table->nr) + goto out; + +- id = array_index_nospec(id, table->nr); + ctx = rcu_dereference(table->table[id]); + if (ctx && ctx->user_id == ctx_id) { + if (percpu_ref_tryget_live(&ctx->users)) diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch new file mode 100644 index 0000000..428bbdf --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch @@ -0,0 +1,23 @@ +commit f90e153d43ab26a02975c5de9d50b01161f044da +Author: Marcel Ziswiler +Date: Tue Apr 16 03:06:34 2019 +0200 + + Revert "futex: Ensure that futex address is aligned in handle_futex_death()" + + This reverts commit 726c28f30ac16e0d4cab17751b447e4abf61b102. + +diff --git a/kernel/futex.c b/kernel/futex.c +index 2e766ffff2cb..30fe0432c46d 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -3110,10 +3110,6 @@ int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) + { + u32 uval, uninitialized_var(nval), mval; + +- /* Futex address must be 32bit aligned */ +- if ((((unsigned long)uaddr) % sizeof(*uaddr)) != 0) +- return -1; +- + retry: + if (get_user(uval, uaddr)) + return -1; diff --git a/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch new file mode 100644 index 0000000..3718efd --- /dev/null +++ b/recipes-kernel/linux/linux-toradex-rt-4.9-2.3.x/revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch @@ -0,0 +1,132 @@ +commit 1b190aef79b0e83bd8fccdc267a1761968f4a20a +Author: Marcel Ziswiler +Date: Tue Apr 16 03:30:56 2019 +0200 + + Revert "futex,rt_mutex: Restructure rt_mutex_finish_proxy_lock()" + + This reverts commit ce813552312bfbb28bae32064d65afff3c0e7c82. + +diff --git a/kernel/futex.c b/kernel/futex.c +index 30fe0432c46d..053d7be08be5 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -2966,13 +2966,10 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + */ + WARN_ON(!q.pi_state); + pi_mutex = &q.pi_state->pi_mutex; +- ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); ++ ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter); ++ debug_rt_mutex_free_waiter(&rt_waiter); + + spin_lock(q.lock_ptr); +- if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) +- ret = 0; +- +- debug_rt_mutex_free_waiter(&rt_waiter); + /* + * Fixup the pi_state owner and possibly acquire the lock if we + * haven't already. +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index 7615e7722258..196cc460e38d 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -1746,23 +1746,21 @@ struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock) + } + + /** +- * rt_mutex_wait_proxy_lock() - Wait for lock acquisition ++ * rt_mutex_finish_proxy_lock() - Complete lock acquisition + * @lock: the rt_mutex we were woken on + * @to: the timeout, null if none. hrtimer should already have + * been started. + * @waiter: the pre-initialized rt_mutex_waiter + * +- * Wait for the the lock acquisition started on our behalf by +- * rt_mutex_start_proxy_lock(). Upon failure, the caller must call +- * rt_mutex_cleanup_proxy_lock(). ++ * Complete the lock acquisition started our behalf by another thread. + * + * Returns: + * 0 - success + * <0 - error, one of -EINTR, -ETIMEDOUT + * +- * Special API call for PI-futex support ++ * Special API call for PI-futex requeue support + */ +-int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, ++int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, + struct hrtimer_sleeper *to, + struct rt_mutex_waiter *waiter) + { +@@ -1775,6 +1773,9 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, + /* sleep on the mutex */ + ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter); + ++ if (unlikely(ret)) ++ remove_waiter(lock, waiter); ++ + /* + * try_to_take_rt_mutex() sets the waiter bit unconditionally. We might + * have to fix that up. +@@ -1785,42 +1786,3 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, + + return ret; + } +- +-/** +- * rt_mutex_cleanup_proxy_lock() - Cleanup failed lock acquisition +- * @lock: the rt_mutex we were woken on +- * @waiter: the pre-initialized rt_mutex_waiter +- * +- * Attempt to clean up after a failed rt_mutex_wait_proxy_lock(). +- * +- * Unless we acquired the lock; we're still enqueued on the wait-list and can +- * in fact still be granted ownership until we're removed. Therefore we can +- * find we are in fact the owner and must disregard the +- * rt_mutex_wait_proxy_lock() failure. +- * +- * Returns: +- * true - did the cleanup, we done. +- * false - we acquired the lock after rt_mutex_wait_proxy_lock() returned, +- * caller should disregards its return value. +- * +- * Special API call for PI-futex support +- */ +-bool rt_mutex_cleanup_proxy_lock(struct rt_mutex *lock, +- struct rt_mutex_waiter *waiter) +-{ +- bool cleanup = false; +- +- raw_spin_lock_irq(&lock->wait_lock); +- /* +- * Unless we're the owner; we're still enqueued on the wait_list. +- * So check if we became owner, if not, take us off the wait_list. +- */ +- if (rt_mutex_owner(lock) != current) { +- remove_waiter(lock, waiter); +- fixup_rt_mutex_waiters(lock); +- cleanup = true; +- } +- raw_spin_unlock_irq(&lock->wait_lock); +- +- return cleanup; +-} +diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h +index 14cbafed0014..50848b460851 100644 +--- a/kernel/locking/rtmutex_common.h ++++ b/kernel/locking/rtmutex_common.h +@@ -107,11 +107,9 @@ extern void rt_mutex_proxy_unlock(struct rt_mutex *lock, + extern int rt_mutex_start_proxy_lock(struct rt_mutex *lock, + struct rt_mutex_waiter *waiter, + struct task_struct *task); +-extern int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, +- struct hrtimer_sleeper *to, +- struct rt_mutex_waiter *waiter); +-extern bool rt_mutex_cleanup_proxy_lock(struct rt_mutex *lock, +- struct rt_mutex_waiter *waiter); ++extern int rt_mutex_finish_proxy_lock(struct rt_mutex *lock, ++ struct hrtimer_sleeper *to, ++ struct rt_mutex_waiter *waiter); + extern int rt_mutex_timed_futex_lock(struct rt_mutex *l, struct hrtimer_sleeper *to); + extern bool rt_mutex_futex_unlock(struct rt_mutex *lock, + struct wake_q_head *wqh); diff --git a/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb b/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb index 30f8562..26948b2 100644 --- a/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb +++ b/recipes-kernel/linux/linux-toradex-rt_4.9-2.3.x.bb @@ -4,28 +4,15 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/linux-toradex-rt-4.9-2.3.x:" SUMMARY = "Real-Time Linux kernel for Toradex Freescale i.MX based modules" SRC_URI += " \ - file://001.patch \ - file://001b.patch \ - file://002.patch \ - file://002b.patch \ - file://002c.patch \ - file://002d.patch \ - file://002e.patch \ - file://002f.patch \ - file://002g.patch \ - file://002h.patch \ - file://002i.patch \ - file://002j.patch \ - file://002k.patch \ - file://002l.patch \ - file://003.patch \ - file://004.patch \ - https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patch-4.9.115-rt94.patch.xz;name=rt-patch \ + file://revert_aio_fix_spectre_gadget_in_lookup_ioctx.patch \ + file://revert_futex_ensure_that_futex_address_is_aligned_in_handle_futex_death.patch \ + file://revert_futex_rt_mutex_restructure_rt_mutex_finish_proxy_lock.patch \ + https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patch-4.9.146-rt125.patch.xz;name=rt-patch \ file://0002-mm-Work-around-the-oops-below-by-disabling-split-ptl.patch \ " -SRC_URI[rt-patch.md5sum] = "7c19c496fe4b1e268f5f185b1b266043" -SRC_URI[rt-patch.sha256sum] = "5d6ac2e1fe94dfea1ac0353bf1907653413bcbf6b795b833e4edf9586b79d68a" +SRC_URI[rt-patch.md5sum] = "b7869d612f2572191ed45c796bde7abe" +SRC_URI[rt-patch.sha256sum] = "925106e44f4bd5213bd38d29bcc0cfdda670fca20600357b15ac576d286ab445" SRCREV = "d899927728beca8357a5b4120b690cb3c1d80844" SRCBRANCH = "toradex_4.9-2.3.x-imx" -- cgit v1.2.3