diff options
author | zangrc <zangrc.fnst@fujitsu.com> | 2021-09-10 05:56:03 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-09-09 09:34:13 -0700 |
commit | c833f0248954cad69cc14f866eb4003752e0b6eb (patch) | |
tree | a88dd27162b33508c8db330067a4a7c87ca15d4d | |
parent | bfaf4055626aebf75efaf2abefe540a1b1dc469c (diff) | |
download | meta-openembedded-c833f0248954cad69cc14f866eb4003752e0b6eb.tar.gz |
crash: upgrade 7.2.9 -> 7.3.0
Refresh the following patch:
donnot-extract-gdb-during-do-compile.patch
remove-unrecognized-gcc-option-m32-for-mips.patch
0001-printk-add-support-for-lockless-ringbuffer.patch
0002-printk-use-committed-finalized-state-values.patch
Removed since these are included in 7.3.0.
Signed-off-by: Zang Ruochen <zangrc.fnst@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-oe/recipes-kernel/crash/crash/0001-printk-add-support-for-lockless-ringbuffer.patch | 445 | ||||
-rw-r--r-- | meta-oe/recipes-kernel/crash/crash/0002-printk-use-committed-finalized-state-values.patch | 103 | ||||
-rw-r--r-- | meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch | 19 | ||||
-rw-r--r-- | meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch | 6 | ||||
-rw-r--r-- | meta-oe/recipes-kernel/crash/crash_7.3.0.bb (renamed from meta-oe/recipes-kernel/crash/crash_7.2.9.bb) | 4 |
5 files changed, 14 insertions, 563 deletions
diff --git a/meta-oe/recipes-kernel/crash/crash/0001-printk-add-support-for-lockless-ringbuffer.patch b/meta-oe/recipes-kernel/crash/crash/0001-printk-add-support-for-lockless-ringbuffer.patch deleted file mode 100644 index 1aaf1e6b07..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/0001-printk-add-support-for-lockless-ringbuffer.patch +++ /dev/null | |||
@@ -1,445 +0,0 @@ | |||
1 | From a5531b24750e7949c35640d996ea14c0587938bc Mon Sep 17 00:00:00 2001 | ||
2 | From: John Ogness <john.ogness@linutronix.de> | ||
3 | Date: Fri, 20 Nov 2020 05:56:59 +0000 | ||
4 | Subject: [PATCH 1/2] printk: add support for lockless ringbuffer | ||
5 | |||
6 | Linux 5.10 introduces a new lockless ringbuffer. The new ringbuffer | ||
7 | is structured completely different to the previous iterations. | ||
8 | Add support for dumping the ringbuffer with the "log" command. | ||
9 | The new ringbuffer is detected based on the availability of | ||
10 | the "prb" symbol. | ||
11 | |||
12 | Upstream-Status: Backport [https://github.com/crash-utility/crash/commit/a5531b24750e7949c35640d996ea14c0587938bc] | ||
13 | |||
14 | Signed-off-by: John Ogness <john.ogness@linutronix.de> | ||
15 | Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com> | ||
16 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> | ||
17 | --- | ||
18 | Makefile | 5 ++ | ||
19 | defs.h | 30 +++++++ | ||
20 | kernel.c | 7 +- | ||
21 | printk.c | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
22 | symbols.c | 27 ++++++ | ||
23 | 5 files changed, 324 insertions(+), 1 deletion(-) | ||
24 | create mode 100644 printk.c | ||
25 | |||
26 | diff --git a/Makefile b/Makefile | ||
27 | index d185719..f66eba7 100644 | ||
28 | --- a/Makefile | ||
29 | +++ b/Makefile | ||
30 | @@ -61,6 +61,7 @@ VMWARE_HFILES=vmware_vmss.h | ||
31 | |||
32 | CFILES=main.c tools.c global_data.c memory.c filesys.c help.c task.c \ | ||
33 | kernel.c test.c gdb_interface.c configure.c net.c dev.c bpf.c \ | ||
34 | + printk.c \ | ||
35 | alpha.c x86.c ppc.c ia64.c s390.c s390x.c s390dbf.c ppc64.c x86_64.c \ | ||
36 | arm.c arm64.c mips.c sparc64.c \ | ||
37 | extensions.c remote.c va_server.c va_server_v1.c symbols.c cmdline.c \ | ||
38 | @@ -80,6 +81,7 @@ SOURCE_FILES=${CFILES} ${GENERIC_HFILES} ${MCORE_HFILES} \ | ||
39 | |||
40 | OBJECT_FILES=main.o tools.o global_data.o memory.o filesys.o help.o task.o \ | ||
41 | build_data.o kernel.o test.o gdb_interface.o net.o dev.o bpf.o \ | ||
42 | + printk.o \ | ||
43 | alpha.o x86.o ppc.o ia64.o s390.o s390x.o s390dbf.o ppc64.o x86_64.o \ | ||
44 | arm.o arm64.o mips.o sparc64.o \ | ||
45 | extensions.o remote.o va_server.o va_server_v1.o symbols.o cmdline.o \ | ||
46 | @@ -363,6 +365,9 @@ task.o: ${GENERIC_HFILES} task.c | ||
47 | kernel.o: ${GENERIC_HFILES} kernel.c | ||
48 | ${CC} -c ${CRASH_CFLAGS} kernel.c ${WARNING_OPTIONS} ${WARNING_ERROR} | ||
49 | |||
50 | +printk.o: ${GENERIC_HFILES} printk.c | ||
51 | + ${CC} -c ${CRASH_CFLAGS} printk.c ${WARNING_OPTIONS} ${WARNING_ERROR} | ||
52 | + | ||
53 | gdb_interface.o: ${GENERIC_HFILES} gdb_interface.c | ||
54 | ${CC} -c ${CRASH_CFLAGS} gdb_interface.c ${WARNING_OPTIONS} ${WARNING_ERROR} | ||
55 | |||
56 | diff --git a/defs.h b/defs.h | ||
57 | index 9594950..e1a18e9 100644 | ||
58 | --- a/defs.h | ||
59 | +++ b/defs.h | ||
60 | @@ -2106,6 +2106,28 @@ struct offset_table { /* stash of commonly-used offsets */ | ||
61 | long irq_common_data_affinity; | ||
62 | long irq_desc_irq_common_data; | ||
63 | long uts_namespace_name; | ||
64 | + long printk_info_seq; | ||
65 | + long printk_info_ts_nsec; | ||
66 | + long printk_info_text_len; | ||
67 | + long printk_info_level; | ||
68 | + long printk_info_caller_id; | ||
69 | + long printk_info_dev_info; | ||
70 | + long dev_printk_info_subsystem; | ||
71 | + long dev_printk_info_device; | ||
72 | + long prb_desc_ring; | ||
73 | + long prb_text_data_ring; | ||
74 | + long prb_desc_ring_count_bits; | ||
75 | + long prb_desc_ring_descs; | ||
76 | + long prb_desc_ring_infos; | ||
77 | + long prb_desc_ring_head_id; | ||
78 | + long prb_desc_ring_tail_id; | ||
79 | + long prb_desc_state_var; | ||
80 | + long prb_desc_text_blk_lpos; | ||
81 | + long prb_data_blk_lpos_begin; | ||
82 | + long prb_data_blk_lpos_next; | ||
83 | + long prb_data_ring_size_bits; | ||
84 | + long prb_data_ring_data; | ||
85 | + long atomic_long_t_counter; | ||
86 | }; | ||
87 | |||
88 | struct size_table { /* stash of commonly-used sizes */ | ||
89 | @@ -2265,6 +2287,9 @@ struct size_table { /* stash of commonly-used sizes */ | ||
90 | long xa_node; | ||
91 | long zram_table_entry; | ||
92 | long irq_common_data; | ||
93 | + long printk_info; | ||
94 | + long printk_ringbuffer; | ||
95 | + long prb_desc; | ||
96 | }; | ||
97 | |||
98 | struct array_table { | ||
99 | @@ -6696,6 +6721,11 @@ int vmware_guestdump_memory_dump(FILE *); | ||
100 | */ | ||
101 | int calc_kaslr_offset(ulong *, ulong *); | ||
102 | |||
103 | +/* | ||
104 | + * printk.c | ||
105 | + */ | ||
106 | +void dump_lockless_record_log(int); | ||
107 | + | ||
108 | /* | ||
109 | * gnu_binutils.c | ||
110 | */ | ||
111 | diff --git a/kernel.c b/kernel.c | ||
112 | index 9871637..e722ff9 100644 | ||
113 | --- a/kernel.c | ||
114 | +++ b/kernel.c | ||
115 | @@ -5042,6 +5042,11 @@ dump_log(int msg_flags) | ||
116 | struct syment *nsp; | ||
117 | int log_wrap, loglevel, log_buf_len; | ||
118 | |||
119 | + if (kernel_symbol_exists("prb")) { | ||
120 | + dump_lockless_record_log(msg_flags); | ||
121 | + return; | ||
122 | + } | ||
123 | + | ||
124 | if (kernel_symbol_exists("log_first_idx") && | ||
125 | kernel_symbol_exists("log_next_idx")) { | ||
126 | dump_variable_length_record_log(msg_flags); | ||
127 | @@ -5289,7 +5294,7 @@ dump_log_entry(char *logptr, int msg_flags) | ||
128 | } | ||
129 | |||
130 | /* | ||
131 | - * Handle the new variable-length-record log_buf. | ||
132 | + * Handle the variable-length-record log_buf. | ||
133 | */ | ||
134 | static void | ||
135 | dump_variable_length_record_log(int msg_flags) | ||
136 | diff --git a/printk.c b/printk.c | ||
137 | new file mode 100644 | ||
138 | index 0000000..f6d54ce | ||
139 | --- /dev/null | ||
140 | +++ b/printk.c | ||
141 | @@ -0,0 +1,256 @@ | ||
142 | +#include "defs.h" | ||
143 | +#include <ctype.h> | ||
144 | + | ||
145 | +#define DESC_SV_BITS (sizeof(unsigned long) * 8) | ||
146 | +#define DESC_COMMITTED_MASK (1UL << (DESC_SV_BITS - 1)) | ||
147 | +#define DESC_REUSE_MASK (1UL << (DESC_SV_BITS - 2)) | ||
148 | +#define DESC_FLAGS_MASK (DESC_COMMITTED_MASK | DESC_REUSE_MASK) | ||
149 | +#define DESC_ID_MASK (~DESC_FLAGS_MASK) | ||
150 | + | ||
151 | +/* convenience struct for passing many values to helper functions */ | ||
152 | +struct prb_map { | ||
153 | + char *prb; | ||
154 | + | ||
155 | + char *desc_ring; | ||
156 | + unsigned long desc_ring_count; | ||
157 | + char *descs; | ||
158 | + char *infos; | ||
159 | + | ||
160 | + char *text_data_ring; | ||
161 | + unsigned long text_data_ring_size; | ||
162 | + char *text_data; | ||
163 | +}; | ||
164 | + | ||
165 | +static void | ||
166 | +init_offsets(void) | ||
167 | +{ | ||
168 | + char *n; | ||
169 | + | ||
170 | + n = "printk_info"; | ||
171 | + STRUCT_SIZE_INIT(printk_info, n); | ||
172 | + MEMBER_OFFSET_INIT(printk_info_seq, n, "seq"); | ||
173 | + MEMBER_OFFSET_INIT(printk_info_ts_nsec, n, "ts_nsec"); | ||
174 | + MEMBER_OFFSET_INIT(printk_info_text_len, n, "text_len"); | ||
175 | + MEMBER_OFFSET_INIT(printk_info_level, n, "level"); | ||
176 | + MEMBER_OFFSET_INIT(printk_info_caller_id, n, "caller_id"); | ||
177 | + MEMBER_OFFSET_INIT(printk_info_dev_info, n, "dev_info"); | ||
178 | + | ||
179 | + n = "dev_printk_info"; | ||
180 | + MEMBER_OFFSET_INIT(dev_printk_info_subsystem, n, "subsystem"); | ||
181 | + MEMBER_OFFSET_INIT(dev_printk_info_device, n, "device"); | ||
182 | + | ||
183 | + n = "printk_ringbuffer"; | ||
184 | + STRUCT_SIZE_INIT(printk_ringbuffer, n); | ||
185 | + MEMBER_OFFSET_INIT(prb_desc_ring, n, "desc_ring"); | ||
186 | + MEMBER_OFFSET_INIT(prb_text_data_ring, n, "text_data_ring"); | ||
187 | + | ||
188 | + n = "prb_desc_ring"; | ||
189 | + MEMBER_OFFSET_INIT(prb_desc_ring_count_bits, n, "count_bits"); | ||
190 | + MEMBER_OFFSET_INIT(prb_desc_ring_descs, n, "descs"); | ||
191 | + MEMBER_OFFSET_INIT(prb_desc_ring_infos, n, "infos"); | ||
192 | + MEMBER_OFFSET_INIT(prb_desc_ring_head_id, n, "head_id"); | ||
193 | + MEMBER_OFFSET_INIT(prb_desc_ring_tail_id, n, "tail_id"); | ||
194 | + | ||
195 | + n = "prb_desc"; | ||
196 | + STRUCT_SIZE_INIT(prb_desc, n); | ||
197 | + MEMBER_OFFSET_INIT(prb_desc_state_var, n, "state_var"); | ||
198 | + MEMBER_OFFSET_INIT(prb_desc_text_blk_lpos, n, "text_blk_lpos"); | ||
199 | + | ||
200 | + n = "prb_data_blk_lpos"; | ||
201 | + MEMBER_OFFSET_INIT(prb_data_blk_lpos_begin, n, "begin"); | ||
202 | + MEMBER_OFFSET_INIT(prb_data_blk_lpos_next, n, "next"); | ||
203 | + | ||
204 | + n = "prb_data_ring"; | ||
205 | + MEMBER_OFFSET_INIT(prb_data_ring_size_bits, n, "size_bits"); | ||
206 | + MEMBER_OFFSET_INIT(prb_data_ring_data, n, "data"); | ||
207 | + | ||
208 | + n = "atomic_long_t"; | ||
209 | + MEMBER_OFFSET_INIT(atomic_long_t_counter, n, "counter"); | ||
210 | +} | ||
211 | + | ||
212 | +static void | ||
213 | +dump_record(struct prb_map *m, unsigned long id, int msg_flags) | ||
214 | +{ | ||
215 | + unsigned short text_len; | ||
216 | + unsigned long state_var; | ||
217 | + unsigned int caller_id; | ||
218 | + unsigned char level; | ||
219 | + unsigned long begin; | ||
220 | + unsigned long next; | ||
221 | + char buf[BUFSIZE]; | ||
222 | + uint64_t ts_nsec; | ||
223 | + ulonglong nanos; | ||
224 | + ulonglong seq; | ||
225 | + int ilen = 0, i; | ||
226 | + char *desc, *info, *text, *p; | ||
227 | + ulong rem; | ||
228 | + | ||
229 | + desc = m->descs + ((id % m->desc_ring_count) * SIZE(prb_desc)); | ||
230 | + | ||
231 | + /* skip non-committed record */ | ||
232 | + state_var = ULONG(desc + OFFSET(prb_desc_state_var) + | ||
233 | + OFFSET(atomic_long_t_counter)); | ||
234 | + if ((state_var & DESC_FLAGS_MASK) != DESC_COMMITTED_MASK) | ||
235 | + return; | ||
236 | + | ||
237 | + info = m->infos + ((id % m->desc_ring_count) * SIZE(printk_info)); | ||
238 | + | ||
239 | + seq = ULONGLONG(info + OFFSET(printk_info_seq)); | ||
240 | + caller_id = UINT(info + OFFSET(printk_info_caller_id)); | ||
241 | + if (CRASHDEBUG(1)) | ||
242 | + fprintf(fp, "seq: %llu caller_id: %x (%s: %u)\n", seq, caller_id, | ||
243 | + caller_id & 0x80000000 ? "cpu" : "pid", caller_id & ~0x80000000); | ||
244 | + | ||
245 | + text_len = USHORT(info + OFFSET(printk_info_text_len)); | ||
246 | + | ||
247 | + begin = ULONG(desc + OFFSET(prb_desc_text_blk_lpos) + | ||
248 | + OFFSET(prb_data_blk_lpos_begin)) % | ||
249 | + m->text_data_ring_size; | ||
250 | + next = ULONG(desc + OFFSET(prb_desc_text_blk_lpos) + | ||
251 | + OFFSET(prb_data_blk_lpos_next)) % | ||
252 | + m->text_data_ring_size; | ||
253 | + | ||
254 | + /* skip data-less text blocks */ | ||
255 | + if (begin == next) | ||
256 | + goto out; | ||
257 | + | ||
258 | + if ((msg_flags & SHOW_LOG_TEXT) == 0) { | ||
259 | + ts_nsec = ULONGLONG(info + OFFSET(printk_info_ts_nsec)); | ||
260 | + nanos = (ulonglong)ts_nsec / (ulonglong)1000000000; | ||
261 | + rem = (ulonglong)ts_nsec % (ulonglong)1000000000; | ||
262 | + if (msg_flags & SHOW_LOG_CTIME) { | ||
263 | + time_t t = kt->boot_date.tv_sec + nanos; | ||
264 | + sprintf(buf, "[%s] ", ctime_tz(&t)); | ||
265 | + } else | ||
266 | + sprintf(buf, "[%5lld.%06ld] ", nanos, rem/1000); | ||
267 | + | ||
268 | + ilen += strlen(buf); | ||
269 | + fprintf(fp, "%s", buf); | ||
270 | + } | ||
271 | + | ||
272 | + if (msg_flags & SHOW_LOG_LEVEL) { | ||
273 | + level = UCHAR(info + OFFSET(printk_info_level)) >> 5; | ||
274 | + sprintf(buf, "<%x>", level); | ||
275 | + ilen += strlen(buf); | ||
276 | + fprintf(fp, "%s", buf); | ||
277 | + } | ||
278 | + | ||
279 | + /* handle wrapping data block */ | ||
280 | + if (begin > next) | ||
281 | + begin = 0; | ||
282 | + | ||
283 | + /* skip over descriptor ID */ | ||
284 | + begin += sizeof(unsigned long); | ||
285 | + | ||
286 | + /* handle truncated messages */ | ||
287 | + if (next - begin < text_len) | ||
288 | + text_len = next - begin; | ||
289 | + | ||
290 | + text = m->text_data + begin; | ||
291 | + | ||
292 | + for (i = 0, p = text; i < text_len; i++, p++) { | ||
293 | + if (*p == '\n') | ||
294 | + fprintf(fp, "\n%s", space(ilen)); | ||
295 | + else if (isprint(*p) || isspace(*p)) | ||
296 | + fputc(*p, fp); | ||
297 | + else | ||
298 | + fputc('.', fp); | ||
299 | + } | ||
300 | + | ||
301 | + if (msg_flags & SHOW_LOG_DICT) { | ||
302 | + text = info + OFFSET(printk_info_dev_info) + | ||
303 | + OFFSET(dev_printk_info_subsystem); | ||
304 | + if (strlen(text)) | ||
305 | + fprintf(fp, "\n%sSUBSYSTEM=%s", space(ilen), text); | ||
306 | + | ||
307 | + text = info + OFFSET(printk_info_dev_info) + | ||
308 | + OFFSET(dev_printk_info_device); | ||
309 | + if (strlen(text)) | ||
310 | + fprintf(fp, "\n%sDEVICE=%s", space(ilen), text); | ||
311 | + } | ||
312 | +out: | ||
313 | + fprintf(fp, "\n"); | ||
314 | +} | ||
315 | + | ||
316 | +/* | ||
317 | + * Handle the lockless printk_ringbuffer. | ||
318 | + */ | ||
319 | +void | ||
320 | +dump_lockless_record_log(int msg_flags) | ||
321 | +{ | ||
322 | + unsigned long head_id; | ||
323 | + unsigned long tail_id; | ||
324 | + unsigned long kaddr; | ||
325 | + unsigned long id; | ||
326 | + struct prb_map m; | ||
327 | + | ||
328 | + if (INVALID_SIZE(printk_info)) | ||
329 | + init_offsets(); | ||
330 | + | ||
331 | + /* setup printk_ringbuffer */ | ||
332 | + get_symbol_data("prb", sizeof(char *), &kaddr); | ||
333 | + m.prb = GETBUF(SIZE(printk_ringbuffer)); | ||
334 | + if (!readmem(kaddr, KVADDR, m.prb, SIZE(printk_ringbuffer), | ||
335 | + "printk_ringbuffer contents", RETURN_ON_ERROR|QUIET)) { | ||
336 | + error(WARNING, "\ncannot read printk_ringbuffer contents\n"); | ||
337 | + goto out_prb; | ||
338 | + } | ||
339 | + | ||
340 | + /* setup descriptor ring */ | ||
341 | + m.desc_ring = m.prb + OFFSET(prb_desc_ring); | ||
342 | + m.desc_ring_count = 1 << UINT(m.desc_ring + OFFSET(prb_desc_ring_count_bits)); | ||
343 | + | ||
344 | + kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring_descs)); | ||
345 | + m.descs = GETBUF(SIZE(prb_desc) * m.desc_ring_count); | ||
346 | + if (!readmem(kaddr, KVADDR, m.descs, SIZE(prb_desc) * m.desc_ring_count, | ||
347 | + "prb_desc_ring contents", RETURN_ON_ERROR|QUIET)) { | ||
348 | + error(WARNING, "\ncannot read prb_desc_ring contents\n"); | ||
349 | + goto out_descs; | ||
350 | + } | ||
351 | + | ||
352 | + kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring_infos)); | ||
353 | + m.infos = GETBUF(SIZE(printk_info) * m.desc_ring_count); | ||
354 | + if (!readmem(kaddr, KVADDR, m.infos, SIZE(printk_info) * m.desc_ring_count, | ||
355 | + "prb_info_ring contents", RETURN_ON_ERROR|QUIET)) { | ||
356 | + error(WARNING, "\ncannot read prb_info_ring contents\n"); | ||
357 | + goto out_infos; | ||
358 | + } | ||
359 | + | ||
360 | + /* setup text data ring */ | ||
361 | + m.text_data_ring = m.prb + OFFSET(prb_text_data_ring); | ||
362 | + m.text_data_ring_size = 1 << UINT(m.text_data_ring + OFFSET(prb_data_ring_size_bits)); | ||
363 | + | ||
364 | + kaddr = ULONG(m.text_data_ring + OFFSET(prb_data_ring_data)); | ||
365 | + m.text_data = GETBUF(m.text_data_ring_size); | ||
366 | + if (!readmem(kaddr, KVADDR, m.text_data, m.text_data_ring_size, | ||
367 | + "prb_text_data_ring contents", RETURN_ON_ERROR|QUIET)) { | ||
368 | + error(WARNING, "\ncannot read prb_text_data_ring contents\n"); | ||
369 | + goto out_text_data; | ||
370 | + } | ||
371 | + | ||
372 | + /* ready to go */ | ||
373 | + | ||
374 | + tail_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring_tail_id) + | ||
375 | + OFFSET(atomic_long_t_counter)); | ||
376 | + head_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring_head_id) + | ||
377 | + OFFSET(atomic_long_t_counter)); | ||
378 | + | ||
379 | + hq_open(); | ||
380 | + | ||
381 | + for (id = tail_id; id != head_id; id = (id + 1) & DESC_ID_MASK) | ||
382 | + dump_record(&m, id, msg_flags); | ||
383 | + | ||
384 | + /* dump head record */ | ||
385 | + dump_record(&m, id, msg_flags); | ||
386 | + | ||
387 | + hq_close(); | ||
388 | + | ||
389 | +out_text_data: | ||
390 | + FREEBUF(m.text_data); | ||
391 | +out_infos: | ||
392 | + FREEBUF(m.infos); | ||
393 | +out_descs: | ||
394 | + FREEBUF(m.descs); | ||
395 | +out_prb: | ||
396 | + FREEBUF(m.prb); | ||
397 | +} | ||
398 | diff --git a/symbols.c b/symbols.c | ||
399 | index b2f4eb5..a51078d 100644 | ||
400 | --- a/symbols.c | ||
401 | +++ b/symbols.c | ||
402 | @@ -10426,6 +10426,30 @@ dump_offset_table(char *spec, ulong makestruct) | ||
403 | OFFSET(log_level)); | ||
404 | fprintf(fp, " log_flags_level: %ld\n", | ||
405 | OFFSET(log_flags_level)); | ||
406 | + | ||
407 | + fprintf(fp, " printk_info_seq: %ld\n", OFFSET(printk_info_seq)); | ||
408 | + fprintf(fp, " printk_info_ts_nseq: %ld\n", OFFSET(printk_info_ts_nsec)); | ||
409 | + fprintf(fp, " printk_info_text_len: %ld\n", OFFSET(printk_info_text_len)); | ||
410 | + fprintf(fp, " printk_info_level: %ld\n", OFFSET(printk_info_level)); | ||
411 | + fprintf(fp, " printk_info_caller_id: %ld\n", OFFSET(printk_info_caller_id)); | ||
412 | + fprintf(fp, " printk_info_dev_info: %ld\n", OFFSET(printk_info_dev_info)); | ||
413 | + fprintf(fp, " dev_printk_info_subsystem: %ld\n", OFFSET(dev_printk_info_subsystem)); | ||
414 | + fprintf(fp, " dev_printk_info_device: %ld\n", OFFSET(dev_printk_info_device)); | ||
415 | + fprintf(fp, " prb_desc_ring: %ld\n", OFFSET(prb_desc_ring)); | ||
416 | + fprintf(fp, " prb_text_data_ring: %ld\n", OFFSET(prb_text_data_ring)); | ||
417 | + fprintf(fp, " prb_desc_ring_count_bits: %ld\n", OFFSET(prb_desc_ring_count_bits)); | ||
418 | + fprintf(fp, " prb_desc_ring_descs: %ld\n", OFFSET(prb_desc_ring_descs)); | ||
419 | + fprintf(fp, " prb_desc_ring_infos: %ld\n", OFFSET(prb_desc_ring_infos)); | ||
420 | + fprintf(fp, " prb_desc_ring_head_id: %ld\n", OFFSET(prb_desc_ring_head_id)); | ||
421 | + fprintf(fp, " prb_desc_ring_tail_id: %ld\n", OFFSET(prb_desc_ring_tail_id)); | ||
422 | + fprintf(fp, " prb_desc_state_var: %ld\n", OFFSET(prb_desc_state_var)); | ||
423 | + fprintf(fp, " prb_desc_text_blk_lpos: %ld\n", OFFSET(prb_desc_text_blk_lpos)); | ||
424 | + fprintf(fp, " prb_data_blk_lpos_begin: %ld\n", OFFSET(prb_data_blk_lpos_begin)); | ||
425 | + fprintf(fp, " prb_data_blk_lpos_next: %ld\n", OFFSET(prb_data_blk_lpos_next)); | ||
426 | + fprintf(fp, " prb_data_ring_size_bits: %ld\n", OFFSET(prb_data_ring_size_bits)); | ||
427 | + fprintf(fp, " prb_data_ring_data: %ld\n", OFFSET(prb_data_ring_data)); | ||
428 | + fprintf(fp, " atomit_long_t_counter: %ld\n", OFFSET(atomic_long_t_counter)); | ||
429 | + | ||
430 | fprintf(fp, " sched_rt_entity_my_q: %ld\n", | ||
431 | OFFSET(sched_rt_entity_my_q)); | ||
432 | fprintf(fp, " task_group_parent: %ld\n", | ||
433 | @@ -10850,6 +10874,9 @@ dump_offset_table(char *spec, ulong makestruct) | ||
434 | SIZE(xarray)); | ||
435 | fprintf(fp, " xa_node: %ld\n", | ||
436 | SIZE(xa_node)); | ||
437 | + fprintf(fp, " printk_info: %ld\n", SIZE(printk_info)); | ||
438 | + fprintf(fp, " printk_ringbuffer: %ld\n", SIZE(printk_ringbuffer)); | ||
439 | + fprintf(fp, " prb_desc: %ld\n", SIZE(prb_desc)); | ||
440 | |||
441 | |||
442 | fprintf(fp, "\n array_table:\n"); | ||
443 | -- | ||
444 | 2.17.1 | ||
445 | |||
diff --git a/meta-oe/recipes-kernel/crash/crash/0002-printk-use-committed-finalized-state-values.patch b/meta-oe/recipes-kernel/crash/crash/0002-printk-use-committed-finalized-state-values.patch deleted file mode 100644 index 5213195c7d..0000000000 --- a/meta-oe/recipes-kernel/crash/crash/0002-printk-use-committed-finalized-state-values.patch +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | From 71e159c64000467e94e08aefc144f5e1cdaa4aa0 Mon Sep 17 00:00:00 2001 | ||
2 | From: John Ogness <john.ogness@linutronix.de> | ||
3 | Date: Wed, 25 Nov 2020 05:27:53 +0106 | ||
4 | Subject: [PATCH 2/2] printk: use committed/finalized state values | ||
5 | |||
6 | An addendum to the previous crash commit a5531b24750e. | ||
7 | The ringbuffer entries use 2 state values (committed and finalized) | ||
8 | rather than a single flag to represent being available for reading. | ||
9 | Copy the definitions and state lookup function directly from the | ||
10 | kernel source and use the new states. | ||
11 | |||
12 | Upstream-Status: Backport [https://github.com/crash-utility/crash/commit/71e159c64000467e94e08aefc144f5e1cdaa4aa0] | ||
13 | |||
14 | Signed-off-by: John Ogness <john.ogness@linutronix.de> | ||
15 | Signed-off-by: Nikolay Borisov <nborisov@suse.com> | ||
16 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> | ||
17 | --- | ||
18 | printk.c | 48 +++++++++++++++++++++++++++++++++++++++++------- | ||
19 | 1 file changed, 41 insertions(+), 7 deletions(-) | ||
20 | |||
21 | diff --git a/printk.c b/printk.c | ||
22 | index f6d54ce..8658016 100644 | ||
23 | --- a/printk.c | ||
24 | +++ b/printk.c | ||
25 | @@ -1,12 +1,6 @@ | ||
26 | #include "defs.h" | ||
27 | #include <ctype.h> | ||
28 | |||
29 | -#define DESC_SV_BITS (sizeof(unsigned long) * 8) | ||
30 | -#define DESC_COMMITTED_MASK (1UL << (DESC_SV_BITS - 1)) | ||
31 | -#define DESC_REUSE_MASK (1UL << (DESC_SV_BITS - 2)) | ||
32 | -#define DESC_FLAGS_MASK (DESC_COMMITTED_MASK | DESC_REUSE_MASK) | ||
33 | -#define DESC_ID_MASK (~DESC_FLAGS_MASK) | ||
34 | - | ||
35 | /* convenience struct for passing many values to helper functions */ | ||
36 | struct prb_map { | ||
37 | char *prb; | ||
38 | @@ -21,6 +15,44 @@ struct prb_map { | ||
39 | char *text_data; | ||
40 | }; | ||
41 | |||
42 | +/* | ||
43 | + * desc_state and DESC_* definitions taken from kernel source: | ||
44 | + * | ||
45 | + * kernel/printk/printk_ringbuffer.h | ||
46 | + */ | ||
47 | + | ||
48 | +/* The possible responses of a descriptor state-query. */ | ||
49 | +enum desc_state { | ||
50 | + desc_miss = -1, /* ID mismatch (pseudo state) */ | ||
51 | + desc_reserved = 0x0, /* reserved, in use by writer */ | ||
52 | + desc_committed = 0x1, /* committed by writer, could get reopened */ | ||
53 | + desc_finalized = 0x2, /* committed, no further modification allowed */ | ||
54 | + desc_reusable = 0x3, /* free, not yet used by any writer */ | ||
55 | +}; | ||
56 | + | ||
57 | +#define DESC_SV_BITS (sizeof(unsigned long) * 8) | ||
58 | +#define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2) | ||
59 | +#define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT) | ||
60 | +#define DESC_STATE(sv) (3UL & (sv >> DESC_FLAGS_SHIFT)) | ||
61 | +#define DESC_ID_MASK (~DESC_FLAGS_MASK) | ||
62 | +#define DESC_ID(sv) ((sv) & DESC_ID_MASK) | ||
63 | + | ||
64 | +/* | ||
65 | + * get_desc_state() taken from kernel source: | ||
66 | + * | ||
67 | + * kernel/printk/printk_ringbuffer.c | ||
68 | + */ | ||
69 | + | ||
70 | +/* Query the state of a descriptor. */ | ||
71 | +static enum desc_state get_desc_state(unsigned long id, | ||
72 | + unsigned long state_val) | ||
73 | +{ | ||
74 | + if (id != DESC_ID(state_val)) | ||
75 | + return desc_miss; | ||
76 | + | ||
77 | + return DESC_STATE(state_val); | ||
78 | +} | ||
79 | + | ||
80 | static void | ||
81 | init_offsets(void) | ||
82 | { | ||
83 | @@ -74,6 +106,7 @@ dump_record(struct prb_map *m, unsigned long id, int msg_flags) | ||
84 | unsigned short text_len; | ||
85 | unsigned long state_var; | ||
86 | unsigned int caller_id; | ||
87 | + enum desc_state state; | ||
88 | unsigned char level; | ||
89 | unsigned long begin; | ||
90 | unsigned long next; | ||
91 | @@ -90,7 +123,8 @@ dump_record(struct prb_map *m, unsigned long id, int msg_flags) | ||
92 | /* skip non-committed record */ | ||
93 | state_var = ULONG(desc + OFFSET(prb_desc_state_var) + | ||
94 | OFFSET(atomic_long_t_counter)); | ||
95 | - if ((state_var & DESC_FLAGS_MASK) != DESC_COMMITTED_MASK) | ||
96 | + state = get_desc_state(id, state_var); | ||
97 | + if (state != desc_committed && state != desc_finalized) | ||
98 | return; | ||
99 | |||
100 | info = m->infos + ((id % m->desc_ring_count) * SIZE(printk_info)); | ||
101 | -- | ||
102 | 2.17.1 | ||
103 | |||
diff --git a/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch b/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch index e254fe8772..7133cf0aa2 100644 --- a/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch +++ b/meta-oe/recipes-kernel/crash/crash/donnot-extract-gdb-during-do-compile.patch | |||
@@ -9,7 +9,7 @@ diff --git a/Makefile b/Makefile | |||
9 | index bb0a34e..5eb7604 100644 | 9 | index bb0a34e..5eb7604 100644 |
10 | --- a/Makefile | 10 | --- a/Makefile |
11 | +++ b/Makefile | 11 | +++ b/Makefile |
12 | @@ -226,7 +226,7 @@ all: make_configure | 12 | @@ -228,7 +228,7 @@ all: make_configure |
13 | # @make --no-print-directory extensions | 13 | # @make --no-print-directory extensions |
14 | 14 | ||
15 | gdb_merge: force | 15 | gdb_merge: force |
@@ -18,15 +18,16 @@ index bb0a34e..5eb7604 100644 | |||
18 | make --no-print-directory gdb_unzip; fi | 18 | make --no-print-directory gdb_unzip; fi |
19 | @echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs | 19 | @echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs |
20 | @echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj | 20 | @echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj |
21 | @@ -253,11 +253,6 @@ gdb_unzip: | 21 | @@ -255,12 +255,6 @@ gdb_unzip: |
22 | @rm -f gdb.files | 22 | @rm -f gdb.files |
23 | @for FILE in ${GDB_FILES} dummy; do\ | 23 | @for FILE in ${GDB_FILES} dummy; do\ |
24 | echo $$FILE >> gdb.files; done | 24 | echo $$FILE >> gdb.files; done |
25 | - @if [ ! -f ${GDB}.tar.gz ] && [ ! -f /usr/bin/wget ]; then \ | 25 | - @if [ ! -f ${GDB}.tar.gz ] && [ ! -f /usr/bin/wget ]; then \ |
26 | - echo /usr/bin/wget is required to download ${GDB}.tar.gz; echo; exit 1; fi | 26 | - echo /usr/bin/wget is required to download ${GDB}.tar.gz; echo; exit 1; fi |
27 | - @if [ ! -f ${GDB}.tar.gz ] && [ -f /usr/bin/wget ]; then \ | 27 | - @if [ ! -f ${GDB}.tar.gz ] && [ -f /usr/bin/wget ]; then \ |
28 | - wget http://ftp.gnu.org/gnu/gdb/${GDB}.tar.gz; fi | 28 | - [ ! -t 2 ] && WGET_OPTS="--progress=dot:mega"; \ |
29 | - @tar --exclude-from gdb.files -xvzmf ${GDB}.tar.gz | 29 | - wget $$WGET_OPTS http://ftp.gnu.org/gnu/gdb/${GDB}.tar.gz; fi |
30 | @make --no-print-directory gdb_patch | 30 | - @tar --exclude-from gdb.files -xzmf ${GDB}.tar.gz |
31 | 31 | @make --no-print-directory gdb_patch | |
32 | |||
32 | gdb_patch: | 33 | gdb_patch: |
diff --git a/meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch b/meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch index 905b4c2cd0..37d43b8887 100644 --- a/meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch +++ b/meta-oe/recipes-kernel/crash/crash/remove-unrecognized-gcc-option-m32-for-mips.patch | |||
@@ -13,16 +13,16 @@ diff --git a/configure.c b/configure.c | |||
13 | index cf1973b..71e97b3 100644 | 13 | index cf1973b..71e97b3 100644 |
14 | --- a/configure.c | 14 | --- a/configure.c |
15 | +++ b/configure.c | 15 | +++ b/configure.c |
16 | @@ -151,7 +151,7 @@ void add_extra_lib(char *); | 16 | @@ -155,7 +155,7 @@ void add_extra_lib(char *); |
17 | #define TARGET_CFLAGS_PPC64_ON_X86_64 "TARGET_CFLAGS=" | 17 | #define TARGET_CFLAGS_PPC64_ON_X86_64 "TARGET_CFLAGS=" |
18 | #define TARGET_CFLAGS_MIPS "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" | 18 | #define TARGET_CFLAGS_MIPS "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" |
19 | #define TARGET_CFLAGS_MIPS_ON_X86 "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" | 19 | #define TARGET_CFLAGS_MIPS_ON_X86 "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" |
20 | -#define TARGET_CFLAGS_MIPS_ON_X86_64 "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64" | 20 | -#define TARGET_CFLAGS_MIPS_ON_X86_64 "TARGET_CFLAGS=-m32 -D_FILE_OFFSET_BITS=64" |
21 | +#define TARGET_CFLAGS_MIPS_ON_X86_64 "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" | 21 | +#define TARGET_CFLAGS_MIPS_ON_X86_64 "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64" |
22 | #define TARGET_CFLAGS_MIPS64 "TARGET_CFLAGS=" | ||
22 | #define TARGET_CFLAGS_SPARC64 "TARGET_CFLAGS=" | 23 | #define TARGET_CFLAGS_SPARC64 "TARGET_CFLAGS=" |
23 | 24 | ||
24 | #define GDB_TARGET_DEFAULT "GDB_CONF_FLAGS=" | 25 | @@ -167,7 +167,7 @@ void add_extra_lib(char *); |
25 | @@ -162,7 +162,7 @@ void add_extra_lib(char *); | ||
26 | #define GDB_TARGET_ARM64_ON_X86_64 "GDB_CONF_FLAGS=--target=aarch64-elf-linux" /* TBD */ | 26 | #define GDB_TARGET_ARM64_ON_X86_64 "GDB_CONF_FLAGS=--target=aarch64-elf-linux" /* TBD */ |
27 | #define GDB_TARGET_PPC64_ON_X86_64 "GDB_CONF_FLAGS=--target=powerpc64le-unknown-linux-gnu" | 27 | #define GDB_TARGET_PPC64_ON_X86_64 "GDB_CONF_FLAGS=--target=powerpc64le-unknown-linux-gnu" |
28 | #define GDB_TARGET_MIPS_ON_X86 "GDB_CONF_FLAGS=--target=mipsel-elf-linux" | 28 | #define GDB_TARGET_MIPS_ON_X86 "GDB_CONF_FLAGS=--target=mipsel-elf-linux" |
diff --git a/meta-oe/recipes-kernel/crash/crash_7.2.9.bb b/meta-oe/recipes-kernel/crash/crash_7.3.0.bb index c2d83cb4f0..4b228bbd9f 100644 --- a/meta-oe/recipes-kernel/crash/crash_7.2.9.bb +++ b/meta-oe/recipes-kernel/crash/crash_7.3.0.bb | |||
@@ -25,10 +25,8 @@ SRC_URI = "git://github.com/crash-utility/${BPN}.git \ | |||
25 | file://remove-unrecognized-gcc-option-m32-for-mips.patch \ | 25 | file://remove-unrecognized-gcc-option-m32-for-mips.patch \ |
26 | file://0002-crash-fix-build-error-unknown-type-name-gdb_fpregset.patch \ | 26 | file://0002-crash-fix-build-error-unknown-type-name-gdb_fpregset.patch \ |
27 | file://0003-crash-detect-the-sysroot-s-glibc-header-file.patch \ | 27 | file://0003-crash-detect-the-sysroot-s-glibc-header-file.patch \ |
28 | file://0001-printk-add-support-for-lockless-ringbuffer.patch \ | ||
29 | file://0002-printk-use-committed-finalized-state-values.patch \ | ||
30 | " | 28 | " |
31 | SRCREV = "a25aa4b649d339dd25c20d5413d81b851a77e0b2" | 29 | SRCREV = "2a3e546942ab560f050ab77e8c7828b06513b3f0" |
32 | 30 | ||
33 | SRC_URI[gdb.md5sum] = "a9836707337e5f7bf76a009a8904f470" | 31 | SRC_URI[gdb.md5sum] = "a9836707337e5f7bf76a009a8904f470" |
34 | SRC_URI[gdb.sha256sum] = "8070389a5dcc104eb0be483d582729f98ed4d761ad19cedd3f17b5d2502faa36" | 32 | SRC_URI[gdb.sha256sum] = "8070389a5dcc104eb0be483d582729f98ed4d761ad19cedd3f17b5d2502faa36" |