FreeBSD/Linux Kernel Cross Reference
sys/sys/cpu_data.h
1 /* $NetBSD: cpu_data.h,v 1.27 2008/06/03 15:50:22 ad Exp $ */
2
3 /*-
4 * Copyright (c) 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /*
30 * based on arch/i386/include/cpu.h:
31 * NetBSD: cpu.h,v 1.115 2004/05/16 12:32:53 yamt Exp
32 */
33
34 #ifndef _SYS_CPU_DATA_H_
35 #define _SYS_CPU_DATA_H_
36
37 struct callout;
38 struct lwp;
39
40 #include <sys/sched.h> /* for schedstate_percpu */
41 #include <sys/condvar.h>
42 #include <sys/percpu_types.h>
43 #include <sys/queue.h>
44
45 /*
46 * MI per-cpu data
47 *
48 * this structure is intended to be included in MD cpu_info structure.
49 * struct cpu_info {
50 * struct cpu_data ci_data;
51 * }
52 *
53 * note that cpu_data is not expected to contain much data,
54 * as cpu_info is size-limited on most ports.
55 */
56
57 struct lockdebug;
58
59 struct cpu_data {
60 /*
61 * The first section is likely to be touched by other CPUs -
62 * it is cache hot.
63 */
64 lwp_t *cpu_biglock_wanted; /* LWP spinning on biglock */
65 void *cpu_callout; /* per-CPU callout state */
66 void *cpu_unused1; /* unused */
67 u_int cpu_unused2; /* unused */
68 struct schedstate_percpu cpu_schedstate; /* scheduler state */
69 kcondvar_t cpu_xcall; /* cross-call support */
70 int cpu_xcall_pending; /* cross-call support */
71 lwp_t *cpu_onproc; /* bottom level LWP */
72 CIRCLEQ_ENTRY(cpu_info) cpu_qchain; /* circleq of all CPUs */
73
74 /*
75 * This section is mostly CPU-private.
76 */
77 lwp_t *cpu_idlelwp; /* idle lwp */
78 void *cpu_lockstat; /* lockstat private tables */
79 u_int cpu_index; /* CPU index */
80 u_int cpu_biglock_count; /* # recursive holds */
81 u_int cpu_spin_locks; /* # of spinlockmgr locks */
82 u_int cpu_simple_locks; /* # of simple locks held */
83 u_int cpu_spin_locks2; /* # of spin locks held XXX */
84 u_int cpu_lkdebug_recurse; /* LOCKDEBUG recursion */
85 u_int cpu_softints; /* pending (slow) softints */
86 u_int cpu_nsyscall; /* syscall counter */
87 u_int cpu_ntrap; /* trap counter */
88 u_int cpu_nswtch; /* context switch counter */
89 void *cpu_uvm; /* uvm per-cpu data */
90 void *cpu_softcpu; /* soft interrupt table */
91 TAILQ_HEAD(,buf) cpu_biodone; /* finished block xfers */
92 percpu_cpu_t cpu_percpu; /* per-cpu data */
93 struct selcpu *cpu_selcpu; /* per-CPU select() info */
94 void *cpu_nch; /* per-cpu vfs_cache data */
95 _TAILQ_HEAD(,struct lockdebug,volatile) cpu_ld_locks;/* !: lockdebug */
96 __cpu_simple_lock_t cpu_ld_lock; /* lockdebug */
97 uint64_t cpu_cc_freq; /* cycle counter frequency */
98 int64_t cpu_cc_skew; /* counter skew vs cpu0 */
99 };
100
101 /* compat definitions */
102 #define ci_schedstate ci_data.cpu_schedstate
103 #define ci_index ci_data.cpu_index
104 #define ci_biglock_count ci_data.cpu_biglock_count
105 #define ci_biglock_wanted ci_data.cpu_biglock_wanted
106 #define ci_spin_locks ci_data.cpu_spin_locks
107 #define ci_simple_locks ci_data.cpu_simple_locks
108 #define ci_lockstat ci_data.cpu_lockstat
109 #define ci_spin_locks2 ci_data.cpu_spin_locks2
110 #define ci_lkdebug_recurse ci_data.cpu_lkdebug_recurse
111
112 int mi_cpu_attach(struct cpu_info *ci);
113
114 #endif /* _SYS_CPU_DATA_H_ */
Cache object: c0c82d802e515c9f05ad54e6917bbc97
|