include/linux/cpu.h

Source file repositories/reference/linux-study-clean/include/linux/cpu.h

File Facts

System
Linux kernel
Corpus path
include/linux/cpu.h
Extension
.h
Size
7694 bytes
Lines
237
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

extern const struct bus_type cpu_subsys;

#ifdef CONFIG_PM_SLEEP_SMP
extern int freeze_secondary_cpus(int primary);
extern void thaw_secondary_cpus(void);

static inline int suspend_disable_secondary_cpus(void)
{
	int cpu = 0;

	if (IS_ENABLED(CONFIG_PM_SLEEP_SMP_NONZERO_CPU))
		cpu = -1;

	return freeze_secondary_cpus(cpu);
}
static inline void suspend_enable_secondary_cpus(void)
{
	thaw_secondary_cpus();
}

#else /* !CONFIG_PM_SLEEP_SMP */
static inline void thaw_secondary_cpus(void) {}
static inline int suspend_disable_secondary_cpus(void) { return 0; }
static inline void suspend_enable_secondary_cpus(void) { }
#endif /* !CONFIG_PM_SLEEP_SMP */

void __noreturn cpu_startup_entry(enum cpuhp_state state);

void cpu_idle_poll_ctrl(bool enable);

bool cpu_in_idle(unsigned long pc);

void arch_cpu_idle(void);
void arch_cpu_idle_prepare(void);
void arch_cpu_idle_enter(void);
void arch_cpu_idle_exit(void);
void arch_tick_broadcast_enter(void);
void arch_tick_broadcast_exit(void);
void __noreturn arch_cpu_idle_dead(void);

#ifdef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT
void arch_cpu_finalize_init(void);
#else
static inline void arch_cpu_finalize_init(void) { }
#endif

void play_idle_precise(u64 duration_ns, u64 latency_ns);

#ifdef CONFIG_HOTPLUG_CPU
void cpuhp_report_idle_dead(void);
#else
static inline void cpuhp_report_idle_dead(void) { }
#endif /* #ifdef CONFIG_HOTPLUG_CPU */

enum cpu_attack_vectors {
	CPU_MITIGATE_USER_KERNEL,
	CPU_MITIGATE_USER_USER,
	CPU_MITIGATE_GUEST_HOST,
	CPU_MITIGATE_GUEST_GUEST,
	NR_CPU_ATTACK_VECTORS,
};

enum smt_mitigations {
	SMT_MITIGATIONS_OFF,
	SMT_MITIGATIONS_AUTO,
	SMT_MITIGATIONS_ON,
};

#ifdef CONFIG_CPU_MITIGATIONS
extern bool cpu_mitigations_off(void);
extern bool cpu_mitigations_auto_nosmt(void);
extern bool cpu_attack_vector_mitigated(enum cpu_attack_vectors v);
extern enum smt_mitigations smt_mitigations;
#else
static inline bool cpu_mitigations_off(void)
{
	return true;
}
static inline bool cpu_mitigations_auto_nosmt(void)
{
	return false;
}
static inline bool cpu_attack_vector_mitigated(enum cpu_attack_vectors v)
{
	return false;
}
#define smt_mitigations SMT_MITIGATIONS_OFF
#endif

int arch_prctl_get_branch_landing_pad_state(struct task_struct *t, unsigned long __user *state);

Annotation

Implementation Notes