3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2016 by Delphix. All rights reserved.
24 */
25
26 #ifndef _SYS_DUMPHDR_H
27 #define _SYS_DUMPHDR_H
28
29 #include <sys/types.h>
30 #include <sys/param.h>
31 #include <sys/utsname.h>
32 #include <sys/log.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39 * The dump header describes the contents of a crash dump. Two headers
40 * are written out: one at the beginning of the dump, and the other at
41 * the very end of the dump device. The terminal header is at a known
42 * location (end of device) so we can always find it. The initial header
147
148 /*
149 * The dump data header is placed after the dumphdr in the compressed
150 * image. It is not needed after savecore runs and the data pages have
151 * been decompressed.
152 */
153 typedef struct dumpdatahdr {
154 uint32_t dump_datahdr_magic; /* data header presence */
155 uint32_t dump_datahdr_version; /* data header version */
156 uint64_t dump_data_csize; /* compressed data size */
157 uint32_t dump_maxcsize; /* compressed data max block size */
158 uint32_t dump_maxrange; /* max number of pages per range */
159 uint16_t dump_nstreams; /* number of compression streams */
160 uint16_t dump_clevel; /* compression level (0-9) */
161 uint32_t dump_metrics; /* size of metrics data */
162 } dumpdatahdr_t;
163
164 #define DUMP_DATAHDR_MAGIC ('d' << 24 | 'h' << 16 | 'd' << 8 | 'r')
165
166 #define DUMP_DATAHDR_VERSION 1
167 #define DUMP_CLEVEL_LZJB 1 /* parallel lzjb compression */
168 #define DUMP_CLEVEL_BZIP2 2 /* parallel bzip2 level 1 */
169
170 #ifdef _KERNEL
171
172 extern kmutex_t dump_lock;
173 extern struct vnode *dumpvp;
174 extern u_offset_t dumpvp_size;
175 extern struct dumphdr *dumphdr;
176 extern int dump_conflags;
177 extern char *dumppath;
178
179 extern int dump_timeout;
180 extern int dump_timeleft;
181 extern int dump_ioerr;
182
183 extern int dumpinit(struct vnode *, char *, int);
184 extern void dumpfini(void);
185 extern void dump_resize(void);
186 extern void dump_page(pfn_t);
187 extern void dump_addpage(struct as *, void *, pfn_t);
188 extern void dumpsys(void);
189 extern void dumpsys_helper(void);
190 extern void dumpsys_helper_nw(void);
191 extern void dump_messages(void);
192 extern void dump_ereports(void);
193 extern void dumpvp_write(const void *, size_t);
194 extern int dumpvp_resize(void);
195 extern int dump_plat_addr(void);
196 extern void dump_plat_pfn(void);
197 extern int dump_plat_data(void *);
198 extern int dump_set_uuid(const char *);
199 extern const char *dump_get_uuid(void);
200
201 /*
202 * Define a CPU count threshold that determines when to employ
203 * bzip2. This value is defined per-platform.
204 */
205 extern uint_t dump_plat_mincpu_default;
206
207 #define DUMP_PLAT_SUN4U_MINCPU 0
208 #define DUMP_PLAT_SUN4U_OPL_MINCPU 0
209 #define DUMP_PLAT_SUN4V_MINCPU 0
210 #define DUMP_PLAT_X86_64_MINCPU 0
211 #define DUMP_PLAT_X86_32_MINCPU 0
212
213 /*
214 * Override the per-platform default by setting this variable with
215 * /etc/system. The value 0 disables parallelism, and the old format
216 * dump is produced.
217 */
218 extern uint_t dump_plat_mincpu;
219
220 /*
221 * Pages may be stolen at dump time. Prevent the pages from ever being
222 * allocated while dump is running.
223 */
224 #define IS_DUMP_PAGE(pp) (dump_check_used && dump_test_used((pp)->p_pagenum))
225
226 extern int dump_test_used(pfn_t);
227 extern int dump_check_used;
228
229 #endif /* _KERNEL */
230
231 #ifdef __cplusplus
232 }
233 #endif
234
235 #endif /* _SYS_DUMPHDR_H */
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2016 by Delphix. All rights reserved.
25 */
26
27 #ifndef _SYS_DUMPHDR_H
28 #define _SYS_DUMPHDR_H
29
30 #include <sys/types.h>
31 #include <sys/param.h>
32 #include <sys/utsname.h>
33 #include <sys/log.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /*
40 * The dump header describes the contents of a crash dump. Two headers
41 * are written out: one at the beginning of the dump, and the other at
42 * the very end of the dump device. The terminal header is at a known
43 * location (end of device) so we can always find it. The initial header
148
149 /*
150 * The dump data header is placed after the dumphdr in the compressed
151 * image. It is not needed after savecore runs and the data pages have
152 * been decompressed.
153 */
154 typedef struct dumpdatahdr {
155 uint32_t dump_datahdr_magic; /* data header presence */
156 uint32_t dump_datahdr_version; /* data header version */
157 uint64_t dump_data_csize; /* compressed data size */
158 uint32_t dump_maxcsize; /* compressed data max block size */
159 uint32_t dump_maxrange; /* max number of pages per range */
160 uint16_t dump_nstreams; /* number of compression streams */
161 uint16_t dump_clevel; /* compression level (0-9) */
162 uint32_t dump_metrics; /* size of metrics data */
163 } dumpdatahdr_t;
164
165 #define DUMP_DATAHDR_MAGIC ('d' << 24 | 'h' << 16 | 'd' << 8 | 'r')
166
167 #define DUMP_DATAHDR_VERSION 1
168 #define DUMP_CLEVEL_SERIAL 0 /* single-threaded lzjb compression */
169 #define DUMP_CLEVEL_LZJB 1 /* parallel lzjb compression */
170
171 #ifdef _KERNEL
172
173 extern kmutex_t dump_lock;
174 extern struct vnode *dumpvp;
175 extern u_offset_t dumpvp_size;
176 extern struct dumphdr *dumphdr;
177 extern int dump_conflags;
178 extern char *dumppath;
179
180 extern int dump_timeout;
181 extern int dump_timeleft;
182 extern int dump_ioerr;
183
184 extern int dumpinit(struct vnode *, char *, int);
185 extern void dumpfini(void);
186 extern void dump_resize(void);
187 extern void dump_page(pfn_t);
188 extern void dump_addpage(struct as *, void *, pfn_t);
189 extern void dumpsys(void);
190 extern void dumpsys_helper(void);
191 extern void dumpsys_helper_nw(void);
192 extern void dump_messages(void);
193 extern void dump_ereports(void);
194 extern void dumpvp_write(const void *, size_t);
195 extern int dumpvp_resize(void);
196 extern int dump_plat_addr(void);
197 extern void dump_plat_pfn(void);
198 extern int dump_plat_data(void *);
199 extern int dump_set_uuid(const char *);
200 extern const char *dump_get_uuid(void);
201
202 /*
203 * Pages may be stolen at dump time. Prevent the pages from ever being
204 * allocated while dump is running.
205 */
206 #define IS_DUMP_PAGE(pp) (dump_check_used && dump_test_used((pp)->p_pagenum))
207
208 extern int dump_test_used(pfn_t);
209 extern int dump_check_used;
210
211 #endif /* _KERNEL */
212
213 #ifdef __cplusplus
214 }
215 #endif
216
217 #endif /* _SYS_DUMPHDR_H */
|