From 6bc693c145e485a4883007566413979c3a96effe Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 4 Jan 2018 20:11:38 +0000 Subject: [PATCH 1/2] linux: revert softirq commit, temporarily fix DVB issues See: https://forum.libreelec.tv/thread/4235-dvb-issue-since-le-switched-to-kernel-4-9-x/?postID=75965#post75965 --- ...ert-softirq-let-ksoftirqd-do-its-job.patch | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch diff --git a/packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch b/packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch new file mode 100644 index 0000000000..bb87a670b3 --- /dev/null +++ b/packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch @@ -0,0 +1,54 @@ +From 3364d0056328b93fb10ab929ae99933af9e304ad Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Thu, 4 Jan 2018 19:56:05 +0000 +Subject: [PATCH] Revert "softirq: Let ksoftirqd do its job" + +See: https://forum.libreelec.tv/thread/4235-dvb-issue-since-le-switched-to-kernel-4-9-x/?postID=75965#post75965 +--- + kernel/softirq.c | 16 +--------------- + 1 file changed, 1 insertion(+), 15 deletions(-) + +diff --git a/kernel/softirq.c b/kernel/softirq.c +index 4e09821..58bb6f6 100644 +--- a/kernel/softirq.c ++++ b/kernel/softirq.c +@@ -77,17 +77,6 @@ static void wakeup_softirqd(void) + wake_up_process(tsk); + } + +-/* +- * If ksoftirqd is scheduled, we do not want to process pending softirqs +- * right now. Let ksoftirqd handle this at its own rate, to get fairness. +- */ +-static bool ksoftirqd_running(void) +-{ +- struct task_struct *tsk = __this_cpu_read(ksoftirqd); +- +- return tsk && (tsk->state == TASK_RUNNING); +-} +- + /* + * preempt_count and SOFTIRQ_OFFSET usage: + * - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving +@@ -324,7 +313,7 @@ asmlinkage __visible void do_softirq(void) + + pending = local_softirq_pending(); + +- if (pending && !ksoftirqd_running()) ++ if (pending) + do_softirq_own_stack(); + + local_irq_restore(flags); +@@ -351,9 +340,6 @@ void irq_enter(void) + + static inline void invoke_softirq(void) + { +- if (ksoftirqd_running()) +- return; +- + if (!force_irqthreads) { + #ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK + /* +-- +2.14.1 + From b387b0c3f21f947ca4c96376fea3ce99f413863d Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 1 Feb 2018 09:27:31 +0000 Subject: [PATCH 2/2] linux: use Linus's commit to fix the ksoftirqd issues Ref: https://www.mail-archive.com/linux-media@vger.kernel.org/msg124351.html --- ...ert-softirq-let-ksoftirqd-do-its-job.patch | 54 ------------------- ...linus-commit-to-fix-ksoftirqd-issues.patch | 53 ++++++++++++++++++ 2 files changed, 53 insertions(+), 54 deletions(-) delete mode 100644 packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch create mode 100644 packages/linux/patches/default/linux-999-use-linus-commit-to-fix-ksoftirqd-issues.patch diff --git a/packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch b/packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch deleted file mode 100644 index bb87a670b3..0000000000 --- a/packages/linux/patches/default/linux-999-revert-softirq-let-ksoftirqd-do-its-job.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 3364d0056328b93fb10ab929ae99933af9e304ad Mon Sep 17 00:00:00 2001 -From: MilhouseVH -Date: Thu, 4 Jan 2018 19:56:05 +0000 -Subject: [PATCH] Revert "softirq: Let ksoftirqd do its job" - -See: https://forum.libreelec.tv/thread/4235-dvb-issue-since-le-switched-to-kernel-4-9-x/?postID=75965#post75965 ---- - kernel/softirq.c | 16 +--------------- - 1 file changed, 1 insertion(+), 15 deletions(-) - -diff --git a/kernel/softirq.c b/kernel/softirq.c -index 4e09821..58bb6f6 100644 ---- a/kernel/softirq.c -+++ b/kernel/softirq.c -@@ -77,17 +77,6 @@ static void wakeup_softirqd(void) - wake_up_process(tsk); - } - --/* -- * If ksoftirqd is scheduled, we do not want to process pending softirqs -- * right now. Let ksoftirqd handle this at its own rate, to get fairness. -- */ --static bool ksoftirqd_running(void) --{ -- struct task_struct *tsk = __this_cpu_read(ksoftirqd); -- -- return tsk && (tsk->state == TASK_RUNNING); --} -- - /* - * preempt_count and SOFTIRQ_OFFSET usage: - * - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving -@@ -324,7 +313,7 @@ asmlinkage __visible void do_softirq(void) - - pending = local_softirq_pending(); - -- if (pending && !ksoftirqd_running()) -+ if (pending) - do_softirq_own_stack(); - - local_irq_restore(flags); -@@ -351,9 +340,6 @@ void irq_enter(void) - - static inline void invoke_softirq(void) - { -- if (ksoftirqd_running()) -- return; -- - if (!force_irqthreads) { - #ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK - /* --- -2.14.1 - diff --git a/packages/linux/patches/default/linux-999-use-linus-commit-to-fix-ksoftirqd-issues.patch b/packages/linux/patches/default/linux-999-use-linus-commit-to-fix-ksoftirqd-issues.patch new file mode 100644 index 0000000000..947c47620e --- /dev/null +++ b/packages/linux/patches/default/linux-999-use-linus-commit-to-fix-ksoftirqd-issues.patch @@ -0,0 +1,53 @@ +From 5839d34af2063552f83865fd5ebac651688087f9 Mon Sep 17 00:00:00 2001 +From: MilhouseVH +Date: Thu, 1 Feb 2018 09:25:19 +0000 +Subject: [PATCH] Fix issues introduced by ksoftirqd change + +--- + kernel/softirq.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/kernel/softirq.c b/kernel/softirq.c +index 4e09821..d6772be 100644 +--- a/kernel/softirq.c ++++ b/kernel/softirq.c +@@ -79,12 +79,16 @@ static void wakeup_softirqd(void) + + /* + * If ksoftirqd is scheduled, we do not want to process pending softirqs +- * right now. Let ksoftirqd handle this at its own rate, to get fairness. ++ * right now. Let ksoftirqd handle this at its own rate, to get fairness, ++ * unless we're doing some of the synchronous softirqs. + */ +-static bool ksoftirqd_running(void) ++#define SOFTIRQ_NOW_MASK ((1 << HI_SOFTIRQ) | (1 << TASKLET_SOFTIRQ)) ++static bool ksoftirqd_running(unsigned long pending) + { + struct task_struct *tsk = __this_cpu_read(ksoftirqd); + ++ if (pending & SOFTIRQ_NOW_MASK) ++ return false; + return tsk && (tsk->state == TASK_RUNNING); + } + +@@ -324,7 +328,7 @@ asmlinkage __visible void do_softirq(void) + + pending = local_softirq_pending(); + +- if (pending && !ksoftirqd_running()) ++ if (pending && !ksoftirqd_running(pending)) + do_softirq_own_stack(); + + local_irq_restore(flags); +@@ -351,7 +355,7 @@ void irq_enter(void) + + static inline void invoke_softirq(void) + { +- if (ksoftirqd_running()) ++ if (ksoftirqd_running(local_softirq_pending())) + return; + + if (!force_irqthreads) { +-- +2.14.1 +