|
@@ -68,9 +68,26 @@ struct cpuhp_cpu_state {
|
|
static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state);
|
|
static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state);
|
|
|
|
|
|
#if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP)
|
|
#if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP)
|
|
-static struct lock_class_key cpuhp_state_key;
|
|
|
|
-static struct lockdep_map cpuhp_state_lock_map =
|
|
|
|
- STATIC_LOCKDEP_MAP_INIT("cpuhp_state", &cpuhp_state_key);
|
|
|
|
|
|
+static struct lockdep_map cpuhp_state_up_map =
|
|
|
|
+ STATIC_LOCKDEP_MAP_INIT("cpuhp_state-up", &cpuhp_state_up_map);
|
|
|
|
+static struct lockdep_map cpuhp_state_down_map =
|
|
|
|
+ STATIC_LOCKDEP_MAP_INIT("cpuhp_state-down", &cpuhp_state_down_map);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+static void inline cpuhp_lock_acquire(bool bringup)
|
|
|
|
+{
|
|
|
|
+ lock_map_acquire(bringup ? &cpuhp_state_up_map : &cpuhp_state_down_map);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void inline cpuhp_lock_release(bool bringup)
|
|
|
|
+{
|
|
|
|
+ lock_map_release(bringup ? &cpuhp_state_up_map : &cpuhp_state_down_map);
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+
|
|
|
|
+static void inline cpuhp_lock_acquire(bool bringup) { }
|
|
|
|
+static void inline cpuhp_lock_release(bool bringup) { }
|
|
|
|
+
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -486,7 +503,7 @@ static void cpuhp_thread_fun(unsigned int cpu)
|
|
if (WARN_ON_ONCE(!st->should_run))
|
|
if (WARN_ON_ONCE(!st->should_run))
|
|
return;
|
|
return;
|
|
|
|
|
|
- lock_map_acquire(&cpuhp_state_lock_map);
|
|
|
|
|
|
+ cpuhp_lock_acquire(bringup);
|
|
|
|
|
|
if (st->single) {
|
|
if (st->single) {
|
|
state = st->cb_state;
|
|
state = st->cb_state;
|
|
@@ -537,7 +554,7 @@ static void cpuhp_thread_fun(unsigned int cpu)
|
|
}
|
|
}
|
|
|
|
|
|
next:
|
|
next:
|
|
- lock_map_release(&cpuhp_state_lock_map);
|
|
|
|
|
|
+ cpuhp_lock_release(bringup);
|
|
|
|
|
|
if (!st->should_run)
|
|
if (!st->should_run)
|
|
complete(&st->done);
|
|
complete(&st->done);
|
|
@@ -554,8 +571,11 @@ cpuhp_invoke_ap_callback(int cpu, enum cpuhp_state state, bool bringup,
|
|
if (!cpu_online(cpu))
|
|
if (!cpu_online(cpu))
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- lock_map_acquire(&cpuhp_state_lock_map);
|
|
|
|
- lock_map_release(&cpuhp_state_lock_map);
|
|
|
|
|
|
+ cpuhp_lock_acquire(false);
|
|
|
|
+ cpuhp_lock_release(false);
|
|
|
|
+
|
|
|
|
+ cpuhp_lock_acquire(true);
|
|
|
|
+ cpuhp_lock_release(true);
|
|
|
|
|
|
/*
|
|
/*
|
|
* If we are up and running, use the hotplug thread. For early calls
|
|
* If we are up and running, use the hotplug thread. For early calls
|
|
@@ -593,8 +613,11 @@ static int cpuhp_kick_ap_work(unsigned int cpu)
|
|
enum cpuhp_state prev_state = st->state;
|
|
enum cpuhp_state prev_state = st->state;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- lock_map_acquire(&cpuhp_state_lock_map);
|
|
|
|
- lock_map_release(&cpuhp_state_lock_map);
|
|
|
|
|
|
+ cpuhp_lock_acquire(false);
|
|
|
|
+ cpuhp_lock_release(false);
|
|
|
|
+
|
|
|
|
+ cpuhp_lock_acquire(true);
|
|
|
|
+ cpuhp_lock_release(true);
|
|
|
|
|
|
trace_cpuhp_enter(cpu, st->target, prev_state, cpuhp_kick_ap_work);
|
|
trace_cpuhp_enter(cpu, st->target, prev_state, cpuhp_kick_ap_work);
|
|
ret = cpuhp_kick_ap(st, st->target);
|
|
ret = cpuhp_kick_ap(st, st->target);
|