Print this page
[mq]: core-v2
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/dumphdr.h
+++ new/usr/src/uts/common/sys/dumphdr.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 (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 #ifndef _SYS_DUMPHDR_H
26 26 #define _SYS_DUMPHDR_H
27 27
28 28 #include <sys/types.h>
29 29 #include <sys/param.h>
30 30 #include <sys/utsname.h>
31 31 #include <sys/log.h>
32 32
33 33 #ifdef __cplusplus
34 34 extern "C" {
35 35 #endif
36 36
37 37 /*
38 38 * The dump header describes the contents of a crash dump. Two headers
39 39 * are written out: one at the beginning of the dump, and the other at
40 40 * the very end of the dump device. The terminal header is at a known
41 41 * location (end of device) so we can always find it. The initial header
42 42 * is redundant, but helps savecore(1M) determine whether the dump has been
43 43 * overwritten by swap activity. See dumpadm(1M) for dump configuration.
44 44 */
45 45 #define DUMP_MAGIC 0xdefec8edU /* dump magic number */
46 46 #define DUMP_VERSION 10 /* version of this dumphdr */
47 47 #define DUMP_WORDSIZE (sizeof (long) * NBBY) /* word size (32 or 64) */
48 48 #define DUMP_PANICSIZE 200 /* Max panic string copied */
49 49 #define DUMP_COMPRESS_RATIO 2 /* conservative; usually 2.5+ */
50 50 #define DUMP_OFFSET 65536 /* pad at start/end of dev */
51 51 #define DUMP_LOGSIZE (2 * LOG_HIWAT) /* /dev/log message save area */
52 52 #define DUMP_ERPTSIZE (P2ROUNDUP( \
53 53 (ERPT_DATA_SZ / 2) * \
54 54 (ERPT_EVCH_MAX + \
55 55 ERPT_MAX_ERRS * ERPT_HIWAT), \
56 56 DUMP_OFFSET)) /* ereport save area */
57 57 #define DUMP_SUMMARYSIZE (P2ROUNDUP( \
58 58 (STACK_BUF_SIZE + \
59 59 sizeof (summary_dump_t) + 1024), \
60 60 DUMP_OFFSET)) /* summary save area */
61 61
62 62 typedef struct dumphdr {
63 63 uint32_t dump_magic; /* magic number */
64 64 uint32_t dump_version; /* version number */
65 65 uint32_t dump_flags; /* flags; see below */
66 66 uint32_t dump_wordsize; /* 32 or 64 */
67 67 offset_t dump_start; /* starting offset on dump device */
68 68 offset_t dump_ksyms; /* offset of compressed symbol table */
69 69 offset_t dump_pfn; /* offset of pfn table for all pages */
70 70 offset_t dump_map; /* offset of page translation map */
71 71 offset_t dump_data; /* offset of actual dump data */
72 72 struct utsname dump_utsname; /* copy of utsname structure */
73 73 char dump_platform[SYS_NMLN]; /* platform name (uname -i) */
74 74 char dump_panicstring[DUMP_PANICSIZE]; /* copy of panicstr */
75 75 time_t dump_crashtime; /* time of crash */
76 76 long dump_pageshift; /* log2(pagesize) */
77 77 long dump_pagesize; /* pagesize */
78 78 long dump_hashmask; /* page translation hash mask */
79 79 long dump_nvtop; /* number of vtop table entries */
80 80 pgcnt_t dump_npages; /* number of data pages */
81 81 size_t dump_ksyms_size; /* kernel symbol table size */
82 82 size_t dump_ksyms_csize; /* compressed symbol table size */
83 83 uint32_t dump_fm_panic; /* initiated from fm subsystems */
84 84 char dump_uuid[36 + 1]; /* os image uuid */
85 85 } dumphdr_t;
86 86
87 87 /*
88 88 * Values for dump_flags
89 89 */
90 90 #define DF_VALID 0x00000001 /* Dump is valid (savecore clears) */
91 91 #define DF_COMPLETE 0x00000002 /* All pages present as configured */
92 92 #define DF_LIVE 0x00000004 /* Dump was taken on a live system */
93 93 #define DF_COMPRESSED 0x00000008 /* Dump is compressed */
94 94 #define DF_KERNEL 0x00010000 /* Contains kernel pages only */
95 95 #define DF_ALL 0x00020000 /* Contains all pages */
96 96 #define DF_CURPROC 0x00040000 /* Contains kernel + cur proc pages */
97 97 #define DF_CONTENT 0xffff0000 /* The set of all dump content flags */
98 98
99 99 /*
100 100 * Dump translation map hash table entry.
101 101 */
102 102 typedef struct dump_map {
103 103 offset_t dm_first;
104 104 offset_t dm_next;
105 105 offset_t dm_data;
106 106 struct as *dm_as;
107 107 uintptr_t dm_va;
108 108 } dump_map_t;
109 109
110 110 /*
111 111 * Dump translation map hash function.
112 112 */
113 113 #define DUMP_HASH(dhp, as, va) \
114 114 ((((uintptr_t)(as) >> 3) + ((va) >> (dhp)->dump_pageshift)) & \
115 115 (dhp)->dump_hashmask)
116 116
117 117 /*
118 118 * Encoding of the csize word used to provide meta information
119 119 * between dumpsys and savecore.
120 120 *
121 121 * tag size
122 122 * 1-4095 1..dump_maxcsize stream block
123 123 * 0 1..pagesize one lzjb page
124 124 * 0 0 marks end of data
125 125 */
126 126 typedef uint32_t dumpcsize_t;
127 127
128 128 #define DUMP_MAX_TAG (0xfffU)
129 129 #define DUMP_MAX_CSIZE (0xfffffU)
130 130 #define DUMP_SET_TAG(w, v) (((w) & DUMP_MAX_CSIZE) | ((v) << 20))
131 131 #define DUMP_GET_TAG(w) (((w) >> 20) & DUMP_MAX_TAG)
132 132 #define DUMP_SET_CSIZE(w, v) \
133 133 (((w) & (DUMP_MAX_TAG << 20)) | ((v) & DUMP_MAX_CSIZE))
134 134 #define DUMP_GET_CSIZE(w) ((w) & DUMP_MAX_CSIZE)
135 135
136 136 typedef struct dumpstreamhdr {
137 137 char stream_magic[8]; /* "StrmHdr" */
138 138 pgcnt_t stream_pagenum; /* starting pfn */
139 139 pgcnt_t stream_npages; /* uncompressed size */
140 140 } dumpstreamhdr_t;
141 141
142 142 #define DUMP_STREAM_MAGIC "StrmHdr"
143 143
144 144 /* The number of helpers is limited by the number of stream tags. */
145 145 #define DUMP_MAX_NHELPER DUMP_MAX_TAG
146 146
147 147 /*
148 148 * The dump data header is placed after the dumphdr in the compressed
149 149 * image. It is not needed after savecore runs and the data pages have
150 150 * been decompressed.
151 151 */
152 152 typedef struct dumpdatahdr {
153 153 uint32_t dump_datahdr_magic; /* data header presence */
154 154 uint32_t dump_datahdr_version; /* data header version */
155 155 uint64_t dump_data_csize; /* compressed data size */
156 156 uint32_t dump_maxcsize; /* compressed data max block size */
157 157 uint32_t dump_maxrange; /* max number of pages per range */
158 158 uint16_t dump_nstreams; /* number of compression streams */
159 159 uint16_t dump_clevel; /* compression level (0-9) */
160 160 uint32_t dump_metrics; /* size of metrics data */
161 161 } dumpdatahdr_t;
162 162
163 163 #define DUMP_DATAHDR_MAGIC ('d' << 24 | 'h' << 16 | 'd' << 8 | 'r')
164 164
165 165 #define DUMP_DATAHDR_VERSION 1
166 166 #define DUMP_CLEVEL_LZJB 1 /* parallel lzjb compression */
167 167 #define DUMP_CLEVEL_BZIP2 2 /* parallel bzip2 level 1 */
168 168
169 169 #ifdef _KERNEL
170 170
171 171 extern kmutex_t dump_lock;
172 172 extern struct vnode *dumpvp;
173 173 extern u_offset_t dumpvp_size;
174 174 extern struct dumphdr *dumphdr;
175 175 extern int dump_conflags;
176 176 extern char *dumppath;
177 177
178 178 extern int dump_timeout;
179 179 extern int dump_timeleft;
↓ open down ↓ |
179 lines elided |
↑ open up ↑ |
180 180 extern int dump_ioerr;
181 181 extern int sync_timeout;
182 182 extern int sync_timeleft;
183 183
184 184 extern int dumpinit(struct vnode *, char *, int);
185 185 extern void dumpfini(void);
186 186 extern void dump_resize(void);
187 187 extern void dump_page(pfn_t);
188 188 extern void dump_addpage(struct as *, void *, pfn_t);
189 189 extern void dumpsys(void);
190 -extern void dumpsys_helper(void);
191 -extern void dumpsys_helper_nw(void);
192 190 extern void dump_messages(void);
193 191 extern void dump_ereports(void);
194 192 extern void dumpvp_write(const void *, size_t);
195 193 extern int dumpvp_resize(void);
196 194 extern int dump_plat_addr(void);
197 195 extern void dump_plat_pfn(void);
198 196 extern int dump_plat_data(void *);
199 197 extern int dump_set_uuid(const char *);
200 198 extern const char *dump_get_uuid(void);
201 199
202 200 /*
203 201 * Define a CPU count threshold that determines when to employ
204 202 * bzip2. This value is defined per-platform.
205 203 */
206 204 extern uint_t dump_plat_mincpu_default;
207 205
208 206 #define DUMP_PLAT_SUN4U_MINCPU 51
209 207 #define DUMP_PLAT_SUN4U_OPL_MINCPU 8
210 208 #define DUMP_PLAT_SUN4V_MINCPU 128
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
211 209 #define DUMP_PLAT_X86_64_MINCPU 11
212 210 #define DUMP_PLAT_X86_32_MINCPU 0
213 211
214 212 /*
215 213 * Override the per-platform default by setting this variable with
216 214 * /etc/system. The value 0 disables parallelism, and the old format
217 215 * dump is produced.
218 216 */
219 217 extern uint_t dump_plat_mincpu;
220 218
221 -/*
222 - * Pages may be stolen at dump time. Prevent the pages from ever being
223 - * allocated while dump is running.
224 - */
225 -#define IS_DUMP_PAGE(pp) (dump_check_used && dump_test_used((pp)->p_pagenum))
226 -
227 -extern int dump_test_used(pfn_t);
228 -extern int dump_check_used;
229 -
230 219 #endif /* _KERNEL */
231 220
232 221 #ifdef __cplusplus
233 222 }
234 223 #endif
235 224
236 225 #endif /* _SYS_DUMPHDR_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX