Lines Matching full:cpu
79 * Per-CPU data.
86 typedef struct cpu { struct
87 processorid_t cpu_id; /* CPU number */
88 processorid_t cpu_seqid; /* sequential CPU id (0..ncpus-1) */
89 volatile cpu_flag_t cpu_flags; /* flags indicating CPU state */
90 struct cpu *cpu_self; /* pointer to itself */ argument
92 kthread_t *cpu_idle_thread; /* idle thread for this CPU */
93 kthread_t *cpu_pause_thread; /* pause thread for this CPU */
96 struct cpupart *cpu_part; /* partition with this CPU */
97 struct lgrp_ld *cpu_lpl; /* pointer to this cpu's load */ argument
109 struct cpu *cpu_next; /* next existing CPU */ argument
110 struct cpu *cpu_prev; /* prev existing CPU */ argument
111 struct cpu *cpu_next_onln; /* next online (enabled) CPU */ argument
112 struct cpu *cpu_prev_onln; /* prev online (enabled) CPU */ argument
113 struct cpu *cpu_next_part; /* next CPU in partition */ argument
114 struct cpu *cpu_prev_part; /* prev CPU in partition */ argument
115 struct cpu *cpu_next_lgrp; /* next CPU in latency group */ argument
116 struct cpu *cpu_prev_lgrp; /* prev CPU in latency group */ argument
117 struct cpu *cpu_next_lpl; /* next CPU in lgrp partition */ argument
118 struct cpu *cpu_prev_lpl; argument
120 struct cpu_pg *cpu_pg; /* cpu's processor groups */ argument
129 * Note that cpu_disp is set before the CPU is added to the system
135 pri_t cpu_chosen_level; /* priority at which cpu */ argument
159 cpu_stats_t cpu_stats; /* per-CPU statistics */
160 struct kstat *cpu_info_kstat; /* kstat for cpu info */ argument
166 ftrace_data_t cpu_ftrace; /* per cpu ftrace data */ argument
178 time_t cpu_state_begin; /* when CPU entered current state */
180 struct cyc_cpu *cpu_cyclic; /* per cpu cyclic subsystem data */ argument
181 struct squeue_set_s *cpu_squeue_set; /* per cpu squeue set */ argument
191 volatile uint16_t cpu_mstate; /* cpu microstate */ argument
193 volatile hrtime_t cpu_mstate_start; /* cpu microstate start time */ argument
194 volatile hrtime_t cpu_acct[NCMSTATES]; /* cpu microstate data */ argument
196 hrtime_t cpu_waitrq; /* cpu run-queue wait time */ argument
197 struct loadavg_s cpu_loadavg; /* loadavg info for this cpu */ argument
204 * this cpu. Cleared at start of interrupt redistribution.
228 * cpu_generation is updated whenever CPU goes on-line or off-line.
250 * The cpu_core structure consists of per-CPU state available in any context.
295 * CPU_PSEUDO_RANDOM() returns a per CPU value that changes each time one
300 #define CPU_PSEUDO_RANDOM() (CPU->cpu_rotor++)
309 * Flags in the CPU structure.
315 * CPU_ENABLE indicates that the CPU is participating in I/O interrupts
317 * is off, the CPU will not be given interrupts that can be sent elsewhere,
318 * but will still get interrupts from devices associated with that CPU only,
322 * other than interrupt threads to run on that CPU. A CPU will not have
326 * CPU and it will not have to run interrupt threads. In this case it'll
341 #define CPU_RUNNING 0x001 /* CPU running */
342 #define CPU_READY 0x002 /* CPU ready for cross-calls */
343 #define CPU_QUIESCED 0x004 /* CPU will stay in idle */
344 #define CPU_EXISTS 0x008 /* CPU is configured */
345 #define CPU_ENABLE 0x010 /* CPU enabled for interrupts */
346 #define CPU_OFFLINE 0x020 /* CPU offline via p_online */
347 #define CPU_POWEROFF 0x040 /* CPU is powered off */
348 #define CPU_FROZEN 0x080 /* CPU is frozen via CPR suspend */
349 #define CPU_SPARE 0x100 /* CPU offline available for use */
350 #define CPU_FAULTED 0x200 /* CPU offline diagnosed faulty */
351 #define CPU_DISABLED 0x400 /* CPU explicitly disabled (HT) */
353 #define CPU_ACTIVE(cpu) (((cpu)->cpu_flags & CPU_OFFLINE) == 0) argument
358 #define CPU_FORCED 0x0001 /* Force CPU offline */
388 * These flags must be changed only by the current CPU.
390 #define CPU_DISP_DONTSTEAL 0x01 /* CPU undergoing context swtch */
391 #define CPU_DISP_HALTED 0x02 /* CPU halted waiting for interrupt */
395 * bitmap may vary in size depending on the maximum CPU id a specific
397 * the platform supports, since CPU ids can be sparse. We define two
398 * sets of macros; one for platforms where the maximum CPU id is less
454 #define CPUSET_ALL_BUT(set, cpu) cpuset_all_but(&(set), cpu) argument
455 #define CPUSET_ONLY(set, cpu) cpuset_only(&(set), cpu) argument
456 #define CPU_IN_SET(set, cpu) cpu_in_set(&(set), cpu) argument
457 #define CPUSET_ADD(set, cpu) cpuset_add(&(set), cpu) argument
458 #define CPUSET_DEL(set, cpu) cpuset_del(&(set), cpu) argument
463 * Find one CPU in the cpuset.
464 * Sets "cpu" to the id of the found CPU, or CPUSET_NOTINSET if no cpu
467 #define CPUSET_FIND(set, cpu) { \ argument
468 cpu = cpuset_find(&(set)); \
472 * Determine the smallest and largest CPU id in the set. Returns
484 * (e.g. attempting to add a cpu to a cpuset that's already there, or
485 * deleting a cpu that's not in the cpuset)
488 #define CPUSET_ATOMIC_DEL(set, cpu) cpuset_atomic_del(&(set), cpu) argument
489 #define CPUSET_ATOMIC_ADD(set, cpu) cpuset_atomic_add(&(set), cpu) argument
491 #define CPUSET_ATOMIC_XADD(set, cpu, result) \ argument
492 (result) = cpuset_atomic_xadd(&(set), cpu)
494 #define CPUSET_ATOMIC_XDEL(set, cpu, result) \ argument
495 (result) = cpuset_atomic_xdel(&(set), cpu)
510 extern struct cpu *cpu[]; /* indexed by CPU number */
511 extern struct cpu **cpu_seq; /* indexed by sequential CPU id */
521 extern processorid_t max_cpuid; /* maximum CPU number */
522 extern struct cpu *cpu_inmotion; /* offline or partition move target */
527 extern struct cpu *curcpup(void);
528 #define CPU (curcpup()) /* Pointer to current CPU */ macro
530 #define CPU (curthread->t_cpu) /* Pointer to current CPU */ macro
535 * current CPU is; holding cpu_lock is not required.
541 * good CPU (in particular, an ht_acquire()-friendly choice); holding cpu_lock
547 * Per-CPU statistics
558 CPU_STATS_ADDQ(CPU, class, stat, amount); \
575 * Increment CPU generation value.
576 * This macro should be called whenever CPU goes on-line or off-line.
585 #define CPU_CPR_IS_OFFLINE(cpu) (((cpu)->cpu_cpr_flags & CPU_CPR_ONLINE) == 0) argument
586 #define CPU_CPR_IS_ONLINE(cpu) ((cpu)->cpu_cpr_flags & CPU_CPR_ONLINE) argument
587 #define CPU_SET_CPR_FLAGS(cpu, flag) ((cpu)->cpu_cpr_flags |= flag) argument
590 * CPU support routines (not for genassym.c)
615 void poke_cpu(int cpun); /* interrupt another CPU (to preempt) */
633 cpu_t *cpu_get(processorid_t cpun); /* get the CPU struct associated */
635 int cpu_online(cpu_t *, int); /* take cpu online */
636 int cpu_offline(cpu_t *, int); /* take cpu offline */
637 int cpu_spare(cpu_t *, int); /* take cpu to spare */
638 int cpu_faulted(cpu_t *, int); /* take cpu to faulted */
639 int cpu_poweron(cpu_t *); /* take powered-off cpu to offline */
640 int cpu_poweroff(cpu_t *); /* take offline cpu to powered-off */
642 cpu_t *cpu_intr_next(cpu_t *cp); /* get next online CPU taking intrs */
644 int cpu_intr_on(cpu_t *cp); /* CPU taking I/O interrupts? */
650 * Routines for checking CPU states.
652 int cpu_is_online(cpu_t *); /* check if CPU is online */
653 int cpu_is_nointr(cpu_t *); /* check if CPU can service intrs */
654 int cpu_is_active(cpu_t *); /* check if CPU can run threads */
655 int cpu_is_offline(cpu_t *); /* check if CPU is offline */
656 int cpu_is_poweredoff(cpu_t *); /* check if CPU is powered off */
658 int cpu_flagged_online(cpu_flag_t); /* flags show CPU is online */
659 int cpu_flagged_nointr(cpu_flag_t); /* flags show CPU not handling intrs */
660 int cpu_flagged_active(cpu_flag_t); /* flags show CPU scheduling threads */
661 int cpu_flagged_offline(cpu_flag_t); /* flags show CPU is offline */
662 int cpu_flagged_poweredoff(cpu_flag_t); /* flags show CPU is powered off */
665 * The processor_info(2) state of a CPU is a simplified representation suitable
667 * internal per-CPU state as given by the cpu_flags member of the cpu structure,
669 * critical to a subsystem's disposition of a particular CPU.
672 int cpu_get_state(cpu_t *); /* get current cpu state */
676 void cpu_set_curr_clock(uint64_t); /* indicate the current CPU's freq */
677 void cpu_set_supp_freqs(cpu_t *, const char *); /* set the CPU supported */
691 extern void init_cpu_mstate(struct cpu *, int);
692 extern void term_cpu_mstate(struct cpu *);
694 extern void get_cpu_mstate(struct cpu *, hrtime_t *);
707 int cpu_disable_intr(struct cpu *cp); /* stop issuing interrupts to cpu */
708 void cpu_enable_intr(struct cpu *cp); /* start issuing interrupts to cpu */
714 extern kmutex_t cpu_lock; /* lock protecting CPU data */
717 * CPU state change events
720 * information by registering CPU state change callbacks using
721 * register_cpu_setup_func(). Whenever any CPU changes its state, the callback
725 * CPU ID
738 * CPU_INIT A new CPU is started and added to the list of active CPUs
741 * CPU_CONFIG A newly inserted CPU is prepared for starting running code
744 * CPU_UNCONFIG CPU has been powered off and needs cleanup
747 * CPU_ON CPU is enabled but does not run anything yet
749 * CPU_INTR_ON CPU is enabled and has interrupts enabled
751 * CPU_OFF CPU is going offline but can still run threads
753 * CPU_CPUPART_OUT CPU is going to move out of its partition
755 * CPU_CPUPART_IN CPU is going to move to a new partition
757 * CPU_SETUP CPU is set up during boot and can run threads
774 * Routines used to register interest in cpu's being added to or removed
782 * Call specified function on the given CPU
789 * Create various strings that describe the given CPU for the
794 extern void init_cpu_info(struct cpu *);
795 extern void populate_idstr(struct cpu *);
796 extern void cpu_vm_data_init(struct cpu *);
797 extern void cpu_vm_data_destroy(struct cpu *);