diff --git a/debian/changelog b/debian/changelog index 13c6f8fa6..5e99078af 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,7 @@ linux (4.4-1~exp2) UNRELEASED; urgency=medium * linux-image: Remove unnecessary debconf initialisations * linux-{headers,image}: Remove support for version-specific hooks * linux-headers: Make postinst script less verbose (see: #734266) + * [rt] Update to 4.4-rt3 -- Ian Campbell Sat, 23 Jan 2016 08:23:05 +0000 diff --git a/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch b/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch index 6a0038e05..ab1eedcd8 100644 --- a/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch +++ b/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 1 Mar 2013 11:17:42 +0100 Subject: futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz In exit_pi_state_list() we have the following locking construct: diff --git a/debian/patches/features/all/rt/0009-ARM-OMAP2-Drop-the-concept-of-certain-power-domains-.patch b/debian/patches/features/all/rt/0009-ARM-OMAP2-Drop-the-concept-of-certain-power-domains-.patch deleted file mode 100644 index 7ec2cc6a7..000000000 --- a/debian/patches/features/all/rt/0009-ARM-OMAP2-Drop-the-concept-of-certain-power-domains-.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 70f4293bd36740fd730ab25abe39281d1b312365 Mon Sep 17 00:00:00 2001 -From: Russ Dill -Date: Wed, 5 Aug 2015 15:30:44 +0530 -Subject: [PATCH 09/21] ARM: OMAP2: Drop the concept of certain power domains - not being able to lose context. -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz - -It isn't much of a win, and with hibernation, everything loses context. - -Signed-off-by: Russ Dill -[j-keerthy@ti.com] ported to 4.1 -Signed-off-by: Keerthy ---- - arch/arm/mach-omap2/gpio.c | 1 - arch/arm/mach-omap2/powerdomain.c | 40 -------------------------------- - arch/arm/mach-omap2/powerdomain.h | 1 - drivers/gpio/gpio-omap.c | 36 +++++++++++----------------- - include/linux/platform_data/gpio-omap.h | 1 - 5 files changed, 14 insertions(+), 65 deletions(-) - ---- a/arch/arm/mach-omap2/gpio.c -+++ b/arch/arm/mach-omap2/gpio.c -@@ -130,7 +130,6 @@ static int __init omap2_gpio_dev_init(st - } - - pwrdm = omap_hwmod_get_pwrdm(oh); -- pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm); - - pdev = omap_device_build(name, id - 1, oh, pdata, sizeof(*pdata)); - kfree(pdata); ---- a/arch/arm/mach-omap2/powerdomain.c -+++ b/arch/arm/mach-omap2/powerdomain.c -@@ -1166,43 +1166,3 @@ int pwrdm_get_context_loss_count(struct - return count; - } - --/** -- * pwrdm_can_ever_lose_context - can this powerdomain ever lose context? -- * @pwrdm: struct powerdomain * -- * -- * Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain -- * can lose either memory or logic context or if @pwrdm is invalid, or -- * returns 0 otherwise. This function is not concerned with how the -- * powerdomain registers are programmed (i.e., to go off or not); it's -- * concerned with whether it's ever possible for this powerdomain to -- * go off while some other part of the chip is active. This function -- * assumes that every powerdomain can go to either ON or INACTIVE. -- */ --bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm) --{ -- int i; -- -- if (!pwrdm) { -- pr_debug("powerdomain: %s: invalid powerdomain pointer\n", -- __func__); -- return 1; -- } -- -- if (pwrdm->pwrsts & PWRSTS_OFF) -- return 1; -- -- if (pwrdm->pwrsts & PWRSTS_RET) { -- if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF) -- return 1; -- -- for (i = 0; i < pwrdm->banks; i++) -- if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF) -- return 1; -- } -- -- for (i = 0; i < pwrdm->banks; i++) -- if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF) -- return 1; -- -- return 0; --} ---- a/arch/arm/mach-omap2/powerdomain.h -+++ b/arch/arm/mach-omap2/powerdomain.h -@@ -244,7 +244,6 @@ int pwrdm_state_switch(struct powerdomai - int pwrdm_pre_transition(struct powerdomain *pwrdm); - int pwrdm_post_transition(struct powerdomain *pwrdm); - int pwrdm_get_context_loss_count(struct powerdomain *pwrdm); --bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm); - - extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 state); - ---- a/drivers/gpio/gpio-omap.c -+++ b/drivers/gpio/gpio-omap.c -@@ -69,7 +69,7 @@ struct gpio_bank { - struct device *dev; - bool is_mpuio; - bool dbck_flag; -- bool loses_context; -+ - bool context_valid; - int stride; - u32 width; -@@ -1208,15 +1208,9 @@ static int omap_gpio_probe(struct platfo - #ifdef CONFIG_OF_GPIO - bank->chip.of_node = of_node_get(node); - #endif -- if (node) { -- if (!of_property_read_bool(node, "ti,gpio-always-on")) -- bank->loses_context = true; -- } else { -- bank->loses_context = pdata->loses_context; -- -- if (bank->loses_context) -- bank->get_context_loss_count = -- pdata->get_context_loss_count; -+ if (!node) { -+ bank->get_context_loss_count = -+ pdata->get_context_loss_count; - } - - if (bank->regs->set_dataout && bank->regs->clr_dataout) -@@ -1373,7 +1367,7 @@ static int omap_gpio_runtime_resume(stru - * been initialised and so initialise it now. Also initialise - * the context loss count. - */ -- if (bank->loses_context && !bank->context_valid) { -+ if (!bank->context_valid) { - omap_gpio_init_context(bank); - - if (bank->get_context_loss_count) -@@ -1394,17 +1388,15 @@ static int omap_gpio_runtime_resume(stru - writel_relaxed(bank->context.risingdetect, - bank->base + bank->regs->risingdetect); - -- if (bank->loses_context) { -- if (!bank->get_context_loss_count) { -+ if (!bank->get_context_loss_count) { -+ omap_gpio_restore_context(bank); -+ } else { -+ c = bank->get_context_loss_count(bank->dev); -+ if (c != bank->context_loss_count) { - omap_gpio_restore_context(bank); - } else { -- c = bank->get_context_loss_count(bank->dev); -- if (c != bank->context_loss_count) { -- omap_gpio_restore_context(bank); -- } else { -- raw_spin_unlock_irqrestore(&bank->lock, flags); -- return 0; -- } -+ spin_unlock_irqrestore(&bank->lock, flags); -+ return 0; - } - } - -@@ -1476,7 +1468,7 @@ void omap2_gpio_prepare_for_idle(int pwr - struct gpio_bank *bank; - - list_for_each_entry(bank, &omap_gpio_list, node) { -- if (!BANK_USED(bank) || !bank->loses_context) -+ if (!BANK_USED(bank)) - continue; - - bank->power_mode = pwr_mode; -@@ -1490,7 +1482,7 @@ void omap2_gpio_resume_after_idle(void) - struct gpio_bank *bank; - - list_for_each_entry(bank, &omap_gpio_list, node) { -- if (!BANK_USED(bank) || !bank->loses_context) -+ if (!BANK_USED(bank)) - continue; - - pm_runtime_get_sync(bank->dev); ---- a/include/linux/platform_data/gpio-omap.h -+++ b/include/linux/platform_data/gpio-omap.h -@@ -198,7 +198,6 @@ struct omap_gpio_platform_data { - int bank_width; /* GPIO bank width */ - int bank_stride; /* Only needed for omap1 MPUIO */ - bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ -- bool loses_context; /* whether the bank would ever lose context */ - bool is_mpuio; /* whether the bank is of type MPUIO */ - u32 non_wakeup_gpios; - diff --git a/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch b/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch index 15a2a2280..db4aa0e0d 100644 --- a/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch +++ b/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch @@ -1,7 +1,7 @@ From: "Yadi.hu" Date: Wed, 10 Dec 2014 10:32:09 +0800 Subject: ARM: enable irq in translation/section permission fault handlers -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Probably happens on all ARM, with CONFIG_PREEMPT_RT_FULL diff --git a/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch b/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch index e680b7794..60fb83b91 100644 --- a/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch +++ b/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 21 Mar 2013 19:01:05 +0100 Subject: printk: Drop the logbuf_lock more often -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The lock is hold with irgs off. The latency drops 500us+ on my arm bugs with a "full" buffer after executing "dmesg" on the shell. diff --git a/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch b/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch index 57c4094e0..4b42c0da6 100644 --- a/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch +++ b/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch @@ -1,7 +1,7 @@ From: Marcelo Tosatti Date: Wed, 8 Apr 2015 20:33:25 -0300 Subject: KVM: lapic: mark LAPIC timer handler as irqsafe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. diff --git a/debian/patches/features/all/rt/KVM-use-simple-waitqueue-for-vcpu-wq.patch b/debian/patches/features/all/rt/KVM-use-simple-waitqueue-for-vcpu-wq.patch index 76d4797ed..de74b70f6 100644 --- a/debian/patches/features/all/rt/KVM-use-simple-waitqueue-for-vcpu-wq.patch +++ b/debian/patches/features/all/rt/KVM-use-simple-waitqueue-for-vcpu-wq.patch @@ -1,7 +1,7 @@ From: Marcelo Tosatti Date: Wed, 8 Apr 2015 20:33:24 -0300 Subject: KVM: use simple waitqueue for vcpu->wq -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The problem: diff --git a/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch b/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch index 5f2f69def..fe34ea198 100644 --- a/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch +++ b/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Wed, 13 Feb 2013 09:26:05 -0500 Subject: acpi/rt: Convert acpi_gbl_hardware lock back to a raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz We hit the following bug with 3.6-rt: diff --git a/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch b/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch index 2280f3f3a..ff6f0e833 100644 --- a/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch +++ b/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch @@ -1,7 +1,7 @@ From: Anders Roxell Date: Thu, 14 May 2015 17:52:17 +0200 Subject: arch/arm64: Add lazy preempt support -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz arm64 is missing support for PREEMPT_RT. The main feature which is lacking is support for lazy preemption. The arch-specific entry code, diff --git a/debian/patches/features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch b/debian/patches/features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch new file mode 100644 index 000000000..f7e58b58f --- /dev/null +++ b/debian/patches/features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch @@ -0,0 +1,77 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 22 Jan 2016 21:33:39 +0100 +Subject: arm+arm64: lazy-preempt: add TIF_NEED_RESCHED_LAZY to _TIF_WORK_MASK +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +_TIF_WORK_MASK is used to check for TIF_NEED_RESCHED so we need to check +for TIF_NEED_RESCHED_LAZY here, too. + +Reported-by: Grygorii Strashko +Signed-off-by: Sebastian Andrzej Siewior +--- + arch/arm/include/asm/thread_info.h | 7 ++++--- + arch/arm/kernel/entry-common.S | 9 +++++++-- + arch/arm64/include/asm/thread_info.h | 3 ++- + 3 files changed, 13 insertions(+), 6 deletions(-) + +--- a/arch/arm/include/asm/thread_info.h ++++ b/arch/arm/include/asm/thread_info.h +@@ -143,8 +143,8 @@ extern int vfp_restore_user_hwstate(stru + #define TIF_SYSCALL_TRACE 4 /* syscall trace active */ + #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ + #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ +-#define TIF_SECCOMP 7 /* seccomp syscall filtering active */ +-#define TIF_NEED_RESCHED_LAZY 8 ++#define TIF_SECCOMP 8 /* seccomp syscall filtering active */ ++#define TIF_NEED_RESCHED_LAZY 7 + + #define TIF_NOHZ 12 /* in adaptive nohz mode */ + #define TIF_USING_IWMMXT 17 +@@ -170,7 +170,8 @@ extern int vfp_restore_user_hwstate(stru + * Change these and you break ASM code in entry-common.S + */ + #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ +- _TIF_NOTIFY_RESUME | _TIF_UPROBE) ++ _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ ++ _TIF_NEED_RESCHED_LAZY) + + #endif /* __KERNEL__ */ + #endif /* __ASM_ARM_THREAD_INFO_H */ +--- a/arch/arm/kernel/entry-common.S ++++ b/arch/arm/kernel/entry-common.S +@@ -36,7 +36,9 @@ + UNWIND(.cantunwind ) + disable_irq_notrace @ disable interrupts + ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing +- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK ++ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) ++ bne fast_work_pending ++ tst r1, #_TIF_SECCOMP + bne fast_work_pending + + /* perform architecture specific actions before user return */ +@@ -62,8 +64,11 @@ ENDPROC(ret_fast_syscall) + str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 + disable_irq_notrace @ disable interrupts + ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing +- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK ++ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) ++ bne do_slower_path ++ tst r1, #_TIF_SECCOMP + beq no_work_pending ++do_slower_path: + UNWIND(.fnend ) + ENDPROC(ret_fast_syscall) + +--- a/arch/arm64/include/asm/thread_info.h ++++ b/arch/arm64/include/asm/thread_info.h +@@ -129,7 +129,8 @@ static inline struct thread_info *curren + #define _TIF_32BIT (1 << TIF_32BIT) + + #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ +- _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE) ++ _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \ ++ _TIF_NEED_RESCHED_LAZY) + + #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ + _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ diff --git a/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch b/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch index 5ed275659..cdb048053 100644 --- a/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch +++ b/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch @@ -1,7 +1,7 @@ From: Benedikt Spranger Date: Sat, 6 Mar 2010 17:47:10 +0100 Subject: ARM: AT91: PIT: Remove irq handler when clock event is unused -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Setup and remove the interrupt handler in clock event mode selection. This avoids calling the (shared) interrupt handler when the device is @@ -14,21 +14,24 @@ commit 8fe82a55 ("ARM: at91: sparse irq support") which is included since v3.6. Patch based on what Sami Pietikäinen suggested]. Signed-off-by: Sebastian Andrzej Siewior --- - drivers/clocksource/timer-atmel-pit.c | 15 ++++++++------- - drivers/clocksource/timer-atmel-st.c | 28 ++++++++++++++++++++-------- - 2 files changed, 28 insertions(+), 15 deletions(-) + drivers/clocksource/timer-atmel-pit.c | 17 +++++++++-------- + drivers/clocksource/timer-atmel-st.c | 32 ++++++++++++++++++++++---------- + 2 files changed, 31 insertions(+), 18 deletions(-) --- a/drivers/clocksource/timer-atmel-pit.c +++ b/drivers/clocksource/timer-atmel-pit.c -@@ -96,6 +96,7 @@ static int pit_clkevt_shutdown(struct cl +@@ -96,15 +96,24 @@ static int pit_clkevt_shutdown(struct cl /* disable irq, leaving the clocksource active */ pit_write(data->base, AT91_PIT_MR, (data->cycle - 1) | AT91_PIT_PITEN); -+ free_irq(atmel_pit_irq, data); ++ free_irq(data->irq, data); return 0; } -@@ -105,6 +106,13 @@ static int pit_clkevt_shutdown(struct cl ++static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id); + /* + * Clockevent device: interrupts every 1/HZ (== pit_cycles * MCK/16) + */ static int pit_clkevt_set_periodic(struct clock_event_device *dev) { struct pit_data *data = clkevt_to_pit_data(dev); @@ -42,6 +45,14 @@ Signed-off-by: Sebastian Andrzej Siewior /* update clocksource counter */ data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR)); +@@ -181,7 +190,6 @@ static void __init at91sam926x_pit_commo + { + unsigned long pit_rate; + unsigned bits; +- int ret; + + /* + * Use our actual MCK to figure out how many MCK/16 ticks per @@ -206,13 +214,6 @@ static void __init at91sam926x_pit_commo data->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS; clocksource_register_hz(&data->clksrc, pit_rate); @@ -92,7 +103,7 @@ Signed-off-by: Sebastian Andrzej Siewior static int clkevt32k_set_periodic(struct clock_event_device *dev) { -+ int irq; ++ int ret; + clkdev32k_disable_and_flush_irq(); @@ -114,8 +125,14 @@ Signed-off-by: Sebastian Andrzej Siewior regmap_st = syscon_node_to_regmap(node); if (IS_ERR(regmap_st)) -@@ -214,13 +233,6 @@ static void __init atmel_st_timer_init(s - if (!irq) +@@ -210,17 +229,10 @@ static void __init atmel_st_timer_init(s + regmap_read(regmap_st, AT91_ST_SR, &val); + + /* Get the interrupts property */ +- irq = irq_of_parse_and_map(node, 0); +- if (!irq) ++ atmel_st_irq = irq_of_parse_and_map(node, 0); ++ if (!atmel_st_irq) panic(pr_fmt("Unable to get IRQ from DT\n")); - /* Make IRQs happen for the system timer */ diff --git a/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch b/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch index a29415a0c..424148dc5 100644 --- a/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch +++ b/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sat, 1 May 2010 18:29:35 +0200 Subject: ARM: at91: tclib: Default to tclib timer for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz RT is not too happy about the shared timer interrupt in AT91 devices. Default to tclib timer for RT. diff --git a/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch b/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch index 000f87495..f4fed3651 100644 --- a/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch +++ b/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch @@ -1,7 +1,7 @@ From: Frank Rowand Date: Mon, 19 Sep 2011 14:51:14 -0700 Subject: arm: Convert arm boot_lock to raw -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The arm boot_lock is used by the secondary processor startup code. The locking task is the idle thread, which has idle->sched_class == &idle_sched_class. diff --git a/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch b/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch index ba5062842..08e150018 100644 --- a/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch +++ b/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch @@ -1,16 +1,16 @@ Subject: arm: Enable highmem for rt From: Thomas Gleixner Date: Wed, 13 Feb 2013 11:03:11 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz fixup highmem for ARM. Signed-off-by: Thomas Gleixner --- - arch/arm/include/asm/switch_to.h | 8 ++++++ - arch/arm/mm/highmem.c | 45 ++++++++++++++++++++++++++++++++++----- + arch/arm/include/asm/switch_to.h | 8 +++++ + arch/arm/mm/highmem.c | 56 +++++++++++++++++++++++++++++++++------ include/linux/highmem.h | 1 - 3 files changed, 49 insertions(+), 5 deletions(-) + 3 files changed, 57 insertions(+), 8 deletions(-) --- a/arch/arm/include/asm/switch_to.h +++ b/arch/arm/include/asm/switch_to.h @@ -38,7 +38,19 @@ Signed-off-by: Thomas Gleixner --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c -@@ -54,12 +54,13 @@ EXPORT_SYMBOL(kunmap); +@@ -34,6 +34,11 @@ static inline pte_t get_fixmap_pte(unsig + return *ptep; + } + ++static unsigned int fixmap_idx(int type) ++{ ++ return FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); ++} ++ + void *kmap(struct page *page) + { + might_sleep(); +@@ -54,12 +59,13 @@ EXPORT_SYMBOL(kunmap); void *kmap_atomic(struct page *page) { @@ -53,7 +65,16 @@ Signed-off-by: Thomas Gleixner pagefault_disable(); if (!PageHighMem(page)) return page_address(page); -@@ -93,7 +94,10 @@ void *kmap_atomic(struct page *page) +@@ -79,7 +85,7 @@ void *kmap_atomic(struct page *page) + + type = kmap_atomic_idx_push(); + +- idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); ++ idx = fixmap_idx(type); + vaddr = __fix_to_virt(idx); + #ifdef CONFIG_DEBUG_HIGHMEM + /* +@@ -93,7 +99,10 @@ void *kmap_atomic(struct page *page) * in place, so the contained TLB flush ensures the TLB is updated * with the new mapping. */ @@ -65,7 +86,12 @@ Signed-off-by: Thomas Gleixner return (void *)vaddr; } -@@ -110,6 +114,9 @@ void __kunmap_atomic(void *kvaddr) +@@ -106,10 +115,13 @@ void __kunmap_atomic(void *kvaddr) + + if (kvaddr >= (void *)FIXADDR_START) { + type = kmap_atomic_idx(); +- idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); ++ idx = fixmap_idx(type); if (cache_is_vivt()) __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); @@ -75,7 +101,7 @@ Signed-off-by: Thomas Gleixner #ifdef CONFIG_DEBUG_HIGHMEM BUG_ON(vaddr != __fix_to_virt(idx)); #else -@@ -122,17 +129,18 @@ void __kunmap_atomic(void *kvaddr) +@@ -122,28 +134,56 @@ void __kunmap_atomic(void *kvaddr) kunmap_high(pte_page(pkmap_page_table[PKMAP_NR(vaddr)])); } pagefault_enable(); @@ -96,7 +122,11 @@ Signed-off-by: Thomas Gleixner pagefault_disable(); if (!PageHighMem(page)) return page_address(page); -@@ -143,7 +151,34 @@ void *kmap_atomic_pfn(unsigned long pfn) + + type = kmap_atomic_idx_push(); +- idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); ++ idx = fixmap_idx(type); + vaddr = __fix_to_virt(idx); #ifdef CONFIG_DEBUG_HIGHMEM BUG_ON(!pte_none(get_fixmap_pte(vaddr))); #endif @@ -117,7 +147,7 @@ Signed-off-by: Thomas Gleixner + * Clear @prev's kmap_atomic mappings + */ + for (i = 0; i < prev_p->kmap_idx; i++) { -+ int idx = i + KM_TYPE_NR * smp_processor_id(); ++ int idx = fixmap_idx(i); + + set_fixmap_pte(idx, __pte(0)); + } @@ -125,7 +155,7 @@ Signed-off-by: Thomas Gleixner + * Restore @next_p's kmap_atomic mappings + */ + for (i = 0; i < next_p->kmap_idx; i++) { -+ int idx = i + KM_TYPE_NR * smp_processor_id(); ++ int idx = fixmap_idx(i); + + if (!pte_none(next_p->kmap_pte[i])) + set_fixmap_pte(idx, next_p->kmap_pte[i]); diff --git a/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch b/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch index bd9382e9b..ec5e2e616 100644 --- a/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch +++ b/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 11 Mar 2013 21:37:27 +0100 Subject: arm/highmem: Flush tlb on unmap -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The tlb should be flushed on unmap and thus make the mapping entry invalid. This is only done in the non-debug case which does not look diff --git a/debian/patches/features/all/rt/arm-preempt-lazy-support.patch b/debian/patches/features/all/rt/arm-preempt-lazy-support.patch index df41da347..58c7e57ab 100644 --- a/debian/patches/features/all/rt/arm-preempt-lazy-support.patch +++ b/debian/patches/features/all/rt/arm-preempt-lazy-support.patch @@ -1,7 +1,7 @@ Subject: arm: Add support for lazy preemption From: Thomas Gleixner Date: Wed, 31 Oct 2012 12:04:11 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Implement the arm pieces for lazy preempt. diff --git a/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch b/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch index 3d20f77b4..d1f05b4c8 100644 --- a/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch +++ b/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 20 Sep 2013 14:31:54 +0200 Subject: arm/unwind: use a raw_spin_lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Mostly unwind is done with irqs enabled however SLUB may call it with irqs disabled while creating a new SLUB cache. diff --git a/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch b/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch index 572063c09..0a38aee11 100644 --- a/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch +++ b/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch @@ -1,7 +1,7 @@ Subject: arm64/xen: Make XEN depend on !RT From: Thomas Gleixner Date: Mon, 12 Oct 2015 11:18:40 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz It's not ready and probably never will be, unless xen folks have a look at it. diff --git a/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch b/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch index 05be187ce..2943c33c5 100644 --- a/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch +++ b/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Fri, 3 Jul 2009 08:44:29 -0500 Subject: ata: Do not disable interrupts in ide code for preempt-rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use the local_irq_*_nort variants. diff --git a/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch b/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch index df87b7826..aa125b88f 100644 --- a/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch +++ b/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Sat, 3 May 2014 11:00:29 +0200 Subject: blk-mq: revert raw locks, post pone notifier to POST_DEAD -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The blk_mq_cpu_notify_lock should be raw because some CPU down levels are called with interrupts off. The notifier itself calls currently one diff --git a/debian/patches/features/all/rt/block-blk-mq-use-swait.patch b/debian/patches/features/all/rt/block-blk-mq-use-swait.patch index 2a871b19e..21ca4d019 100644 --- a/debian/patches/features/all/rt/block-blk-mq-use-swait.patch +++ b/debian/patches/features/all/rt/block-blk-mq-use-swait.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 13 Feb 2015 11:01:26 +0100 Subject: block: blk-mq: Use swait -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz | BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 | in_atomic(): 1, irqs_disabled(): 0, pid: 255, name: kworker/u257:6 diff --git a/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch b/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch index a27394cbe..c425b911b 100644 --- a/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch +++ b/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Jan 2015 15:10:08 +0100 Subject: block/mq: don't complete requests via IPI -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The IPI runs in hardirq context and there are sleeping locks. This patch moves the completion into a workqueue. diff --git a/debian/patches/features/all/rt/block-mq-drop-per-ctx-cpu_lock.patch b/debian/patches/features/all/rt/block-mq-drop-per-ctx-cpu_lock.patch index 229f04d6f..5d0cbb1c5 100644 --- a/debian/patches/features/all/rt/block-mq-drop-per-ctx-cpu_lock.patch +++ b/debian/patches/features/all/rt/block-mq-drop-per-ctx-cpu_lock.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 18 Feb 2015 18:37:26 +0100 Subject: block/mq: drop per ctx cpu_lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz While converting the get_cpu() to get_cpu_light() I added a cpu lock to ensure the same code is not invoked twice on the same CPU. And now I run diff --git a/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch b/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch index 50f92fb63..6be4d8db9 100644 --- a/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch +++ b/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: block/mq: do not invoke preempt_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz preempt_disable() and get_cpu() don't play well together with the sleeping locks it tries to allocate later. diff --git a/debian/patches/features/all/rt/block-mq-use-cpu_light.patch b/debian/patches/features/all/rt/block-mq-use-cpu_light.patch index 5ed3de7e6..930c9b614 100644 --- a/debian/patches/features/all/rt/block-mq-use-cpu_light.patch +++ b/debian/patches/features/all/rt/block-mq-use-cpu_light.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 9 Apr 2014 10:37:23 +0200 Subject: block: mq: use cpu_light() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz there is a might sleep splat because get_cpu() disables preemption and later we grab a lock. As a workaround for this we use get_cpu_light() diff --git a/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch b/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch index 2c4deaf44..9d90a2e5f 100644 --- a/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch +++ b/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch @@ -1,7 +1,7 @@ Subject: block: Shorten interrupt disabled regions From: Thomas Gleixner Date: Wed, 22 Jun 2011 19:47:02 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Moving the blk_sched_flush_plug() call out of the interrupt/preempt disabled region in the scheduler allows us to replace diff --git a/debian/patches/features/all/rt/block-use-cpu-chill.patch b/debian/patches/features/all/rt/block-use-cpu-chill.patch index c44b1d8be..d91e9781f 100644 --- a/debian/patches/features/all/rt/block-use-cpu-chill.patch +++ b/debian/patches/features/all/rt/block-use-cpu-chill.patch @@ -1,7 +1,7 @@ Subject: block: Use cpu_chill() for retry loops From: Thomas Gleixner Date: Thu, 20 Dec 2012 18:28:26 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Steven also observed a live lock when there was a diff --git a/debian/patches/features/all/rt/btrfs-initialize-the-seq-counter-in-struct-btrfs_dev.patch b/debian/patches/features/all/rt/btrfs-initialize-the-seq-counter-in-struct-btrfs_dev.patch new file mode 100644 index 000000000..989b51a33 --- /dev/null +++ b/debian/patches/features/all/rt/btrfs-initialize-the-seq-counter-in-struct-btrfs_dev.patch @@ -0,0 +1,37 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 15 Jan 2016 14:28:39 +0100 +Subject: btrfs: initialize the seq counter in struct btrfs_device +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +I managed to trigger this: +| INFO: trying to register non-static key. +| the code is fine but needs lockdep annotation. +| turning off the locking correctness validator. +| CPU: 1 PID: 781 Comm: systemd-gpt-aut Not tainted 4.4.0-rt2+ #14 +| Hardware name: ARM-Versatile Express +| [<80307cec>] (dump_stack) +| [<80070e98>] (__lock_acquire) +| [<8007184c>] (lock_acquire) +| [<80287800>] (btrfs_ioctl) +| [<8012a8d4>] (do_vfs_ioctl) +| [<8012ac14>] (SyS_ioctl) + +so I think that btrfs_device_data_ordered_init() is not invoked behind +a macro somewhere. + +Fixes: 7cc8e58d53cd ("Btrfs: fix unprotected device's variants on 32bits machine") +Signed-off-by: Sebastian Andrzej Siewior +--- + fs/btrfs/volumes.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -232,6 +232,7 @@ static struct btrfs_device *__alloc_devi + spin_lock_init(&dev->reada_lock); + atomic_set(&dev->reada_in_flight, 0); + atomic_set(&dev->dev_stats_ccnt, 0); ++ btrfs_device_data_ordered_init(dev); + INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM); + INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM); + diff --git a/debian/patches/features/all/rt/bug-rt-dependend-variants.patch b/debian/patches/features/all/rt/bug-rt-dependend-variants.patch index 5652fe93f..4dfe326b8 100644 --- a/debian/patches/features/all/rt/bug-rt-dependend-variants.patch +++ b/debian/patches/features/all/rt/bug-rt-dependend-variants.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:58 -0500 Subject: bug: BUG_ON/WARN_ON variants dependend on RT/!RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Introduce RT/NON-RT WARN/BUG statements to avoid ifdefs in the code. diff --git a/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch b/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch index 28c3b8f80..c5e143990 100644 --- a/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch +++ b/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Sat, 21 Jun 2014 10:09:48 +0200 Subject: memcontrol: Prevent scheduling while atomic in cgroup code -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz mm, memcg: make refill_stock() use get_cpu_light() diff --git a/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch b/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch index a2b6e0d44..7a0508d5c 100644 --- a/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch +++ b/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 13 Feb 2015 15:52:24 +0100 Subject: cgroups: use simple wait in css_release() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz To avoid: |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 diff --git a/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch b/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch index 31708b681..651f5ebd9 100644 --- a/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch +++ b/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch @@ -1,7 +1,7 @@ From: Benedikt Spranger Date: Mon, 8 Mar 2010 18:57:04 +0100 Subject: clocksource: TCLIB: Allow higher clock rates for clock events -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz As default the TCLIB uses the 32KiHz base clock rate for clock events. Add a compile time selection to allow higher clock resulution. diff --git a/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch b/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch index 94f7f4c99..4b29e43ea 100644 --- a/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch +++ b/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch @@ -1,7 +1,7 @@ Subject: completion: Use simple wait queues From: Thomas Gleixner Date: Fri, 11 Jan 2013 11:23:51 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Completions have no long lasting callbacks and therefor do not need the complex waitqueue variant. Use simple waitqueues which reduces the @@ -199,7 +199,7 @@ Signed-off-by: Thomas Gleixner EXPORT_SYMBOL(completion_done); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -3143,7 +3143,10 @@ void migrate_disable(void) +@@ -3102,7 +3102,10 @@ void migrate_disable(void) } #ifdef CONFIG_SCHED_DEBUG @@ -211,7 +211,7 @@ Signed-off-by: Thomas Gleixner #endif if (p->migrate_disable) { -@@ -3173,7 +3176,10 @@ void migrate_enable(void) +@@ -3130,7 +3133,10 @@ void migrate_enable(void) } #ifdef CONFIG_SCHED_DEBUG diff --git a/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch b/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch index 76bf97051..768cbeaa3 100644 --- a/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch +++ b/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch @@ -1,7 +1,7 @@ Subject: sched: Use the proper LOCK_OFFSET for cond_resched() From: Thomas Gleixner Date: Sun, 17 Jul 2011 22:51:33 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz RT does not increment preempt count when a 'sleeping' spinlock is locked. Update PREEMPT_LOCK_OFFSET for that case. diff --git a/debian/patches/features/all/rt/cond-resched-softirq-rt.patch b/debian/patches/features/all/rt/cond-resched-softirq-rt.patch index a30f1b6d6..ea776c8c9 100644 --- a/debian/patches/features/all/rt/cond-resched-softirq-rt.patch +++ b/debian/patches/features/all/rt/cond-resched-softirq-rt.patch @@ -1,7 +1,7 @@ Subject: sched: Take RT softirq semantics into account in cond_resched() From: Thomas Gleixner Date: Thu, 14 Jul 2011 09:56:44 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The softirq semantics work different on -RT. There is no SOFTIRQ_MASK in the preemption counter which leads to the BUG_ON() statement in @@ -35,7 +35,7 @@ Signed-off-by: Thomas Gleixner { --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -4832,6 +4832,7 @@ int __cond_resched_lock(spinlock_t *lock +@@ -4771,6 +4771,7 @@ int __cond_resched_lock(spinlock_t *lock } EXPORT_SYMBOL(__cond_resched_lock); @@ -43,7 +43,7 @@ Signed-off-by: Thomas Gleixner int __sched __cond_resched_softirq(void) { BUG_ON(!in_softirq()); -@@ -4845,6 +4846,7 @@ int __sched __cond_resched_softirq(void) +@@ -4784,6 +4785,7 @@ int __sched __cond_resched_softirq(void) return 0; } EXPORT_SYMBOL(__cond_resched_softirq); diff --git a/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch b/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch index 2130d6ce8..810ef1ef5 100644 --- a/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch +++ b/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Thu, 5 Dec 2013 09:16:52 -0500 Subject: cpu hotplug: Document why PREEMPT_RT uses a spinlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The patch: diff --git a/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch b/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch index 47e18b6dc..697cdf8e4 100644 --- a/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch +++ b/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch @@ -1,7 +1,7 @@ Subject: cpu: Make hotplug.lock a "sleeping" spinlock on RT From: Steven Rostedt Date: Fri, 02 Mar 2012 10:36:57 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Tasks can block on hotplug.lock in pin_current_cpu(), but their state might be != RUNNING. So the mutex wakeup will set the state diff --git a/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch b/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch index fdb5ab7a0..7c0382982 100644 --- a/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch +++ b/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 16 Jul 2012 08:07:43 +0000 Subject: cpu/rt: Rework cpu down for PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Bringing a CPU down is a pain with the PREEMPT_RT kernel because tasks can be preempted in many more places than in non-RT. In @@ -57,7 +57,7 @@ Signed-off-by: Thomas Gleixner --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -2284,6 +2284,10 @@ extern void do_set_cpus_allowed(struct t +@@ -2287,6 +2287,10 @@ extern void do_set_cpus_allowed(struct t extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); @@ -68,7 +68,7 @@ Signed-off-by: Thomas Gleixner #else static inline void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) -@@ -2296,6 +2300,9 @@ static inline int set_cpus_allowed_ptr(s +@@ -2299,6 +2303,9 @@ static inline int set_cpus_allowed_ptr(s return -EINVAL; return 0; } @@ -443,7 +443,7 @@ Signed-off-by: Thomas Gleixner * interrupt affinities. --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -1220,6 +1220,84 @@ void do_set_cpus_allowed(struct task_str +@@ -1211,6 +1211,84 @@ void do_set_cpus_allowed(struct task_str enqueue_task(rq, p, ENQUEUE_RESTORE); } @@ -528,7 +528,7 @@ Signed-off-by: Thomas Gleixner /* * Change a given task's CPU affinity. Migrate the thread to a * proper CPU and schedule it away if the CPU it's executing on -@@ -3085,7 +3163,7 @@ void migrate_disable(void) +@@ -3044,7 +3122,7 @@ void migrate_disable(void) { struct task_struct *p = current; @@ -537,9 +537,9 @@ Signed-off-by: Thomas Gleixner #ifdef CONFIG_SCHED_DEBUG p->migrate_disable_atomic++; #endif -@@ -3118,7 +3196,7 @@ void migrate_enable(void) - unsigned long flags; - struct rq *rq; +@@ -3075,7 +3153,7 @@ void migrate_enable(void) + { + struct task_struct *p = current; - if (in_atomic() || p->flags & PF_NO_SETAFFINITY) { + if (in_atomic()) { diff --git a/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch b/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch index de048d9d8..dd5da9426 100644 --- a/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch +++ b/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Tue, 4 Mar 2014 12:28:32 -0500 Subject: cpu_chill: Add a UNINTERRUPTIBLE hrtimer_nanosleep -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz We hit another bug that was caused by switching cpu_chill() from msleep() to hrtimer_nanosleep(). @@ -34,7 +34,7 @@ Signed-off-by: Sebastian Andrzej Siewior --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c -@@ -1657,12 +1657,13 @@ void hrtimer_init_sleeper(struct hrtimer +@@ -1656,12 +1656,13 @@ void hrtimer_init_sleeper(struct hrtimer } EXPORT_SYMBOL_GPL(hrtimer_init_sleeper); @@ -50,7 +50,7 @@ Signed-off-by: Sebastian Andrzej Siewior hrtimer_start_expires(&t->timer, mode); if (likely(t->task)) -@@ -1704,7 +1705,8 @@ long __sched hrtimer_nanosleep_restart(s +@@ -1703,7 +1704,8 @@ long __sched hrtimer_nanosleep_restart(s HRTIMER_MODE_ABS); hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires); @@ -60,7 +60,7 @@ Signed-off-by: Sebastian Andrzej Siewior goto out; rmtp = restart->nanosleep.rmtp; -@@ -1721,8 +1723,10 @@ long __sched hrtimer_nanosleep_restart(s +@@ -1720,8 +1722,10 @@ long __sched hrtimer_nanosleep_restart(s return ret; } @@ -73,7 +73,7 @@ Signed-off-by: Sebastian Andrzej Siewior { struct restart_block *restart; struct hrtimer_sleeper t; -@@ -1735,7 +1739,7 @@ long hrtimer_nanosleep(struct timespec * +@@ -1734,7 +1738,7 @@ long hrtimer_nanosleep(struct timespec * hrtimer_init_on_stack(&t.timer, clockid, mode); hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack); @@ -82,7 +82,7 @@ Signed-off-by: Sebastian Andrzej Siewior goto out; /* Absolute timers do not update the rmtp value and restart: */ -@@ -1762,6 +1766,12 @@ long hrtimer_nanosleep(struct timespec * +@@ -1761,6 +1765,12 @@ long hrtimer_nanosleep(struct timespec * return ret; } @@ -95,7 +95,7 @@ Signed-off-by: Sebastian Andrzej Siewior SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp, struct timespec __user *, rmtp) { -@@ -1788,7 +1798,8 @@ void cpu_chill(void) +@@ -1787,7 +1797,8 @@ void cpu_chill(void) unsigned int freeze_flag = current->flags & PF_NOFREEZE; current->flags |= PF_NOFREEZE; diff --git a/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch b/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch index 3ac0941b7..ac50ed186 100644 --- a/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch +++ b/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch @@ -1,7 +1,7 @@ From: Tiejun Chen Subject: cpu_down: move migrate_enable() back Date: Thu, 7 Nov 2013 10:06:07 +0800 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Commit 08c1ab68, "hotplug-use-migrate-disable.patch", intends to use migrate_enable()/migrate_disable() to replace that combination diff --git a/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch b/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch index 3080ec7b5..6c01a71e5 100644 --- a/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch +++ b/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 9 Apr 2015 15:23:01 +0200 Subject: cpufreq: drop K8's driver from beeing selected -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Ralf posted a picture of a backtrace from diff --git a/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch b/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch index e7e0e4070..758f51d68 100644 --- a/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch +++ b/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch @@ -1,7 +1,7 @@ Subject: cpumask: Disable CONFIG_CPUMASK_OFFSTACK for RT From: Thomas Gleixner Date: Wed, 14 Dec 2011 01:03:49 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz We can't deal with the cpumask allocations which happen in atomic context (see arch/x86/kernel/apic/io_apic.c) on RT right now. diff --git a/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch b/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch index 7ed97af4a..36cc0cc95 100644 --- a/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch +++ b/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 21 Feb 2014 17:24:04 +0100 Subject: crypto: Reduce preempt disabled regions, more algos -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Don Estabrook reported | kernel: WARNING: CPU: 2 PID: 858 at kernel/sched/core.c:2428 migrate_disable+0xed/0x100() diff --git a/debian/patches/features/all/rt/debugobjects-rt.patch b/debian/patches/features/all/rt/debugobjects-rt.patch index c4aebf429..4a2643d32 100644 --- a/debian/patches/features/all/rt/debugobjects-rt.patch +++ b/debian/patches/features/all/rt/debugobjects-rt.patch @@ -1,7 +1,7 @@ Subject: debugobjects: Make RT aware From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:41:35 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Avoid filling the pool / allocating memory with irqs off(). diff --git a/debian/patches/features/all/rt/dm-make-rt-aware.patch b/debian/patches/features/all/rt/dm-make-rt-aware.patch index fb94382b1..c1215d51d 100644 --- a/debian/patches/features/all/rt/dm-make-rt-aware.patch +++ b/debian/patches/features/all/rt/dm-make-rt-aware.patch @@ -1,7 +1,7 @@ Subject: dm: Make rt aware From: Thomas Gleixner Date: Mon, 14 Nov 2011 23:06:09 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use the BUG_ON_NORT variant for the irq_disabled() checks. RT has interrupts legitimately enabled here as we cant deadlock against the diff --git a/debian/patches/features/all/rt/drivers-cpuidle-coupled-fix-warning-cpuidle_coupled_.patch b/debian/patches/features/all/rt/drivers-cpuidle-coupled-fix-warning-cpuidle_coupled_.patch new file mode 100644 index 000000000..797ea6c6b --- /dev/null +++ b/debian/patches/features/all/rt/drivers-cpuidle-coupled-fix-warning-cpuidle_coupled_.patch @@ -0,0 +1,26 @@ +From: Anders Roxell +Date: Fri, 15 Jan 2016 20:21:12 +0100 +Subject: drivers/cpuidle: coupled: fix warning cpuidle_coupled_lock +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +Used multi_v7_defconfig+PREEMPT_RT_FULL=y and this caused a compilation +warning without this fix: +../drivers/cpuidle/coupled.c:122:21: warning: 'cpuidle_coupled_lock' +defined but not used [-Wunused-variable] + +Signed-off-by: Anders Roxell +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/cpuidle/coupled.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/cpuidle/coupled.c ++++ b/drivers/cpuidle/coupled.c +@@ -119,7 +119,6 @@ struct cpuidle_coupled { + + #define CPUIDLE_COUPLED_NOT_IDLE (-1) + +-static DEFINE_MUTEX(cpuidle_coupled_lock); + static DEFINE_PER_CPU(struct call_single_data, cpuidle_coupled_poke_cb); + + /* diff --git a/debian/patches/features/all/rt/drivers-media-vsp1_video-fix-compile-error.patch b/debian/patches/features/all/rt/drivers-media-vsp1_video-fix-compile-error.patch new file mode 100644 index 000000000..88bce3139 --- /dev/null +++ b/debian/patches/features/all/rt/drivers-media-vsp1_video-fix-compile-error.patch @@ -0,0 +1,33 @@ +From: Anders Roxell +Date: Fri, 15 Jan 2016 01:09:43 +0100 +Subject: drivers/media: vsp1_video: fix compile error +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +This was found with the -RT patch enabled, but the fix should apply to +non-RT also. + +Compilation error without this fix: +../drivers/media/platform/vsp1/vsp1_video.c: In function +'vsp1_pipeline_stopped': +../drivers/media/platform/vsp1/vsp1_video.c:524:2: error: expected +expression before 'do' + spin_unlock_irqrestore(&pipe->irqlock, flags); + ^ + +Signed-off-by: Anders Roxell +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/media/platform/vsp1/vsp1_video.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/platform/vsp1/vsp1_video.c ++++ b/drivers/media/platform/vsp1/vsp1_video.c +@@ -520,7 +520,7 @@ static bool vsp1_pipeline_stopped(struct + bool stopped; + + spin_lock_irqsave(&pipe->irqlock, flags); +- stopped = pipe->state == VSP1_PIPELINE_STOPPED, ++ stopped = pipe->state == VSP1_PIPELINE_STOPPED; + spin_unlock_irqrestore(&pipe->irqlock, flags); + + return stopped; diff --git a/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch b/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch index 505e55472..ab4926fb6 100644 --- a/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch +++ b/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:24 -0500 Subject: drivers/net: Use disable_irq_nosync() in 8139too -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use disable_irq_nosync() instead of disable_irq() as this might be called in atomic context with netpoll. diff --git a/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch b/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch index edd3be824..1757c696a 100644 --- a/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch +++ b/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sat, 20 Jun 2009 11:36:54 +0200 Subject: drivers/net: fix livelock issues -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Preempt-RT runs into a live lock issue with the NETDEV_TX_LOCKED micro optimization. The reason is that the softirq thread is rescheduling diff --git a/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch b/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch index cf1337346..166a14ea0 100644 --- a/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch +++ b/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Fri, 3 Jul 2009 08:30:00 -0500 Subject: drivers/net: vortex fix locking issues -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Argh, cut and paste wasn't enough... diff --git a/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch b/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch index 7b48d673a..3cfebc6d1 100644 --- a/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch +++ b/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:30 -0500 Subject: drivers: random: Reduce preempt disabled region -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz No need to keep preemption disabled across the whole function. diff --git a/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch b/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch index 7a5c117b5..532a85380 100644 --- a/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch +++ b/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch @@ -1,7 +1,7 @@ Subject: tty/serial/omap: Make the locking RT aware From: Thomas Gleixner Date: Thu, 28 Jul 2011 13:32:57 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The lock is a sleeping lock and local_irq_save() is not the optimsation we are looking for. Redo it to make it work on -RT and diff --git a/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch b/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch index 1ee262aec..88d686549 100644 --- a/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch +++ b/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch @@ -1,7 +1,7 @@ Subject: tty/serial/pl011: Make the locking work on RT From: Thomas Gleixner Date: Tue, 08 Jan 2013 21:36:51 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The lock is a sleeping lock and local_irq_save() is not the optimsation we are looking for. Redo it to make it work on -RT and non-RT. diff --git a/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch b/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch index 53b5796e1..13689473c 100644 --- a/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch +++ b/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 25 Apr 2013 18:12:52 +0200 Subject: drm/i915: drop trace_i915_gem_ring_dispatch on rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz This tracepoint is responsible for: diff --git a/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch b/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch index 6f48a7d8e..e2dcc8073 100644 --- a/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch +++ b/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Sun, 16 Aug 2015 14:27:50 +0200 Subject: dump stack: don't disable preemption during trace -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz I see here large latencies during a stack dump on x86. The preempt_disable() and get_cpu() should forbid moving the task to another diff --git a/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch b/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch index 91a362863..b5a7b5801 100644 --- a/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch +++ b/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch @@ -1,7 +1,7 @@ Subject: fs/epoll: Do not disable preemption on RT From: Thomas Gleixner Date: Fri, 08 Jul 2011 16:35:35 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz ep_call_nested() takes a sleeping lock so we can't disable preemption. The light version is enough since ep_call_nested() doesn't mind beeing diff --git a/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch b/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch index 8f9160abd..dd1a62cb6 100644 --- a/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch +++ b/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 16 Feb 2015 18:49:10 +0100 Subject: fs/aio: simple simple work -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:768 |in_atomic(): 1, irqs_disabled(): 0, pid: 26, name: rcuos/2 diff --git a/debian/patches/features/all/rt/fs-block-rt-support.patch b/debian/patches/features/all/rt/fs-block-rt-support.patch index 15ca03c9b..e022a328e 100644 --- a/debian/patches/features/all/rt/fs-block-rt-support.patch +++ b/debian/patches/features/all/rt/fs-block-rt-support.patch @@ -1,7 +1,7 @@ Subject: block: Turn off warning which is bogus on RT From: Thomas Gleixner Date: Tue, 14 Jun 2011 17:05:09 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On -RT the context is always with IRQs enabled. Ignore this warning on -RT. diff --git a/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch b/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch index 0b3033ef8..8e96459ea 100644 --- a/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch +++ b/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch @@ -1,7 +1,7 @@ Subject: fs: dcache: Use cpu_chill() in trylock loops From: Thomas Gleixner Date: Wed, 07 Mar 2012 21:00:34 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Use cpu_chill() instead of cpu_relax() to let the system diff --git a/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch b/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch index 16190fe07..e81de78a2 100644 --- a/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch +++ b/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 18 Mar 2011 10:11:25 +0100 Subject: fs: jbd/jbd2: Make state lock and journal head lock rt safe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz bit_spin_locks break under RT. diff --git a/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch b/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch index 2325cc4b2..8bf136b1d 100644 --- a/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch +++ b/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 17 Feb 2014 17:30:03 +0100 Subject: fs: jbd2: pull your plug when waiting for space -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Two cps in parallel managed to stall the the ext4 fs. It seems that journal code is either waiting for locks or sleeping waiting for diff --git a/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch b/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch index 70dfa5769..b05d6605c 100644 --- a/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch +++ b/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 19 Jul 2009 08:44:27 -0500 Subject: fs: namespace preemption fix -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On RT we cannot loop with preemption disabled here as mnt_make_readonly() might have been preempted. We can safely enable diff --git a/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch b/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch index b15b50bfe..580a9cd6b 100644 --- a/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch +++ b/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 3 Jul 2009 08:44:12 -0500 Subject: fs: ntfs: disable interrupt only on !RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On Sat, 2007-10-27 at 11:44 +0200, Ingo Molnar wrote: > * Nick Piggin wrote: diff --git a/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch b/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch index d2746226a..13245460a 100644 --- a/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch +++ b/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 18 Mar 2011 09:18:52 +0100 Subject: buffer_head: Replace bh_uptodate_lock for -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Wrap the bit_spin_lock calls into a separate inline and add the RT replacements with a real spinlock. diff --git a/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch b/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch index 1c3297103..0286cb60d 100644 --- a/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch +++ b/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:56:42 +0200 Subject: trace: Add migrate-disabled counter to tracing output -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Signed-off-by: Thomas Gleixner --- diff --git a/debian/patches/features/all/rt/futex-requeue-pi-fix.patch b/debian/patches/features/all/rt/futex-requeue-pi-fix.patch index 1290b0214..b2edb5e46 100644 --- a/debian/patches/features/all/rt/futex-requeue-pi-fix.patch +++ b/debian/patches/features/all/rt/futex-requeue-pi-fix.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: futex: Fix bug on when a requeued RT task times out -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Requeue with timeout causes a bug with PREEMPT_RT_FULL. diff --git a/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch b/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch index 99d3b6558..66a873143 100644 --- a/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch +++ b/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:57 -0500 Subject: genirq: Disable irqpoll on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Creates long latencies for no value diff --git a/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch b/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch index 0c497a36c..3a500fb33 100644 --- a/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch +++ b/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 21 Aug 2013 17:48:46 +0200 Subject: genirq: Do not invoke the affinity callback via a workqueue on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Joe Korty reported, that __irq_set_affinity_locked() schedules a workqueue while holding a rawlock which results in a might_sleep() @@ -11,13 +11,21 @@ wakeup() a process while holding the lock. Signed-off-by: Sebastian Andrzej Siewior --- - include/linux/interrupt.h | 1 + include/linux/interrupt.h | 2 + kernel/irq/manage.c | 79 ++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 77 insertions(+), 3 deletions(-) + 2 files changed, 78 insertions(+), 3 deletions(-) --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h -@@ -217,6 +217,7 @@ struct irq_affinity_notify { +@@ -206,6 +206,7 @@ extern void resume_device_irqs(void); + * @irq: Interrupt to which notification applies + * @kref: Reference count, for internal use + * @work: Work item, for internal use ++ * @list: List item for deferred callbacks + * @notify: Function to be called on change. This will be + * called in process context. + * @release: Function to be called on release. This will be +@@ -217,6 +218,7 @@ struct irq_affinity_notify { unsigned int irq; struct kref kref; struct work_struct work; diff --git a/debian/patches/features/all/rt/genirq-force-threading.patch b/debian/patches/features/all/rt/genirq-force-threading.patch index d9bfb72f5..59d8e278c 100644 --- a/debian/patches/features/all/rt/genirq-force-threading.patch +++ b/debian/patches/features/all/rt/genirq-force-threading.patch @@ -1,7 +1,7 @@ Subject: genirq: Force interrupt thread on RT From: Thomas Gleixner Date: Sun, 03 Apr 2011 11:57:29 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Force threaded_irqs and optimize the code (force_irqthreads) in regard to this. diff --git a/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch b/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch index 4fbb5e360..66afb4668 100644 --- a/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch +++ b/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Tue, 24 Mar 2015 08:14:49 +0100 Subject: hotplug: Use set_cpus_allowed_ptr() in sync_unplug_thread() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz do_set_cpus_allowed() is not safe vs ->sched_class change. diff --git a/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch b/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch index 2c5a7a04e..ad4fab88c 100644 --- a/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch +++ b/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch @@ -1,7 +1,7 @@ Subject: hotplug: Lightweight get online cpus From: Thomas Gleixner Date: Wed, 15 Jun 2011 12:36:06 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz get_online_cpus() is a heavy weight function which involves a global mutex. migrate_disable() wants a simpler construct which prevents only diff --git a/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch b/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch index 797f5fe0a..564629632 100644 --- a/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch +++ b/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch @@ -1,7 +1,7 @@ Subject: hotplug: sync_unplug: No "\n" in task name From: Yong Zhang Date: Sun, 16 Oct 2011 18:56:43 +0800 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Otherwise the output will look a little odd. diff --git a/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch b/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch index 5188b3f62..0ca619755 100644 --- a/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch +++ b/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch @@ -1,7 +1,7 @@ Subject: hotplug: Use migrate disable on unplug From: Thomas Gleixner Date: Sun, 17 Jul 2011 19:35:29 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Migration needs to be disabled accross the unplug handling to make sure that the unplug thread is off the unplugged cpu. diff --git a/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch b/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch index 62ca4a7be..bdc6f6683 100644 --- a/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch +++ b/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch @@ -1,7 +1,7 @@ From: Yang Shi Date: Mon, 16 Sep 2013 14:09:19 -0700 Subject: hrtimer: Move schedule_work call to helper thread -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz When run ltp leapsec_timer test, the following call trace is caught: diff --git a/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch b/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch index ffc0357e7..d356ca9e3 100644 --- a/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch +++ b/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch @@ -1,8 +1,7 @@ -From e35e67cb032e78055b63eae5a3a370664fabfc01 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 23 Dec 2015 20:57:41 +0100 -Subject: [PATCH] hrtimer: enfore 64byte alignment -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Subject: hrtimer: enfore 64byte alignment +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The patch "hrtimer: Fixup hrtimer callback changes for preempt-rt" adds a list_head expired to struct hrtimer_clock_base and with it we run into @@ -15,7 +14,7 @@ Signed-off-by: Sebastian Andrzej Siewior --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h -@@ -124,11 +124,7 @@ struct hrtimer_sleeper { +@@ -125,11 +125,7 @@ struct hrtimer_sleeper { struct task_struct *task; }; diff --git a/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch b/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch index d4e01ee6f..c63f344c5 100644 --- a/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch +++ b/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:44:31 -0500 Subject: hrtimer: Fixup hrtimer callback changes for preempt-rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz In preempt-rt we can not call the callbacks which take sleeping locks from the timer interrupt context. @@ -11,19 +11,28 @@ delivery problem for real. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar -[bwh: Adjust context to apply after fixed latency-hist.patch] + --- - include/linux/hrtimer.h | 4 + + include/linux/hrtimer.h | 7 ++ kernel/sched/core.c | 1 kernel/sched/rt.c | 1 - kernel/time/hrtimer.c | 142 +++++++++++++++++++++++++++++++++++++++++++---- + kernel/time/hrtimer.c | 137 +++++++++++++++++++++++++++++++++++++++++++---- kernel/time/tick-sched.c | 1 kernel/watchdog.c | 1 - 6 files changed, 139 insertions(+), 11 deletions(-) + 6 files changed, 139 insertions(+), 9 deletions(-) --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h -@@ -102,6 +102,8 @@ struct hrtimer { +@@ -87,6 +87,8 @@ enum hrtimer_restart { + * @function: timer expiry callback function + * @base: pointer to the timer base (per cpu and per clock) + * @state: state information (See bit values above) ++ * @cb_entry: list entry to defer timers from hardirq context ++ * @irqsafe: timer can run in hardirq context + * @praecox: timer expiry time if expired at the time of programming + * @start_pid: timer statistics field to store the pid of the task which + * started the timer +@@ -103,6 +105,8 @@ struct hrtimer { enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; unsigned long state; @@ -32,7 +41,15 @@ Signed-off-by: Ingo Molnar #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST ktime_t praecox; #endif -@@ -141,6 +143,7 @@ struct hrtimer_clock_base { +@@ -134,6 +138,7 @@ struct hrtimer_sleeper { + * timer to a base on another cpu. + * @clockid: clock id for per_cpu support + * @active: red black tree root node for the active timers ++ * @expired: list head for deferred timers. + * @get_time: function to retrieve the current time of the clock + * @offset: offset of this clock to the monotonic base + */ +@@ -142,6 +147,7 @@ struct hrtimer_clock_base { int index; clockid_t clockid; struct timerqueue_head active; @@ -40,7 +57,7 @@ Signed-off-by: Ingo Molnar ktime_t (*get_time)(void); ktime_t offset; } __attribute__((__aligned__(HRTIMER_CLOCK_BASE_ALIGN))); -@@ -184,6 +187,7 @@ struct hrtimer_cpu_base { +@@ -185,6 +191,7 @@ struct hrtimer_cpu_base { raw_spinlock_t lock; seqcount_t seq; struct hrtimer *running; @@ -121,7 +138,7 @@ Signed-off-by: Ingo Molnar cpu_base->running == timer) return true; -@@ -1292,12 +1296,113 @@ static void __run_hrtimer(struct hrtimer +@@ -1292,12 +1296,112 @@ static void __run_hrtimer(struct hrtimer cpu_base->running = NULL; } @@ -223,7 +240,6 @@ Signed-off-by: Ingo Molnar +static inline int hrtimer_rt_defer(struct hrtimer *timer) { return 0; } + +#endif -+ + static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer); @@ -235,15 +251,15 @@ Signed-off-by: Ingo Molnar for (; active; base++, active >>= 1) { struct timerqueue_node *node; -@@ -1337,9 +1442,14 @@ static void __hrtimer_run_queues(struct +@@ -1337,9 +1441,14 @@ static void __hrtimer_run_queues(struct if (basenow.tv64 < hrtimer_get_softexpires_tv64(timer)) break; - __run_hrtimer(cpu_base, base, timer, &basenow); -+ if (!hrtimer_rt_defer(timer)) -+ __run_hrtimer(cpu_base, base, timer, &basenow); -+ else -+ raise = 1; ++ if (!hrtimer_rt_defer(timer)) ++ __run_hrtimer(cpu_base, base, timer, &basenow); ++ else ++ raise = 1; } } + if (raise) @@ -251,7 +267,7 @@ Signed-off-by: Ingo Molnar } #ifdef CONFIG_HIGH_RES_TIMERS -@@ -1481,8 +1591,6 @@ void hrtimer_run_queues(void) +@@ -1481,8 +1590,6 @@ void hrtimer_run_queues(void) now = hrtimer_update_base(cpu_base); __hrtimer_run_queues(cpu_base, now); raw_spin_unlock(&cpu_base->lock); @@ -260,7 +276,7 @@ Signed-off-by: Ingo Molnar } /* -@@ -1504,6 +1612,7 @@ static enum hrtimer_restart hrtimer_wake +@@ -1504,6 +1611,7 @@ static enum hrtimer_restart hrtimer_wake void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task) { sl->timer.function = hrtimer_wakeup; @@ -268,7 +284,7 @@ Signed-off-by: Ingo Molnar sl->task = task; } EXPORT_SYMBOL_GPL(hrtimer_init_sleeper); -@@ -1638,6 +1747,7 @@ static void init_hrtimers_cpu(int cpu) +@@ -1638,6 +1746,7 @@ static void init_hrtimers_cpu(int cpu) for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { cpu_base->clock_base[i].cpu_base = cpu_base; timerqueue_init_head(&cpu_base->clock_base[i].active); @@ -276,7 +292,7 @@ Signed-off-by: Ingo Molnar } cpu_base->cpu = cpu; -@@ -1742,11 +1852,21 @@ static struct notifier_block hrtimers_nb +@@ -1742,11 +1851,21 @@ static struct notifier_block hrtimers_nb .notifier_call = hrtimer_cpu_notify, }; diff --git a/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch b/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch index 9c3616304..36dc90459 100644 --- a/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch +++ b/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:34 -0500 Subject: hrtimers: Prepare full preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Make cancellation of a running callback in softirq context safe against preemption. @@ -18,7 +18,7 @@ Signed-off-by: Thomas Gleixner --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h -@@ -204,6 +204,9 @@ struct hrtimer_cpu_base { +@@ -205,6 +205,9 @@ struct hrtimer_cpu_base { unsigned int nr_hangs; unsigned int max_hang_time; #endif @@ -28,7 +28,7 @@ Signed-off-by: Thomas Gleixner struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; } ____cacheline_aligned; -@@ -392,6 +395,13 @@ static inline void hrtimer_restart(struc +@@ -393,6 +396,13 @@ static inline void hrtimer_restart(struc hrtimer_start_expires(timer, HRTIMER_MODE_ABS); } @@ -42,7 +42,7 @@ Signed-off-by: Thomas Gleixner /* Query timers: */ extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer); -@@ -411,7 +421,7 @@ static inline int hrtimer_is_queued(stru +@@ -412,7 +422,7 @@ static inline int hrtimer_is_queued(stru * Helper function to check, whether the timer is running the callback * function */ diff --git a/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch b/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch index 1ff69c0d6..8f5314026 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 30 Aug 2013 07:57:25 +0200 Subject: hwlat-detector: Don't ignore threshold module parameter -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz If the user specified a threshold at module load time, use it. diff --git a/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch b/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch index 2be129b8d..7da25de70 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 19 Aug 2013 17:33:25 -0400 Subject: hwlat-detector: Update hwlat_detector to add outer loop detection -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The hwlat_detector reads two timestamps in a row, then reports any gap between those calls. The problem is, it misses everything between diff --git a/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch b/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch index 3913d64bb..2f3ec574d 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 19 Aug 2013 17:33:27 -0400 Subject: hwlat-detector: Use thread instead of stop machine -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz There's no reason to use stop machine to search for hardware latency. Simply disabling interrupts while running the loop will do enough to diff --git a/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch b/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch index dbda336cb..5661ff15d 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 19 Aug 2013 17:33:26 -0400 Subject: hwlat-detector: Use trace_clock_local if available -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz As ktime_get() calls into the timing code which does a read_seq(), it may be affected by other CPUS that touch that lock. To remove this diff --git a/debian/patches/features/all/rt/hwlatdetect.patch b/debian/patches/features/all/rt/hwlatdetect.patch index dc4fec054..43f1c8e85 100644 --- a/debian/patches/features/all/rt/hwlatdetect.patch +++ b/debian/patches/features/all/rt/hwlatdetect.patch @@ -1,7 +1,7 @@ Subject: hwlatdetect.patch From: Carsten Emde Date: Tue, 19 Jul 2011 13:53:12 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Jon Masters developed this wonderful SMI detector. For details please consult Documentation/hwlat_detector.txt. It could be ported to Linux @@ -725,7 +725,7 @@ Signed-off-by: Carsten Emde + + buf[sizeof(buf)-1] = '\0'; /* just in case */ + err = kstrtoul(buf, 10, &val); -+ if (0 != err) ++ if (err) + return -EINVAL; + + if (val) { @@ -1029,7 +1029,7 @@ Signed-off-by: Carsten Emde + + buf[U64STR_SIZE-1] = '\0'; /* just in case */ + err = kstrtoull(buf, 10, &val); -+ if (0 != err) ++ if (err) + return -EINVAL; + + mutex_lock(&data.lock); @@ -1113,7 +1113,7 @@ Signed-off-by: Carsten Emde + + buf[U64STR_SIZE-1] = '\0'; /* just in case */ + err = kstrtoull(buf, 10, &val); -+ if (0 != err) ++ if (err) + return -EINVAL; + + mutex_lock(&data.lock); @@ -1306,11 +1306,11 @@ Signed-off-by: Carsten Emde + pr_info(BANNER "version %s\n", VERSION); + + ret = init_stats(); -+ if (0 != ret) ++ if (ret) + goto out; + + ret = init_debugfs(); -+ if (0 != ret) ++ if (ret) + goto err_stats; + + if (enabled) diff --git a/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch b/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch index a57322d5c..dd7847e72 100644 --- a/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch +++ b/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 21 Mar 2013 11:35:49 +0100 Subject: i2c/omap: drop the lock hard irq context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The lock is taken while reading two registers. On RT the first lock is taken in hard irq where it might sleep and in the threaded irq. diff --git a/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch b/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch index f1a91fb5a..e111f7701 100644 --- a/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch +++ b/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch @@ -1,7 +1,7 @@ From: Clark Williams Date: Tue, 26 May 2015 10:43:43 -0500 Subject: i915: bogus warning from i915 when running on PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The i915 driver has a 'WARN_ON(!in_interrupt())' in the display handler, which whines constanly on the RT kernel (since the interrupt diff --git a/debian/patches/features/all/rt/i915_compile_fix.patch b/debian/patches/features/all/rt/i915_compile_fix.patch index 9618f2528..a1e2db4bd 100644 --- a/debian/patches/features/all/rt/i915_compile_fix.patch +++ b/debian/patches/features/all/rt/i915_compile_fix.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: gpu/i915: don't open code these things -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The opencode part is gone in 1f83fee0 ("drm/i915: clear up wedged transitions") the owner check is still there. diff --git a/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch b/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch index bbcc30df3..51f75701b 100644 --- a/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch +++ b/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:16 -0500 Subject: ide: Do not disable interrupts for PREEMPT-RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use the local_irq_*_nort variants. diff --git a/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch b/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch index 23fb94d39..aa9062be9 100644 --- a/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch +++ b/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: idr: Use local lock instead of preempt enable/disable -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz We need to protect the per cpu variable and prevent migration. diff --git a/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch b/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch index 1299bb623..7a8f40c04 100644 --- a/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch +++ b/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch @@ -1,7 +1,7 @@ From: Sven-Thorsten Dietrich Date: Fri, 3 Jul 2009 08:30:35 -0500 Subject: infiniband: Mellanox IB driver patch use _nort() primitives -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Fixes in_atomic stack-dump, when Mellanox module is loaded into the RT Kernel. diff --git a/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch b/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch index 294227d27..85157f78e 100644 --- a/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch +++ b/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:16 -0500 Subject: input: gameport: Do not disable interrupts on PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use the _nort() primitives. diff --git a/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch b/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch index b4c5e910c..61f629571 100644 --- a/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch +++ b/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch @@ -1,7 +1,7 @@ Subject: Intrduce migrate_disable() + cpu_light() From: Thomas Gleixner Date: Fri, 17 Jun 2011 15:42:38 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Introduce migrate_disable(). The task can't be pushed to another CPU but can be preempted. @@ -31,14 +31,14 @@ invoked again from another caller on the same CPU. Signed-off-by: Thomas Gleixner --- - include/linux/cpu.h | 3 + - include/linux/preempt.h | 9 +++ - include/linux/sched.h | 29 +++++++++- - include/linux/smp.h | 3 + - kernel/sched/core.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++- - kernel/sched/debug.c | 7 ++ - lib/smp_processor_id.c | 5 + - 7 files changed, 182 insertions(+), 6 deletions(-) + include/linux/cpu.h | 3 ++ + include/linux/preempt.h | 9 ++++++ + include/linux/sched.h | 39 ++++++++++++++++++++------ + include/linux/smp.h | 3 ++ + kernel/sched/core.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++- + kernel/sched/debug.c | 7 ++++ + lib/smp_processor_id.c | 5 ++- + 7 files changed, 126 insertions(+), 11 deletions(-) --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -90,17 +90,22 @@ Signed-off-by: Thomas Gleixner int nr_cpus_allowed; cpumask_t cpus_allowed; -@@ -1837,9 +1843,6 @@ extern int arch_task_struct_size __read_ +@@ -1837,14 +1843,6 @@ extern int arch_task_struct_size __read_ # define arch_task_struct_size (sizeof(struct task_struct)) #endif -/* Future-safe accessor for struct task_struct's cpus_allowed. */ -#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) +- +-static inline int tsk_nr_cpus_allowed(struct task_struct *p) +-{ +- return p->nr_cpus_allowed; +-} - #define TNF_MIGRATED 0x01 #define TNF_NO_GROUP 0x02 #define TNF_SHARED 0x04 -@@ -3116,6 +3119,26 @@ static inline void set_task_cpu(struct t +@@ -3121,6 +3119,31 @@ static inline void set_task_cpu(struct t #endif /* CONFIG_SMP */ @@ -116,13 +121,18 @@ Signed-off-by: Thomas Gleixner +/* Future-safe accessor for struct task_struct's cpus_allowed. */ +static inline const struct cpumask *tsk_cpus_allowed(struct task_struct *p) +{ -+#ifdef CONFIG_PREEMPT_RT_FULL -+ if (p->migrate_disable) ++ if (__migrate_disabled(p)) + return cpumask_of(task_cpu(p)); -+#endif + + return &p->cpus_allowed; +} ++ ++static inline int tsk_nr_cpus_allowed(struct task_struct *p) ++{ ++ if (__migrate_disabled(p)) ++ return 1; ++ return p->nr_cpus_allowed; ++} + extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); extern long sched_getaffinity(pid_t pid, struct cpumask *mask); @@ -141,27 +151,11 @@ Signed-off-by: Thomas Gleixner * boot command line: --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -1164,6 +1164,15 @@ void set_cpus_allowed_common(struct task - p->nr_cpus_allowed = cpumask_weight(new_mask); - } - -+#if defined(CONFIG_PREEMPT_RT_FULL) && defined(CONFIG_SMP) -+#define MIGRATE_DISABLE_SET_AFFIN (1<<30) /* Can't make a negative */ -+#define migrate_disabled_updated(p) ((p)->migrate_disable & MIGRATE_DISABLE_SET_AFFIN) -+#define migrate_disable_count(p) ((p)->migrate_disable & ~MIGRATE_DISABLE_SET_AFFIN) -+#else -+static inline void update_migrate_disable(struct task_struct *p) { } -+#define migrate_disabled_updated(p) 0 -+#endif -+ - void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) - { - struct rq *rq = task_rq(p); -@@ -1171,6 +1180,11 @@ void do_set_cpus_allowed(struct task_str +@@ -1171,6 +1171,11 @@ void do_set_cpus_allowed(struct task_str lockdep_assert_held(&p->pi_lock); -+ if (migrate_disabled_updated(p)) { ++ if (__migrate_disabled(p)) { + cpumask_copy(&p->cpus_allowed, new_mask); + return; + } @@ -169,7 +163,7 @@ Signed-off-by: Thomas Gleixner queued = task_on_rq_queued(p); running = task_current(rq, p); -@@ -1232,7 +1246,7 @@ static int __set_cpus_allowed_ptr(struct +@@ -1232,7 +1237,7 @@ static int __set_cpus_allowed_ptr(struct do_set_cpus_allowed(p, new_mask); /* Can the task run on the task's current CPU? If so, we're done */ @@ -178,44 +172,12 @@ Signed-off-by: Thomas Gleixner goto out; dest_cpu = cpumask_any_and(cpu_active_mask, new_mask); -@@ -3022,6 +3036,120 @@ static inline void schedule_debug(struct +@@ -3022,6 +3027,70 @@ static inline void schedule_debug(struct schedstat_inc(this_rq(), sched_count); } +#if defined(CONFIG_PREEMPT_RT_FULL) && defined(CONFIG_SMP) + -+static inline void update_migrate_disable(struct task_struct *p) -+{ -+ const struct cpumask *mask; -+ -+ if (likely(!p->migrate_disable)) -+ return; -+ -+ /* Did we already update affinity? */ -+ if (unlikely(migrate_disabled_updated(p))) -+ return; -+ -+ /* -+ * Since this is always current we can get away with only locking -+ * rq->lock, the ->cpus_allowed value can normally only be changed -+ * while holding both p->pi_lock and rq->lock, but seeing that this -+ * is current, we cannot actually be waking up, so all code that -+ * relies on serialization against p->pi_lock is out of scope. -+ * -+ * Having rq->lock serializes us against things like -+ * set_cpus_allowed_ptr() that can still happen concurrently. -+ */ -+ mask = tsk_cpus_allowed(p); -+ -+ if (p->sched_class->set_cpus_allowed) -+ p->sched_class->set_cpus_allowed(p, mask); -+ /* mask==cpumask_of(task_cpu(p)) which has a cpumask_weight==1 */ -+ p->nr_cpus_allowed = 1; -+ -+ /* Let migrate_enable know to fix things back up */ -+ p->migrate_disable |= MIGRATE_DISABLE_SET_AFFIN; -+} -+ +void migrate_disable(void) +{ + struct task_struct *p = current; @@ -239,6 +201,7 @@ Signed-off-by: Thomas Gleixner + preempt_disable(); + pin_current_cpu(); + p->migrate_disable = 1; ++ p->nr_cpus_allowed = 1; + preempt_enable(); +} +EXPORT_SYMBOL(migrate_disable); @@ -246,9 +209,6 @@ Signed-off-by: Thomas Gleixner +void migrate_enable(void) +{ + struct task_struct *p = current; -+ const struct cpumask *mask; -+ unsigned long flags; -+ struct rq *rq; + + if (in_atomic() || p->flags & PF_NO_SETAFFINITY) { +#ifdef CONFIG_SCHED_DEBUG @@ -262,33 +222,17 @@ Signed-off-by: Thomas Gleixner +#endif + WARN_ON_ONCE(p->migrate_disable <= 0); + -+ if (migrate_disable_count(p) > 1) { ++ if (p->migrate_disable > 1) { + p->migrate_disable--; + return; + } + + preempt_disable(); -+ if (unlikely(migrate_disabled_updated(p))) { -+ /* -+ * Undo whatever update_migrate_disable() did, also see there -+ * about locking. -+ */ -+ rq = this_rq(); -+ raw_spin_lock_irqsave(¤t->pi_lock, flags); -+ raw_spin_lock(&rq->lock); -+ -+ /* -+ * Clearing migrate_disable causes tsk_cpus_allowed to -+ * show the tasks original cpu affinity. -+ */ -+ p->migrate_disable = 0; -+ mask = tsk_cpus_allowed(p); -+ do_set_cpus_allowed(p, mask); -+ -+ raw_spin_unlock(&rq->lock); -+ raw_spin_unlock_irqrestore(¤t->pi_lock, flags); -+ } else -+ p->migrate_disable = 0; ++ /* ++ * Clearing migrate_disable causes tsk_cpus_allowed to ++ * show the tasks original cpu affinity. ++ */ ++ p->migrate_disable = 0; + + unpin_current_cpu(); + preempt_enable(); @@ -299,15 +243,6 @@ Signed-off-by: Thomas Gleixner /* * Pick up the highest-prio task: */ -@@ -3137,6 +3265,8 @@ static void __sched notrace __schedule(b - raw_spin_lock_irq(&rq->lock); - lockdep_pin_lock(&rq->lock); - -+ update_migrate_disable(prev); -+ - rq->clock_skip_update <<= 1; /* promote REQ to ACT */ - - switch_count = &prev->nivcsw; --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -251,6 +251,9 @@ void print_rt_rq(struct seq_file *m, int diff --git a/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch b/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch index 56665740e..ee98ab98e 100644 --- a/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch +++ b/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch @@ -1,8 +1,7 @@ -From 9a69dce752915917ecfe06a21f9c826c76f6eb07 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 30 Oct 2015 11:59:07 +0100 -Subject: [PATCH] ipc/msg: Implement lockless pipelined wakeups -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Subject: ipc/msg: Implement lockless pipelined wakeups +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz This patch moves the wakeup_process() invocation so it is not done under the perm->lock by making use of a lockless wake_q. With this change, the diff --git a/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch b/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch index dbd5ca70e..32a5b87a6 100644 --- a/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch +++ b/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch @@ -1,7 +1,7 @@ Subject: ipc/sem: Rework semaphore wakeups From: Peter Zijlstra Date: Wed, 14 Sep 2011 11:57:04 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Current sysv sems have a weird ass wakeup scheme that involves keeping preemption disabled over a potential O(n^2) loop and busy waiting on diff --git a/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch b/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch index 0cde3db9d..bae5388f9 100644 --- a/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch +++ b/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch @@ -1,7 +1,7 @@ Subject: genirq: Allow disabling of softirq processing in irq thread context From: Thomas Gleixner Date: Tue, 31 Jan 2012 13:01:27 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The processing of softirqs in irq thread context is a performance gain for the non-rt workloads of a system, but it's counterproductive for diff --git a/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch b/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch index 21ff0e61d..387cf0178 100644 --- a/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch +++ b/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch @@ -1,7 +1,7 @@ Subject: irqwork: Move irq safe work to irq context From: Thomas Gleixner Date: Sun, 15 Nov 2015 18:40:17 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On architectures where arch_irq_work_has_interrupt() returns false, we end up running the irq safe work from the softirq context. That diff --git a/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch b/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch index eb3bf05ea..44f11f770 100644 --- a/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch +++ b/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch @@ -1,7 +1,7 @@ Subject: irqwork: push most work into softirq context From: Sebastian Andrzej Siewior Date: Tue, 23 Jun 2015 15:32:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Initially we defered all irqwork into softirq because we didn't want the latency spikes if perf or another user was busy and delayed the RT task. diff --git a/debian/patches/features/all/rt/jump-label-rt.patch b/debian/patches/features/all/rt/jump-label-rt.patch index 221f57590..a10104278 100644 --- a/debian/patches/features/all/rt/jump-label-rt.patch +++ b/debian/patches/features/all/rt/jump-label-rt.patch @@ -1,7 +1,7 @@ Subject: jump-label: disable if stop_machine() is used From: Thomas Gleixner Date: Wed, 08 Jul 2015 17:14:48 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Some architectures are using stop_machine() while switching the opcode which leads to latency spikes. diff --git a/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch b/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch index 7e4493e43..5e3ae17ae 100644 --- a/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch +++ b/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch @@ -1,7 +1,7 @@ Subject: kconfig: Disable config options which are not RT compatible From: Thomas Gleixner Date: Sun, 24 Jul 2011 12:11:43 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Disable stuff which is known to have issues on RT diff --git a/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch b/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch index 25ce228ed..274f7c56e 100644 --- a/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch +++ b/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch @@ -1,7 +1,7 @@ Subject: kconfig: Add PREEMPT_RT_FULL From: Thomas Gleixner Date: Wed, 29 Jun 2011 14:58:57 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Introduce the final symbol for PREEMPT_RT_FULL. diff --git a/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch b/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch index db71b8fe0..e78fe9481 100644 --- a/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch +++ b/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 19 Mar 2013 14:44:30 +0100 -Subject: [PATCH] kernel/SRCU: provide a static initializer -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Subject: kernel/SRCU: provide a static initializer +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz There are macros for static initializer for the three out of four possible notifier types, that are: diff --git a/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch b/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch index 264f60aaf..41ef702fd 100644 --- a/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch +++ b/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 7 Jun 2013 22:37:06 +0200 Subject: kernel/cpu: fix cpu down problem if kthread's cpu is going down -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz If kthread is pinned to CPUx and CPUx is going down then we get into trouble: diff --git a/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch b/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch index 3a9f9d4b4..e9d226559 100644 --- a/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch +++ b/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 14 Jun 2013 17:16:35 +0200 Subject: kernel/hotplug: restore original cpu mask oncpu/down -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz If a task which is allowed to run only on CPU X puts CPU Y down then it will be allowed on all CPUs but the on CPU Y after it comes back from diff --git a/debian/patches/features/all/rt/kgb-serial-hackaround.patch b/debian/patches/features/all/rt/kgb-serial-hackaround.patch index 7064c4e4c..111b05090 100644 --- a/debian/patches/features/all/rt/kgb-serial-hackaround.patch +++ b/debian/patches/features/all/rt/kgb-serial-hackaround.patch @@ -1,7 +1,7 @@ From: Jason Wessel Date: Thu, 28 Jul 2011 12:42:23 -0500 Subject: kgdb/serial: Short term workaround -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On 07/27/2011 04:37 PM, Thomas Gleixner wrote: > - KGDB (not yet disabled) is reportedly unusable on -rt right now due diff --git a/debian/patches/features/all/rt/latency-hist.patch b/debian/patches/features/all/rt/latency-hist.patch index 263060fdd..19b172804 100644 --- a/debian/patches/features/all/rt/latency-hist.patch +++ b/debian/patches/features/all/rt/latency-hist.patch @@ -1,7 +1,7 @@ Subject: tracing: Add latency histograms From: Carsten Emde Date: Tue, 19 Jul 2011 14:03:41 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz This patch provides a recording mechanism to store data of potential sources of system latencies. The recordings separately determine the @@ -12,10 +12,10 @@ filesystem. For details please consult Documentation/trace/histograms.txt. Signed-off-by: Carsten Emde Signed-off-by: Thomas Gleixner -[bwh: Move up prototype of hrtimer_wakeup() so this actually compiles] + --- Documentation/trace/histograms.txt | 186 +++++ - include/linux/hrtimer.h | 3 + include/linux/hrtimer.h | 4 include/linux/sched.h | 6 include/trace/events/hist.h | 72 ++ include/trace/events/latency_hist.h | 29 @@ -24,7 +24,7 @@ Signed-off-by: Thomas Gleixner kernel/trace/Makefile | 4 kernel/trace/latency_hist.c | 1178 ++++++++++++++++++++++++++++++++++++ kernel/trace/trace_irqsoff.c | 11 - 10 files changed, 1614 insertions(+) + 10 files changed, 1615 insertions(+) --- /dev/null +++ b/Documentation/trace/histograms.txt @@ -217,7 +217,15 @@ Signed-off-by: Thomas Gleixner +These data are also reset when the wakeup histogram is reset. --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h -@@ -102,6 +102,9 @@ struct hrtimer { +@@ -87,6 +87,7 @@ enum hrtimer_restart { + * @function: timer expiry callback function + * @base: pointer to the timer base (per cpu and per clock) + * @state: state information (See bit values above) ++ * @praecox: timer expiry time if expired at the time of programming + * @start_pid: timer statistics field to store the pid of the task which + * started the timer + * @start_site: timer statistics field to store the site where the timer +@@ -102,6 +103,9 @@ struct hrtimer { enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; unsigned long state; @@ -1784,7 +1792,7 @@ Signed-off-by: Thomas Gleixner if (!preempt_trace() && irq_trace()) stop_critical_timing(CALLER_ADDR0, caller_addr); } -@@ -490,6 +498,7 @@ __visible void trace_hardirqs_off_caller +@@ -490,6 +498,7 @@ EXPORT_SYMBOL(trace_hardirqs_on_caller); { if (!preempt_trace() && irq_trace()) start_critical_timing(CALLER_ADDR0, caller_addr); diff --git a/debian/patches/features/all/rt/latency_hist-update-sched_switch-probe.patch b/debian/patches/features/all/rt/latency_hist-update-sched_switch-probe.patch deleted file mode 100644 index e62a21f46..000000000 --- a/debian/patches/features/all/rt/latency_hist-update-sched_switch-probe.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Ben Hutchings -Date: Mon, 04 Jan 2016 17:19:33 +0000 -Subject: latency_hist: Update sched_switch probe - -Commit c73464b1c843 ("sched/core: Fix trace_sched_switch()") adds a -'bool preempt' parameter to probe functions, so change -probe_wakeup_latency_hist_stop() accordingly.. - -Signed-off-by: Ben Hutchings ---- ---- a/kernel/trace/latency_hist.c -+++ b/kernel/trace/latency_hist.c -@@ -116,7 +116,7 @@ static char *wakeup_latency_hist_dir = " - static char *wakeup_latency_hist_dir_sharedprio = "sharedprio"; - static notrace void probe_wakeup_latency_hist_start(void *v, - struct task_struct *p); --static notrace void probe_wakeup_latency_hist_stop(void *v, -+static notrace void probe_wakeup_latency_hist_stop(void *v, bool preempt, - struct task_struct *prev, struct task_struct *next); - static notrace void probe_sched_migrate_task(void *, - struct task_struct *task, int cpu); -@@ -906,7 +906,7 @@ out: - raw_spin_unlock_irqrestore(&wakeup_lock, flags); - } - --static notrace void probe_wakeup_latency_hist_stop(void *v, -+static notrace void probe_wakeup_latency_hist_stop(void *v, bool preempt, - struct task_struct *prev, struct task_struct *next) - { - unsigned long flags; diff --git a/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch b/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch index 1a8823e9f..8ce566552 100644 --- a/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch +++ b/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch @@ -1,7 +1,7 @@ Subject: latency_hist: Update sched_wakeup probe From: Mathieu Desnoyers Date: Sun, 25 Oct 2015 18:06:05 -0400 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz "sched: Introduce the 'trace_sched_waking' tracepoint" introduces a prototype change for the sched_wakeup probe: the "success" argument is diff --git a/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch b/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch index b8eaba62b..0de136ce7 100644 --- a/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch +++ b/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 23 Jan 2014 14:45:59 +0100 Subject: leds: trigger: disable CPU trigger on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz as it triggers: |CPU: 0 PID: 0 Comm: swapper Not tainted 3.12.8-rt10 #141 diff --git a/debian/patches/features/all/rt/lglocks-rt.patch b/debian/patches/features/all/rt/lglocks-rt.patch index 76712342a..91044ad03 100644 --- a/debian/patches/features/all/rt/lglocks-rt.patch +++ b/debian/patches/features/all/rt/lglocks-rt.patch @@ -1,7 +1,7 @@ Subject: lglocks: Provide a RT safe variant From: Thomas Gleixner Date: Wed, 15 Jun 2011 11:02:21 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz lglocks by itself will spin in order to get the lock. This will end up badly if a task with the highest priority keeps spinning while a task diff --git a/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch b/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch index 1ac90957e..cf98e37d2 100644 --- a/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch +++ b/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch @@ -1,7 +1,7 @@ From: Paul Gortmaker Date: Fri, 21 Jun 2013 15:07:25 -0400 Subject: list_bl: Make list head locking RT safe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz As per changes in include/linux/jbd_common.h for avoiding the bit_spin_locks on RT ("fs: jbd/jbd2: Make state lock and journal diff --git a/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch b/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch index 9e2fd38ba..cc67faa96 100644 --- a/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch +++ b/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 21 Jul 2009 22:34:14 +0200 Subject: rt: local_irq_* variants depending on RT/!RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Add local_irq_*_(no)rt variant which are mainly used to break interrupt disabled sections on PREEMPT_RT or to explicitely disable diff --git a/debian/patches/features/all/rt/localversion.patch b/debian/patches/features/all/rt/localversion.patch index e2813c278..c40026cd0 100644 --- a/debian/patches/features/all/rt/localversion.patch +++ b/debian/patches/features/all/rt/localversion.patch @@ -1,7 +1,7 @@ -Subject: v4.4-rt2 +Subject: v4.4-rt3 From: Thomas Gleixner Date: Fri, 08 Jul 2011 20:25:16 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Signed-off-by: Thomas Gleixner --- @@ -11,4 +11,4 @@ Signed-off-by: Thomas Gleixner --- /dev/null +++ b/localversion-rt @@ -0,0 +1 @@ -+-rt2 ++-rt3 diff --git a/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch b/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch index bc95f1c9e..98548d047 100644 --- a/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch +++ b/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch @@ -1,7 +1,7 @@ Subject: lockdep: Make it RT aware From: Thomas Gleixner Date: Sun, 17 Jul 2011 18:51:23 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz teach lockdep that we don't really do softirqs on -RT. diff --git a/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch b/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch index da777f134..1892d32d3 100644 --- a/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch +++ b/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch @@ -1,7 +1,7 @@ From: Josh Cartwright Date: Wed, 28 Jan 2015 13:08:45 -0600 Subject: lockdep: selftest: fix warnings due to missing PREEMPT_RT conditionals -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz "lockdep: Selftest: Only do hardirq context test for raw spinlock" disabled the execution of certain tests with PREEMPT_RT_FULL, but did diff --git a/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch b/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch index 134d2a36e..d6f3ad7b1 100644 --- a/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch +++ b/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch @@ -1,7 +1,7 @@ Subject: lockdep: selftest: Only do hardirq context test for raw spinlock From: Yong Zhang Date: Mon, 16 Apr 2012 15:01:56 +0800 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz From: Yong Zhang diff --git a/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch b/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch index 0ff8f53dd..9bb129242 100644 --- a/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch +++ b/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch @@ -1,7 +1,7 @@ From: "Wolfgang M. Reimer" Date: Tue, 21 Jul 2015 16:20:07 +0200 Subject: locking: locktorture: Do NOT include rwlock.h directly -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Including rwlock.h directly will cause kernel builds to fail if CONFIG_PREEMPT_RT_FULL is defined. The correct header file diff --git a/debian/patches/features/all/rt/md-disable-bcache.patch b/debian/patches/features/all/rt/md-disable-bcache.patch index a3a260a62..167d252a7 100644 --- a/debian/patches/features/all/rt/md-disable-bcache.patch +++ b/debian/patches/features/all/rt/md-disable-bcache.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Aug 2013 11:48:57 +0200 Subject: md: disable bcache -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz It uses anon semaphores |drivers/md/bcache/request.c: In function ‘cached_dev_write_complete’: diff --git a/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch b/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch index d2b3924eb..d30efdf03 100644 --- a/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch +++ b/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 6 Apr 2010 16:51:31 +0200 Subject: md: raid5: Make raid5_percpu handling RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz __raid_run_ops() disables preemption with get_cpu() around the access to the raid5_percpu variables. That causes scheduling while atomic diff --git a/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch b/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch index e87ebda79..f9737b794 100644 --- a/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch +++ b/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch @@ -1,7 +1,7 @@ Subject: mips: Disable highmem on RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:10:12 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The current highmem handling on -RT is not compatible and needs fixups. diff --git a/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT b/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT index 50de786a6..4f317294f 100644 --- a/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT +++ b/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT @@ -1,7 +1,7 @@ Subject: mm: rt: Fix generic kmap_atomic for RT From: Thomas Gleixner Date: Sat, 19 Sep 2015 10:15:00 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The update to 4.1 brought in the mainline variant of the pagefault disable distangling from preempt count. That introduced a diff --git a/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch b/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch index a7b22c436..0e27bcc2a 100644 --- a/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch +++ b/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch @@ -1,7 +1,7 @@ Subject: mm: bounce: Use local_irq_save_nort From: Thomas Gleixner Date: Wed, 09 Jan 2013 10:33:09 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz kmap_atomic() is preemptible on RT. diff --git a/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch b/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch index a1e4cb1f8..71fc5c9ba 100644 --- a/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch +++ b/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:51 -0500 Subject: mm/swap: Convert to percpu locked -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Replace global locks (get_cpu + local_irq_save) with "local_locks()". Currently there is one of for "rotate" and one for "swap". diff --git a/debian/patches/features/all/rt/mm-disable-sloub-rt.patch b/debian/patches/features/all/rt/mm-disable-sloub-rt.patch index c02e71abd..ae2d161da 100644 --- a/debian/patches/features/all/rt/mm-disable-sloub-rt.patch +++ b/debian/patches/features/all/rt/mm-disable-sloub-rt.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:44:03 -0500 Subject: mm: Allow only slub on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Disable SLAB and SLOB on -RT. Only SLUB is adopted to -RT needs. diff --git a/debian/patches/features/all/rt/mm-enable-slub.patch b/debian/patches/features/all/rt/mm-enable-slub.patch index c1f063ee2..856883290 100644 --- a/debian/patches/features/all/rt/mm-enable-slub.patch +++ b/debian/patches/features/all/rt/mm-enable-slub.patch @@ -1,7 +1,7 @@ Subject: mm: Enable SLUB for RT From: Thomas Gleixner Date: Thu, 25 Oct 2012 10:32:35 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Make SLUB RT aware by converting locks to raw and using free lists to move the freeing out of the lock held region. diff --git a/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch b/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch index 908b90ef9..a4a821ac8 100644 --- a/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch +++ b/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:13 -0500 Subject: mm/vmstat: Protect per cpu variables with preempt disable on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Disable preemption on -RT for the vmstat code. On vanila the code runs in IRQ-off regions while on -RT it is not. "preempt_disable" ensures that the diff --git a/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch b/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch index a7662c0de..544752f68 100644 --- a/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch +++ b/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch @@ -1,7 +1,7 @@ From: Yang Shi Subject: mm/memcontrol: Don't call schedule_work_on in preemption disabled context Date: Wed, 30 Oct 2013 11:48:33 -0700 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The following trace is triggered when running ltp oom test cases: diff --git a/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch b/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch index 848bc85d1..6d5775bb1 100644 --- a/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch +++ b/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Subject: mm/memcontrol: Replace local_irq_disable with local locks Date: Wed, 28 Jan 2015 17:14:16 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz There are a few local_irq_disable() which then take sleeping locks. This patch converts them local locks. diff --git a/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch b/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch index aa1b56b85..711c3d1a9 100644 --- a/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch +++ b/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch @@ -1,7 +1,7 @@ Subject: mm: page_alloc: Use local_lock_on() instead of plain spinlock From: Thomas Gleixner Date: Thu, 27 Sep 2012 11:11:46 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The plain spinlock while sufficient does not update the local_lock internals. Use a proper local_lock function instead to ease debugging. diff --git a/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch b/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch index 380c888d8..074c76a58 100644 --- a/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch +++ b/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch @@ -1,7 +1,7 @@ From: Peter Zijlstra Date: Fri Jul 3 08:44:37 2009 -0500 Subject: mm: page_alloc: Reduce lock sections further -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Split out the pages which are to be freed into a separate list and call free_pages_bulk() outside of the percpu page allocator locks. diff --git a/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch b/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch index e8c157414..02ad58307 100644 --- a/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch +++ b/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:37 -0500 Subject: mm: page_alloc: rt-friendly per-cpu pages -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz rt-friendly per-cpu pages: convert the irqs-off per-cpu locking method into a preemptible, explicit-per-cpu-locks method. diff --git a/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch b/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch index 2e74137ec..60ecaaf00 100644 --- a/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch +++ b/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch @@ -1,7 +1,7 @@ From: Yong Zhang Date: Tue, 15 May 2012 13:53:56 +0800 Subject: mm: Protect activate_mm() by preempt_[disable&enable]_rt() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz User preempt_*_rt instead of local_irq_*_rt or otherwise there will be warning on ARM like below: diff --git a/debian/patches/features/all/rt/mm-rmap-retry-lock-check-in-anon_vma_free.patch_vma_free.patch b/debian/patches/features/all/rt/mm-rmap-retry-lock-check-in-anon_vma_free.patch_vma_free.patch deleted file mode 100644 index c8d7b7dba..000000000 --- a/debian/patches/features/all/rt/mm-rmap-retry-lock-check-in-anon_vma_free.patch_vma_free.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Sebastian Andrzej Siewior -Date: Tue, 1 Dec 2015 17:57:02 +0100 -Subject: mm/rmap: retry lock check in anon_vma_free() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz - -anon_vma_free() checks if the rwsem is locked and if so performs a -rw lock + unlock operation. It seems the purpose is to flush the current -reader out. -From testing it seems that after the anon_vma_unlock_write() there is -the rt_mutex's owner field has the waiter bit set. It does seem right to -leave and kfree() that memory if there is still a waiter on that lock. -The msleep() is there in case the anon_vma_free() caller has the highest -priority and the waiter never gets scheduled. - -XXX - -Signed-off-by: Sebastian Andrzej Siewior ---- - mm/rmap.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - ---- a/mm/rmap.c -+++ b/mm/rmap.c -@@ -89,8 +89,10 @@ static inline struct anon_vma *anon_vma_ - return anon_vma; - } - --static inline void anon_vma_free(struct anon_vma *anon_vma) -+#include -+static void anon_vma_free(struct anon_vma *anon_vma) - { -+ int cnt = 0; - VM_BUG_ON(atomic_read(&anon_vma->refcount)); - - /* -@@ -111,9 +113,17 @@ static inline void anon_vma_free(struct - * happen _before_ what follows. - */ - might_sleep(); -+retry: - if (rwsem_is_locked(&anon_vma->root->rwsem)) { - anon_vma_lock_write(anon_vma); - anon_vma_unlock_write(anon_vma); -+ -+ if (rwsem_is_locked(&anon_vma->root->rwsem)) { -+ cnt++; -+ if (cnt > 3) -+ msleep(1); -+ } -+ goto retry; - } - - kmem_cache_free(anon_vma_cachep, anon_vma); diff --git a/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch b/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch index 90121b42b..25d073d1c 100644 --- a/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch +++ b/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch @@ -1,7 +1,7 @@ Subject: mm, rt: kmap_atomic scheduling From: Peter Zijlstra Date: Thu, 28 Jul 2011 10:43:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz In fact, with migrate_disable() existing one could play games with kmap_atomic. You could save/restore the kmap_atomic slots on context diff --git a/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch b/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch index 06bd7ddba..afacc26d5 100644 --- a/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch +++ b/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:44:34 -0500 Subject: mm/scatterlist: Do not disable irqs on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The local_irq_save() is not only used to get things done "fast" but also to ensure that in case of SG_MITER_ATOMIC we are in "atomic" diff --git a/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch b/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch index 766ddfca9..52772e633 100644 --- a/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch +++ b/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch @@ -1,7 +1,7 @@ Subject: mm/vmalloc: Another preempt disable region which sucks From: Thomas Gleixner Date: Tue, 12 Jul 2011 11:39:36 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Avoid the preempt disable version of get_cpu_var(). The inner-lock should provide enough serialisation. diff --git a/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch b/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch index 11323abe7..86f4b3a60 100644 --- a/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch +++ b/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Jan 2015 17:19:44 +0100 Subject: mm/workingset: Do not protect workingset_shadow_nodes with irq off -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz workingset_shadow_nodes is protected by local_irq_disable(). Some users use spin_lock_irq(). diff --git a/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch b/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch index 43985ec1b..0bb593d3c 100644 --- a/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch +++ b/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch @@ -1,7 +1,7 @@ Subject: mmci: Remove bogus local_irq_save() From: Thomas Gleixner Date: Wed, 09 Jan 2013 12:11:12 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On !RT interrupt runs with interrupts disabled. On RT it's in a thread, so no need to disable interrupts at all. diff --git a/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch b/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch index 80a383975..4d40d09a5 100644 --- a/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch +++ b/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch @@ -1,7 +1,7 @@ Date: Wed, 26 Jun 2013 15:28:11 -0400 From: Steven Rostedt Subject: rt,ntp: Move call to schedule_delayed_work() to helper thread -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The ntp code for notify_cmos_timer() is called from a hard interrupt context. schedule_delayed_work() under PREEMPT_RT_FULL calls spinlocks diff --git a/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch b/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch index 860c6c8ce..ae0f6c98b 100644 --- a/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch +++ b/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:51:45 +0200 Subject: locking: Disable spin on owner for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Drop spin on owner for mutex / rwsem. We are most likely not using it but… diff --git a/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch b/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch index dd6ffbb5a..ebb8daaf9 100644 --- a/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch +++ b/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch @@ -1,14 +1,14 @@ From: Thomas Gleixner Date: Wed, 26 Sep 2012 16:21:08 +0200 Subject: net: Another local_irq_disable/kmalloc headache -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Replace it by a local lock. Though that's pretty inefficient :( Signed-off-by: Thomas Gleixner --- - net/core/skbuff.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) + net/core/skbuff.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -41,3 +41,19 @@ Signed-off-by: Thomas Gleixner return data; } +@@ -427,13 +429,13 @@ struct sk_buff *__netdev_alloc_skb(struc + if (sk_memalloc_socks()) + gfp_mask |= __GFP_MEMALLOC; + +- local_irq_save(flags); ++ local_lock_irqsave(netdev_alloc_lock, flags); + + nc = this_cpu_ptr(&netdev_alloc_cache); + data = __alloc_page_frag(nc, len, gfp_mask); + pfmemalloc = nc->pfmemalloc; + +- local_irq_restore(flags); ++ local_unlock_irqrestore(netdev_alloc_lock, flags); + + if (unlikely(!data)) + return NULL; diff --git a/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch b/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch index 90079f9bc..586937151 100644 --- a/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch +++ b/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch @@ -1,7 +1,7 @@ Subject: net/core/cpuhotplug: Drain input_pkt_queue lockless From: Grygorii Strashko Date: Fri, 9 Oct 2015 09:25:49 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz I can constantly see below error report with 4.1 RT-kernel on TI ARM dra7-evm if I'm trying to unplug cpu1: diff --git a/debian/patches/features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch b/debian/patches/features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch new file mode 100644 index 000000000..5f441a9cc --- /dev/null +++ b/debian/patches/features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch @@ -0,0 +1,77 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 15 Jan 2016 16:33:34 +0100 +Subject: net/core: protect users of napi_alloc_cache against + reentrance +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +On -RT the code running in BH can not be moved to another CPU so CPU +local variable remain local. However the code can be preempted +and another task may enter BH accessing the same CPU using the same +napi_alloc_cache variable. +This patch ensures that each user of napi_alloc_cache uses a local lock. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + net/core/skbuff.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -351,6 +351,7 @@ EXPORT_SYMBOL(build_skb); + static DEFINE_PER_CPU(struct page_frag_cache, netdev_alloc_cache); + static DEFINE_PER_CPU(struct page_frag_cache, napi_alloc_cache); + static DEFINE_LOCAL_IRQ_LOCK(netdev_alloc_lock); ++static DEFINE_LOCAL_IRQ_LOCK(napi_alloc_cache_lock); + + static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) + { +@@ -380,9 +381,13 @@ EXPORT_SYMBOL(netdev_alloc_frag); + + static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) + { +- struct page_frag_cache *nc = this_cpu_ptr(&napi_alloc_cache); ++ struct page_frag_cache *nc; ++ void *data; + +- return __alloc_page_frag(nc, fragsz, gfp_mask); ++ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); ++ data = __alloc_page_frag(nc, fragsz, gfp_mask); ++ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); ++ return data; + } + + void *napi_alloc_frag(unsigned int fragsz) +@@ -476,9 +481,10 @@ EXPORT_SYMBOL(__netdev_alloc_skb); + struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, + gfp_t gfp_mask) + { +- struct page_frag_cache *nc = this_cpu_ptr(&napi_alloc_cache); ++ struct page_frag_cache *nc; + struct sk_buff *skb; + void *data; ++ bool pfmemalloc; + + len += NET_SKB_PAD + NET_IP_ALIGN; + +@@ -496,7 +502,11 @@ struct sk_buff *__napi_alloc_skb(struct + if (sk_memalloc_socks()) + gfp_mask |= __GFP_MEMALLOC; + ++ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); + data = __alloc_page_frag(nc, len, gfp_mask); ++ pfmemalloc = nc->pfmemalloc; ++ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); ++ + if (unlikely(!data)) + return NULL; + +@@ -507,7 +517,7 @@ struct sk_buff *__napi_alloc_skb(struct + } + + /* use OR instead of assignment to avoid clearing of bits in mask */ +- if (nc->pfmemalloc) ++ if (pfmemalloc) + skb->pfmemalloc = 1; + skb->head_frag = 1; + diff --git a/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch b/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch index dc11ad4b8..3364d70fd 100644 --- a/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch +++ b/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch @@ -1,7 +1,7 @@ Subject: net: netfilter: Serialize xt_write_recseq sections on RT From: Thomas Gleixner Date: Sun, 28 Oct 2012 11:18:08 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The netfilter code relies only on the implicit semantics of local_bh_disable() for serializing wt_write_recseq sections. RT breaks diff --git a/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch b/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch index e818f4e42..45cc93fa1 100644 --- a/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch +++ b/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 20 Mar 2013 18:06:20 +0100 Subject: net: Add a mutex around devnet_rename_seq -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On RT write_seqcount_begin() disables preemption and device_rename() allocates memory with GFP_KERNEL and grabs later the sysfs_mutex diff --git a/debian/patches/features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch b/debian/patches/features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch new file mode 100644 index 000000000..ef6db0c56 --- /dev/null +++ b/debian/patches/features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch @@ -0,0 +1,126 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 13 Jan 2016 15:55:02 +0100 +Subject: net: move xmit_recursion to per-task variable on -RT +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +A softirq on -RT can be preempted. That means one task is in +__dev_queue_xmit(), gets preempted and another task may enter +__dev_queue_xmit() aw well. netperf together with a bridge device +will then trigger the `recursion alert` because each task increments +the xmit_recursion variable which is per-CPU. +A virtual device like br0 is required to trigger this warning. + +This patch moves the counter to per task instead per-CPU so it counts +the recursion properly on -RT. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/netdevice.h | 9 +++++++++ + include/linux/sched.h | 3 +++ + net/core/dev.c | 41 ++++++++++++++++++++++++++++++++++++++--- + 3 files changed, 50 insertions(+), 3 deletions(-) + +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -2249,11 +2249,20 @@ void netdev_freemem(struct net_device *d + void synchronize_net(void); + int init_dummy_netdev(struct net_device *dev); + ++#ifdef CONFIG_PREEMPT_RT_FULL ++static inline int dev_recursion_level(void) ++{ ++ return current->xmit_recursion; ++} ++ ++#else ++ + DECLARE_PER_CPU(int, xmit_recursion); + static inline int dev_recursion_level(void) + { + return this_cpu_read(xmit_recursion); + } ++#endif + + struct net_device *dev_get_by_index(struct net *net, int ifindex); + struct net_device *__dev_get_by_index(struct net *net, int ifindex); +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -1851,6 +1851,9 @@ struct task_struct { + #ifdef CONFIG_DEBUG_ATOMIC_SLEEP + unsigned long task_state_change; + #endif ++#ifdef CONFIG_PREEMPT_RT_FULL ++ int xmit_recursion; ++#endif + int pagefault_disabled; + /* CPU-specific state of this task */ + struct thread_struct thread; +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -2940,9 +2940,44 @@ static void skb_update_prio(struct sk_bu + #define skb_update_prio(skb) + #endif + ++#ifdef CONFIG_PREEMPT_RT_FULL ++ ++static inline int xmit_rec_read(void) ++{ ++ return current->xmit_recursion; ++} ++ ++static inline void xmit_rec_inc(void) ++{ ++ current->xmit_recursion++; ++} ++ ++static inline void xmit_rec_dec(void) ++{ ++ current->xmit_recursion--; ++} ++ ++#else ++ + DEFINE_PER_CPU(int, xmit_recursion); + EXPORT_SYMBOL(xmit_recursion); + ++static inline int xmit_rec_read(void) ++{ ++ return __this_cpu_read(xmit_recursion); ++} ++ ++static inline void xmit_rec_inc(void) ++{ ++ __this_cpu_inc(xmit_recursion); ++} ++ ++static inline int xmit_rec_dec(void) ++{ ++ __this_cpu_dec(xmit_recursion); ++} ++#endif ++ + #define RECURSION_LIMIT 10 + + /** +@@ -3135,7 +3170,7 @@ static int __dev_queue_xmit(struct sk_bu + + if (txq->xmit_lock_owner != cpu) { + +- if (__this_cpu_read(xmit_recursion) > RECURSION_LIMIT) ++ if (xmit_rec_read() > RECURSION_LIMIT) + goto recursion_alert; + + skb = validate_xmit_skb(skb, dev); +@@ -3145,9 +3180,9 @@ static int __dev_queue_xmit(struct sk_bu + HARD_TX_LOCK(dev, txq, cpu); + + if (!netif_xmit_stopped(txq)) { +- __this_cpu_inc(xmit_recursion); ++ xmit_rec_inc(); + skb = dev_hard_start_xmit(skb, dev, txq, &rc); +- __this_cpu_dec(xmit_recursion); ++ xmit_rec_dec(); + if (dev_xmit_complete(rc)) { + HARD_TX_UNLOCK(dev, txq); + goto out; diff --git a/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch b/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch index 8d0731cf1..e4f5eada8 100644 --- a/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch +++ b/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch @@ -1,7 +1,7 @@ Subject: net-flip-lock-dep-thingy.patch From: Thomas Gleixner Date: Tue, 28 Jun 2011 10:59:58 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz ======================================================= [ INFO: possible circular locking dependency detected ] diff --git a/debian/patches/features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch b/debian/patches/features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch new file mode 100644 index 000000000..133e906a9 --- /dev/null +++ b/debian/patches/features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch @@ -0,0 +1,79 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 20 Jan 2016 15:39:05 +0100 +Subject: net: provide a way to delegate processing a softirq to + ksoftirqd +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +If the NET_RX uses up all of his budget it moves the following NAPI +invocations into the `ksoftirqd`. On -RT it does not do so. Instead it +rises the NET_RX softirq in its current context again. + +In order to get closer to mainline's behaviour this patch provides +__raise_softirq_irqoff_ksoft() which raises the softirq in the ksoftird. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/interrupt.h | 8 ++++++++ + kernel/softirq.c | 21 +++++++++++++++++++++ + net/core/dev.c | 2 +- + 3 files changed, 30 insertions(+), 1 deletion(-) + +--- a/include/linux/interrupt.h ++++ b/include/linux/interrupt.h +@@ -465,6 +465,14 @@ extern void thread_do_softirq(void); + extern void open_softirq(int nr, void (*action)(struct softirq_action *)); + extern void softirq_init(void); + extern void __raise_softirq_irqoff(unsigned int nr); ++#ifdef CONFIG_PREEMPT_RT_FULL ++extern void __raise_softirq_irqoff_ksoft(unsigned int nr); ++#else ++static inline void __raise_softirq_irqoff_ksoft(unsigned int nr) ++{ ++ __raise_softirq_irqoff(nr); ++} ++#endif + + extern void raise_softirq_irqoff(unsigned int nr); + extern void raise_softirq(unsigned int nr); +--- a/kernel/softirq.c ++++ b/kernel/softirq.c +@@ -673,6 +673,27 @@ void __raise_softirq_irqoff(unsigned int + } + + /* ++ * Same as __raise_softirq_irqoff() but will process them in ksoftirqd ++ */ ++void __raise_softirq_irqoff_ksoft(unsigned int nr) ++{ ++ unsigned int mask; ++ ++ if (WARN_ON_ONCE(!__this_cpu_read(ksoftirqd) || ++ !__this_cpu_read(ktimer_softirqd))) ++ return; ++ mask = 1UL << nr; ++ ++ trace_softirq_raise(nr); ++ or_softirq_pending(mask); ++ if (mask & TIMER_SOFTIRQS) ++ __this_cpu_read(ktimer_softirqd)->softirqs_raised |= mask; ++ else ++ __this_cpu_read(ksoftirqd)->softirqs_raised |= mask; ++ wakeup_proper_softirq(nr); ++} ++ ++/* + * This function must run with irqs disabled! + */ + void raise_softirq_irqoff(unsigned int nr) +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -4919,7 +4919,7 @@ static void net_rx_action(struct softirq + list_splice_tail(&repoll, &list); + list_splice(&list, &sd->poll_list); + if (!list_empty(&sd->poll_list)) +- __raise_softirq_irqoff(NET_RX_SOFTIRQ); ++ __raise_softirq_irqoff_ksoft(NET_RX_SOFTIRQ); + + net_rps_action_and_irq_enable(sd); + } diff --git a/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch b/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch index 32964f7f2..61f38059f 100644 --- a/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch +++ b/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch @@ -1,7 +1,7 @@ From: Marc Kleine-Budde Date: Wed, 5 Mar 2014 00:49:47 +0100 Subject: net: sched: Use msleep() instead of yield() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On PREEMPT_RT enabled systems the interrupt handler run as threads at prio 50 (by default). If a high priority userspace process tries to shut down a busy diff --git a/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch b/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch index 5736e1d34..e29cc42c2 100644 --- a/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch +++ b/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch @@ -1,7 +1,7 @@ Subject: net: Avoid livelock in net_tx_action() on RT From: Steven Rostedt Date: Thu, 06 Oct 2011 10:48:39 -0400 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz qdisc_lock is taken w/o disabling interrupts or bottom halfs. So code holding a qdisc_lock() can be interrupted and softirqs can run on the @@ -45,7 +45,7 @@ Signed-off-by: Thomas Gleixner --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3598,6 +3598,36 @@ int netif_rx_ni(struct sk_buff *skb) +@@ -3633,6 +3633,36 @@ int netif_rx_ni(struct sk_buff *skb) } EXPORT_SYMBOL(netif_rx_ni); @@ -82,7 +82,7 @@ Signed-off-by: Thomas Gleixner static void net_tx_action(struct softirq_action *h) { struct softnet_data *sd = this_cpu_ptr(&softnet_data); -@@ -3639,7 +3669,7 @@ static void net_tx_action(struct softirq +@@ -3674,7 +3704,7 @@ static void net_tx_action(struct softirq head = head->next_sched; root_lock = qdisc_lock(q); diff --git a/debian/patches/features/all/rt/net-use-cpu-chill.patch b/debian/patches/features/all/rt/net-use-cpu-chill.patch index e726a0eaa..f3770c18f 100644 --- a/debian/patches/features/all/rt/net-use-cpu-chill.patch +++ b/debian/patches/features/all/rt/net-use-cpu-chill.patch @@ -1,7 +1,7 @@ Subject: net: Use cpu_chill() instead of cpu_relax() From: Thomas Gleixner Date: Wed, 07 Mar 2012 21:10:04 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Use cpu_chill() instead of cpu_relax() to let the system diff --git a/debian/patches/features/all/rt/net-wireless-warn-nort.patch b/debian/patches/features/all/rt/net-wireless-warn-nort.patch index a6ec0de33..cdaea8dbb 100644 --- a/debian/patches/features/all/rt/net-wireless-warn-nort.patch +++ b/debian/patches/features/all/rt/net-wireless-warn-nort.patch @@ -1,7 +1,7 @@ Subject: net/wireless: Use WARN_ON_NORT() From: Thomas Gleixner Date: Thu, 21 Jul 2011 21:05:33 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The softirq counter is meaningless on RT, so the check triggers a false positive. diff --git a/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt b/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt index 37ccb0927..fb8f6c1f4 100644 --- a/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt +++ b/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt @@ -1,7 +1,7 @@ Date: Tue, 27 Oct 2015 07:31:53 -0500 From: Josh Cartwright Subject: net: Make synchronize_rcu_expedited() conditional on !RT_FULL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz While the use of synchronize_rcu_expedited() might make synchronize_net() "faster", it does so at significant cost on RT diff --git a/debian/patches/features/all/rt/oleg-signal-rt-fix.patch b/debian/patches/features/all/rt/oleg-signal-rt-fix.patch index 5d7001b15..8a27d7b50 100644 --- a/debian/patches/features/all/rt/oleg-signal-rt-fix.patch +++ b/debian/patches/features/all/rt/oleg-signal-rt-fix.patch @@ -1,7 +1,7 @@ From: Oleg Nesterov Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: signal/x86: Delay calling signals in atomic -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On x86_64 we must disable preemption before we enable interrupts for stack faults, int3 and debugging, because the current task is using diff --git a/debian/patches/features/all/rt/panic-disable-random-on-rt.patch b/debian/patches/features/all/rt/panic-disable-random-on-rt.patch index c153092d8..3f6a76a11 100644 --- a/debian/patches/features/all/rt/panic-disable-random-on-rt.patch +++ b/debian/patches/features/all/rt/panic-disable-random-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: panic: skip get_random_bytes for RT_FULL in init_oops_id -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Disable on -RT. If this is invoked from irq-context we will have problems to acquire the sleeping lock. diff --git a/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch b/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch index 4afb1536e..d92eb2a14 100644 --- a/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch +++ b/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch @@ -1,7 +1,7 @@ Subject: rcu: Make ksoftirqd do RCU quiescent states From: "Paul E. McKenney" Date: Wed, 5 Oct 2011 11:45:18 -0700 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Implementing RCU-bh in terms of RCU-preempt makes the system vulnerable to network-based denial-of-service attacks. This patch therefore diff --git a/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch b/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch index d79ec94f5..3978eff43 100644 --- a/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch +++ b/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch @@ -1,7 +1,7 @@ Subject: pci: Use __wake_up_all_locked in pci_unblock_user_cfg_access() From: Thomas Gleixner Date: Thu, 01 Dec 2011 00:07:16 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The waitqueue is protected by the pci_lock, so we can just avoid to lock the waitqueue lock itself. That prevents the diff --git a/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch b/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch index 666e88f4e..6dbe4ef69 100644 --- a/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch +++ b/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 9 Apr 2014 11:58:17 +0200 Subject: percpu_ida: Use local locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz the local_irq_save() + spin_lock() does not work that well on -RT diff --git a/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch b/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch index 1e2c2a537..e28e7281d 100644 --- a/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch +++ b/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch @@ -1,7 +1,7 @@ From: Yong Zhang Date: Wed, 11 Jul 2012 22:05:21 +0000 Subject: perf: Make swevent hrtimer run in irq instead of softirq -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Otherwise we get a deadlock like below: diff --git a/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch b/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch index af0d1f9ac..0be0efca5 100644 --- a/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch +++ b/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch @@ -1,7 +1,7 @@ Subject: rcu: Frob softirq test From: Peter Zijlstra Date: Sat Aug 13 00:23:17 CEST 2011 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz With RT_FULL we get the below wreckage: diff --git a/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch b/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch index 6b58e8e8b..786a5807a 100644 --- a/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch +++ b/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch @@ -1,7 +1,7 @@ Subject: crypto: Convert crypto notifier chain to SRCU From: Peter Zijlstra Date: Fri, 05 Oct 2012 09:03:24 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The crypto notifier deadlocks on RT. Though this can be a real deadlock on mainline as well due to fifo fair rwsems. diff --git a/debian/patches/features/all/rt/pid.h-include-atomic.h.patch b/debian/patches/features/all/rt/pid.h-include-atomic.h.patch index f725136d0..682fc032b 100644 --- a/debian/patches/features/all/rt/pid.h-include-atomic.h.patch +++ b/debian/patches/features/all/rt/pid.h-include-atomic.h.patch @@ -1,7 +1,7 @@ From: Grygorii Strashko Date: Tue, 21 Jul 2015 19:43:56 +0300 Subject: wait.h: include atomic.h -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz This patch fixes build error: CC kernel/pid_namespace.o diff --git a/debian/patches/features/all/rt/ping-sysrq.patch b/debian/patches/features/all/rt/ping-sysrq.patch index 23b7afaae..e9fd94e7c 100644 --- a/debian/patches/features/all/rt/ping-sysrq.patch +++ b/debian/patches/features/all/rt/ping-sysrq.patch @@ -1,7 +1,7 @@ Subject: net: sysrq via icmp From: Carsten Emde Date: Tue, 19 Jul 2011 13:51:17 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz There are (probably rare) situations when a system crashed and the system console becomes unresponsive but the network icmp layer still is alive. diff --git a/debian/patches/features/all/rt/posix-timers-no-broadcast.patch b/debian/patches/features/all/rt/posix-timers-no-broadcast.patch index 6b2b955f7..b939cf204 100644 --- a/debian/patches/features/all/rt/posix-timers-no-broadcast.patch +++ b/debian/patches/features/all/rt/posix-timers-no-broadcast.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:29:20 -0500 Subject: posix-timers: Prevent broadcast signals -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Posix timers should not send broadcast signals and kernel only signals. Prevent it. diff --git a/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch b/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch index 13c12b437..fe304f2e2 100644 --- a/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch +++ b/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch @@ -1,7 +1,7 @@ From: John Stultz Date: Fri, 3 Jul 2009 08:29:58 -0500 Subject: posix-timers: Thread posix-cpu-timers on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz posix-cpu-timer code takes non -rt safe locks in hard irq context. Move it to a thread. diff --git a/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch b/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch index 21e7e630b..b0580e67c 100644 --- a/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch +++ b/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch @@ -1,7 +1,7 @@ Subject: powerpc: Disable highmem on RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:08:34 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The current highmem handling on -RT is not compatible and needs fixups. diff --git a/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch b/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch index 9add8f494..32222d8d6 100644 --- a/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch +++ b/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: powerpc: Use generic rwsem on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use generic code which uses rtmutex diff --git a/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch b/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch index 46fc57827..4edd4d065 100644 --- a/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch +++ b/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch @@ -1,7 +1,7 @@ From: Bogdan Purcareata Date: Fri, 24 Apr 2015 15:53:13 +0000 Subject: powerpc/kvm: Disable in-kernel MPIC emulation for PREEMPT_RT_FULL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz While converting the openpic emulation code to use a raw_spinlock_t enables guests to run on RT, there's still a performance issue. For interrupts sent in diff --git a/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch b/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch index 2f7c1bad4..ecedd7a91 100644 --- a/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch +++ b/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 1 Nov 2012 10:14:11 +0100 Subject: powerpc: Add support for lazy preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Implement the powerpc pieces for lazy preempt. diff --git a/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch b/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch index 317b7e0d3..4b4aedcd7 100644 --- a/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch +++ b/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch @@ -1,7 +1,7 @@ From: Paul Gortmaker Date: Sun, 31 May 2015 14:44:42 -0400 Subject: powerpc: ps3/device-init.c - adapt to completions using swait vs wait -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz To fix: diff --git a/debian/patches/features/all/rt/preempt-lazy-check-preempt_schedule.patch b/debian/patches/features/all/rt/preempt-lazy-check-preempt_schedule.patch new file mode 100644 index 000000000..5339456f9 --- /dev/null +++ b/debian/patches/features/all/rt/preempt-lazy-check-preempt_schedule.patch @@ -0,0 +1,74 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 20 Jan 2016 15:13:30 +0100 +Subject: preempt-lazy: Add the lazy-preemption check to preempt_schedule() +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +Probably in the rebase onto v4.1 this check got moved into less commonly used +preempt_schedule_notrace(). This patch ensures that both functions use it. + +Reported-by: Mike Galbraith +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/sched/core.c | 36 ++++++++++++++++++++++++++++-------- + 1 file changed, 28 insertions(+), 8 deletions(-) + +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -3461,6 +3461,30 @@ static void __sched notrace preempt_sche + } while (need_resched()); + } + ++#ifdef CONFIG_PREEMPT_LAZY ++/* ++ * If TIF_NEED_RESCHED is then we allow to be scheduled away since this is ++ * set by a RT task. Oterwise we try to avoid beeing scheduled out as long as ++ * preempt_lazy_count counter >0. ++ */ ++static int preemptible_lazy(void) ++{ ++ if (test_thread_flag(TIF_NEED_RESCHED)) ++ return 1; ++ if (current_thread_info()->preempt_lazy_count) ++ return 0; ++ return 1; ++} ++ ++#else ++ ++static int preemptible_lazy(void) ++{ ++ return 1; ++} ++ ++#endif ++ + #ifdef CONFIG_PREEMPT + /* + * this is the entry point to schedule() from in-kernel preemption +@@ -3475,6 +3499,8 @@ asmlinkage __visible void __sched notrac + */ + if (likely(!preemptible())) + return; ++ if (!preemptible_lazy()) ++ return; + + preempt_schedule_common(); + } +@@ -3501,15 +3527,9 @@ asmlinkage __visible void __sched notrac + + if (likely(!preemptible())) + return; +- +-#ifdef CONFIG_PREEMPT_LAZY +- /* +- * Check for lazy preemption +- */ +- if (current_thread_info()->preempt_lazy_count && +- !test_thread_flag(TIF_NEED_RESCHED)) ++ if (!preemptible_lazy()) + return; +-#endif ++ + do { + preempt_disable_notrace(); + /* diff --git a/debian/patches/features/all/rt/preempt-lazy-support.patch b/debian/patches/features/all/rt/preempt-lazy-support.patch index 5d469c680..a8ef97e55 100644 --- a/debian/patches/features/all/rt/preempt-lazy-support.patch +++ b/debian/patches/features/all/rt/preempt-lazy-support.patch @@ -1,7 +1,7 @@ Subject: sched: Add support for lazy preemption From: Thomas Gleixner Date: Fri, 26 Oct 2012 18:50:54 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz It has become an obsession to mitigate the determinism vs. throughput loss of RT. Looking at the mainline semantics of preemption points @@ -166,7 +166,7 @@ Signed-off-by: Thomas Gleixner --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -2963,6 +2963,43 @@ static inline int test_tsk_need_resched( +@@ -2966,6 +2966,43 @@ static inline int test_tsk_need_resched( return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); } @@ -297,7 +297,7 @@ Signed-off-by: Thomas Gleixner void resched_cpu(int cpu) { struct rq *rq = cpu_rq(cpu); -@@ -2353,6 +2385,9 @@ int sched_fork(unsigned long clone_flags +@@ -2344,6 +2376,9 @@ int sched_fork(unsigned long clone_flags p->on_cpu = 0; #endif init_task_preempt_count(p); @@ -307,15 +307,15 @@ Signed-off-by: Thomas Gleixner #ifdef CONFIG_SMP plist_node_init(&p->pushable_tasks, MAX_PRIO); RB_CLEAR_NODE(&p->pushable_dl_tasks); -@@ -3183,6 +3218,7 @@ void migrate_disable(void) +@@ -3142,6 +3177,7 @@ void migrate_disable(void) } preempt_disable(); + preempt_lazy_disable(); pin_current_cpu(); p->migrate_disable = 1; - preempt_enable(); -@@ -3241,6 +3277,7 @@ void migrate_enable(void) + p->nr_cpus_allowed = 1; +@@ -3182,6 +3218,7 @@ void migrate_enable(void) unpin_current_cpu(); preempt_enable(); @@ -323,7 +323,7 @@ Signed-off-by: Thomas Gleixner } EXPORT_SYMBOL(migrate_enable); #endif -@@ -3380,6 +3417,7 @@ static void __sched notrace __schedule(b +@@ -3319,6 +3356,7 @@ static void __sched notrace __schedule(b next = pick_next_task(rq, prev); clear_tsk_need_resched(prev); @@ -331,7 +331,7 @@ Signed-off-by: Thomas Gleixner clear_preempt_need_resched(); rq->clock_skip_update = 0; -@@ -3525,6 +3563,14 @@ asmlinkage __visible void __sched notrac +@@ -3464,6 +3502,14 @@ asmlinkage __visible void __sched notrac if (likely(!preemptible())) return; @@ -346,7 +346,7 @@ Signed-off-by: Thomas Gleixner do { preempt_disable_notrace(); /* -@@ -5265,7 +5311,9 @@ void init_idle(struct task_struct *idle, +@@ -5204,7 +5250,9 @@ void init_idle(struct task_struct *idle, /* Set the preempt count _outside_ the spinlocks! */ init_idle_preempt_count(idle, cpu); diff --git a/debian/patches/features/all/rt/preempt-nort-rt-variants.patch b/debian/patches/features/all/rt/preempt-nort-rt-variants.patch index e236c9953..73d61d1c1 100644 --- a/debian/patches/features/all/rt/preempt-nort-rt-variants.patch +++ b/debian/patches/features/all/rt/preempt-nort-rt-variants.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 24 Jul 2009 12:38:56 +0200 Subject: preempt: Provide preempt_*_(no)rt variants -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz RT needs a few preempt_disable/enable points which are not necessary otherwise. Implement variants to avoid #ifdeffery. diff --git a/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch b/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch index f4ff3548f..d8c1de27b 100644 --- a/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch +++ b/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch @@ -1,7 +1,7 @@ Subject: printk: Add "force_early_printk" boot param to help with debugging From: Peter Zijlstra Date: Fri, 02 Sep 2011 14:41:29 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Gives me an option to screw printk and actually see what the machine says. diff --git a/debian/patches/features/all/rt/printk-kill.patch b/debian/patches/features/all/rt/printk-kill.patch index a146684b0..659eb639a 100644 --- a/debian/patches/features/all/rt/printk-kill.patch +++ b/debian/patches/features/all/rt/printk-kill.patch @@ -1,7 +1,7 @@ Subject: printk: Add a printk kill switch From: Ingo Molnar Date: Fri, 22 Jul 2011 17:58:40 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Add a prinkt-kill-switch. This is used from (NMI) watchdog to ensure that it does not dead-lock with the early printk code. diff --git a/debian/patches/features/all/rt/printk-rt-aware.patch b/debian/patches/features/all/rt/printk-rt-aware.patch index 2ea38627d..2aa515ea8 100644 --- a/debian/patches/features/all/rt/printk-rt-aware.patch +++ b/debian/patches/features/all/rt/printk-rt-aware.patch @@ -1,7 +1,7 @@ Subject: printk: Make rt aware From: Thomas Gleixner Date: Wed, 19 Sep 2012 14:50:37 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Drop the lock before calling the console driver and do not disable interrupts while printing to a serial console. diff --git a/debian/patches/features/all/rt/ptrace-don-t-open-IRQs-in-ptrace_freeze_traced-too-e.patch b/debian/patches/features/all/rt/ptrace-don-t-open-IRQs-in-ptrace_freeze_traced-too-e.patch new file mode 100644 index 000000000..7820a32b6 --- /dev/null +++ b/debian/patches/features/all/rt/ptrace-don-t-open-IRQs-in-ptrace_freeze_traced-too-e.patch @@ -0,0 +1,35 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 13 Jan 2016 14:09:05 +0100 +Subject: ptrace: don't open IRQs in ptrace_freeze_traced() too early +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +In the non-RT case the spin_lock_irq() here disables interrupts as well +as raw_spin_lock_irq(). So in the unlock case the interrupts are enabled +too early. + +Reported-by: kernel test robot +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/ptrace.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/kernel/ptrace.c ++++ b/kernel/ptrace.c +@@ -129,12 +129,14 @@ static bool ptrace_freeze_traced(struct + + spin_lock_irq(&task->sighand->siglock); + if (task_is_traced(task) && !__fatal_signal_pending(task)) { +- raw_spin_lock_irq(&task->pi_lock); ++ unsigned long flags; ++ ++ raw_spin_lock_irqsave(&task->pi_lock, flags); + if (task->state & __TASK_TRACED) + task->state = __TASK_TRACED; + else + task->saved_state = __TASK_TRACED; +- raw_spin_unlock_irq(&task->pi_lock); ++ raw_spin_unlock_irqrestore(&task->pi_lock, flags); + ret = true; + } + spin_unlock_irq(&task->sighand->siglock); diff --git a/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch b/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch index b3cbba8d8..ed5a7cbbc 100644 --- a/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch +++ b/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Aug 2013 18:21:04 +0200 Subject: ptrace: fix ptrace vs tasklist_lock race -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz As explained by Alexander Fyodorov : @@ -112,7 +112,7 @@ Signed-off-by: Sebastian Andrzej Siewior spin_unlock_irq(&task->sighand->siglock); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -1435,6 +1435,18 @@ int migrate_swap(struct task_struct *cur +@@ -1426,6 +1426,18 @@ int migrate_swap(struct task_struct *cur return ret; } @@ -131,7 +131,7 @@ Signed-off-by: Sebastian Andrzej Siewior /* * wait_task_inactive - wait for a thread to unschedule. * -@@ -1479,7 +1491,7 @@ unsigned long wait_task_inactive(struct +@@ -1470,7 +1482,7 @@ unsigned long wait_task_inactive(struct * is actually now running somewhere else! */ while (task_running(rq, p)) { @@ -140,7 +140,7 @@ Signed-off-by: Sebastian Andrzej Siewior return 0; cpu_relax(); } -@@ -1494,7 +1506,8 @@ unsigned long wait_task_inactive(struct +@@ -1485,7 +1497,8 @@ unsigned long wait_task_inactive(struct running = task_running(rq, p); queued = task_on_rq_queued(p); ncsw = 0; diff --git a/debian/patches/features/all/rt/radix-tree-rt-aware.patch b/debian/patches/features/all/rt/radix-tree-rt-aware.patch index 1542e32cf..97b1cea5d 100644 --- a/debian/patches/features/all/rt/radix-tree-rt-aware.patch +++ b/debian/patches/features/all/rt/radix-tree-rt-aware.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:33:18 +0200 Subject: radix-tree: Make RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Disable radix_tree_preload() on -RT. This functions returns with preemption disabled which may cause high latencies and breaks if the diff --git a/debian/patches/features/all/rt/random-make-it-work-on-rt.patch b/debian/patches/features/all/rt/random-make-it-work-on-rt.patch index b4860c04a..895b2beed 100644 --- a/debian/patches/features/all/rt/random-make-it-work-on-rt.patch +++ b/debian/patches/features/all/rt/random-make-it-work-on-rt.patch @@ -1,7 +1,7 @@ Subject: random: Make it work on rt From: Thomas Gleixner Date: Tue, 21 Aug 2012 20:38:50 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Delegate the random insertion to the forced threaded interrupt handler. Store the return IP of the hard interrupt handler in the irq diff --git a/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch b/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch index e8abd0244..0996339a7 100644 --- a/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch +++ b/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch @@ -1,7 +1,7 @@ From: "Paul E. McKenney" Date: Mon, 4 Nov 2013 13:21:10 -0800 Subject: rcu: Eliminate softirq processing from rcutree -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Running RCU out of softirq is a problem for some workloads that would like to manage RCU core processing independently of other softirq work, diff --git a/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch b/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch index 27359fe92..70f6dbd7a 100644 --- a/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch +++ b/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch @@ -1,7 +1,7 @@ Subject: rcu: Disable RCU_FAST_NO_HZ on RT From: Thomas Gleixner Date: Sun, 28 Oct 2012 13:26:09 +0000 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz This uses a timer_list timer from the irq disabled guts of the idle code. Disable it for now to prevent wreckage. diff --git a/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch b/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch index b5edca701..ba7cb58bf 100644 --- a/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch +++ b/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch @@ -1,21 +1,29 @@ From: Sebastian Andrzej Siewior Date: Fri, 21 Mar 2014 20:19:05 +0100 Subject: rcu: make RCU_BOOST default on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Since it is no longer invoked from the softirq people run into OOM more often if the priority of the RCU thread is too low. Making boosting default on RT should help in those case and it can be switched off if someone knows better. - Signed-off-by: Sebastian Andrzej Siewior --- - init/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + init/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) --- a/init/Kconfig +++ b/init/Kconfig +@@ -498,7 +498,7 @@ config TINY_RCU + + config RCU_EXPERT + bool "Make expert-level adjustments to RCU configuration" +- default n ++ default y if PREEMPT_RT_FULL + help + This option needs to be enabled if you wish to make + expert-level adjustments to RCU configuration. By default, @@ -641,7 +641,7 @@ config TREE_RCU_TRACE config RCU_BOOST bool "Enable RCU priority boosting" diff --git a/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch b/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch index 905495baa..3ad308d4e 100644 --- a/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch +++ b/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch @@ -1,7 +1,7 @@ Subject: rcu: Merge RCU-bh into RCU-preempt Date: Wed, 5 Oct 2011 11:59:38 -0700 From: Thomas Gleixner -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The Linux kernel has long RCU-bh read-side critical sections that intolerably increase scheduling latency under mainline's RCU-bh rules, diff --git a/debian/patches/features/all/rt/rcu-more-swait-conversions.patch b/debian/patches/features/all/rt/rcu-more-swait-conversions.patch index 85adf0f1b..7c4a0fca2 100644 --- a/debian/patches/features/all/rt/rcu-more-swait-conversions.patch +++ b/debian/patches/features/all/rt/rcu-more-swait-conversions.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Wed, 31 Jul 2013 19:00:35 +0200 Subject: rcu: use simple waitqueues -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Convert RCU's wait-queues into simple waitqueues. diff --git a/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch b/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch index 91e05b76d..f1cfc26a2 100644 --- a/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch +++ b/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch @@ -1,7 +1,7 @@ From: Tiejun Chen Date: Wed, 18 Dec 2013 17:51:49 +0800 Subject: rcutree/rcu_bh_qs: Disable irq while calling rcu_preempt_qs() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Any callers to the function rcu_preempt_qs() must disable irqs in order to protect the assignment to ->rcu_read_unlock_special. In diff --git a/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch b/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch index b3130384b..d12c4086a 100644 --- a/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch +++ b/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch @@ -1,7 +1,7 @@ From: Yong Zhang Date: Thu, 28 Jul 2011 11:16:00 +0800 Subject: hotplug: Reread hotplug_pcp on pin_current_cpu() retry -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz When retry happens, it's likely that the task has been migrated to another cpu (except unplug failed), but it still derefernces the diff --git a/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch b/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch index 830db4d7c..eebf0dac7 100644 --- a/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch +++ b/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch @@ -1,7 +1,7 @@ Subject: ARM: Initialize split page table locks for vector page From: Frank Rowand Date: Sat, 1 Oct 2011 18:58:13 -0700 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Without this patch, ARM can not use SPLIT_PTLOCK_CPUS if PREEMPT_RT_FULL=y because vectors_user_mapping() creates a diff --git a/debian/patches/features/all/rt/relay-fix-timer-madness.patch b/debian/patches/features/all/rt/relay-fix-timer-madness.patch index e741f64e8..6b2570927 100644 --- a/debian/patches/features/all/rt/relay-fix-timer-madness.patch +++ b/debian/patches/features/all/rt/relay-fix-timer-madness.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:44:07 -0500 Subject: relay: Fix timer madness -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz remove timer calls (!!!) from deep within the tracing infrastructure. This was totally bogus code that can cause lockups and worse. Poll diff --git a/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch b/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch index 98f946bc2..44ef89a41 100644 --- a/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch +++ b/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch @@ -1,7 +1,7 @@ Subject: ARM: smp: Move clear_tasks_mm_cpumask() call to __cpu_die() From: Grygorii Strashko Date: Fri, 11 Sep 2015 21:21:23 +0300 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz When running with the RT-kernel (4.1.5-rt5) on TI OMAP dra7-evm and trying to do Suspend to RAM, the following backtrace occurs: diff --git a/debian/patches/features/all/rt/rt-add-rt-locks.patch b/debian/patches/features/all/rt/rt-add-rt-locks.patch index b4dfad188..4dcb09a87 100644 --- a/debian/patches/features/all/rt/rt-add-rt-locks.patch +++ b/debian/patches/features/all/rt/rt-add-rt-locks.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 26 Jul 2009 19:39:56 +0200 Subject: rt: Add the preempt-rt lock replacement APIs -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Map spinlocks, rwlocks, rw_semaphores and semaphores to the rt_mutex based locking functions for preempt-rt. diff --git a/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch b/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch index ff98cadea..ef52f61d9 100644 --- a/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch +++ b/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch @@ -1,7 +1,7 @@ Subject: rt: Introduce cpu_chill() From: Thomas Gleixner Date: Wed, 07 Mar 2012 20:51:03 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Add cpu_chill() to replace cpu_relax(). cpu_chill() @@ -101,7 +101,7 @@ Signed-off-by: Sebastian Andrzej Siewior #endif /* defined(_LINUX_DELAY_H) */ --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c -@@ -1776,6 +1776,25 @@ SYSCALL_DEFINE2(nanosleep, struct timesp +@@ -1775,6 +1775,25 @@ SYSCALL_DEFINE2(nanosleep, struct timesp return hrtimer_nanosleep(&tu, rmtp, HRTIMER_MODE_REL, CLOCK_MONOTONIC); } diff --git a/debian/patches/features/all/rt/rt-local-irq-lock.patch b/debian/patches/features/all/rt/rt-local-irq-lock.patch index ca27478d9..5271d101f 100644 --- a/debian/patches/features/all/rt/rt-local-irq-lock.patch +++ b/debian/patches/features/all/rt/rt-local-irq-lock.patch @@ -1,7 +1,7 @@ Subject: rt: Add local irq locks From: Thomas Gleixner Date: Mon, 20 Jun 2011 09:03:47 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Introduce locallock. For !RT this maps to preempt_disable()/ local_irq_disable() so there is not much that changes. For RT this will diff --git a/debian/patches/features/all/rt/rt-preempt-base-config.patch b/debian/patches/features/all/rt/rt-preempt-base-config.patch index 8f8a9d430..9cbdba6ad 100644 --- a/debian/patches/features/all/rt/rt-preempt-base-config.patch +++ b/debian/patches/features/all/rt/rt-preempt-base-config.patch @@ -1,7 +1,7 @@ Subject: rt: Provide PREEMPT_RT_BASE config switch From: Thomas Gleixner Date: Fri, 17 Jun 2011 12:39:57 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Introduce PREEMPT_RT_BASE which enables parts of PREEMPT_RT_FULL. Forces interrupt threading and enables some of the RT diff --git a/debian/patches/features/all/rt/rt-serial-warn-fix.patch b/debian/patches/features/all/rt/rt-serial-warn-fix.patch index 4ffae1059..13d0d68ea 100644 --- a/debian/patches/features/all/rt/rt-serial-warn-fix.patch +++ b/debian/patches/features/all/rt/rt-serial-warn-fix.patch @@ -1,7 +1,7 @@ Subject: rt: Improve the serial console PASS_LIMIT From: Ingo Molnar Date: Wed Dec 14 13:05:54 CET 2011 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Beyond the warning: diff --git a/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully b/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully index 6926b68e0..9bf5bcffb 100644 --- a/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully +++ b/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully @@ -1,7 +1,7 @@ Subject: rtmutex: Handle non enqueued waiters gracefully From: Thomas Gleixner Date: Fri, 06 Nov 2015 18:51:03 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Yimin debugged that in case of a PI wakeup in progress when rt_mutex_start_proxy_lock() calls task_blocks_on_rt_mutex() the latter diff --git a/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch b/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch index 06a14a597..770da26f7 100644 --- a/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch +++ b/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch @@ -1,8 +1,7 @@ -From 13f032043086194982ac91c68124adae545f5627 Mon Sep 17 00:00:00 2001 From: "bmouring@ni.com" Date: Tue, 15 Dec 2015 17:07:30 -0600 -Subject: [PATCH] rtmutex: Use chainwalking control enum -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Subject: rtmutex: Use chainwalking control enum +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz In 8930ed80 (rtmutex: Cleanup deadlock detector debug logic), chainwalking control enums were introduced to limit the deadlock diff --git a/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch b/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch index d47c90e40..de6c9deee 100644 --- a/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch +++ b/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 28 Oct 2013 09:36:37 +0100 Subject: rtmutex: Add RT aware ww locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz lockdep says: | -------------------------------------------------------------------------- diff --git a/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch b/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch index 539823011..cf236bbbf 100644 --- a/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch +++ b/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch @@ -1,7 +1,7 @@ Subject: rtmutex: Avoid include hell From: Thomas Gleixner Date: Wed, 29 Jun 2011 20:06:39 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Include only the required raw types. This avoids pulling in the complete spinlock header which in turn requires rtmutex.h at some point. diff --git a/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch b/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch index 936421985..81a2042ef 100644 --- a/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch +++ b/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch @@ -1,7 +1,7 @@ Subject: rtmutex: Handle the various new futex race conditions From: Thomas Gleixner Date: Fri, 10 Jun 2011 11:04:15 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz RT opens a few new interesting race conditions in the rtmutex/futex combo due to futex hash bucket lock being a 'sleeping' spinlock and diff --git a/debian/patches/features/all/rt/rtmutex-lock-killable.patch b/debian/patches/features/all/rt/rtmutex-lock-killable.patch index 5873a6655..d79380be3 100644 --- a/debian/patches/features/all/rt/rtmutex-lock-killable.patch +++ b/debian/patches/features/all/rt/rtmutex-lock-killable.patch @@ -1,7 +1,7 @@ Subject: rtmutex: Add rtmutex_lock_killable() From: Thomas Gleixner Date: Thu, 09 Jun 2011 11:43:52 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Add "killable" type to rtmutex. We need this since rtmutex are used as "normal" mutexes which do use this type. diff --git a/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch b/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch index b36988a6c..c2f53cf2e 100644 --- a/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch +++ b/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed 02 Dec 2015 11:34:07 +0100 Subject: rtmutex: trylock is okay on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz non-RT kernel could deadlock on rt_mutex_trylock() in softirq context. On -RT we don't run softirqs in IRQ context but in thread context so it is diff --git a/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch b/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch index d99099de1..bcdf84d1d 100644 --- a/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch +++ b/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch @@ -1,6 +1,6 @@ From: Sebastian Andrzej Siewior Subject: rbtree: don't include the rcu header -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The RCU header pulls in spinlock.h and fails due not yet defined types: diff --git a/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch b/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch index 985570c5c..68fbaaeea 100644 --- a/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch +++ b/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch @@ -1,7 +1,7 @@ From: Paul Gortmaker Date: Sat, 14 Feb 2015 11:01:16 -0500 Subject: sas-ata/isci: dont't disable interrupts in qc_issue handler -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On 3.14-rt we see the following trace on Canoe Pass for SCSI_ISCI "Intel(R) C600 Series Chipset SAS Controller" diff --git a/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch b/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch index 2e7b024a4..f8fb00820 100644 --- a/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch +++ b/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch @@ -1,7 +1,7 @@ From: Juri Lelli Date: Tue, 13 May 2014 15:30:20 +0200 Subject: sched/deadline: dl_task_timer has to be irqsafe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz As for rt_period_timer, dl_task_timer has to be irqsafe. diff --git a/debian/patches/features/all/rt/sched-delay-put-task.patch b/debian/patches/features/all/rt/sched-delay-put-task.patch index 3bd2e453e..a6802bead 100644 --- a/debian/patches/features/all/rt/sched-delay-put-task.patch +++ b/debian/patches/features/all/rt/sched-delay-put-task.patch @@ -1,7 +1,7 @@ Subject: sched: Move task_struct cleanup to RCU From: Thomas Gleixner Date: Tue, 31 May 2011 16:59:16 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz __put_task_struct() does quite some expensive work. We don't want to burden random tasks with that. diff --git a/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch b/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch index c7df8502f..88bf221c0 100644 --- a/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch +++ b/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch @@ -1,7 +1,7 @@ Subject: sched: Disable CONFIG_RT_GROUP_SCHED on RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:03:52 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Carsten reported problems when running: diff --git a/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch b/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch index 7cb92c02a..e11a5616b 100644 --- a/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch +++ b/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch @@ -1,7 +1,7 @@ Subject: sched: Disable TTWU_QUEUE on RT From: Thomas Gleixner Date: Tue, 13 Sep 2011 16:42:35 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The queued remote wakeup mechanism can introduce rather large latencies if the number of migrated tasks is high. Disable it for RT. diff --git a/debian/patches/features/all/rt/sched-limit-nr-migrate.patch b/debian/patches/features/all/rt/sched-limit-nr-migrate.patch index cc55e81dc..da9cacdfb 100644 --- a/debian/patches/features/all/rt/sched-limit-nr-migrate.patch +++ b/debian/patches/features/all/rt/sched-limit-nr-migrate.patch @@ -1,7 +1,7 @@ Subject: sched: Limit the number of task migrations per batch From: Thomas Gleixner Date: Mon, 06 Jun 2011 12:12:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Put an upper limit on the number of tasks which are migrated per batch to avoid large latencies. diff --git a/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch b/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch index b1cd8f2ea..c67605532 100644 --- a/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch +++ b/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch @@ -1,7 +1,7 @@ Subject: sched: Do not account rcu_preempt_depth on RT in might_sleep() From: Thomas Gleixner Date: Tue, 07 Jun 2011 09:19:06 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz RT changes the rcu_preempt_depth semantics, so we cannot check for it in might_sleep(). @@ -37,7 +37,7 @@ Signed-off-by: Thomas Gleixner /* Internal to kernel */ --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -7729,7 +7729,7 @@ void __init sched_init(void) +@@ -7668,7 +7668,7 @@ void __init sched_init(void) #ifdef CONFIG_DEBUG_ATOMIC_SLEEP static inline int preempt_count_equals(int preempt_offset) { diff --git a/debian/patches/features/all/rt/sched-mmdrop-delayed.patch b/debian/patches/features/all/rt/sched-mmdrop-delayed.patch index 909d328c9..a34fa3806 100644 --- a/debian/patches/features/all/rt/sched-mmdrop-delayed.patch +++ b/debian/patches/features/all/rt/sched-mmdrop-delayed.patch @@ -1,7 +1,7 @@ Subject: sched: Move mmdrop to RCU on RT From: Thomas Gleixner Date: Mon, 06 Jun 2011 12:20:33 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Takes sleeping locks and calls into the memory allocator, so nothing we want to do in task switch and oder atomic contexts. @@ -85,7 +85,7 @@ Signed-off-by: Thomas Gleixner */ --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -2602,8 +2602,12 @@ static struct rq *finish_task_switch(str +@@ -2593,8 +2593,12 @@ static struct rq *finish_task_switch(str finish_arch_post_lock_switch(); fire_sched_in_preempt_notifiers(current); @@ -99,7 +99,7 @@ Signed-off-by: Thomas Gleixner if (unlikely(prev_state == TASK_DEAD)) { if (prev->sched_class->task_dead) prev->sched_class->task_dead(prev); -@@ -5317,6 +5321,8 @@ void sched_setnuma(struct task_struct *p +@@ -5256,6 +5260,8 @@ void sched_setnuma(struct task_struct *p #endif /* CONFIG_NUMA_BALANCING */ #ifdef CONFIG_HOTPLUG_CPU @@ -108,7 +108,7 @@ Signed-off-by: Thomas Gleixner /* * Ensures that the idle task is using init_mm right before its cpu goes * offline. -@@ -5331,7 +5337,11 @@ void idle_task_exit(void) +@@ -5270,7 +5276,11 @@ void idle_task_exit(void) switch_mm(mm, &init_mm, current); finish_arch_post_lock_switch(); } @@ -121,7 +121,7 @@ Signed-off-by: Thomas Gleixner } /* -@@ -5703,6 +5713,10 @@ migration_call(struct notifier_block *nf +@@ -5642,6 +5652,10 @@ migration_call(struct notifier_block *nf case CPU_DEAD: calc_load_migrate(rq); diff --git a/debian/patches/features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch b/debian/patches/features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch new file mode 100644 index 000000000..6aa705177 --- /dev/null +++ b/debian/patches/features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch @@ -0,0 +1,262 @@ +From: Thomas Gleixner +Date: Mon, 18 Jan 2016 17:21:59 +0100 +Subject: sched: provide a tsk_nr_cpus_allowed() helper +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +tsk_nr_cpus_allowed() is an accessor for task->nr_cpus_allowed which allows +us to change the representation of ->nr_cpus_allowed if required. + +Signed-off-by: Thomas Gleixner +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/sched.h | 5 +++++ + kernel/sched/core.c | 2 +- + kernel/sched/deadline.c | 28 ++++++++++++++-------------- + kernel/sched/rt.c | 24 ++++++++++++------------ + 4 files changed, 32 insertions(+), 27 deletions(-) + +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -1832,6 +1832,11 @@ extern int arch_task_struct_size __read_ + /* Future-safe accessor for struct task_struct's cpus_allowed. */ + #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) + ++static inline int tsk_nr_cpus_allowed(struct task_struct *p) ++{ ++ return p->nr_cpus_allowed; ++} ++ + #define TNF_MIGRATED 0x01 + #define TNF_NO_GROUP 0x02 + #define TNF_SHARED 0x04 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -1624,7 +1624,7 @@ int select_task_rq(struct task_struct *p + { + lockdep_assert_held(&p->pi_lock); + +- if (p->nr_cpus_allowed > 1) ++ if (tsk_nr_cpus_allowed(p) > 1) + cpu = p->sched_class->select_task_rq(p, cpu, sd_flags, wake_flags); + + /* +--- a/kernel/sched/deadline.c ++++ b/kernel/sched/deadline.c +@@ -134,7 +134,7 @@ static void inc_dl_migration(struct sche + { + struct task_struct *p = dl_task_of(dl_se); + +- if (p->nr_cpus_allowed > 1) ++ if (tsk_nr_cpus_allowed(p) > 1) + dl_rq->dl_nr_migratory++; + + update_dl_migration(dl_rq); +@@ -144,7 +144,7 @@ static void dec_dl_migration(struct sche + { + struct task_struct *p = dl_task_of(dl_se); + +- if (p->nr_cpus_allowed > 1) ++ if (tsk_nr_cpus_allowed(p) > 1) + dl_rq->dl_nr_migratory--; + + update_dl_migration(dl_rq); +@@ -989,7 +989,7 @@ static void enqueue_task_dl(struct rq *r + + enqueue_dl_entity(&p->dl, pi_se, flags); + +- if (!task_current(rq, p) && p->nr_cpus_allowed > 1) ++ if (!task_current(rq, p) && tsk_nr_cpus_allowed(p) > 1) + enqueue_pushable_dl_task(rq, p); + } + +@@ -1067,9 +1067,9 @@ select_task_rq_dl(struct task_struct *p, + * try to make it stay here, it might be important. + */ + if (unlikely(dl_task(curr)) && +- (curr->nr_cpus_allowed < 2 || ++ (tsk_nr_cpus_allowed(curr) < 2 || + !dl_entity_preempt(&p->dl, &curr->dl)) && +- (p->nr_cpus_allowed > 1)) { ++ (tsk_nr_cpus_allowed(p) > 1)) { + int target = find_later_rq(p); + + if (target != -1 && +@@ -1090,7 +1090,7 @@ static void check_preempt_equal_dl(struc + * Current can't be migrated, useless to reschedule, + * let's hope p can move out. + */ +- if (rq->curr->nr_cpus_allowed == 1 || ++ if (tsk_nr_cpus_allowed(rq->curr) == 1 || + cpudl_find(&rq->rd->cpudl, rq->curr, NULL) == -1) + return; + +@@ -1098,7 +1098,7 @@ static void check_preempt_equal_dl(struc + * p is migratable, so let's not schedule it and + * see if it is pushed or pulled somewhere else. + */ +- if (p->nr_cpus_allowed != 1 && ++ if (tsk_nr_cpus_allowed(p) != 1 && + cpudl_find(&rq->rd->cpudl, p, NULL) != -1) + return; + +@@ -1212,7 +1212,7 @@ static void put_prev_task_dl(struct rq * + { + update_curr_dl(rq); + +- if (on_dl_rq(&p->dl) && p->nr_cpus_allowed > 1) ++ if (on_dl_rq(&p->dl) && tsk_nr_cpus_allowed(p) > 1) + enqueue_pushable_dl_task(rq, p); + } + +@@ -1335,7 +1335,7 @@ static int find_later_rq(struct task_str + if (unlikely(!later_mask)) + return -1; + +- if (task->nr_cpus_allowed == 1) ++ if (tsk_nr_cpus_allowed(task) == 1) + return -1; + + /* +@@ -1480,7 +1480,7 @@ static struct task_struct *pick_next_pus + + BUG_ON(rq->cpu != task_cpu(p)); + BUG_ON(task_current(rq, p)); +- BUG_ON(p->nr_cpus_allowed <= 1); ++ BUG_ON(tsk_nr_cpus_allowed(p) <= 1); + + BUG_ON(!task_on_rq_queued(p)); + BUG_ON(!dl_task(p)); +@@ -1519,7 +1519,7 @@ static int push_dl_task(struct rq *rq) + */ + if (dl_task(rq->curr) && + dl_time_before(next_task->dl.deadline, rq->curr->dl.deadline) && +- rq->curr->nr_cpus_allowed > 1) { ++ tsk_nr_cpus_allowed(rq->curr) > 1) { + resched_curr(rq); + return 0; + } +@@ -1666,9 +1666,9 @@ static void task_woken_dl(struct rq *rq, + { + if (!task_running(rq, p) && + !test_tsk_need_resched(rq->curr) && +- p->nr_cpus_allowed > 1 && ++ tsk_nr_cpus_allowed(p) > 1 && + dl_task(rq->curr) && +- (rq->curr->nr_cpus_allowed < 2 || ++ (tsk_nr_cpus_allowed(rq->curr) < 2 || + !dl_entity_preempt(&p->dl, &rq->curr->dl))) { + push_dl_tasks(rq); + } +@@ -1769,7 +1769,7 @@ static void switched_to_dl(struct rq *rq + { + if (task_on_rq_queued(p) && rq->curr != p) { + #ifdef CONFIG_SMP +- if (p->nr_cpus_allowed > 1 && rq->dl.overloaded) ++ if (tsk_nr_cpus_allowed(p) > 1 && rq->dl.overloaded) + queue_push_tasks(rq); + #else + if (dl_task(rq->curr)) +--- a/kernel/sched/rt.c ++++ b/kernel/sched/rt.c +@@ -326,7 +326,7 @@ static void inc_rt_migration(struct sche + rt_rq = &rq_of_rt_rq(rt_rq)->rt; + + rt_rq->rt_nr_total++; +- if (p->nr_cpus_allowed > 1) ++ if (tsk_nr_cpus_allowed(p) > 1) + rt_rq->rt_nr_migratory++; + + update_rt_migration(rt_rq); +@@ -343,7 +343,7 @@ static void dec_rt_migration(struct sche + rt_rq = &rq_of_rt_rq(rt_rq)->rt; + + rt_rq->rt_nr_total--; +- if (p->nr_cpus_allowed > 1) ++ if (tsk_nr_cpus_allowed(p) > 1) + rt_rq->rt_nr_migratory--; + + update_rt_migration(rt_rq); +@@ -1262,7 +1262,7 @@ enqueue_task_rt(struct rq *rq, struct ta + + enqueue_rt_entity(rt_se, flags & ENQUEUE_HEAD); + +- if (!task_current(rq, p) && p->nr_cpus_allowed > 1) ++ if (!task_current(rq, p) && tsk_nr_cpus_allowed(p) > 1) + enqueue_pushable_task(rq, p); + } + +@@ -1351,7 +1351,7 @@ select_task_rq_rt(struct task_struct *p, + * will have to sort it out. + */ + if (curr && unlikely(rt_task(curr)) && +- (curr->nr_cpus_allowed < 2 || ++ (tsk_nr_cpus_allowed(curr) < 2 || + curr->prio <= p->prio)) { + int target = find_lowest_rq(p); + +@@ -1375,7 +1375,7 @@ static void check_preempt_equal_prio(str + * Current can't be migrated, useless to reschedule, + * let's hope p can move out. + */ +- if (rq->curr->nr_cpus_allowed == 1 || ++ if (tsk_nr_cpus_allowed(rq->curr) == 1 || + !cpupri_find(&rq->rd->cpupri, rq->curr, NULL)) + return; + +@@ -1383,7 +1383,7 @@ static void check_preempt_equal_prio(str + * p is migratable, so let's not schedule it and + * see if it is pushed or pulled somewhere else. + */ +- if (p->nr_cpus_allowed != 1 ++ if (tsk_nr_cpus_allowed(p) != 1 + && cpupri_find(&rq->rd->cpupri, p, NULL)) + return; + +@@ -1517,7 +1517,7 @@ static void put_prev_task_rt(struct rq * + * The previous task needs to be made eligible for pushing + * if it is still active + */ +- if (on_rt_rq(&p->rt) && p->nr_cpus_allowed > 1) ++ if (on_rt_rq(&p->rt) && tsk_nr_cpus_allowed(p) > 1) + enqueue_pushable_task(rq, p); + } + +@@ -1567,7 +1567,7 @@ static int find_lowest_rq(struct task_st + if (unlikely(!lowest_mask)) + return -1; + +- if (task->nr_cpus_allowed == 1) ++ if (tsk_nr_cpus_allowed(task) == 1) + return -1; /* No other targets possible */ + + if (!cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask)) +@@ -1699,7 +1699,7 @@ static struct task_struct *pick_next_pus + + BUG_ON(rq->cpu != task_cpu(p)); + BUG_ON(task_current(rq, p)); +- BUG_ON(p->nr_cpus_allowed <= 1); ++ BUG_ON(tsk_nr_cpus_allowed(p) <= 1); + + BUG_ON(!task_on_rq_queued(p)); + BUG_ON(!rt_task(p)); +@@ -2059,9 +2059,9 @@ static void task_woken_rt(struct rq *rq, + { + if (!task_running(rq, p) && + !test_tsk_need_resched(rq->curr) && +- p->nr_cpus_allowed > 1 && ++ tsk_nr_cpus_allowed(p) > 1 && + (dl_task(rq->curr) || rt_task(rq->curr)) && +- (rq->curr->nr_cpus_allowed < 2 || ++ (tsk_nr_cpus_allowed(rq->curr) < 2 || + rq->curr->prio <= p->prio)) + push_rt_tasks(rq); + } +@@ -2134,7 +2134,7 @@ static void switched_to_rt(struct rq *rq + */ + if (task_on_rq_queued(p) && rq->curr != p) { + #ifdef CONFIG_SMP +- if (p->nr_cpus_allowed > 1 && rq->rt.overloaded) ++ if (tsk_nr_cpus_allowed(p) > 1 && rq->rt.overloaded) + queue_push_tasks(rq); + #else + if (p->prio < rq->curr->prio) diff --git a/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch b/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch index 058926917..e2a2e8072 100644 --- a/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch +++ b/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch @@ -1,7 +1,7 @@ Subject: sched: Add saved_state for tasks blocked on sleeping locks From: Thomas Gleixner Date: Sat, 25 Jun 2011 09:21:04 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Spinlocks are state preserving in !RT. RT changes the state when a task gets blocked on a lock. So we need to remember the state before @@ -36,7 +36,7 @@ Signed-off-by: Thomas Gleixner extern void kick_process(struct task_struct *tsk); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -1958,8 +1958,25 @@ try_to_wake_up(struct task_struct *p, un +@@ -1949,8 +1949,25 @@ try_to_wake_up(struct task_struct *p, un */ smp_mb__before_spinlock(); raw_spin_lock_irqsave(&p->pi_lock, flags); @@ -63,7 +63,7 @@ Signed-off-by: Thomas Gleixner trace_sched_waking(p); -@@ -2092,6 +2109,18 @@ int wake_up_process(struct task_struct * +@@ -2083,6 +2100,18 @@ int wake_up_process(struct task_struct * } EXPORT_SYMBOL(wake_up_process); diff --git a/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch b/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch index ddec337c4..3e5cff8f0 100644 --- a/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch +++ b/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch @@ -1,7 +1,7 @@ Subject: sched: ttwu: Return success when only changing the saved_state value From: Thomas Gleixner Date: Tue, 13 Dec 2011 21:42:19 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz When a task blocks on a rt lock, it saves the current state in p->saved_state, so a lock related wake up will not destroy the @@ -21,7 +21,7 @@ Signed-off-by: Thomas Gleixner --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -1965,8 +1965,10 @@ try_to_wake_up(struct task_struct *p, un +@@ -1956,8 +1956,10 @@ try_to_wake_up(struct task_struct *p, un * if the wakeup condition is true. */ if (!(wake_flags & WF_LOCK_SLEEPER)) { diff --git a/debian/patches/features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch b/debian/patches/features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch new file mode 100644 index 000000000..70e03fce4 --- /dev/null +++ b/debian/patches/features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch @@ -0,0 +1,58 @@ +From: Thomas Gleixner +Date: Mon, 18 Jan 2016 17:10:39 +0100 +Subject: sched: use tsk_cpus_allowed() instead of accessing + ->cpus_allowed +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +Use the future-safe accessor for struct task_struct's. + +Signed-off-by: Thomas Gleixner +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/sched/cpudeadline.c | 4 ++-- + kernel/sched/cpupri.c | 4 ++-- + kernel/sched/deadline.c | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +--- a/kernel/sched/cpudeadline.c ++++ b/kernel/sched/cpudeadline.c +@@ -103,10 +103,10 @@ int cpudl_find(struct cpudl *cp, struct + const struct sched_dl_entity *dl_se = &p->dl; + + if (later_mask && +- cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) { ++ cpumask_and(later_mask, cp->free_cpus, tsk_cpus_allowed(p))) { + best_cpu = cpumask_any(later_mask); + goto out; +- } else if (cpumask_test_cpu(cpudl_maximum(cp), &p->cpus_allowed) && ++ } else if (cpumask_test_cpu(cpudl_maximum(cp), tsk_cpus_allowed(p)) && + dl_time_before(dl_se->deadline, cp->elements[0].dl)) { + best_cpu = cpudl_maximum(cp); + if (later_mask) +--- a/kernel/sched/cpupri.c ++++ b/kernel/sched/cpupri.c +@@ -103,11 +103,11 @@ int cpupri_find(struct cpupri *cp, struc + if (skip) + continue; + +- if (cpumask_any_and(&p->cpus_allowed, vec->mask) >= nr_cpu_ids) ++ if (cpumask_any_and(tsk_cpus_allowed(p), vec->mask) >= nr_cpu_ids) + continue; + + if (lowest_mask) { +- cpumask_and(lowest_mask, &p->cpus_allowed, vec->mask); ++ cpumask_and(lowest_mask, tsk_cpus_allowed(p), vec->mask); + + /* + * We have to ensure that we have at least one bit +--- a/kernel/sched/deadline.c ++++ b/kernel/sched/deadline.c +@@ -1441,7 +1441,7 @@ static struct rq *find_lock_later_rq(str + if (double_lock_balance(rq, later_rq)) { + if (unlikely(task_rq(task) != rq || + !cpumask_test_cpu(later_rq->cpu, +- &task->cpus_allowed) || ++ tsk_cpus_allowed(task)) || + task_running(rq, task) || + !task_on_rq_queued(task))) { + double_unlock_balance(rq, later_rq); diff --git a/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch b/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch index b38f81da5..3c472e845 100644 --- a/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch +++ b/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 18 Mar 2013 15:12:49 -0400 Subject: sched/workqueue: Only wake up idle workers if not blocked on sleeping spin lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz In -rt, most spin_locks() turn into mutexes. One of these spin_lock conversions is performed on the workqueue gcwq->lock. When the idle @@ -24,7 +24,7 @@ Signed-off-by: Sebastian Andrzej Siewior --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -3326,8 +3326,10 @@ static void __sched notrace __schedule(b +@@ -3265,8 +3265,10 @@ static void __sched notrace __schedule(b * If a worker went to sleep, notify and ask workqueue * whether it wants to wake up a task to maintain * concurrency. diff --git a/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch b/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch index 870be57de..f58fe270e 100644 --- a/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch +++ b/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch @@ -1,7 +1,7 @@ Subject: scsi/fcoe: Make RT aware. From: Thomas Gleixner Date: Sat, 12 Nov 2011 14:00:48 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Do not disable preemption while taking sleeping locks. All user look safe for migrate_diable() only. diff --git a/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch b/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch index 8aa2fdc0d..b71a5be4d 100644 --- a/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch +++ b/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch @@ -1,7 +1,7 @@ Subject: scsi: qla2xxx: Use local_irq_save_nort() in qla2x00_poll From: John Kacur Date: Fri, 27 Apr 2012 12:48:46 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz RT triggers the following: diff --git a/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch b/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch index f4adbd112..6b696ed96 100644 --- a/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch +++ b/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch @@ -1,7 +1,7 @@ Subject: seqlock: Prevent rt starvation From: Thomas Gleixner Date: Wed, 22 Feb 2012 12:03:30 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz If a low prio writer gets preempted while holding the seqlock write locked, a high prio reader spins forever on RT. diff --git a/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch b/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch index 24e1ef502..e4c654884 100644 --- a/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch +++ b/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch @@ -1,7 +1,7 @@ Subject: signal: Make __lock_task_sighand() RT aware From: Thomas Gleixner Date: Fri, 22 Jul 2011 08:07:08 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz local_irq_save() + spin_lock(&sighand->siglock) does not work on -RT. Use the nort variants. diff --git a/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch b/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch index 96dd34e67..80cea0088 100644 --- a/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch +++ b/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch @@ -1,7 +1,7 @@ Subject: signal: Revert ptrace preempt magic From: Thomas Gleixner Date: Wed, 21 Sep 2011 19:57:12 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Upstream commit '53da1d9456fe7f8 fix ptrace slowness' is nothing more than a bandaid around the ptrace design trainwreck. It's not a diff --git a/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch b/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch index 8f4132f9d..5a5b1a98b 100644 --- a/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch +++ b/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:44:56 -0500 Subject: signals: Allow rt tasks to cache one sigqueue struct -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz To avoid allocation allow rt tasks to cache one sigqueue struct in task struct. diff --git a/debian/patches/features/all/rt/skbufhead-raw-lock.patch b/debian/patches/features/all/rt/skbufhead-raw-lock.patch index 5981139c9..d82bf1fcf 100644 --- a/debian/patches/features/all/rt/skbufhead-raw-lock.patch +++ b/debian/patches/features/all/rt/skbufhead-raw-lock.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 12 Jul 2011 15:38:34 +0200 Subject: net: Use skbufhead with raw lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use the rps lock as rawlock so we can keep irq-off regions. It looks low latency. However we can't kfree() from this context therefore we defer this diff --git a/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch b/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch index c7c1bf6bb..36a70155b 100644 --- a/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch +++ b/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 15 Apr 2015 19:00:47 +0200 Subject: slub: Disable SLUB_CPU_PARTIAL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:915 |in_atomic(): 1, irqs_disabled(): 0, pid: 87, name: rcuop/7 diff --git a/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch b/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch index 8d1c0a3ba..968ad915e 100644 --- a/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch +++ b/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch @@ -1,7 +1,7 @@ Subject: slub: Enable irqs for __GFP_WAIT From: Thomas Gleixner Date: Wed, 09 Jan 2013 12:08:15 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz SYSTEM_RUNNING might be too late for enabling interrupts. Allocations with GFP_WAIT can happen before that. So use this as an indicator. diff --git a/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch b/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch index 2de192b09..80047cfdf 100644 --- a/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch +++ b/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Wed, 18 Feb 2015 15:09:23 +0100 Subject: snd/pcm: fix snd_pcm_stream_lock*() irqs_disabled() splats -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Locking functions previously using read_lock_irq()/read_lock_irqsave() were changed to local_irq_disable/save(), leading to gripes. Use nort variants. diff --git a/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch b/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch index 7104d3277..696d8c824 100644 --- a/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch +++ b/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch @@ -1,7 +1,7 @@ Subject: softirq: Disable softirq stacks for RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 13:59:17 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Disable extra stacks for softirqs. We want to preempt softirqs and having them on special IRQ-stack does not make this easier. @@ -146,7 +146,7 @@ Signed-off-by: Thomas Gleixner { --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h -@@ -446,7 +446,7 @@ struct softirq_action +@@ -447,7 +447,7 @@ struct softirq_action asmlinkage void do_softirq(void); asmlinkage void __do_softirq(void); diff --git a/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch b/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch index 5e4f011e1..6aa4931d0 100644 --- a/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch +++ b/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch @@ -1,7 +1,7 @@ Subject: softirq: Check preemption after reenabling interrupts From: Thomas Gleixner Date: Sun, 13 Nov 2011 17:17:09 +0100 (CET) -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz raise_softirq_irqoff() disables interrupts and wakes the softirq daemon, but after reenabling interrupts there is no preemption check, diff --git a/debian/patches/features/all/rt/softirq-split-locks.patch b/debian/patches/features/all/rt/softirq-split-locks.patch index 3a5b1804d..d994b3112 100644 --- a/debian/patches/features/all/rt/softirq-split-locks.patch +++ b/debian/patches/features/all/rt/softirq-split-locks.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 04 Oct 2012 14:20:47 +0100 Subject: softirq: Split softirq locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The 3.x RT series removed the split softirq implementation in favour of pushing softirq processing into the context of the thread which @@ -86,7 +86,7 @@ Signed-off-by: Thomas Gleixner #endif /* _LINUX_BH_H */ --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h -@@ -443,10 +443,11 @@ struct softirq_action +@@ -444,10 +444,11 @@ struct softirq_action void (*action)(struct softirq_action *); }; @@ -100,7 +100,7 @@ Signed-off-by: Thomas Gleixner void do_softirq_own_stack(void); #else static inline void do_softirq_own_stack(void) -@@ -454,6 +455,9 @@ static inline void do_softirq_own_stack( +@@ -455,6 +456,9 @@ static inline void do_softirq_own_stack( __do_softirq(); } #endif @@ -110,7 +110,7 @@ Signed-off-by: Thomas Gleixner extern void open_softirq(int nr, void (*action)(struct softirq_action *)); extern void softirq_init(void); -@@ -461,6 +465,7 @@ extern void __raise_softirq_irqoff(unsig +@@ -462,6 +466,7 @@ extern void __raise_softirq_irqoff(unsig extern void raise_softirq_irqoff(unsigned int nr); extern void raise_softirq(unsigned int nr); @@ -118,7 +118,7 @@ Signed-off-by: Thomas Gleixner DECLARE_PER_CPU(struct task_struct *, ksoftirqd); -@@ -618,6 +623,12 @@ void tasklet_hrtimer_cancel(struct taskl +@@ -619,6 +624,12 @@ void tasklet_hrtimer_cancel(struct taskl tasklet_kill(&ttimer->tasklet); } @@ -576,8 +576,8 @@ Signed-off-by: Thomas Gleixner + + do_current_softirqs(); + current->softirq_nestcnt--; -+ rcu_note_context_switch(); + local_irq_enable(); ++ cond_resched_rcu_qs(); +} + +/* diff --git a/debian/patches/features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch b/debian/patches/features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch new file mode 100644 index 000000000..a42c7aca6 --- /dev/null +++ b/debian/patches/features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch @@ -0,0 +1,208 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 20 Jan 2016 16:34:17 +0100 +Subject: softirq: split timer softirqs out of ksoftirqd +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +The softirqd runs in -RT with SCHED_FIFO (prio 1) and deals mostly with +timer wakeup which can not happen in hardirq context. The prio has been +risen from the normal SCHED_OTHER so the timer wakeup does not happen +too late. +With enough networking load it is possible that the system never goes +idle and schedules ksoftirqd and everything else with a higher priority. +One of the tasks left behind is one of RCU's threads and so we see stalls +and eventually run out of memory. +This patch moves the TIMER and HRTIMER softirqs out of the `ksoftirqd` +thread into its own `ktimersoftd`. The former can now run SCHED_OTHER +(same as mainline) and the latter at SCHED_FIFO due to the wakeups. + +From networking point of view: The NAPI callback runs after the network +interrupt thread completes. If its run time takes too long the NAPI code +itself schedules the `ksoftirqd`. Here in the thread it can run at +SCHED_OTHER priority and it won't defer RCU anymore. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/softirq.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 74 insertions(+), 11 deletions(-) + +--- a/kernel/softirq.c ++++ b/kernel/softirq.c +@@ -58,6 +58,10 @@ EXPORT_SYMBOL(irq_stat); + static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp; + + DEFINE_PER_CPU(struct task_struct *, ksoftirqd); ++#ifdef CONFIG_PREEMPT_RT_FULL ++#define TIMER_SOFTIRQS ((1 << TIMER_SOFTIRQ) | (1 << HRTIMER_SOFTIRQ)) ++DEFINE_PER_CPU(struct task_struct *, ktimer_softirqd); ++#endif + + const char * const softirq_to_name[NR_SOFTIRQS] = { + "HI", "TIMER", "NET_TX", "NET_RX", "BLOCK", "BLOCK_IOPOLL", +@@ -171,6 +175,17 @@ static void wakeup_softirqd(void) + wake_up_process(tsk); + } + ++#ifdef CONFIG_PREEMPT_RT_FULL ++static void wakeup_timer_softirqd(void) ++{ ++ /* Interrupts are disabled: no need to stop preemption */ ++ struct task_struct *tsk = __this_cpu_read(ktimer_softirqd); ++ ++ if (tsk && tsk->state != TASK_RUNNING) ++ wake_up_process(tsk); ++} ++#endif ++ + static void handle_softirq(unsigned int vec_nr) + { + struct softirq_action *h = softirq_vec + vec_nr; +@@ -473,7 +488,6 @@ void __raise_softirq_irqoff(unsigned int + static inline void local_bh_disable_nort(void) { local_bh_disable(); } + static inline void _local_bh_enable_nort(void) { _local_bh_enable(); } + static void ksoftirqd_set_sched_params(unsigned int cpu) { } +-static void ksoftirqd_clr_sched_params(unsigned int cpu, bool online) { } + + #else /* !PREEMPT_RT_FULL */ + +@@ -618,8 +632,12 @@ void thread_do_softirq(void) + + static void do_raise_softirq_irqoff(unsigned int nr) + { ++ unsigned int mask; ++ ++ mask = 1UL << nr; ++ + trace_softirq_raise(nr); +- or_softirq_pending(1UL << nr); ++ or_softirq_pending(mask); + + /* + * If we are not in a hard interrupt and inside a bh disabled +@@ -628,16 +646,30 @@ static void do_raise_softirq_irqoff(unsi + * delegate it to ksoftirqd. + */ + if (!in_irq() && current->softirq_nestcnt) +- current->softirqs_raised |= (1U << nr); +- else if (__this_cpu_read(ksoftirqd)) +- __this_cpu_read(ksoftirqd)->softirqs_raised |= (1U << nr); ++ current->softirqs_raised |= mask; ++ else if (!__this_cpu_read(ksoftirqd) || !__this_cpu_read(ktimer_softirqd)) ++ return; ++ ++ if (mask & TIMER_SOFTIRQS) ++ __this_cpu_read(ktimer_softirqd)->softirqs_raised |= mask; ++ else ++ __this_cpu_read(ksoftirqd)->softirqs_raised |= mask; ++} ++ ++static void wakeup_proper_softirq(unsigned int nr) ++{ ++ if ((1UL << nr) & TIMER_SOFTIRQS) ++ wakeup_timer_softirqd(); ++ else ++ wakeup_softirqd(); + } + ++ + void __raise_softirq_irqoff(unsigned int nr) + { + do_raise_softirq_irqoff(nr); + if (!in_irq() && !current->softirq_nestcnt) +- wakeup_softirqd(); ++ wakeup_proper_softirq(nr); + } + + /* +@@ -663,7 +695,7 @@ void raise_softirq_irqoff(unsigned int n + * raise a WARN() if the condition is met. + */ + if (!current->softirq_nestcnt) +- wakeup_softirqd(); ++ wakeup_proper_softirq(nr); + } + + static inline int ksoftirqd_softirq_pending(void) +@@ -676,22 +708,37 @@ static inline void _local_bh_enable_nort + + static inline void ksoftirqd_set_sched_params(unsigned int cpu) + { ++ /* Take over all but timer pending softirqs when starting */ ++ local_irq_disable(); ++ current->softirqs_raised = local_softirq_pending() & ~TIMER_SOFTIRQS; ++ local_irq_enable(); ++} ++ ++static inline void ktimer_softirqd_set_sched_params(unsigned int cpu) ++{ + struct sched_param param = { .sched_priority = 1 }; + + sched_setscheduler(current, SCHED_FIFO, ¶m); +- /* Take over all pending softirqs when starting */ ++ ++ /* Take over timer pending softirqs when starting */ + local_irq_disable(); +- current->softirqs_raised = local_softirq_pending(); ++ current->softirqs_raised = local_softirq_pending() & TIMER_SOFTIRQS; + local_irq_enable(); + } + +-static inline void ksoftirqd_clr_sched_params(unsigned int cpu, bool online) ++static inline void ktimer_softirqd_clr_sched_params(unsigned int cpu, ++ bool online) + { + struct sched_param param = { .sched_priority = 0 }; + + sched_setscheduler(current, SCHED_NORMAL, ¶m); + } + ++static int ktimer_softirqd_should_run(unsigned int cpu) ++{ ++ return current->softirqs_raised; ++} ++ + #endif /* PREEMPT_RT_FULL */ + /* + * Enter an interrupt context. +@@ -741,6 +788,9 @@ static inline void invoke_softirq(void) + if (__this_cpu_read(ksoftirqd) && + __this_cpu_read(ksoftirqd)->softirqs_raised) + wakeup_softirqd(); ++ if (__this_cpu_read(ktimer_softirqd) && ++ __this_cpu_read(ktimer_softirqd)->softirqs_raised) ++ wakeup_timer_softirqd(); + local_irq_restore(flags); + #endif + } +@@ -1173,17 +1223,30 @@ static struct notifier_block cpu_nfb = { + static struct smp_hotplug_thread softirq_threads = { + .store = &ksoftirqd, + .setup = ksoftirqd_set_sched_params, +- .cleanup = ksoftirqd_clr_sched_params, + .thread_should_run = ksoftirqd_should_run, + .thread_fn = run_ksoftirqd, + .thread_comm = "ksoftirqd/%u", + }; + ++#ifdef CONFIG_PREEMPT_RT_FULL ++static struct smp_hotplug_thread softirq_timer_threads = { ++ .store = &ktimer_softirqd, ++ .setup = ktimer_softirqd_set_sched_params, ++ .cleanup = ktimer_softirqd_clr_sched_params, ++ .thread_should_run = ktimer_softirqd_should_run, ++ .thread_fn = run_ksoftirqd, ++ .thread_comm = "ktimersoftd/%u", ++}; ++#endif ++ + static __init int spawn_ksoftirqd(void) + { + register_cpu_notifier(&cpu_nfb); + + BUG_ON(smpboot_register_percpu_thread(&softirq_threads)); ++#ifdef CONFIG_PREEMPT_RT_FULL ++ BUG_ON(smpboot_register_percpu_thread(&softirq_timer_threads)); ++#endif + + return 0; + } diff --git a/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch b/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch index 1f2106466..a7f06587f 100644 --- a/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch +++ b/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch @@ -1,8 +1,7 @@ -From d6a6675d436897cd1b09e299436df3499abd753e Mon Sep 17 00:00:00 2001 From: Allen Pais Date: Fri, 13 Dec 2013 09:44:41 +0530 -Subject: [PATCH 1/3] sparc64: use generic rwsem spinlocks rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Subject: sparc64: use generic rwsem spinlocks rt +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Signed-off-by: Allen Pais Signed-off-by: Sebastian Andrzej Siewior diff --git a/debian/patches/features/all/rt/spinlock-types-separate-raw.patch b/debian/patches/features/all/rt/spinlock-types-separate-raw.patch index de4ffa9e7..e4fb48838 100644 --- a/debian/patches/features/all/rt/spinlock-types-separate-raw.patch +++ b/debian/patches/features/all/rt/spinlock-types-separate-raw.patch @@ -1,7 +1,7 @@ Subject: spinlock: Split the lock types header From: Thomas Gleixner Date: Wed, 29 Jun 2011 19:34:01 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Split raw_spinlock into its own file and the remaining spinlock_t into its own non-RT header. The non-RT header will be replaced later by sleeping diff --git a/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch b/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch index f20c39596..6e801c12a 100644 --- a/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch +++ b/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 2 May 2014 13:13:22 +0200 Subject: stomp-machine: create lg_global_trylock_relax() primitive -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Create lg_global_trylock_relax() for use by stopper thread when it cannot schedule, to deal with stop_cpus_lock, which is now an lglock. diff --git a/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch b/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch index 16010e2a0..0ec0debac 100644 --- a/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch +++ b/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 2 May 2014 13:13:34 +0200 Subject: stomp-machine: use lg_global_trylock_relax() to dead with stop_cpus_lock lglock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz If the stop machinery is called from inactive CPU we cannot use lg_global_lock(), because some other stomp machine invocation might be diff --git a/debian/patches/features/all/rt/stop-machine-raw-lock.patch b/debian/patches/features/all/rt/stop-machine-raw-lock.patch index 6b3893946..cfb3fcdbc 100644 --- a/debian/patches/features/all/rt/stop-machine-raw-lock.patch +++ b/debian/patches/features/all/rt/stop-machine-raw-lock.patch @@ -1,7 +1,7 @@ Subject: stop_machine: Use raw spinlocks From: Thomas Gleixner Date: Wed, 29 Jun 2011 11:01:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use raw-locks in stomp_machine() to allow locking in irq-off regions. diff --git a/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch b/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch index 90ca811a6..39e4b6a6f 100644 --- a/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch +++ b/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:27 -0500 Subject: stop_machine: convert stop_machine_run() to PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Instead of playing with non-preemption, introduce explicit startup serialization. This is more robust and cleaner as diff --git a/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch b/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch index 8e4ce7721..b31c63c48 100644 --- a/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch +++ b/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Wed, 18 Feb 2015 16:05:28 +0100 Subject: sunrpc: Make svc_xprt_do_enqueue() use get_cpu_light() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:915 |in_atomic(): 1, irqs_disabled(): 0, pid: 3194, name: rpc.nfsd diff --git a/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch b/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch index 502aaabc2..ee4977c8e 100644 --- a/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch +++ b/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 15 Jul 2010 10:29:00 +0200 Subject: suspend: Prevent might sleep splats -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz timekeeping suspend/resume calls read_persistant_clock() which takes rtc_lock. That results in might sleep warnings because at that point diff --git a/debian/patches/features/all/rt/sysfs-realtime-entry.patch b/debian/patches/features/all/rt/sysfs-realtime-entry.patch index 4f0822553..0a843f4c2 100644 --- a/debian/patches/features/all/rt/sysfs-realtime-entry.patch +++ b/debian/patches/features/all/rt/sysfs-realtime-entry.patch @@ -1,7 +1,7 @@ Subject: sysfs: Add /sys/kernel/realtime entry From: Clark Williams Date: Sat Jul 30 21:55:53 2011 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Add a /sys/kernel entry to indicate that the kernel is a realtime kernel. diff --git a/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch b/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch index 498224e01..0cfc74619 100644 --- a/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch +++ b/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch @@ -1,7 +1,7 @@ Subject: tasklet: Prevent tasklets from going into infinite spin in RT From: Ingo Molnar Date: Tue Nov 29 20:18:22 2011 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz When CONFIG_PREEMPT_RT_FULL is enabled, tasklets run as threads, and spinlocks turn are mutexes. But this can cause issues with @@ -44,7 +44,7 @@ Signed-off-by: Thomas Gleixner --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h -@@ -482,8 +482,9 @@ static inline struct task_struct *this_c +@@ -483,8 +483,9 @@ static inline struct task_struct *this_c to be executed on some cpu at least once after this. * If the tasklet is already scheduled, but its execution is still not started, it will be executed only once. @@ -56,7 +56,7 @@ Signed-off-by: Thomas Gleixner * Tasklet is strictly serialized wrt itself, but not wrt another tasklets. If client needs some intertask synchronization, he makes it with spinlocks. -@@ -508,27 +509,36 @@ struct tasklet_struct name = { NULL, 0, +@@ -509,27 +510,36 @@ struct tasklet_struct name = { NULL, 0, enum { TASKLET_STATE_SCHED, /* Tasklet is scheduled for execution */ @@ -99,7 +99,7 @@ Signed-off-by: Thomas Gleixner #define tasklet_unlock_wait(t) do { } while (0) #define tasklet_unlock(t) do { } while (0) #endif -@@ -577,12 +587,7 @@ static inline void tasklet_disable(struc +@@ -578,12 +588,7 @@ static inline void tasklet_disable(struc smp_mb(); } diff --git a/debian/patches/features/all/rt/tasklist-lock-fix-section-conflict.patch b/debian/patches/features/all/rt/tasklist-lock-fix-section-conflict.patch index dbeaaf569..65ebe8a90 100644 --- a/debian/patches/features/all/rt/tasklist-lock-fix-section-conflict.patch +++ b/debian/patches/features/all/rt/tasklist-lock-fix-section-conflict.patch @@ -1,7 +1,7 @@ Subject: rwlocks: Fix section mismatch From: John Kacur Date: Mon, 19 Sep 2011 11:09:27 +0200 (CEST) -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz This fixes the following build error for the preempt-rt kernel. diff --git a/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch b/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch index b295b821b..4f06feec8 100644 --- a/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch +++ b/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch @@ -1,7 +1,7 @@ From: Daniel Wagner Date: Tue, 17 Feb 2015 09:37:44 +0100 Subject: thermal: Defer thermal wakups to threads -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On RT the spin lock in pkg_temp_thermal_platfrom_thermal_notify will call schedule while we run in irq context. diff --git a/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch b/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch index f05e39fd1..eaad2a494 100644 --- a/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch +++ b/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch @@ -1,7 +1,7 @@ Subject: timekeeping: Split jiffies seqlock From: Thomas Gleixner Date: Thu, 14 Feb 2013 22:36:59 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Replace jiffies_lock seqlock with a simple seqcounter and a rawlock so it can be taken in atomic context on RT. diff --git a/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch b/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch index 3ee5bee00..948c765aa 100644 --- a/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch +++ b/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch @@ -1,7 +1,7 @@ From: Peter Zijlstra Date: Fri, 21 Aug 2009 11:56:45 +0200 Subject: timer: delay waking softirqs from the jiffy tick -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz People were complaining about broken balancing with the recent -rt series. diff --git a/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch b/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch index 51d9179dd..4a4b6f447 100644 --- a/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch +++ b/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch @@ -1,7 +1,7 @@ Subject: timer-fd: Prevent live lock From: Thomas Gleixner Date: Wed, 25 Jan 2012 11:08:40 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz If hrtimer_try_to_cancel() requires a retry, then depending on the priority setting te retry loop might prevent timer callback completion diff --git a/debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch b/debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch index 784a94995..d55f97d41 100644 --- a/debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch +++ b/debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch @@ -1,7 +1,7 @@ Subject: timers: Avoid the switch timers base set to NULL trick on RT From: Thomas Gleixner Date: Thu, 21 Jul 2011 15:23:39 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz On RT that code is preemptible, so we cannot assign NULL to timers base as a preempter would spin forever in lock_timer_base(). diff --git a/debian/patches/features/all/rt/timers-preempt-rt-support.patch b/debian/patches/features/all/rt/timers-preempt-rt-support.patch index 4902adaa3..3a473c8b6 100644 --- a/debian/patches/features/all/rt/timers-preempt-rt-support.patch +++ b/debian/patches/features/all/rt/timers-preempt-rt-support.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:20 -0500 Subject: timers: Preempt-rt support -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The base->lock is a sleeping lock. Try not to workaround with a spin_trylock(). The rt-mutex lock is not irq save even the try-lock @@ -30,7 +30,7 @@ Signed-off-by: Thomas Gleixner + * the base lock to check when the next timer is pending and so + * we assume the next jiffy. + */ -+ return basej; ++ return basem + TICK_NSEC; +#endif spin_lock(&base->lock); if (base->active_timers) { diff --git a/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch b/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch index bb41c11ce..23cbe7afe 100644 --- a/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch +++ b/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:34 -0500 Subject: timers: Prepare for full preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz When softirqs can be preempted we need to make sure that cancelling the timer from the active thread can not deadlock vs. a running timer @@ -13,8 +13,8 @@ Signed-off-by: Thomas Gleixner --- include/linux/timer.h | 2 +- kernel/sched/core.c | 9 +++++++-- - kernel/time/timer.c | 39 +++++++++++++++++++++++++++++++++++++-- - 3 files changed, 45 insertions(+), 5 deletions(-) + kernel/time/timer.c | 41 ++++++++++++++++++++++++++++++++++++++--- + 3 files changed, 46 insertions(+), 6 deletions(-) --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -101,6 +101,15 @@ Signed-off-by: Thomas Gleixner /** * del_timer - deactive a timer. * @timer: the timer to be deactivated +@@ -1063,7 +1093,7 @@ int try_to_del_timer_sync(struct timer_l + } + EXPORT_SYMBOL(try_to_del_timer_sync); + +-#ifdef CONFIG_SMP ++#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) + /** + * del_timer_sync - deactivate a timer and wait for the handler to finish. + * @timer: the timer to be deactivated @@ -1123,7 +1153,7 @@ int del_timer_sync(struct timer_list *ti int ret = try_to_del_timer_sync(timer); if (ret >= 0) diff --git a/debian/patches/features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch b/debian/patches/features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch new file mode 100644 index 000000000..eefb8beb1 --- /dev/null +++ b/debian/patches/features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch @@ -0,0 +1,38 @@ +From: Carsten Emde +Date: Tue, 5 Jan 2016 10:21:59 +0100 +Subject: trace/latency-hist: Consider new argument when probing the + sched_switch tracer +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz + +The sched_switch tracer has got a new argument. Fix the latency tracer +accordingly. + +Recently: c73464b1c843 ("sched/core: Fix trace_sched_switch()") since +v4.4-rc1. + +Signed-off-by: Carsten Emde +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/trace/latency_hist.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/kernel/trace/latency_hist.c ++++ b/kernel/trace/latency_hist.c +@@ -117,7 +117,7 @@ static char *wakeup_latency_hist_dir_sha + static notrace void probe_wakeup_latency_hist_start(void *v, + struct task_struct *p); + static notrace void probe_wakeup_latency_hist_stop(void *v, +- struct task_struct *prev, struct task_struct *next); ++ bool preempt, struct task_struct *prev, struct task_struct *next); + static notrace void probe_sched_migrate_task(void *, + struct task_struct *task, int cpu); + static struct enable_data wakeup_latency_enabled_data = { +@@ -907,7 +907,7 @@ static notrace void probe_wakeup_latency + } + + static notrace void probe_wakeup_latency_hist_stop(void *v, +- struct task_struct *prev, struct task_struct *next) ++ bool preempt, struct task_struct *prev, struct task_struct *next) + { + unsigned long flags; + int cpu = task_cpu(next); diff --git a/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch b/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch index 6283a8aa8..039ba9649 100644 --- a/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch +++ b/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Thu, 29 Sep 2011 12:24:30 -0500 Subject: tracing: Account for preempt off in preempt_schedule() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz The preempt_schedule() uses the preempt_disable_notrace() version because it can cause infinite recursion by the function tracer as diff --git a/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch b/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch index 025ddeab2..8f21c3ca6 100644 --- a/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch +++ b/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch @@ -1,7 +1,7 @@ Subject: net: Remove preemption disabling in netif_rx() From: Priyanka Jain Date: Thu, 17 May 2012 09:35:11 +0530 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz 1)enqueue_to_backlog() (called from netif_rx) should be bind to a particluar CPU. This can be achieved by @@ -38,7 +38,7 @@ Signed-off-by: Thomas Gleixner --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3540,7 +3540,7 @@ static int netif_rx_internal(struct sk_b +@@ -3575,7 +3575,7 @@ static int netif_rx_internal(struct sk_b struct rps_dev_flow voidflow, *rflow = &voidflow; int cpu; @@ -47,7 +47,7 @@ Signed-off-by: Thomas Gleixner rcu_read_lock(); cpu = get_rps_cpu(skb->dev, skb, &rflow); -@@ -3550,13 +3550,13 @@ static int netif_rx_internal(struct sk_b +@@ -3585,13 +3585,13 @@ static int netif_rx_internal(struct sk_b ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); rcu_read_unlock(); diff --git a/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch b/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch index 0bb72af50..f2f7329bc 100644 --- a/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch +++ b/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 8 Nov 2013 17:34:54 +0100 Subject: usb: Use _nort in giveback function -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Since commit 94dfd7ed ("USB: HCD: support giveback of URB in tasklet context") I see diff --git a/debian/patches/features/all/rt/user-use-local-irq-nort.patch b/debian/patches/features/all/rt/user-use-local-irq-nort.patch index fcf0a910a..d0557a8fb 100644 --- a/debian/patches/features/all/rt/user-use-local-irq-nort.patch +++ b/debian/patches/features/all/rt/user-use-local-irq-nort.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 21 Jul 2009 23:06:05 +0200 Subject: core: Do not disable interrupts on RT in kernel/users.c -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use the local_irq_*_nort variants to reduce latencies in RT. The code is serialized by the locks. No need to disable interrupts. diff --git a/debian/patches/features/all/rt/vtime-split-lock-and-seqcount.patch b/debian/patches/features/all/rt/vtime-split-lock-and-seqcount.patch index e5d5723a7..f628ab206 100644 --- a/debian/patches/features/all/rt/vtime-split-lock-and-seqcount.patch +++ b/debian/patches/features/all/rt/vtime-split-lock-and-seqcount.patch @@ -1,7 +1,7 @@ Subject: vtime: Split lock and seqcount From: Thomas Gleixner Date: Tue, 23 Jul 2013 15:45:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Replace vtime_seqlock seqlock with a simple seqcounter and a rawlock so it can taken in atomic context on RT. diff --git a/debian/patches/features/all/rt/wait-simple-implementation.patch b/debian/patches/features/all/rt/wait-simple-implementation.patch index 3806f8f62..ad0f75da4 100644 --- a/debian/patches/features/all/rt/wait-simple-implementation.patch +++ b/debian/patches/features/all/rt/wait-simple-implementation.patch @@ -12,7 +12,7 @@ should go mainline as well, as it lowers memory consumption and runtime overhead. Signed-off-by: Thomas Gleixner -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz smp_mb() added by Steven Rostedt to fix a race condition with swait wakeups vs adding items to the list. diff --git a/debian/patches/features/all/rt/wait.h-include-atomic.h.patch b/debian/patches/features/all/rt/wait.h-include-atomic.h.patch index bdfbb528d..919433997 100644 --- a/debian/patches/features/all/rt/wait.h-include-atomic.h.patch +++ b/debian/patches/features/all/rt/wait.h-include-atomic.h.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 28 Oct 2013 12:19:57 +0100 Subject: wait.h: include atomic.h -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz | CC init/main.o |In file included from include/linux/mmzone.h:9:0, diff --git a/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch b/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch index f2fa2308c..552b34a0c 100644 --- a/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch +++ b/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Mon, 01 Jul 2013 11:02:42 +0200 Subject: workqueue: Prevent workqueue versus ata-piix livelock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz An Intel i7 system regularly detected rcu_preempt stalls after the kernel was upgraded from 3.6-rt to 3.8-rt. When the stall happened, disk I/O was no diff --git a/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch b/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch index 41f64e821..f067f1484 100644 --- a/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch +++ b/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch @@ -1,7 +1,7 @@ From: Daniel Wagner Date: Fri, 11 Jul 2014 15:26:11 +0200 Subject: work-simple: Simple work queue implemenation -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Provides a framework for enqueuing callbacks from irq context PREEMPT_RT_FULL safe. The callbacks are executed in kthread context. diff --git a/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch b/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch index 05d0bee8b..7f70ef7e5 100644 --- a/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch +++ b/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch @@ -22,7 +22,7 @@ Cc: Jens Axboe Cc: Linus Torvalds Link: http://lkml.kernel.org/r/20110622174919.135236139@linutronix.de Signed-off-by: Thomas Gleixner -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz --- kernel/sched/core.c | 80 ++++++++------------------------------------ @@ -32,7 +32,7 @@ Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2. --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -1744,10 +1744,6 @@ static inline void ttwu_activate(struct +@@ -1735,10 +1735,6 @@ static inline void ttwu_activate(struct { activate_task(rq, p, en_flags); p->on_rq = TASK_ON_RQ_QUEUED; @@ -43,7 +43,7 @@ Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2. } /* -@@ -2064,52 +2060,6 @@ try_to_wake_up(struct task_struct *p, un +@@ -2055,52 +2051,6 @@ try_to_wake_up(struct task_struct *p, un } /** @@ -96,7 +96,7 @@ Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2. * wake_up_process - Wake up a specific process * @p: The process to be woken up. * -@@ -3343,21 +3293,6 @@ static void __sched notrace __schedule(b +@@ -3282,21 +3232,6 @@ static void __sched notrace __schedule(b } else { deactivate_task(rq, prev, DEQUEUE_SLEEP); prev->on_rq = 0; @@ -118,7 +118,7 @@ Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2. } switch_count = &prev->nvcsw; } -@@ -3390,6 +3325,14 @@ static inline void sched_submit_work(str +@@ -3329,6 +3264,14 @@ static inline void sched_submit_work(str { if (!tsk->state || tsk_is_pi_blocked(tsk)) return; @@ -133,7 +133,7 @@ Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2. /* * If we are going to sleep and we have plugged IO queued, * make sure to submit it to avoid deadlocks. -@@ -3398,6 +3341,12 @@ static inline void sched_submit_work(str +@@ -3337,6 +3280,12 @@ static inline void sched_submit_work(str blk_schedule_flush_plug(tsk); } @@ -146,7 +146,7 @@ Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2. asmlinkage __visible void __sched schedule(void) { struct task_struct *tsk = current; -@@ -3408,6 +3357,7 @@ asmlinkage __visible void __sched schedu +@@ -3347,6 +3296,7 @@ asmlinkage __visible void __sched schedu __schedule(false); sched_preempt_enable_no_resched(); } while (need_resched()); diff --git a/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch b/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch index ccfea9697..b00382d71 100644 --- a/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch +++ b/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch @@ -1,7 +1,7 @@ Subject: workqueue: Prevent deadlock/stall on RT From: Thomas Gleixner Date: Fri, 27 Jun 2014 16:24:52 +0200 (CEST) -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Austin reported a XFS deadlock/stall on RT where scheduled work gets never exececuted and tasks are waiting for each other for ever. @@ -44,7 +44,7 @@ Cc: Steven Rostedt --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -3439,9 +3439,8 @@ static void __sched notrace __schedule(b +@@ -3378,9 +3378,8 @@ static void __sched notrace __schedule(b static inline void sched_submit_work(struct task_struct *tsk) { @@ -55,7 +55,7 @@ Cc: Steven Rostedt /* * If a worker went to sleep, notify and ask workqueue whether * it wants to wake up a task to maintain concurrency. -@@ -3449,6 +3448,10 @@ static inline void sched_submit_work(str +@@ -3388,6 +3387,10 @@ static inline void sched_submit_work(str if (tsk->flags & PF_WQ_WORKER) wq_worker_sleeping(tsk); diff --git a/debian/patches/features/all/rt/workqueue-use-locallock.patch b/debian/patches/features/all/rt/workqueue-use-locallock.patch index a062e3013..544d1a520 100644 --- a/debian/patches/features/all/rt/workqueue-use-locallock.patch +++ b/debian/patches/features/all/rt/workqueue-use-locallock.patch @@ -1,7 +1,7 @@ Subject: workqueue: Use local irq lock instead of irq disable regions From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:42:26 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Use a local_irq_lock as a replacement for irq off regions. We keep the semantic of irq-off in regard to the pool->lock and remain preemptible. diff --git a/debian/patches/features/all/rt/workqueue-use-rcu.patch b/debian/patches/features/all/rt/workqueue-use-rcu.patch index 9a78a0382..173bca09a 100644 --- a/debian/patches/features/all/rt/workqueue-use-rcu.patch +++ b/debian/patches/features/all/rt/workqueue-use-rcu.patch @@ -1,7 +1,7 @@ Subject: workqueue: Use normal rcu From: Thomas Gleixner Date: Wed, 24 Jul 2013 15:26:54 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz There is no need for sched_rcu. The undocumented reason why sched_rcu is used is to avoid a few explicit rcu_read_lock()/unlock() pairs by diff --git a/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch b/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch index f209c3b82..04641d465 100644 --- a/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch +++ b/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Sun, 2 Nov 2014 08:31:37 +0100 Subject: x86: UV: raw_spinlock conversion -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Shrug. Lots of hobbyists have a beast in their basement, right? diff --git a/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch b/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch index 833cd8c86..40a2f63d5 100644 --- a/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch +++ b/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch @@ -1,7 +1,7 @@ Subject: x86: crypto: Reduce preempt disabled regions From: Peter Zijlstra Date: Mon, 14 Nov 2011 18:19:27 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Restrict the preempt disabled regions to the actual floating point operations and enable preemption for the administrative actions. diff --git a/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch b/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch index d7c19fb6f..768f076fc 100644 --- a/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch +++ b/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 11 Mar 2013 17:09:55 +0100 Subject: x86/highmem: Add a "already used pte" check -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz This is a copy from kmap_atomic_prot(). diff --git a/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch b/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch index 1c1ae2d59..b87c9b58f 100644 --- a/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch +++ b/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:27 -0500 Subject: x86/ioapic: Do not unmask io_apic when interrupt is in progress -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz With threaded interrupts we might see an interrupt in progress on migration. Do not unmask it when this is the case. diff --git a/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch b/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch index 7cf458aff..5348c230c 100644 --- a/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch +++ b/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch @@ -1,7 +1,7 @@ Subject: x86: kvm Require const tsc for RT From: Thomas Gleixner Date: Sun, 06 Nov 2011 12:26:18 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Non constant TSC is a nightmare on bare metal already, but with virtualization it becomes a complete disaster because the workarounds diff --git a/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch b/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch index 612427b03..b19afe8b6 100644 --- a/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch +++ b/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Mon, 13 Dec 2010 16:33:39 +0100 Subject: x86: Convert mce timer to hrtimer -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz mce_timer is started in atomic contexts of cpu bringup. This results in might_sleep() warnings on RT. Convert mce_timer to a hrtimer to diff --git a/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch b/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch index d11b3f209..7ad7c715c 100644 --- a/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch +++ b/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch @@ -1,7 +1,7 @@ Subject: x86/mce: use swait queue for mce wakeups From: Steven Rostedt Date: Fri, 27 Feb 2015 15:20:37 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz We had a customer report a lockup on a 3.0-rt kernel that had the following backtrace: diff --git a/debian/patches/features/all/rt/x86-preempt-lazy.patch b/debian/patches/features/all/rt/x86-preempt-lazy.patch index a6422557b..0ab1b688e 100644 --- a/debian/patches/features/all/rt/x86-preempt-lazy.patch +++ b/debian/patches/features/all/rt/x86-preempt-lazy.patch @@ -1,19 +1,19 @@ Subject: x86: Support for lazy preemption From: Thomas Gleixner Date: Thu, 01 Nov 2012 11:03:47 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Implement the x86 pieces for lazy preempt. Signed-off-by: Thomas Gleixner --- arch/x86/Kconfig | 1 + - arch/x86/entry/common.c | 2 +- + arch/x86/entry/common.c | 4 ++-- arch/x86/entry/entry_32.S | 16 ++++++++++++++++ arch/x86/entry/entry_64.S | 16 ++++++++++++++++ arch/x86/include/asm/thread_info.h | 6 ++++++ arch/x86/kernel/asm-offsets.c | 2 ++ - 6 files changed, 42 insertions(+), 1 deletion(-) + 6 files changed, 43 insertions(+), 2 deletions(-) --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -27,6 +27,15 @@ Signed-off-by: Thomas Gleixner select ANON_INODES --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c +@@ -220,7 +220,7 @@ long syscall_trace_enter(struct pt_regs + + #define EXIT_TO_USERMODE_LOOP_FLAGS \ + (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ +- _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY) ++ _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY) + + static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags) + { @@ -236,7 +236,7 @@ static void exit_to_usermode_loop(struct /* We have work to do. */ local_irq_enable(); diff --git a/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch b/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch index f6062baf8..3b7b01ca2 100644 --- a/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch +++ b/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch @@ -1,7 +1,7 @@ From: Yang Shi Date: Thu, 10 Dec 2015 10:58:51 -0800 Subject: x86/signal: delay calling signals on 32bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz When running some ptrace single step tests on x86-32 machine, the below problem is triggered: diff --git a/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch b/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch index 43a60e495..82a1def60 100644 --- a/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch +++ b/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 16 Dec 2010 14:25:18 +0100 Subject: x86: stackprotector: Avoid random pool on rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz CPU bringup calls into the random pool to initialize the stack canary. During boot that works nicely even on RT as the might sleep diff --git a/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch b/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch index 8bf1b02f1..4dfb55999 100644 --- a/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch +++ b/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 26 Jul 2009 02:21:32 +0200 Subject: x86: Use generic rwsem_spinlocks on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt2.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patches-4.4-rt3.tar.xz Simplifies the separation of anon_rw_semaphores and rw_semaphores for -rt. diff --git a/debian/patches/series-rt b/debian/patches/series-rt index b72e03e8d..d81c2c4e0 100644 --- a/debian/patches/series-rt +++ b/debian/patches/series-rt @@ -13,6 +13,11 @@ ############################################################ # Stuff broken upstream, patches submitted ############################################################ +features/all/rt/btrfs-initialize-the-seq-counter-in-struct-btrfs_dev.patch +features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch +features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch +features/all/rt/drivers-cpuidle-coupled-fix-warning-cpuidle_coupled_.patch +features/all/rt/drivers-media-vsp1_video-fix-compile-error.patch ############################################################ # Stuff which needs addressing upstream, but requires more @@ -63,7 +68,6 @@ features/all/rt/kernel-SRCU-provide-a-static-initializer.patch ############################################################ # Stuff which should go upstream ASAP ############################################################ -features/all/rt/0009-ARM-OMAP2-Drop-the-concept-of-certain-power-domains-.patch # SCHED BLOCK/WQ features/all/rt/block-shorten-interrupt-disabled-regions.patch @@ -135,6 +139,8 @@ features/all/rt/pci-access-use-__wake_up_all_locked.patch # TRACING features/all/rt/latency-hist.patch +features/all/rt/latency_hist-update-sched_wakeup-probe.patch +features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch # HW LATENCY DETECTOR - this really wants a rewrite features/all/rt/hwlatdetect.patch @@ -227,7 +233,6 @@ features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch features/all/rt/mm-memcontrol-do_not_disable_irq.patch -features/all/rt/mm-rmap-retry-lock-check-in-anon_vma_free.patch_vma_free.patch # RADIX TREE features/all/rt/radix-tree-rt-aware.patch @@ -294,6 +299,7 @@ features/all/rt/softirq-preempt-fix-3-re.patch features/all/rt/softirq-disable-softirq-stacks-for-rt.patch features/all/rt/softirq-split-locks.patch features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch +features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch features/all/rt/rtmutex-trylock-is-okay-on-RT.patch # RAID5 @@ -319,6 +325,8 @@ features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch # RTMUTEX Fallout features/all/rt/tasklist-lock-fix-section-conflict.patch +#fold +features/all/rt/ptrace-don-t-open-IRQs-in-ptrace_freeze_traced-too-e.patch # RCU features/all/rt/peter_zijlstra-frob-rcu.patch @@ -407,6 +415,14 @@ features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt features/all/rt/skbufhead-raw-lock.patch features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch +features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch +features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch + +# NETWORK livelock fix +features/all/rt/net-tx-action-avoid-livelock-on-rt.patch + +# NETWORK DEBUGGING AID +features/all/rt/ping-sysrq.patch # irqwork features/all/rt/irqwork-push_most_work_into_softirq_context.patch @@ -432,12 +448,6 @@ features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch # ARM64 features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch -# NETWORK livelock fix -features/all/rt/net-tx-action-avoid-livelock-on-rt.patch - -# NETWORK DEBUGGING AID -features/all/rt/ping-sysrq.patch - # KGDB features/all/rt/kgb-serial-hackaround.patch @@ -501,6 +511,7 @@ features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-conte # NET features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch +features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch features/all/rt/net-make-devnet_rename_seq-a-mutex.patch @@ -521,10 +532,12 @@ features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch # PREEMPT LAZY features/all/rt/preempt-lazy-support.patch +features/all/rt/preempt-lazy-check-preempt_schedule.patch features/all/rt/x86-preempt-lazy.patch features/all/rt/arm-preempt-lazy-support.patch features/all/rt/powerpc-preempt-lazy-support.patch features/all/rt/arch-arm64-Add-lazy-preempt-support.patch +features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch # LEDS features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch @@ -553,9 +566,5 @@ features/all/rt/md-disable-bcache.patch # WORKQUEUE SIGH features/all/rt/workqueue-prevent-deadlock-stall.patch -# TRACING -features/all/rt/latency_hist-update-sched_wakeup-probe.patch -features/all/rt/latency_hist-update-sched_switch-probe.patch - # Add RT to version features/all/rt/localversion.patch