Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
cpu.c 23.05 KiB
/* CPU control.
* (C) 2001, 2002, 2003, 2004 Rusty Russell
*
* This code is licenced under the GPL.
*/
#include <linux/proc_fs.h>
#include <linux/smp.h>
#include <linux/init.h>
#include <linux/notifier.h>
#include <linux/sched.h>
#include <linux/unistd.h>
#include <linux/cpu.h>
#include <linux/oom.h>
#include <linux/rcupdate.h>
#include <linux/export.h>
#include <linux/bug.h>
#include <linux/kthread.h>
#include <linux/stop_machine.h>
#include <linux/mutex.h>
#include <linux/gfp.h>
#include <linux/suspend.h>
#include <linux/lockdep.h>
#include <linux/tick.h>
#include <linux/irq.h>
#include <trace/events/power.h>
#define CREATE_TRACE_POINTS
#include <trace/events/cpuhp.h>
#include "smpboot.h"
/**
* cpuhp_cpu_state - Per cpu hotplug state storage
* @state: The current cpu state
* @target: The target state
*/
struct cpuhp_cpu_state {
enum cpuhp_state state;
enum cpuhp_state target;
};
static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state);
/**
* cpuhp_step - Hotplug state machine step
* @name: Name of the step
* @startup: Startup function of the step
* @teardown: Teardown function of the step
* @skip_onerr: Do not invoke the functions on error rollback
* Will go away once the notifiers are gone
*/
struct cpuhp_step {
const char *name;
int (*startup)(unsigned int cpu);
int (*teardown)(unsigned int cpu);
bool skip_onerr;
};
static struct cpuhp_step cpuhp_bp_states[];
/**
* cpuhp_invoke_callback _ Invoke the callbacks for a given state
* @cpu: The cpu for which the callback should be invoked
* @step: The step in the state machine
* @cb: The callback function to invoke
*
* Called from cpu hotplug and from the state register machinery
*/
static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state step,
int (*cb)(unsigned int))