Skip to content
Snippets Groups Projects
Unverified Commit 28164178 authored by TAKIZAWA Fumiya's avatar TAKIZAWA Fumiya
Browse files

Add patches to avoid bootloop

parent 4fae5682
No related branches found
No related tags found
No related merge requests found
Showing with 367 additions and 1 deletion
From 7fc383ecf3a8913dfb89fb7e6a4d2e9376f91fcd Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sat, 9 May 2020 23:58:39 +0900
Subject: [PATCH 1/6] Revert "tty: check before stopping kthread"
This reverts commit d74871d364a32d28c70eb9f521807d8ca6e1968e.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/tty_buffer.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 92af201f9030..8917b6f87b04 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -132,8 +132,7 @@ void tty_buffer_free_all(struct tty_port *port)
buf->tail = &buf->sentinel;
atomic_set(&buf->mem_used, 0);
- if (!IS_ERR_OR_NULL(port->worker_thread))
- kthread_stop(port->worker_thread);
+ kthread_stop(port->worker_thread);
}
/**
--
2.26.2
From d2b77ffe10854d1aa3d68c1c346a7d003faa50ca Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sat, 9 May 2020 23:59:08 +0900
Subject: [PATCH 2/6] Revert "tty: move tty_port workqueue to be a kthread"
This reverts commit 6504bb3e934293960287fcf31aba8fd58407d22a.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/tty_buffer.c | 27 +++++++--------------------
include/linux/tty.h | 6 ++----
2 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 8917b6f87b04..4706df20191b 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -71,7 +71,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port)
atomic_dec(&buf->priority);
mutex_unlock(&buf->lock);
if (restart)
- queue_kthread_work(&port->worker, &buf->work);
+ queue_work(system_unbound_wq, &buf->work);
}
EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive);
@@ -132,7 +132,6 @@ void tty_buffer_free_all(struct tty_port *port)
buf->tail = &buf->sentinel;
atomic_set(&buf->mem_used, 0);
- kthread_stop(port->worker_thread);
}
/**
@@ -405,7 +404,7 @@ void tty_schedule_flip(struct tty_port *port)
* flush_to_ldisc() sees buffer data.
*/
smp_store_release(&buf->tail->commit, buf->tail->used);
- queue_kthread_work(&port->worker, &buf->work);
+ queue_work(system_unbound_wq, &buf->work);
}
EXPORT_SYMBOL(tty_schedule_flip);
@@ -473,7 +472,7 @@ receive_buf(struct tty_struct *tty, struct tty_buffer *head, int count)
* 'consumer'
*/
-static void flush_to_ldisc(struct kthread_work *work)
+static void flush_to_ldisc(struct work_struct *work)
{
struct tty_port *port = container_of(work, struct tty_port, buf.work);
struct tty_bufhead *buf = &port->buf;
@@ -563,20 +562,8 @@ void tty_buffer_init(struct tty_port *port)
init_llist_head(&buf->free);
atomic_set(&buf->mem_used, 0);
atomic_set(&buf->priority, 0);
+ INIT_WORK(&buf->work, flush_to_ldisc);
buf->mem_limit = TTYB_DEFAULT_MEM_LIMIT;
- init_kthread_work(&buf->work, flush_to_ldisc);
- init_kthread_worker(&port->worker);
- port->worker_thread = kthread_run(kthread_worker_fn, &port->worker,
- "tty_worker_thread");
- if (IS_ERR(port->worker_thread)) {
- /*
- * Not good, we can't unwind, this tty is going to be really
- * sad...
- */
- pr_err("Unable to start tty_worker_thread\n");
- }
-
-
}
/**
@@ -604,15 +591,15 @@ void tty_buffer_set_lock_subclass(struct tty_port *port)
bool tty_buffer_restart_work(struct tty_port *port)
{
- return queue_kthread_work(&port->worker, &port->buf.work);
+ return queue_work(system_unbound_wq, &port->buf.work);
}
bool tty_buffer_cancel_work(struct tty_port *port)
{
- return kthread_cancel_work_sync(&port->buf.work);
+ return cancel_work_sync(&port->buf.work);
}
void tty_buffer_flush_work(struct tty_port *port)
{
- flush_kthread_work(&port->buf.work);
+ flush_work(&port->buf.work);
}
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1c1bb90f6819..99165b4e6a7b 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -12,7 +12,7 @@
#include <uapi/linux/tty.h>
#include <linux/rwsem.h>
#include <linux/llist.h>
-#include <linux/kthread.h>
+
/*
* Lock subclasses for tty locks
@@ -82,7 +82,7 @@ static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
struct tty_bufhead {
struct tty_buffer *head; /* Queue head */
- struct kthread_work work;
+ struct work_struct work;
struct mutex lock;
atomic_t priority;
struct tty_buffer sentinel;
@@ -240,8 +240,6 @@ struct tty_port {
based drain is needed else
set to size of fifo */
struct kref kref; /* Ref counter */
- struct kthread_worker worker; /* worker thread */
- struct task_struct *worker_thread; /* worker thread */
};
/*
--
2.26.2
From 7a30026cccdf446246b39c3d4bb1fc5c26f2b5bf Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sun, 10 May 2020 00:00:14 +0900
Subject: [PATCH 3/6] Revert "tty: add tty_port_set_policy function"
This reverts commit 115aa3ef849b1c34cdc2f61c5aac3df22a8e1964.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/tty_port.c | 10 ----------
include/linux/tty.h | 2 --
2 files changed, 12 deletions(-)
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 9f06fc11bc5f..482f33f20043 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -16,7 +16,6 @@
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/module.h>
-#include <uapi/linux/sched.h>
void tty_port_init(struct tty_port *port)
{
@@ -599,12 +598,3 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
}
EXPORT_SYMBOL(tty_port_open);
-
-int tty_port_set_policy(struct tty_port *port, int policy, int sched_priority)
-{
- struct sched_param param = { .sched_priority = sched_priority };
-
- return sched_setscheduler(port->worker_thread, policy, &param);
-}
-EXPORT_SYMBOL_GPL(tty_port_set_policy);
-
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 99165b4e6a7b..812cdd8cff22 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -580,8 +580,6 @@ static inline int tty_port_users(struct tty_port *port)
{
return port->count + port->blocked_open;
}
-extern int tty_port_set_policy(struct tty_port *port, int policy,
- int sched_priority);
extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
extern int tty_unregister_ldisc(int disc);
--
2.26.2
From d0d3339500f7b50461492f934b08b953b6a1ba54 Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sun, 10 May 2020 00:00:32 +0900
Subject: [PATCH 4/6] Revert "msm_serial_hs: make the Bluetooth tty thread RT"
This reverts commit f5c9ea68f5c91907e406228710582ef3c23dbe39.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/serial/msm_serial_hs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
index c699a662d0a9..1ea54d00e23e 100644
--- a/drivers/tty/serial/msm_serial_hs.c
+++ b/drivers/tty/serial/msm_serial_hs.c
@@ -62,7 +62,6 @@
#include <linux/ipc_logging.h>
#include <asm/irq.h>
#include <linux/kthread.h>
-#include <uapi/linux/sched.h>
#include <linux/msm-sps.h>
#include <linux/platform_data/msm_serial_hs.h>
@@ -3386,7 +3385,6 @@ static void msm_serial_hs_rt_init(struct uart_port *uport)
msm_uport->pm_state = MSM_HS_PM_SUSPENDED;
mutex_unlock(&msm_uport->mtx);
pm_runtime_enable(uport->dev);
- tty_port_set_policy(&uport->state->port, SCHED_FIFO, 1);
}
static int msm_hs_runtime_suspend(struct device *dev)
--
2.26.2
From a324fdc2d86c1c4ca091cfa7ece2899e57c49c3f Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sat, 9 May 2020 23:17:52 +0900
Subject: [PATCH 6/6] Add condition for calling mdss_fb_free_fb_ion_memory()
Vendor code release memory when closing framebuffer device.
It causes ENODEV and so on.
eg.
$ cat /dev/random > /dev/fb0
ash: write error: No such device
In order to prevent this behavior, add condition for calling mdss_fb_free_fb_ion_memory() in mdss_fb_release_all().
---
drivers/video/fbdev/msm/mdss_fb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index acf6d8f77bc8..2c9578ff8cfa 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -2937,8 +2937,10 @@ static int mdss_fb_release_all(struct fb_info *info, bool release_all)
mfd->index, ret, task->comm, current->tgid);
return ret;
}
- if (mfd->fb_ion_handle)
+ if (release_all && mfd->fb_ion_handle) {
+ printk("mdss_fb_release_all: release_ion_memory");
mdss_fb_free_fb_ion_memory(mfd);
+ }
atomic_set(&mfd->ioctl_ref_cnt, 0);
} else {
--
2.26.2
......@@ -23,6 +23,13 @@ source="
$_config
cc-option_wrapper_Wno-frame-larger.patch
f_fs_module_inittest.patch
0001-Revert-tty-check-before-stopping-kthread.patch
0002-Revert-tty-move-tty_port-workqueue-to-be-a-kthread.patch
0003-Revert-tty-add-tty_port_set_policy-function.patch
0004-Revert-msm_serial_hs-make-the-Bluetooth-tty-thread-R.patch
0006-Add-condition-for-calling-mdss_fb_free_fb_ion_memory.patch
init-ignore-dm-parameter.patch
init-initramfs-disable-do_skip_initramfs.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
......@@ -45,4 +52,11 @@ package() {
sha512sums="7d0d937c3482eaf2e30f5de29b62398201203d29674003980774d227896343d870e6f0f821a78489d7d5d76ce11d9d002e84ea471a72f193c5fc9b2b90c6173c linux-essential-mata-d13a367745bb75601f7346d4d9d7525a6ca6e332.tar.gz
481b67dc9e9d127f1204e0eb57231a2d396fea9479342a24726035d77422dfbedd51ea521533a6eb62031dded0ef933b8afa12e7db5fe51abebebd2d61bb5eba config-essential-mata.aarch64
9326ec6cdd89ca093c690ccafb4ceb0d4835063f672b74205997ea9dffe9e45b923e772be7c0daaa9fb2b71377e9b8519db9efd259404f28238cadd8431b4b45 cc-option_wrapper_Wno-frame-larger.patch
c3968546a3cdd0abe0c7f32fcbdefeb7ca2b7f7507ad1d1ca214ac65a3a5ce930ca471024f5abd92e33a22801caffbfa5bb16e106479c0dec09eb1b60094ba3a f_fs_module_inittest.patch"
c3968546a3cdd0abe0c7f32fcbdefeb7ca2b7f7507ad1d1ca214ac65a3a5ce930ca471024f5abd92e33a22801caffbfa5bb16e106479c0dec09eb1b60094ba3a f_fs_module_inittest.patch
1a8cb6ed2cc9b81815160ec990c16385cbe94d71e1607c5968c24a5fa653128fc3e25dfdac861b03faa163d612251814d4c59f4c083258c0d9964c74504c462d 0001-Revert-tty-check-before-stopping-kthread.patch
892a5414647ba609741382bea12de9e2731481fd109bc8febcf77210e1a8d672f22588b5086f27ec32d87b9aea1b0ab1a9e0556f7bd11ddcdfd6ab8b6a1904b0 0002-Revert-tty-move-tty_port-workqueue-to-be-a-kthread.patch
94d8c6a9009fca6484d12cef0698b6e219a09bd82b9ed20eb109467f141514aa9f418988470e658ab340710fb910337645cc772ebe2e59547d329e0c35c9a2a6 0003-Revert-tty-add-tty_port_set_policy-function.patch
89401939fbedfe4719de4706a09702504a92e171806788e597513b7dfca763f4a345895f963b300840fa126c628b43dc3836cf5b3958667b1e6993c1ef0e973e 0004-Revert-msm_serial_hs-make-the-Bluetooth-tty-thread-R.patch
f226a33de5ca4b5919465bee3a2e68e2bfe376c56afcb2884d72d57d4a3c1a0627f1f71c0d4d28e7bf4b3e3cc4fb4122c2e3aeeb9637c41390d95fa9f5495a89 0006-Add-condition-for-calling-mdss_fb_free_fb_ion_memory.patch
66ac924e2619994dad71a88223d62e911cc90c20f578eb1b0544f115de8367ea9767e7955245c70699f7af040bb8c42f9fa7aff60d4638f1e568a3b3662d30a6 init-ignore-dm-parameter.patch
0f536e5acd0f5e6d6774918d8e226ae1f4edc486596fc5c93a110b4eb2555e0f1281f460065928a7f7a272b886f61f7967fe60cc4952ed1f4b37143bd2a28962 init-initramfs-disable-do_skip_initramfs.patch"
From 9eb681bb5e4166553fee08c2ff2aebae76f0e727 Mon Sep 17 00:00:00 2001
From: Zhuowei Zhang <linux@worthdoingbadly.com>
Date: Sat, 8 Dec 2018 00:42:49 -0800
Subject: [PATCH] init: ignore dm= parameter
The commit "CHROMIUM: dm: boot time specification of dm="
(a058da83727d9f3df84c956d9b29d775a2a9d45f) added a new boot
parameter for specifying dm partitions. This breaks postmarketOS's
root partition mounting.
Change the boot parameter to something the bootloader doesn't know
about.
Thanks to opendata26 for figuring this out.
---
init/do_mounts_dm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/do_mounts_dm.c b/init/do_mounts_dm.c
index 7760705faffe..628b6a0c66d8 100644
--- a/init/do_mounts_dm.c
+++ b/init/do_mounts_dm.c
@@ -459,7 +459,7 @@ static void __init dm_setup_drives(void)
dm_setup_cleanup(devices);
}
-__setup("dm=", dm_setup);
+__setup("dm_IGNORE=", dm_setup);
void __init dm_run_setup(void)
{
--
2.17.1
From 75dedb7524818dfa9904417fe1e5ac0c40291d89 Mon Sep 17 00:00:00 2001
From: Zhuowei Zhang <linux@worthdoingbadly.com>
Date: Tue, 27 Nov 2018 14:24:17 -0800
Subject: [PATCH 2/2] init: initramfs: disable do_skip_initramfs
On Android devices with A/B partition scheme, the initramfs is
ignored when booting into the operating system. This breaks
postmarketOS, which requires the initramfs.
This reverts the change so the initramfs is always used.
Based on a patch by erfanoabdi.
---
init/initramfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/init/initramfs.c b/init/initramfs.c
index bf3af10c500a..34af892143b2 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -622,11 +622,13 @@ static int __init populate_rootfs(void)
{
char *err;
+ /*
if (do_skip_initramfs) {
if (initrd_start)
free_initrd();
return default_rootfs();
}
+ */
err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
if (err)
--
2.17.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment