Thu Mar 5 16:05:06 2020 UTC ()
Revert "Add fixup operation to remove private mutex types for x86."

The x86 (and arm) definitions of struct kmutex are no longer defined
differently depending on __MUTEX_PRIVATE.


(riastradh)
diff -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c

cvs diff -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c (expand / switch to unified diff)

--- src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c 2019/07/16 07:27:35 1.5
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c 2020/03/05 16:05:05 1.6
@@ -270,68 +270,26 @@ fix_small_cpu_struct(tdata_t *td, size_t @@ -270,68 +270,26 @@ fix_small_cpu_struct(tdata_t *td, size_t
270 cpum = xmalloc(sizeof (*cpum)); 270 cpum = xmalloc(sizeof (*cpum));
271 cpum->ml_offset = lml->ml_offset + (ptrsize * NBBY); 271 cpum->ml_offset = lml->ml_offset + (ptrsize * NBBY);
272 cpum->ml_size = 0; 272 cpum->ml_size = 0;
273 cpum->ml_name = xstrdup("cpu_m"); 273 cpum->ml_name = xstrdup("cpu_m");
274 cpum->ml_type = machcpu; 274 cpum->ml_type = machcpu;
275 cpum->ml_next = NULL; 275 cpum->ml_next = NULL;
276 276
277 lml->ml_next = cpum; 277 lml->ml_next = cpum;
278} 278}
279 279
280#ifdef __NetBSD__ 280#ifdef __NetBSD__
281 281
282/* 282/*
283 * The kmutex structure comes in two flavours, with or without __MUTEX_PRIVATE 
284 * defined. Since many structures include kmutexes this causes massive amounts 
285 * of duplication on merge (~ 40% for a GENERIC kernel). Remove the private 
286 * fields if we see them. 
287 */ 
288static void 
289fix_kmutex_private(tdata_t *td, size_t ptrsize) 
290{ 
291 tdesc_t *desc; 
292 mlist_t *ml; 
293 
294 /* 
295 * X86 kmutex is either 
296 * union { 
297 * volatile uintptr_t mtxa_owner; 
298 * } u 
299 * or 
300 * union { 
301 * volatile uintptr_t mtxa_owner; 
302 * struct { 
303 * ... 
304 * } s; 
305 * } u 
306 * so we remove "struct s" if we find it. 
307 */ 
308 if ((desc = lookup_tdesc(td, "kmutex")) != NULL && 
309 desc->t_type == STRUCT && 
310 (ml = desc->t_members) != NULL && 
311 streq(ml->ml_name, "u") && 
312 (desc = ml->ml_type) != NULL && 
313 desc->t_type == UNION && 
314 (ml = desc->t_members) != NULL && 
315 streq(ml->ml_name, "mtxa_owner") && 
316 (ml = ml->ml_next) != NULL && 
317 streq(ml->ml_name, "s") && 
318 ml->ml_next == NULL) { 
319 /* Found, delete member "s". */ 
320 desc->t_members->ml_next = NULL; 
321 } 
322} 
323 
324/* 
325 * XXX: A crude hack to bring down the number of types for a 283 * XXX: A crude hack to bring down the number of types for a
326 * GENRIC kernel below 2**15-1 (from ~34000 to ~29800). 284 * GENRIC kernel below 2**15-1 (from ~34000 to ~29800).
327 * 285 *
328 * Remove the type attributes "volatile", "const" and "restrict", 286 * Remove the type attributes "volatile", "const" and "restrict",
329 * for DTRACE these attributes are of little value. 287 * for DTRACE these attributes are of little value.
330 */ 288 */
331 289
332static int 290static int
333fix_kill_attr_cb(tdesc_t *tdp, tdesc_t **tdpp, void *private __unused) 291fix_kill_attr_cb(tdesc_t *tdp, tdesc_t **tdpp, void *private __unused)
334{ 292{
335 293
336 while (tdp->t_type == VOLATILE || 294 while (tdp->t_type == VOLATILE ||
337 tdp->t_type == RESTRICT || 295 tdp->t_type == RESTRICT ||
@@ -367,17 +325,16 @@ fix_kill_attr(tdata_t *td, size_t ptrsiz @@ -367,17 +325,16 @@ fix_kill_attr(tdata_t *td, size_t ptrsiz
367{ 325{
368 326
369 (void) iitraverse_hash(td->td_iihash, &td->td_curvgen, 327 (void) iitraverse_hash(td->td_iihash, &td->td_curvgen,
370 fix_kill_attr_tab, NULL, NULL, NULL); 328 fix_kill_attr_tab, NULL, NULL, NULL);
371} 329}
372 330
373#endif /* __NetBSD__ */ 331#endif /* __NetBSD__ */
374 332
375void 333void
376cvt_fixups(tdata_t *td, size_t ptrsize) 334cvt_fixups(tdata_t *td, size_t ptrsize)
377{ 335{
378 fix_small_cpu_struct(td, ptrsize); 336 fix_small_cpu_struct(td, ptrsize);
379#ifdef __NetBSD__ 337#ifdef __NetBSD__
380 fix_kmutex_private(td, ptrsize); 
381 fix_kill_attr(td, ptrsize); 338 fix_kill_attr(td, ptrsize);
382#endif 339#endif
383} 340}