mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 11:03:37 +03:00
217 lines
7.0 KiB
Diff
217 lines
7.0 KiB
Diff
From 5e58b2dc2a5c6ca6e4090ff1f14092a315f779f3 Mon Sep 17 00:00:00 2001
|
|
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
|
|
Date: Mon, 18 Nov 2019 20:23:14 -0500
|
|
Subject: [PATCH] Revert four tty-related commits
|
|
|
|
With these commits, CONFIG_VT fails early at boot:
|
|
|
|
```
|
|
[ 0.022380] c0 0 [<ffffff95d5af7ee0>] _raw_spin_lock_irqsave+0x1c/0x50^M
|
|
[ 0.022383] c0 0 [<ffffff95d4ad1614>] wake_up_process+0x14/0x1c^M
|
|
[ 0.022389] c0 0 [<ffffff95d4ac4ff0>] kthread_create_on_node+0xc0/0x1bc^M
|
|
[ 0.022395] c0 0 [<ffffff95d4f879d8>] tty_buffer_init+0xac/0xe4^M
|
|
[ 0.022399] c0 0 [<ffffff95d4f87b9c>] tty_port_init+0x28/0xa0^M
|
|
[ 0.022405] c0 0 [<ffffff95d68398d8>] con_init+0x124/0x228^M
|
|
[ 0.022408] c0 0 [<ffffff95d68391ac>] console_init+0x3c/0x40^M
|
|
[ 0.022413] c0 0 [<ffffff95d6800b04>] start_kernel+0x2f8/0x41c^M
|
|
[ 0.022417] c0 0 [<ffffff95d68001c4>] __primary_switched+0x30/0x8c^M
|
|
```
|
|
|
|
These commits were identified by looking at the changes using `tig log
|
|
HEAD...v4.4.201`, only for the files relevant to that stack trace.
|
|
|
|
The misfeature from these commits is an Android-ism, so it should not
|
|
affect a normal 4.4 GNU/Linux system in bad ways.
|
|
|
|
Revert "tty: check before stopping kthread"
|
|
|
|
This reverts commit b3b46e7ac9b8305d67442663b067750765fc075e.
|
|
|
|
Revert "tty: move tty_port workqueue to be a kthread"
|
|
|
|
This reverts commit b83aec1ef001201faa812f71e23ae30fdeded9d7.
|
|
|
|
Revert "tty: add tty_port_set_policy function"
|
|
|
|
This reverts commit 2794ede02f40029d8b10205c814dcfed993bdc6f.
|
|
|
|
Revert "msm_serial_hs: make the Bluetooth tty thread RT"
|
|
|
|
This reverts commit 4c7f1a012302347c8b4d43b41c822eeaeb0320f9.
|
|
---
|
|
drivers/tty/serial/msm_serial_hs.c | 2 --
|
|
drivers/tty/tty_buffer.c | 28 +++++++---------------------
|
|
drivers/tty/tty_port.c | 10 ----------
|
|
include/linux/tty.h | 8 ++------
|
|
4 files changed, 9 insertions(+), 39 deletions(-)
|
|
|
|
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
|
|
index b4640e996f89..baaa2351f796 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>
|
|
@@ -3302,7 +3301,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)
|
|
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
|
|
index 92af201f9030..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,8 +132,6 @@ 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);
|
|
}
|
|
|
|
/**
|
|
@@ -406,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);
|
|
|
|
@@ -474,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;
|
|
@@ -564,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");
|
|
- }
|
|
-
|
|
-
|
|
}
|
|
|
|
/**
|
|
@@ -605,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/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, ¶m);
|
|
-}
|
|
-EXPORT_SYMBOL_GPL(tty_port_set_policy);
|
|
-
|
|
diff --git a/include/linux/tty.h b/include/linux/tty.h
|
|
index 1c1bb90f6819..812cdd8cff22 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 */
|
|
};
|
|
|
|
/*
|
|
@@ -582,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.23.0
|
|
|