Print this page
OS-5192 need faster clock_gettime
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Ryan Zezeski <ryan@zinascii.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/i86pc/sys/machparam.h
+++ new/usr/src/uts/i86pc/sys/machparam.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2015 by Delphix. All rights reserved.
24 + * Copyright 2016 Joyent, Inc.
24 25 */
25 26
26 27 /* Copyright (c) 1988 AT&T */
27 28 /* All Rights Reserved */
28 29
29 30
30 31 #ifndef _SYS_MACHPARAM_H
31 32 #define _SYS_MACHPARAM_H
32 33
33 34 #if !defined(_ASM)
34 35 #include <sys/types.h>
35 36
36 37 #if defined(__xpv)
37 38 #include <sys/xpv_impl.h>
38 39 #endif
39 40
40 41 #endif
41 42
42 43 #ifdef __cplusplus
43 44 extern "C" {
44 45 #endif
45 46
46 47 #ifndef _ASM
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
47 48 #define ADDRESS_C(c) c ## ul
48 49 #else /* _ASM */
49 50 #define ADDRESS_C(c) (c)
50 51 #endif /* _ASM */
51 52
52 53 /*
53 54 * Machine dependent parameters and limits.
54 55 */
55 56
56 57 #if defined(__amd64)
58 +/*
59 + * If NCPU grows beyond 256, sizing for the x86 comm page will require
60 + * adjustment.
61 + */
57 62 #define NCPU 256
58 63 #define NCPU_LOG2 8
59 64 #elif defined(__i386)
60 65 #define NCPU 32
61 66 #define NCPU_LOG2 5
62 67 #endif
63 68
64 69 /* NCPU_P2 is NCPU rounded to a power of 2 */
65 70 #define NCPU_P2 (1 << NCPU_LOG2)
66 71
67 72 /*
68 73 * The value defined below could grow to 16. hat structure and
69 74 * page_t have room for 16 nodes.
70 75 */
71 76 #define MAXNODES 4
72 77 #define NUMA_NODEMASK 0x0f
73 78
74 79 /*
75 80 * Define the FPU symbol if we could run on a machine with an external
76 81 * FPU (i.e. not integrated with the normal machine state like the vax).
77 82 *
78 83 * The fpu is defined in the architecture manual, and the kernel hides
79 84 * its absence if it is not present, that's pretty integrated, no?
80 85 */
81 86
82 87 /* supported page sizes */
83 88 #define MMU_PAGE_SIZES 3
84 89
85 90 /*
86 91 * MMU_PAGES* describes the physical page size used by the mapping hardware.
87 92 * PAGES* describes the logical page size used by the system.
88 93 */
89 94
90 95 #define MMU_PAGESIZE 0x1000 /* 4096 bytes */
91 96 #define MMU_PAGESHIFT 12 /* log2(MMU_PAGESIZE) */
92 97
93 98 #if !defined(_ASM)
94 99 #define MMU_PAGEOFFSET (MMU_PAGESIZE-1) /* Mask of address bits in page */
95 100 #else /* _ASM */
96 101 #define MMU_PAGEOFFSET _CONST(MMU_PAGESIZE-1) /* assembler lameness */
97 102 #endif /* _ASM */
98 103
99 104 #define MMU_PAGEMASK (~MMU_PAGEOFFSET)
100 105
101 106 #define PAGESIZE 0x1000 /* All of the above, for logical */
102 107 #define PAGESHIFT 12
103 108 #define PAGEOFFSET (PAGESIZE - 1)
104 109 #define PAGEMASK (~PAGEOFFSET)
105 110
106 111 /*
107 112 * DATA_ALIGN is used to define the alignment of the Unix data segment.
108 113 */
109 114 #define DATA_ALIGN PAGESIZE
110 115
111 116 /*
112 117 * DEFAULT KERNEL THREAD stack size (in pages).
113 118 */
114 119 #if defined(__amd64)
115 120 #define DEFAULTSTKSZ_NPGS 5
116 121 #elif defined(__i386)
117 122 #define DEFAULTSTKSZ_NPGS 3
118 123 #endif
119 124
120 125 #if !defined(_ASM)
121 126 #define DEFAULTSTKSZ (DEFAULTSTKSZ_NPGS * PAGESIZE)
122 127 #else /* !_ASM */
123 128 #define DEFAULTSTKSZ _MUL(DEFAULTSTKSZ_NPGS, PAGESIZE) /* as(1) lameness */
124 129 #endif /* !_ASM */
125 130
126 131 /*
127 132 * KERNELBASE is the virtual address at which the kernel segments start in
128 133 * all contexts.
129 134 *
130 135 * KERNELBASE is not fixed. The value of KERNELBASE can change with
131 136 * installed memory or on 32 bit systems the eprom variable 'eprom_kernelbase'.
132 137 *
133 138 * common/conf/param.c requires a compile time defined value for KERNELBASE.
134 139 * This value is save in the variable _kernelbase. _kernelbase may then be
135 140 * modified with to a different value in i86pc/os/startup.c.
136 141 *
137 142 * Most code should be using kernelbase, which resolves to a reference to
138 143 * _kernelbase.
139 144 */
140 145 #define KERNEL_TEXT_amd64 UINT64_C(0xfffffffffb800000)
141 146
142 147 #ifdef __i386
143 148
144 149 #define KERNEL_TEXT_i386 ADDRESS_C(0xfe800000)
145 150
146 151 /*
147 152 * We don't use HYPERVISOR_VIRT_START, as we need both the PAE and non-PAE
148 153 * versions in our code. We always compile based on the lower PAE address.
149 154 */
150 155 #define KERNEL_TEXT_i386_xpv \
151 156 (HYPERVISOR_VIRT_START_PAE - 3 * ADDRESS_C(0x400000))
152 157
153 158 #endif /* __i386 */
154 159
155 160 #if defined(__amd64)
156 161
157 162 #define KERNELBASE ADDRESS_C(0xfffffd8000000000)
158 163
159 164 /*
160 165 * Size of the unmapped "red zone" at the very bottom of the kernel's
161 166 * address space. Corresponds to 1 slot in the toplevel pagetable.
162 167 */
163 168 #define KERNEL_REDZONE_SIZE ((uintptr_t)1 << 39)
164 169
165 170 /*
166 171 * Base of 'core' heap area, which is used for kernel and module text/data
167 172 * that must be within a 2GB range to allow for rip-relative addressing.
168 173 */
169 174 #define COREHEAP_BASE ADDRESS_C(0xffffffffc0000000)
170 175
171 176 /*
172 177 * Beginning of the segkpm window. A lower value than this is used if
173 178 * physical addresses exceed 1TB. See i86pc/os/startup.c
174 179 */
175 180 #define SEGKPM_BASE ADDRESS_C(0xfffffe0000000000)
176 181
177 182 /*
178 183 * This is valloc_base, above seg_kpm, but below everything else.
179 184 * A lower value than this may be used if SEGKPM_BASE is adjusted.
180 185 * See i86pc/os/startup.c
181 186 */
182 187 #define VALLOC_BASE ADDRESS_C(0xffffff0000000000)
183 188
184 189 /*
185 190 * default and boundary sizes for segkp
186 191 */
187 192 #define SEGKPDEFSIZE (2L * 1024L * 1024L * 1024L) /* 2G */
188 193 #define SEGKPMAXSIZE (8L * 1024L * 1024L * 1024L) /* 8G */
189 194 #define SEGKPMINSIZE (200L * 1024 * 1024L) /* 200M */
190 195
191 196 /*
192 197 * minimum size for segzio
193 198 */
194 199 #define SEGZIOMINSIZE (400L * 1024 * 1024L) /* 400M */
195 200
196 201 /*
197 202 * During intial boot we limit heap to the top 4Gig.
198 203 */
199 204 #define BOOT_KERNELHEAP_BASE ADDRESS_C(0xffffffff00000000)
200 205
201 206 /*
202 207 * VMWare works best if we don't use the top 64Meg of memory for amd64.
203 208 * Set KERNEL_TEXT to top_o_memory - 64Meg - 8 Meg for 8Meg of nucleus pages.
204 209 */
205 210 #define PROMSTART ADDRESS_C(0xffc00000)
206 211 #define KERNEL_TEXT KERNEL_TEXT_amd64
207 212
208 213 /*
209 214 * Virtual address range available to the debugger
210 215 */
211 216 #define SEGDEBUGBASE ADDRESS_C(0xffffffffff800000)
212 217 #define SEGDEBUGSIZE ADDRESS_C(0x400000)
213 218
214 219 /*
215 220 * Define upper limit on user address space
216 221 *
217 222 * In amd64, the upper limit on a 64-bit user address space is 1 large page
218 223 * (2MB) below kernelbase. The upper limit for a 32-bit user address space
219 224 * is 1 small page (4KB) below the top of the 32-bit range. The 64-bit
220 225 * limit give dtrace the red zone it needs below kernelbase. The 32-bit
221 226 * limit gives us a small red zone to detect address-space overruns in a
222 227 * user program.
223 228 *
224 229 * On the hypervisor, we limit the user to memory below the VA hole.
225 230 * Subtract 1 large page for a red zone.
226 231 */
227 232 #if defined(__xpv)
228 233 #define USERLIMIT ADDRESS_C(0x00007fffffe00000)
229 234 #else
230 235 #define USERLIMIT ADDRESS_C(0xfffffd7fffe00000)
231 236 #endif
232 237
233 238 #ifdef bug_5074717_is_fixed
234 239 #define USERLIMIT32 ADDRESS_C(0xfffff000)
235 240 #else
236 241 #define USERLIMIT32 ADDRESS_C(0xfefff000)
237 242 #endif
238 243
239 244 #elif defined(__i386)
240 245
241 246 #ifdef DEBUG
242 247 #define KERNELBASE ADDRESS_C(0xc8000000)
243 248 #else
244 249 #define KERNELBASE ADDRESS_C(0xd4000000)
245 250 #endif
246 251
247 252 #define KERNELBASE_MAX ADDRESS_C(0xe0000000)
248 253
249 254 /*
250 255 * The i386 ABI requires that the user address space be at least 3Gb
251 256 * in size. KERNELBASE_ABI_MIN is used as the default KERNELBASE for
252 257 * physical memory configurations > 4gb.
253 258 */
254 259 #define KERNELBASE_ABI_MIN ADDRESS_C(0xc0000000)
255 260
256 261 /*
257 262 * Size of the unmapped "red zone" at the very bottom of the kernel's
258 263 * address space. Since segmap start immediately above the red zone, this
259 264 * needs to be MAXBSIZE aligned.
260 265 */
261 266 #define KERNEL_REDZONE_SIZE MAXBSIZE
262 267
263 268 /*
264 269 * This is the last 4MB of the 4G address space. Some psm modules
265 270 * need this region of virtual address space mapped 1-1
266 271 * The top 64MB of the address space is reserved for the hypervisor.
267 272 */
268 273 #define PROMSTART ADDRESS_C(0xffc00000)
269 274 #ifdef __xpv
270 275 #define KERNEL_TEXT KERNEL_TEXT_i386_xpv
271 276 #else
272 277 #define KERNEL_TEXT KERNEL_TEXT_i386
273 278 #endif
274 279
275 280 /*
276 281 * Virtual address range available to the debugger
277 282 * We place it just above the kernel text (4M) and kernel data (4M).
278 283 */
279 284 #define SEGDEBUGBASE (KERNEL_TEXT + ADDRESS_C(0x800000))
280 285 #define SEGDEBUGSIZE ADDRESS_C(0x400000)
281 286
282 287 /*
283 288 * Define upper limit on user address space
284 289 */
285 290 #define USERLIMIT KERNELBASE
286 291 #define USERLIMIT32 USERLIMIT
287 292
288 293 #endif /* __i386 */
289 294
290 295 /*
291 296 * Reserve pages just below KERNEL_TEXT for the GDT, IDT, TSS and debug info.
292 297 *
293 298 * For now, DEBUG_INFO_VA must be first in this list for "xm" initiated dumps
294 299 * of solaris domUs to be usable with mdb. Relying on a fixed VA is not viable
295 300 * long term, but it's the best we've got for now.
296 301 */
297 302 #if !defined(_ASM)
298 303 #define DEBUG_INFO_VA (KERNEL_TEXT - MMU_PAGESIZE)
299 304 #define GDT_VA (DEBUG_INFO_VA - MMU_PAGESIZE)
300 305 #define IDT_VA (GDT_VA - MMU_PAGESIZE)
301 306 #define KTSS_VA (IDT_VA - MMU_PAGESIZE)
302 307 #define DFTSS_VA (KTSS_VA - MMU_PAGESIZE)
303 308 #define MISC_VA_BASE (DFTSS_VA)
304 309 #define MISC_VA_SIZE (KERNEL_TEXT - MISC_VA_BASE)
305 310 #endif /* !_ASM */
306 311
307 312 #if !defined(_ASM) && !defined(_KMDB)
308 313 extern uintptr_t kernelbase, segmap_start, segmapsize;
309 314 #endif
310 315
311 316 /*
312 317 * ARGSBASE is the base virtual address of the range which
313 318 * the kernel uses to map the arguments for exec.
314 319 */
315 320 #define ARGSBASE PROMSTART
316 321
317 322 /*
318 323 * reserve space for modules
319 324 */
320 325 #define MODTEXT (1024 * 1024 * 2)
321 326 #define MODDATA (1024 * 300)
322 327
323 328 /*
324 329 * The heap has a region allocated from it of HEAPTEXT_SIZE bytes specifically
325 330 * for module text.
326 331 */
327 332 #define HEAPTEXT_SIZE (64 * 1024 * 1024) /* bytes */
328 333
329 334 /*
330 335 * Size of a kernel threads stack. It must be a whole number of pages
331 336 * since the segment it comes from will only allocate space in pages.
332 337 */
333 338 #define T_STACKSZ 2*PAGESIZE
334 339
335 340 /*
336 341 * Size of a cpu startup thread stack. (It must be a whole number of pages
337 342 * since the containing segment only allocates space in pages.)
338 343 */
339 344
340 345 #define STARTUP_STKSZ 3*PAGESIZE
341 346
342 347 /*
343 348 * Bus types
344 349 */
345 350 #define BTISA 1
346 351 #define BTEISA 2
347 352 #define BTMCA 3
348 353
349 354 #ifdef __cplusplus
350 355 }
351 356 #endif
352 357
353 358 #endif /* _SYS_MACHPARAM_H */
|
↓ open down ↓ |
287 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX