Print this page
NEX-18463 Parallel dump produces corrupted dump file
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/vm/hat.h
+++ new/usr/src/uts/common/vm/hat.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
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 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 27 /* All Rights Reserved */
28 28
|
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
29 29 /*
30 30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 31 * The Regents of the University of California
32 32 * All Rights Reserved
33 33 *
34 34 * University Acknowledgment- Portions of this document are derived from
35 35 * software developed by the University of California, Berkeley, and its
36 36 * contributors.
37 37 */
38 38
39 +/*
40 + * Copyright 2018 Nexenta Systems, Inc.
41 + */
42 +
39 43 #ifndef _VM_HAT_H
40 44 #define _VM_HAT_H
41 45
42 46 #include <sys/types.h>
43 47 #include <sys/t_lock.h>
44 48 #include <vm/faultcode.h>
45 49 #include <sys/kstat.h>
46 50 #include <sys/siginfo.h>
47 51
48 52 #ifdef __cplusplus
49 53 extern "C" {
50 54 #endif
51 55
52 56 /*
53 57 * VM - Hardware Address Translation management.
54 58 *
55 59 * This file describes the machine independent interfaces to
56 60 * the hardware address translation management routines. Other
57 61 * machine specific interfaces and structures are defined
58 62 * in <vm/hat_xxx.h>. The hat layer manages the address
59 63 * translation hardware as a cache driven by calls from the
60 64 * higher levels of the VM system.
61 65 */
62 66
63 67 struct hat;
64 68 struct kpme;
65 69 struct memseg;
66 70
67 71 #include <vm/page.h>
68 72
69 73 /*
70 74 * a callback used with hat_unload_callback()
71 75 * start and end mark are set to a range of unloaded addresses
72 76 * and the function is invoked with a pointer to this data structure
73 77 */
74 78 typedef struct hat_callback {
75 79 caddr_t hcb_start_addr;
76 80 caddr_t hcb_end_addr;
77 81 void (*hcb_function)(struct hat_callback *);
78 82 void *hcb_data;
79 83 } hat_callback_t;
80 84
81 85 typedef void *hat_region_cookie_t;
82 86
83 87 #ifdef _KERNEL
84 88
85 89 /*
86 90 * One time hat initialization
87 91 */
88 92 void hat_init(void);
89 93
90 94 /*
91 95 * Notify hat of a system dump
92 96 */
93 97 void hat_dump(void);
94 98
95 99 /*
96 100 * Operations on an address space:
97 101 *
98 102 * struct hat *hat_alloc(as)
99 103 * allocated a hat structure for as.
100 104 *
101 105 * void hat_free_start(hat)
102 106 * informs hat layer process has finished executing but as has not
103 107 * been cleaned up yet.
104 108 *
105 109 * void hat_free_end(hat)
106 110 * informs hat layer as is being destroyed. hat layer cannot use as
107 111 * pointer after this call.
108 112 *
109 113 * void hat_swapin(hat)
110 114 * allocate any hat resources required for process being swapped in.
111 115 *
112 116 * void hat_swapout(hat)
113 117 * deallocate hat resources for process being swapped out.
114 118 *
115 119 * size_t hat_get_mapped_size(hat)
116 120 * returns number of bytes that have valid mappings in hat.
117 121 *
118 122 * void hat_stats_enable(hat)
119 123 * void hat_stats_disable(hat)
120 124 * enables/disables collection of stats for hat.
121 125 *
122 126 * int hat_dup(parenthat, childhat, addr, len, flags)
123 127 * Duplicate address translations of the parent to the child. Supports
124 128 * the entire address range or a range depending on flag,
125 129 * zero returned on success, non-zero on error
126 130 *
127 131 * void hat_thread_exit(thread)
128 132 * Notifies the HAT that a thread is exiting, called after it has been
129 133 * reassigned to the kernel AS.
130 134 */
131 135
132 136 struct hat *hat_alloc(struct as *);
133 137 void hat_free_start(struct hat *);
134 138 void hat_free_end(struct hat *);
135 139 int hat_dup(struct hat *, struct hat *, caddr_t, size_t, uint_t);
136 140 void hat_swapin(struct hat *);
137 141 void hat_swapout(struct hat *);
138 142 size_t hat_get_mapped_size(struct hat *);
139 143 int hat_stats_enable(struct hat *);
140 144 void hat_stats_disable(struct hat *);
141 145 void hat_thread_exit(kthread_t *);
142 146
143 147 /*
144 148 * Operations on a named address within a segment:
145 149 *
146 150 * void hat_memload(hat, addr, pp, attr, flags)
147 151 * load/lock the given page struct
148 152 *
149 153 * void hat_memload_array(hat, addr, len, ppa, attr, flags)
150 154 * load/lock the given array of page structs
151 155 *
152 156 * void hat_devload(hat, addr, len, pf, attr, flags)
153 157 * load/lock the given page frame number
154 158 *
155 159 * void hat_unlock(hat, addr, len)
156 160 * unlock a given range of addresses
157 161 *
158 162 * void hat_unload(hat, addr, len, flags)
159 163 * void hat_unload_callback(hat, addr, len, flags, callback)
160 164 * unload a given range of addresses (has optional callback)
161 165 *
162 166 * void hat_sync(hat, addr, len, flags)
163 167 * synchronize mapping with software data structures
164 168 *
165 169 * void hat_map(hat, addr, len, flags)
166 170 *
167 171 * void hat_setattr(hat, addr, len, attr)
168 172 * void hat_clrattr(hat, addr, len, attr)
169 173 * void hat_chgattr(hat, addr, len, attr)
170 174 * modify attributes for a range of addresses. skips any invalid mappings
171 175 *
172 176 * uint_t hat_getattr(hat, addr, *attr)
173 177 * returns attr for <hat,addr> in *attr. returns 0 if there was a
174 178 * mapping and *attr is valid, nonzero if there was no mapping and
175 179 * *attr is not valid.
176 180 *
177 181 * size_t hat_getpagesize(hat, addr)
178 182 * returns pagesize in bytes for <hat, addr>. returns -1 if there is
179 183 * no mapping. This is an advisory call.
180 184 *
181 185 * pfn_t hat_getpfnum(hat, addr)
182 186 * returns pfn for <hat, addr> or PFN_INVALID if mapping is invalid.
183 187 *
184 188 * int hat_probe(hat, addr)
185 189 * return 0 if no valid mapping is present. Faster version
186 190 * of hat_getattr in certain architectures.
187 191 *
188 192 * int hat_share(dhat, daddr, shat, saddr, len, szc)
189 193 *
|
↓ open down ↓ |
141 lines elided |
↑ open up ↑ |
190 194 * void hat_unshare(hat, addr, len, szc)
191 195 *
192 196 * void hat_chgprot(hat, addr, len, vprot)
193 197 * This is a deprecated call. New segment drivers should store
194 198 * all attributes and use hat_*attr calls.
195 199 * Change the protections in the virtual address range
196 200 * given to the specified virtual protection. If vprot is ~PROT_WRITE,
197 201 * then remove write permission, leaving the other permissions
198 202 * unchanged. If vprot is ~PROT_USER, remove user permissions.
199 203 *
200 - * void hat_flush_range(hat, addr, size)
201 - * Invalidate a virtual address translation for the local CPU.
204 + * void hat_flush(void)
205 + * Flush the TLB for the local CPU.
202 206 */
203 207
204 208 void hat_memload(struct hat *, caddr_t, struct page *, uint_t, uint_t);
205 209 void hat_memload_array(struct hat *, caddr_t, size_t, struct page **,
206 210 uint_t, uint_t);
207 211 void hat_memload_region(struct hat *, caddr_t, struct page *, uint_t,
208 212 uint_t, hat_region_cookie_t);
209 213 void hat_memload_array_region(struct hat *, caddr_t, size_t, struct page **,
210 214 uint_t, uint_t, hat_region_cookie_t);
211 215
212 216 void hat_devload(struct hat *, caddr_t, size_t, pfn_t, uint_t, int);
213 217
214 218 void hat_unlock(struct hat *, caddr_t, size_t);
215 219 void hat_unlock_region(struct hat *, caddr_t, size_t, hat_region_cookie_t);
216 220
217 221 void hat_unload(struct hat *, caddr_t, size_t, uint_t);
218 222 void hat_unload_callback(struct hat *, caddr_t, size_t, uint_t,
219 223 hat_callback_t *);
220 -void hat_flush_range(struct hat *, caddr_t, size_t);
224 +void hat_flush(void);
221 225 void hat_sync(struct hat *, caddr_t, size_t, uint_t);
222 226 void hat_map(struct hat *, caddr_t, size_t, uint_t);
223 227 void hat_setattr(struct hat *, caddr_t, size_t, uint_t);
224 228 void hat_clrattr(struct hat *, caddr_t, size_t, uint_t);
225 229 void hat_chgattr(struct hat *, caddr_t, size_t, uint_t);
226 230 uint_t hat_getattr(struct hat *, caddr_t, uint_t *);
227 231 ssize_t hat_getpagesize(struct hat *, caddr_t);
228 232 pfn_t hat_getpfnum(struct hat *, caddr_t);
229 233 int hat_probe(struct hat *, caddr_t);
230 234 int hat_share(struct hat *, caddr_t, struct hat *, caddr_t, size_t, uint_t);
231 235 void hat_unshare(struct hat *, caddr_t, size_t, uint_t);
232 236 void hat_chgprot(struct hat *, caddr_t, size_t, uint_t);
233 237 void hat_reserve(struct as *, caddr_t, size_t);
234 238 pfn_t va_to_pfn(void *);
235 239 uint64_t va_to_pa(void *);
236 240
237 241 /*
238 242 * Kernel Physical Mapping (segkpm) hat interface routines.
239 243 */
240 244 caddr_t hat_kpm_mapin(struct page *, struct kpme *);
241 245 void hat_kpm_mapout(struct page *, struct kpme *, caddr_t);
242 246 caddr_t hat_kpm_mapin_pfn(pfn_t);
243 247 void hat_kpm_mapout_pfn(pfn_t);
244 248 caddr_t hat_kpm_page2va(struct page *, int);
245 249 struct page *hat_kpm_vaddr2page(caddr_t);
246 250 int hat_kpm_fault(struct hat *, caddr_t);
247 251 void hat_kpm_mseghash_clear(int);
248 252 void hat_kpm_mseghash_update(pgcnt_t, struct memseg *);
249 253 void hat_kpm_addmem_mseg_update(struct memseg *, pgcnt_t, offset_t);
250 254 void hat_kpm_addmem_mseg_insert(struct memseg *);
251 255 void hat_kpm_addmem_memsegs_update(struct memseg *);
252 256 caddr_t hat_kpm_mseg_reuse(struct memseg *);
253 257 void hat_kpm_delmem_mseg_update(struct memseg *, struct memseg **);
254 258 void hat_kpm_split_mseg_update(struct memseg *, struct memseg **,
255 259 struct memseg *, struct memseg *, struct memseg *);
256 260 void hat_kpm_walk(void (*)(void *, void *, size_t), void *);
257 261
258 262 /*
259 263 * Operations on all translations for a given page(s)
260 264 *
261 265 * void hat_page_setattr(pp, flag)
262 266 * void hat_page_clrattr(pp, flag)
263 267 * used to set/clr red/mod bits.
264 268 *
265 269 * uint hat_page_getattr(pp, flag)
266 270 * If flag is specified, returns 0 if attribute is disabled
267 271 * and non zero if enabled. If flag specifes multiple attributs
268 272 * then returns 0 if ALL atriibutes are disabled. This is an advisory
269 273 * call.
270 274 *
271 275 * int hat_pageunload(pp, forceflag)
272 276 * unload all translations attached to pp.
273 277 *
274 278 * uint_t hat_pagesync(pp, flags)
275 279 * get hw stats from hardware into page struct and reset hw stats
276 280 * returns attributes of page
277 281 *
278 282 * ulong_t hat_page_getshare(pp)
279 283 * returns approx number of mappings to this pp. A return of 0 implies
280 284 * there are no mappings to the page.
281 285 *
282 286 * faultcode_t hat_softlock(hat, addr, lenp, ppp, flags);
283 287 * called to softlock pages for zero copy tcp
284 288 *
285 289 * void hat_page_demote(pp);
286 290 * unload all large mappings to pp and decrease p_szc of all
287 291 * constituent pages according to the remaining mappings.
288 292 */
289 293
290 294 void hat_page_setattr(struct page *, uint_t);
291 295 void hat_page_clrattr(struct page *, uint_t);
292 296 uint_t hat_page_getattr(struct page *, uint_t);
293 297 int hat_pageunload(struct page *, uint_t);
294 298 uint_t hat_pagesync(struct page *, uint_t);
295 299 ulong_t hat_page_getshare(struct page *);
296 300 int hat_page_checkshare(struct page *, ulong_t);
297 301 faultcode_t hat_softlock(struct hat *, caddr_t, size_t *,
298 302 struct page **, uint_t);
299 303 void hat_page_demote(struct page *);
300 304
301 305 /*
302 306 * Rountine to expose supported HAT features to PIM.
303 307 */
304 308 enum hat_features {
305 309 HAT_SHARED_PT, /* Shared page tables */
306 310 HAT_DYNAMIC_ISM_UNMAP, /* hat_pageunload() handles ISM pages */
307 311 HAT_VMODSORT, /* support for VMODSORT flag of vnode */
308 312 HAT_SHARED_REGIONS /* shared regions support */
309 313 };
310 314
311 315 int hat_supported(enum hat_features, void *);
312 316
313 317 /*
314 318 * Services provided to the hat:
315 319 *
316 320 * void as_signal_proc(as, siginfo)
317 321 * deliver signal to all processes that have this as.
318 322 *
319 323 * int hat_setstat(as, addr, len, rmbits)
320 324 * informs hatstat layer that ref/mod bits need to be updated for
321 325 * address range. Returns 0 on success, 1 for failure.
322 326 */
323 327 void as_signal_proc(struct as *, k_siginfo_t *siginfo);
324 328 void hat_setstat(struct as *, caddr_t, size_t, uint_t);
325 329
326 330 /*
327 331 * Flags to pass to hat routines.
328 332 *
329 333 * Certain flags only apply to some interfaces:
330 334 *
331 335 * HAT_LOAD Default flags to load a translation to the page.
332 336 * HAT_LOAD_LOCK Lock down mapping resources; hat_map(), hat_memload(),
333 337 * and hat_devload().
334 338 * HAT_LOAD_ADV Advisory load - Load translation if and only if
335 339 * sufficient MMU resources exist (i.e., do not steal).
336 340 * HAT_LOAD_SHARE A flag to hat_memload() to indicate h/w page tables
337 341 * that map some user pages (not kas) is shared by more
338 342 * than one process (eg. ISM).
339 343 * HAT_LOAD_CONTIG Pages are contigous
340 344 * HAT_LOAD_NOCONSIST Do not add mapping to mapping list.
341 345 * HAT_LOAD_REMAP Reload a valid pte with a different page frame.
342 346 * HAT_RELOAD_SHARE Reload a shared page table entry. Some platforms
343 347 * may require different actions than on the first
344 348 * load of a shared mapping.
345 349 * HAT_NO_KALLOC Do not kmem_alloc while creating the mapping; at this
346 350 * point, it's setting up mapping to allocate internal
347 351 * hat layer data structures. This flag forces hat layer
348 352 * to tap its reserves in order to prevent infinite
349 353 * recursion.
350 354 * HAT_LOAD_TEXT A flag to hat_memload() to indicate loading text pages.
351 355 */
352 356
353 357 /*
354 358 * Flags for hat_memload/hat_devload
355 359 */
356 360 #define HAT_FLAGS_RESV 0xFF000000 /* resv for hat impl */
357 361 #define HAT_LOAD 0x00
358 362 #define HAT_LOAD_LOCK 0x01
359 363 #define HAT_LOAD_ADV 0x04
360 364 #define HAT_LOAD_CONTIG 0x10
361 365 #define HAT_LOAD_NOCONSIST 0x20
362 366 #define HAT_LOAD_SHARE 0x40
363 367 #define HAT_LOAD_REMAP 0x80
364 368 #define HAT_RELOAD_SHARE 0x100
365 369 #define HAT_NO_KALLOC 0x200
366 370 #define HAT_LOAD_TEXT 0x400
367 371
368 372 /*
369 373 * Flags for initializing disable_*large_pages.
370 374 *
371 375 * HAT_AUTO_TEXT Get MMU specific disable_auto_text_large_pages
372 376 * HAT_AUTO_DATA Get MMU specific disable_auto_data_large_pages
373 377 */
374 378 #define HAT_AUTO_TEXT 0x800
375 379 #define HAT_AUTO_DATA 0x1000
376 380
377 381 /*
378 382 * Attributes for hat_memload/hat_devload/hat_*attr
379 383 * are a superset of prot flags defined in mman.h.
380 384 */
381 385 #define HAT_PLAT_ATTR_MASK 0xF00000
382 386 #define HAT_PROT_MASK 0x0F
383 387
384 388 #define HAT_NOFAULT 0x10
385 389 #define HAT_NOSYNC 0x20
386 390
387 391 /*
388 392 * Advisory ordering attributes. Apply only to device mappings.
389 393 *
390 394 * HAT_STRICTORDER: the CPU must issue the references in order, as the
391 395 * programmer specified. This is the default.
392 396 * HAT_UNORDERED_OK: the CPU may reorder the references (this is all kinds
393 397 * of reordering; store or load with store or load).
394 398 * HAT_MERGING_OK: merging and batching: the CPU may merge individual stores
395 399 * to consecutive locations (for example, turn two consecutive byte
396 400 * stores into one halfword store), and it may batch individual loads
397 401 * (for example, turn two consecutive byte loads into one halfword load).
398 402 * This also implies re-ordering.
399 403 * HAT_LOADCACHING_OK: the CPU may cache the data it fetches and reuse it
400 404 * until another store occurs. The default is to fetch new data
401 405 * on every load. This also implies merging.
402 406 * HAT_STORECACHING_OK: the CPU may keep the data in the cache and push it to
403 407 * the device (perhaps with other data) at a later time. The default is
404 408 * to push the data right away. This also implies load caching.
405 409 */
406 410 #define HAT_STRICTORDER 0x0000
407 411 #define HAT_UNORDERED_OK 0x0100
408 412 #define HAT_MERGING_OK 0x0200
409 413 #define HAT_LOADCACHING_OK 0x0300
410 414 #define HAT_STORECACHING_OK 0x0400
411 415 #define HAT_ORDER_MASK 0x0700
412 416
413 417 /* endian attributes */
414 418 #define HAT_NEVERSWAP 0x0000
415 419 #define HAT_STRUCTURE_BE 0x1000
416 420 #define HAT_STRUCTURE_LE 0x2000
417 421 #define HAT_ENDIAN_MASK 0x3000
418 422
419 423 /* flags for hat_softlock */
420 424 #define HAT_COW 0x0001
421 425
422 426 /*
423 427 * Flags for hat_unload
424 428 */
425 429 #define HAT_UNLOAD 0x00
426 430 #define HAT_UNLOAD_NOSYNC 0x02
427 431 #define HAT_UNLOAD_UNLOCK 0x04
428 432 #define HAT_UNLOAD_OTHER 0x08
429 433 #define HAT_UNLOAD_UNMAP 0x10
430 434
431 435 /*
432 436 * Flags for hat_pagesync, hat_getstat, hat_sync
433 437 */
434 438 #define HAT_SYNC_DONTZERO 0x00
435 439 #define HAT_SYNC_ZERORM 0x01
436 440 /* Additional flags for hat_pagesync */
437 441 #define HAT_SYNC_STOPON_REF 0x02
438 442 #define HAT_SYNC_STOPON_MOD 0x04
439 443 #define HAT_SYNC_STOPON_RM (HAT_SYNC_STOPON_REF | HAT_SYNC_STOPON_MOD)
440 444 #define HAT_SYNC_STOPON_SHARED 0x08
441 445
442 446 /*
443 447 * Flags for hat_dup
444 448 *
445 449 * HAT_DUP_ALL dup entire address space
446 450 * HAT_DUP_COW dup plus hat_clrattr(..PROT_WRITE) on newas
447 451 */
448 452 #define HAT_DUP_ALL 1
449 453 #define HAT_DUP_COW 2
450 454 #define HAT_DUP_SRD 3
451 455
452 456
453 457 /*
454 458 * Flags for hat_map
455 459 */
456 460 #define HAT_MAP 0x00
457 461
458 462 /*
459 463 * Flag for hat_pageunload
460 464 */
461 465 #define HAT_ADV_PGUNLOAD 0x00
462 466 #define HAT_FORCE_PGUNLOAD 0x01
463 467
464 468 /*
465 469 * Attributes for hat_page_*attr, hat_setstats and
466 470 * returned by hat_pagesync.
467 471 */
468 472 #define P_MOD 0x1 /* the modified bit */
469 473 #define P_REF 0x2 /* the referenced bit */
470 474 #define P_RO 0x4 /* Read only page */
471 475 #define P_NSH 0x8 /* Not to shuffle v_pages */
472 476
473 477 #define hat_ismod(pp) (hat_page_getattr(pp, P_MOD))
474 478 #define hat_isref(pp) (hat_page_getattr(pp, P_REF))
475 479 #define hat_isro(pp) (hat_page_getattr(pp, P_RO))
476 480
477 481 #define hat_setmod(pp) (hat_page_setattr(pp, P_MOD))
478 482 #define hat_setmod_only(pp) (hat_page_setattr(pp, P_MOD|P_NSH))
479 483 #define hat_setref(pp) (hat_page_setattr(pp, P_REF))
480 484 #define hat_setrefmod(pp) (hat_page_setattr(pp, P_REF|P_MOD))
481 485
482 486 #define hat_clrmod(pp) (hat_page_clrattr(pp, P_MOD))
483 487 #define hat_clrref(pp) (hat_page_clrattr(pp, P_REF))
484 488 #define hat_clrrefmod(pp) (hat_page_clrattr(pp, P_REF|P_MOD))
485 489
486 490 #define hat_page_is_mapped(pp) (hat_page_getshare(pp))
487 491
488 492 /*
489 493 * hat_setup is being used in sparc/os/sundep.c
490 494 */
491 495 void hat_setup(struct hat *, int);
492 496
493 497 /*
494 498 * Flags for hat_setup
495 499 */
496 500 #define HAT_DONTALLOC 0
497 501 #define HAT_ALLOC 1
498 502 #define HAT_INIT 2
499 503
500 504 /*
501 505 * Other routines, for statistics
502 506 */
503 507 int hat_startstat(struct as *);
504 508 void hat_getstat(struct as *, caddr_t, size_t, uint_t, char *, int);
505 509 void hat_freestat(struct as *, int);
506 510 void hat_resvstat(size_t, struct as *, caddr_t);
507 511
508 512 /*
509 513 * Relocation callback routines. Currently only sfmmu HAT supports
510 514 * these.
511 515 */
512 516 extern int hat_add_callback(id_t, caddr_t, uint_t, uint_t, void *,
513 517 pfn_t *, void **);
514 518 extern id_t hat_register_callback(int,
515 519 int (*prehandler)(caddr_t, uint_t, uint_t, void *),
516 520 int (*posthandler)(caddr_t, uint_t, uint_t, void *, pfn_t),
517 521 int (*errhandler)(caddr_t, uint_t, uint_t, void *), int);
518 522 extern void hat_delete_callback(caddr_t, uint_t, void *, uint_t, void *);
519 523
520 524 /*
521 525 * hat_add_callback()/hat_delete_callback() flags.
522 526 */
523 527 #define HAC_NOSLEEP 0x0
524 528 #define HAC_SLEEP 0x1
525 529 #define HAC_PAGELOCK 0x2
526 530
527 531 /*
528 532 * Suspend/unsuspend handler callback arguments.
529 533 */
530 534 #define HAT_SUSPEND 0x0010
531 535 #define HAT_UNSUSPEND 0x0010
532 536 #define HAT_PRESUSPEND 0x0020
533 537 #define HAT_POSTUNSUSPEND 0x0020
534 538
535 539 /*
536 540 * Error handler callback arguments. See the block comments
537 541 * before the implementation of hat_add_callback() for an
538 542 * explanation of what these mean.
539 543 */
540 544 #define HAT_CB_ERR_LEAKED 0x1
541 545
542 546 #endif /* _KERNEL */
543 547
544 548 /*
545 549 * The size of the bit array for ref and mod bit storage must be a power of 2.
546 550 * 2 bits are collected for each page. Below the power used is 4,
547 551 * which is 16 8-bit characters = 128 bits, ref and mod bit information
548 552 * for 64 pages.
549 553 */
550 554 #define HRM_SHIFT 4
551 555 #define HRM_BYTES (1 << HRM_SHIFT)
552 556 #define HRM_PAGES ((HRM_BYTES * NBBY) / 2)
553 557 #define HRM_PGPERBYTE (NBBY/2)
554 558 #define HRM_PGBYTEMASK (HRM_PGPERBYTE-1)
555 559
556 560 #define HRM_PGOFFMASK ((HRM_PGPERBYTE-1) << MMU_PAGESHIFT)
557 561 #define HRM_BASEOFFSET (((MMU_PAGESIZE * HRM_PAGES) - 1))
558 562 #define HRM_BASEMASK (~(HRM_BASEOFFSET))
559 563
560 564 #define HRM_BASESHIFT (MMU_PAGESHIFT + (HRM_SHIFT + 2))
561 565 #define HRM_PAGEMASK (MMU_PAGEMASK ^ HRM_BASEMASK)
562 566
563 567 #define HRM_HASHSIZE 0x200
564 568 #define HRM_HASHMASK (HRM_HASHSIZE - 1)
565 569
566 570 #define HRM_BLIST_INCR 0x200
567 571
568 572 /*
569 573 * The structure for maintaining referenced and modified information
570 574 */
571 575 struct hrmstat {
572 576 struct as *hrm_as; /* stat block belongs to this as */
573 577 uintptr_t hrm_base; /* base of block */
574 578 ushort_t hrm_id; /* opaque identifier, one of a_vbits */
575 579 struct hrmstat *hrm_anext; /* as statistics block list */
576 580 struct hrmstat *hrm_hnext; /* list for hashed blocks */
577 581 uchar_t hrm_bits[HRM_BYTES]; /* the ref and mod bits */
578 582 };
579 583
580 584 extern struct hrmstat **hrm_hashtab;
581 585
582 586 /*
583 587 * For global monitoring of the reference and modified bits
584 588 * of all address spaces we reserve one id bit.
585 589 */
586 590 #define HRM_SWSMONID 1
587 591
588 592
589 593 #ifdef _KERNEL
590 594
591 595 /*
592 596 * Hat locking functions
593 597 * XXX - these two functions are currently being used by hatstats
594 598 * they can be removed by using a per-as mutex for hatstats.
595 599 */
596 600 void hat_enter(struct hat *);
597 601 void hat_exit(struct hat *);
598 602
599 603 typedef void (*hat_rgn_cb_func_t)(caddr_t, caddr_t, caddr_t,
600 604 size_t, void *, u_offset_t);
601 605
602 606 void hat_join_srd(struct hat *, vnode_t *);
603 607
604 608 hat_region_cookie_t hat_join_region(struct hat *, caddr_t, size_t, void *,
605 609 u_offset_t, uchar_t, uchar_t, hat_rgn_cb_func_t,
606 610 uint_t);
607 611 void hat_leave_region(struct hat *, hat_region_cookie_t,
608 612 uint_t);
609 613 void hat_dup_region(struct hat *, hat_region_cookie_t);
610 614
611 615 #define HAT_INVALID_REGION_COOKIE ((hat_region_cookie_t)-1)
612 616 #define HAT_IS_REGION_COOKIE_VALID(c) ((c) != HAT_INVALID_REGION_COOKIE)
613 617
614 618 /* hat_join_region() flags */
615 619
616 620 #define HAT_REGION_TEXT 0x1 /* passed by segvn */
617 621 #define HAT_REGION_ISM 0x2 /* for hat_share()/hat_unshare() */
618 622
619 623 #define HAT_REGION_TYPE_MASK (0x7)
620 624
621 625 #endif /* _KERNEL */
622 626
623 627 #ifdef __cplusplus
624 628 }
625 629 #endif
626 630
627 631 #endif /* _VM_HAT_H */
|
↓ open down ↓ |
397 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX