summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonglin Lee <jonglin@google.com>2023-03-21 05:11:55 +0000
committerTreeHugger Robot <treehugger-gerrit@google.com>2023-03-21 06:02:46 +0000
commite29e57f3ef25227fd8571887cc296ea15b95b6c1 (patch)
tree8de8e3cf8b21f0b3f248105ab34eb509926401f4
parentc58390eed81903abbdd30947eccef8496eb9a992 (diff)
downloadtrusty-e29e57f3ef25227fd8571887cc296ea15b95b6c1.tar.gz
Revert "ANDROID: trusty: park threads when cpu is offline"
This reverts commit f2787bd94c86ffd7f2134d20f25fa5a82712022a. Reason for revert: Causing Watchdogs and Suspend Timeouts Bug: 274202992 Bug: 274541609 Change-Id: I09158b556d327e5658f299c111f04eb3f1682aaf Signed-off-by: Jonglin Lee <jonglin@google.com>
-rw-r--r--drivers/trusty/trusty.c78
1 files changed, 5 insertions, 73 deletions
diff --git a/drivers/trusty/trusty.c b/drivers/trusty/trusty.c
index 5c753bf..808b98b 100644
--- a/drivers/trusty/trusty.c
+++ b/drivers/trusty/trusty.c
@@ -27,7 +27,6 @@
struct trusty_state;
static struct platform_driver trusty_driver;
-static int trusty_cpuhp_slot = -1;
static bool use_high_wq;
module_param(use_high_wq, bool, 0660);
@@ -51,7 +50,6 @@ struct trusty_state {
u32 api_version;
bool trusty_panicked;
struct device *dev;
- struct hlist_node cpuhp_node;
struct trusty_work __percpu *nop_works;
struct list_head nop_queue;
spinlock_t nop_lock; /* protects nop_queue */
@@ -884,9 +882,6 @@ static void nop_work_func(struct trusty_work *tw)
dev_dbg(s->dev, "%s: %x %x %x\n",
__func__, args[0], args[1], args[2]);
- if (kthread_should_park())
- kthread_parkme();
-
preempt_disable();
if (tw != this_cpu_ptr(s->nop_works)) {
@@ -994,9 +989,6 @@ static int trusty_nop_thread(void *context)
wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
- if (kthread_should_park())
- kthread_parkme();
-
/* process work */
work_func(tw);
};
@@ -1005,34 +997,6 @@ static int trusty_nop_thread(void *context)
return ret;
}
-static int trusty_cpu_up(unsigned int cpu, struct hlist_node *node)
-{
- struct trusty_state *s;
- struct trusty_work *tw;
-
- s = container_of(node, struct trusty_state, cpuhp_node);
- tw = this_cpu_ptr(s->nop_works);
- kthread_unpark(tw->nop_thread);
-
- dev_dbg(s->dev, "cpu %d up\n", cpu);
-
- return 0;
-}
-
-static int trusty_cpu_down(unsigned int cpu, struct hlist_node *node)
-{
- struct trusty_state *s;
- struct trusty_work *tw;
-
- s = container_of(node, struct trusty_state, cpuhp_node);
- tw = this_cpu_ptr(s->nop_works);
-
- dev_dbg(s->dev, "cpu %d down\n", cpu);
- kthread_park(tw->nop_thread);
-
- return 0;
-}
-
static int trusty_probe(struct platform_device *pdev)
{
int ret;
@@ -1099,22 +1063,17 @@ static int trusty_probe(struct platform_device *pdev)
for_each_possible_cpu(cpu) {
struct trusty_work *tw = per_cpu_ptr(s->nop_works, cpu);
- tw->nop_thread = kthread_create_on_cpu(trusty_nop_thread, tw,
- cpu, "trusty-nop-%d");
+ tw->nop_thread = kthread_create(trusty_nop_thread, tw,
+ "trusty-nop-%d", cpu);
if (IS_ERR(tw->nop_thread)) {
ret = PTR_ERR(tw->nop_thread);
dev_err(s->dev, "%s: failed to create thread for cpu= %d (%p)\n",
__func__, cpu, tw->nop_thread);
goto err_thread_create;
}
- kthread_park(tw->nop_thread);
- }
- ret = cpuhp_state_add_instance(trusty_cpuhp_slot, &s->cpuhp_node);
- if (ret < 0) {
- dev_err(&pdev->dev, "cpuhp_state_add_instance failed %d\n",
- ret);
- goto err_add_cpuhp_instance;
+ kthread_bind(tw->nop_thread, cpu);
+ wake_up_process(tw->nop_thread);
}
s->trusty_sched_share_state = trusty_register_sched_share(&pdev->dev);
@@ -1128,8 +1087,6 @@ static int trusty_probe(struct platform_device *pdev)
return 0;
err_add_children:
- cpuhp_state_remove_instance(trusty_cpuhp_slot, &s->cpuhp_node);
-err_add_cpuhp_instance:
err_thread_create:
for_each_possible_cpu(cpu) {
struct trusty_work *tw = per_cpu_ptr(s->nop_works, cpu);
@@ -1161,8 +1118,6 @@ static int trusty_remove(struct platform_device *pdev)
device_for_each_child(&pdev->dev, NULL, trusty_remove_child);
- cpuhp_state_remove_instance(trusty_cpuhp_slot, &s->cpuhp_node);
-
for_each_possible_cpu(cpu) {
struct trusty_work *tw = per_cpu_ptr(s->nop_works, cpu);
@@ -1198,35 +1153,12 @@ static struct platform_driver trusty_driver = {
static int __init trusty_driver_init(void)
{
- int ret;
-
- /* allocate dynamic cpuhp state slot */
- ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
- "trusty:online",
- trusty_cpu_up,
- trusty_cpu_down);
- if (ret < 0)
- return ret;
-
- trusty_cpuhp_slot = ret;
-
- ret = platform_driver_register(&trusty_driver);
- if (ret < 0)
- goto err_driver_register;
-
- return 0;
-
-err_driver_register:
- cpuhp_remove_multi_state(trusty_cpuhp_slot);
- trusty_cpuhp_slot = -1;
- return ret;
+ return platform_driver_register(&trusty_driver);
}
static void __exit trusty_driver_exit(void)
{
platform_driver_unregister(&trusty_driver);
- cpuhp_remove_multi_state(trusty_cpuhp_slot);
- trusty_cpuhp_slot = -1;
}
subsys_initcall(trusty_driver_init);