lkml.org 
[lkml]   [2021]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/4] cpu/hotplug: CPUHP_BRINGUP_CPU exception in fail injection
Date
From: Vincent Donnefort <vincent.donnefort@arm.com>

The atomic states (between CPUHP_AP_IDLE_DEAD and CPUHP_AP_ONLINE) are
triggered by the CPUHP_BRINGUP_CPU step. If the latter doesn't run, none
of the atomic can. Hence, rollback is not possible after a hotunplug
CPUHP_BRINGUP_CPU step failure and the "fail" interface shouldn't allow
it. Moreover, the current CPUHP_BRINGUP_CPU teardown callback
(finish_cpu()) cannot fail anyway.

Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
---
kernel/cpu.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 9121edf..bcd7b2a 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -2216,9 +2216,14 @@ static ssize_t write_cpuhp_fail(struct device *dev,
return -EINVAL;

/*
- * Cannot fail STARTING/DYING callbacks.
+ * Cannot fail STARTING/DYING callbacks. Also, those callbacks are
+ * triggered by BRINGUP_CPU bringup callback. Therefore, the latter
+ * can't fail during hotunplug, as it would mean we have no way of
+ * rolling back the atomic states that have been previously teared
+ * down.
*/
- if (cpuhp_is_atomic_state(fail))
+ if (cpuhp_is_atomic_state(fail) ||
+ (fail == CPUHP_BRINGUP_CPU && st->state > CPUHP_BRINGUP_CPU))
return -EINVAL;

/*
--
2.7.4
\
 
 \ /
  Last update: 2021-01-11 18:14    [W:0.158 / U:1.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site