Lines Matching +full:- +full:section

2  * Copyright (c) 2013-2019, Intel Corporation
35 #include "intel-pt.h"
47 struct pt_section *section);
49 struct pt_section *section, uint64_t size);
52 struct pt_section *section) in pt_iscache_notify_map() argument
55 return -pte_internal; in pt_iscache_notify_map()
57 if (iscache->map <= 0) in pt_iscache_notify_map()
58 return iscache->map; in pt_iscache_notify_map()
61 iscache->map = 0; in pt_iscache_notify_map()
63 return pt_section_map_share(section); in pt_iscache_notify_map()
67 struct pt_section *section, uint64_t size) in pt_iscache_notify_resize() argument
73 return -pte_internal; in pt_iscache_notify_resize()
75 if (iscache->map <= 0) in pt_iscache_notify_resize()
76 return iscache->map; in pt_iscache_notify_resize()
79 iscache->map = 0; in pt_iscache_notify_resize()
81 errcode = pt_section_memsize(section, &memsize); in pt_iscache_notify_resize()
86 return -pte_internal; in pt_iscache_notify_resize()
88 return pt_section_map_share(section); in pt_iscache_notify_resize()
105 bcache->nentries = (uint32_t) nentries; in pt_bcache_alloc()
115 /* A test fixture providing a temporary file and an initially NULL section. */
126 /* The section. */
127 struct pt_section *section; member
149 written = fwrite(buffer, 1, size, sfix->file); in sfix_write_aux()
152 fflush(sfix->file); in sfix_write_aux()
169 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in create()
171 ptu_ptr(sfix->section); in create()
173 name = pt_section_filename(sfix->section); in create()
174 ptu_str_eq(name, sfix->name); in create()
176 offset = pt_section_offset(sfix->section); in create()
179 size = pt_section_size(sfix->section); in create()
189 errcode = pt_mk_section(&sfix->section, sfix->name, 0x10ull, 0x0ull); in create_bad_offset()
190 ptu_int_eq(errcode, -pte_invalid); in create_bad_offset()
204 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, UINT64_MAX); in create_truncated()
206 ptu_ptr(sfix->section); in create_truncated()
208 name = pt_section_filename(sfix->section); in create_truncated()
209 ptu_str_eq(name, sfix->name); in create_truncated()
211 offset = pt_section_offset(sfix->section); in create_truncated()
214 size = pt_section_size(sfix->section); in create_truncated()
215 ptu_uint_eq(size, sizeof(bytes) - 1); in create_truncated()
224 errcode = pt_mk_section(&sfix->section, sfix->name, 0x0ull, 0x10ull); in create_empty()
225 ptu_int_eq(errcode, -pte_invalid); in create_empty()
226 ptu_null(sfix->section); in create_empty()
257 ptu_int_eq(errcode, -pte_internal); in memsize_null()
259 errcode = pt_section_memsize(sfix->section, NULL); in memsize_null()
260 ptu_int_eq(errcode, -pte_internal); in memsize_null()
263 ptu_int_eq(errcode, -pte_internal); in memsize_null()
283 ptu_int_eq(errcode, -pte_internal); in get_null()
293 ptu_int_eq(errcode, -pte_internal); in put_null()
301 struct pt_section section; in attach_null() local
305 ptu_int_eq(errcode, -pte_internal); in attach_null()
307 errcode = pt_section_attach(&section, NULL); in attach_null()
308 ptu_int_eq(errcode, -pte_internal); in attach_null()
311 ptu_int_eq(errcode, -pte_internal); in attach_null()
319 struct pt_section section; in detach_null() local
323 ptu_int_eq(errcode, -pte_internal); in detach_null()
325 errcode = pt_section_detach(&section, NULL); in detach_null()
326 ptu_int_eq(errcode, -pte_internal); in detach_null()
329 ptu_int_eq(errcode, -pte_internal); in detach_null()
339 ptu_int_eq(errcode, -pte_internal); in map_null()
349 ptu_int_eq(errcode, -pte_internal); in unmap_null()
371 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in get_overflow()
373 ptu_ptr(sfix->section); in get_overflow()
375 sfix->section->ucount = UINT16_MAX; in get_overflow()
377 errcode = pt_section_get(sfix->section); in get_overflow()
378 ptu_int_eq(errcode, -pte_overflow); in get_overflow()
380 sfix->section->ucount = 1; in get_overflow()
393 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in attach_overflow()
395 ptu_ptr(sfix->section); in attach_overflow()
397 sfix->section->acount = UINT16_MAX; in attach_overflow()
399 errcode = pt_section_attach(sfix->section, &iscache); in attach_overflow()
400 ptu_int_eq(errcode, -pte_overflow); in attach_overflow()
402 sfix->section->acount = 0; in attach_overflow()
415 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in attach_bad_ucount()
417 ptu_ptr(sfix->section); in attach_bad_ucount()
419 sfix->section->acount = 2; in attach_bad_ucount()
421 errcode = pt_section_attach(sfix->section, &iscache); in attach_bad_ucount()
422 ptu_int_eq(errcode, -pte_internal); in attach_bad_ucount()
424 sfix->section->acount = 0; in attach_bad_ucount()
436 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in map_change()
438 ptu_ptr(sfix->section); in map_change()
442 errcode = pt_section_map(sfix->section); in map_change()
443 ptu_int_eq(errcode, -pte_bad_image); in map_change()
455 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in map_put()
457 ptu_ptr(sfix->section); in map_put()
459 errcode = pt_section_map(sfix->section); in map_put()
462 errcode = pt_section_put(sfix->section); in map_put()
463 ptu_int_eq(errcode, -pte_internal); in map_put()
465 errcode = pt_section_unmap(sfix->section); in map_put()
478 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in unmap_nomap()
480 ptu_ptr(sfix->section); in unmap_nomap()
482 errcode = pt_section_unmap(sfix->section); in unmap_nomap()
483 ptu_int_eq(errcode, -pte_nomap); in unmap_nomap()
495 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in map_overflow()
497 ptu_ptr(sfix->section); in map_overflow()
499 sfix->section->mcount = UINT16_MAX; in map_overflow()
501 errcode = pt_section_map(sfix->section); in map_overflow()
502 ptu_int_eq(errcode, -pte_overflow); in map_overflow()
504 sfix->section->mcount = 0; in map_overflow()
516 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in get_put()
518 ptu_ptr(sfix->section); in get_put()
520 errcode = pt_section_get(sfix->section); in get_put()
523 errcode = pt_section_get(sfix->section); in get_put()
526 errcode = pt_section_put(sfix->section); in get_put()
529 errcode = pt_section_put(sfix->section); in get_put()
543 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in attach_detach()
545 ptu_ptr(sfix->section); in attach_detach()
547 sfix->section->ucount += 2; in attach_detach()
549 errcode = pt_section_attach(sfix->section, &iscache); in attach_detach()
552 errcode = pt_section_attach(sfix->section, &iscache); in attach_detach()
555 errcode = pt_section_detach(sfix->section, &iscache); in attach_detach()
558 errcode = pt_section_detach(sfix->section, &iscache); in attach_detach()
561 sfix->section->ucount -= 2; in attach_detach()
574 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in attach_bad_iscache()
576 ptu_ptr(sfix->section); in attach_bad_iscache()
578 sfix->section->ucount += 2; in attach_bad_iscache()
580 errcode = pt_section_attach(sfix->section, &iscache); in attach_bad_iscache()
583 errcode = pt_section_attach(sfix->section, &bad); in attach_bad_iscache()
584 ptu_int_eq(errcode, -pte_internal); in attach_bad_iscache()
586 errcode = pt_section_detach(sfix->section, &iscache); in attach_bad_iscache()
589 sfix->section->ucount -= 2; in attach_bad_iscache()
602 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in detach_bad_iscache()
604 ptu_ptr(sfix->section); in detach_bad_iscache()
606 errcode = pt_section_attach(sfix->section, &iscache); in detach_bad_iscache()
609 errcode = pt_section_detach(sfix->section, &bad); in detach_bad_iscache()
610 ptu_int_eq(errcode, -pte_internal); in detach_bad_iscache()
612 errcode = pt_section_detach(sfix->section, &iscache); in detach_bad_iscache()
625 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in map_unmap()
627 ptu_ptr(sfix->section); in map_unmap()
629 errcode = pt_section_map(sfix->section); in map_unmap()
632 errcode = pt_section_map(sfix->section); in map_unmap()
635 errcode = pt_section_unmap(sfix->section); in map_unmap()
638 errcode = pt_section_unmap(sfix->section); in map_unmap()
654 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in attach_map()
656 ptu_ptr(sfix->section); in attach_map()
658 errcode = pt_section_attach(sfix->section, &iscache); in attach_map()
661 errcode = pt_section_map(sfix->section); in attach_map()
664 errcode = pt_section_map(sfix->section); in attach_map()
667 ptu_uint_eq(sfix->section->mcount, 2); in attach_map()
669 errcode = pt_section_unmap(sfix->section); in attach_map()
672 errcode = pt_section_unmap(sfix->section); in attach_map()
675 errcode = pt_section_detach(sfix->section, &iscache); in attach_map()
687 iscache.map = -pte_eos; in attach_bad_map()
691 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in attach_bad_map()
693 ptu_ptr(sfix->section); in attach_bad_map()
695 errcode = pt_section_attach(sfix->section, &iscache); in attach_bad_map()
698 errcode = pt_section_map(sfix->section); in attach_bad_map()
699 ptu_int_eq(errcode, -pte_eos); in attach_bad_map()
701 errcode = pt_section_detach(sfix->section, &iscache); in attach_bad_map()
717 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in attach_map_overflow()
719 ptu_ptr(sfix->section); in attach_map_overflow()
721 errcode = pt_section_attach(sfix->section, &iscache); in attach_map_overflow()
724 sfix->section->mcount = UINT16_MAX - 1; in attach_map_overflow()
726 errcode = pt_section_map(sfix->section); in attach_map_overflow()
727 ptu_int_eq(errcode, -pte_overflow); in attach_map_overflow()
729 errcode = pt_section_detach(sfix->section, &iscache); in attach_map_overflow()
743 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read()
745 ptu_ptr(sfix->section); in read()
747 status = pt_section_map(sfix->section); in read()
750 status = pt_section_read(sfix->section, buffer, 2, 0x0ull); in read()
756 status = pt_section_unmap(sfix->section); in read()
770 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_null()
772 ptu_ptr(sfix->section); in read_null()
774 status = pt_section_map(sfix->section); in read_null()
777 status = pt_section_read(sfix->section, NULL, 1, 0x0ull); in read_null()
778 ptu_int_eq(status, -pte_internal); in read_null()
782 ptu_int_eq(status, -pte_internal); in read_null()
785 status = pt_section_unmap(sfix->section); in read_null()
799 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_offset()
801 ptu_ptr(sfix->section); in read_offset()
803 status = pt_section_map(sfix->section); in read_offset()
806 status = pt_section_read(sfix->section, buffer, 2, 0x1ull); in read_offset()
812 status = pt_section_unmap(sfix->section); in read_offset()
825 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_truncated()
827 ptu_ptr(sfix->section); in read_truncated()
829 status = pt_section_map(sfix->section); in read_truncated()
832 status = pt_section_read(sfix->section, buffer, 2, 0x2ull); in read_truncated()
837 status = pt_section_unmap(sfix->section); in read_truncated()
850 status = pt_mk_section(&sfix->section, sfix->name, 0x2ull, 0x10ull); in read_from_truncated()
852 ptu_ptr(sfix->section); in read_from_truncated()
854 status = pt_section_map(sfix->section); in read_from_truncated()
857 status = pt_section_read(sfix->section, buffer, 2, 0x1ull); in read_from_truncated()
862 status = pt_section_unmap(sfix->section); in read_from_truncated()
875 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_nomem()
877 ptu_ptr(sfix->section); in read_nomem()
879 status = pt_section_map(sfix->section); in read_nomem()
882 status = pt_section_read(sfix->section, buffer, 1, 0x3ull); in read_nomem()
883 ptu_int_eq(status, -pte_nomap); in read_nomem()
886 status = pt_section_unmap(sfix->section); in read_nomem()
899 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_overflow()
901 ptu_ptr(sfix->section); in read_overflow()
903 status = pt_section_map(sfix->section); in read_overflow()
906 status = pt_section_read(sfix->section, buffer, 1, in read_overflow()
908 ptu_int_eq(status, -pte_nomap); in read_overflow()
911 status = pt_section_unmap(sfix->section); in read_overflow()
924 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_overflow_32bit()
926 ptu_ptr(sfix->section); in read_overflow_32bit()
928 status = pt_section_map(sfix->section); in read_overflow_32bit()
931 status = pt_section_read(sfix->section, buffer, 1, in read_overflow_32bit()
933 ptu_int_eq(status, -pte_nomap); in read_overflow_32bit()
936 status = pt_section_unmap(sfix->section); in read_overflow_32bit()
949 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_nomap()
951 ptu_ptr(sfix->section); in read_nomap()
953 status = pt_section_read(sfix->section, buffer, 1, 0x0ull); in read_nomap()
954 ptu_int_eq(status, -pte_nomap); in read_nomap()
968 status = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in read_unmap_map()
970 ptu_ptr(sfix->section); in read_unmap_map()
972 status = pt_section_map(sfix->section); in read_unmap_map()
975 status = pt_section_read(sfix->section, buffer, 2, 0x0ull); in read_unmap_map()
983 status = pt_section_unmap(sfix->section); in read_unmap_map()
986 status = pt_section_read(sfix->section, buffer, 2, 0x0ull); in read_unmap_map()
987 ptu_int_eq(status, -pte_nomap); in read_unmap_map()
992 status = pt_section_map(sfix->section); in read_unmap_map()
995 status = pt_section_read(sfix->section, buffer, 2, 0x0ull); in read_unmap_map()
1001 status = pt_section_unmap(sfix->section); in read_unmap_map()
1014 return -pte_internal; in worker_read()
1020 errcode = pt_section_get(sfix->section); in worker_read()
1024 errcode = pt_section_map(sfix->section); in worker_read()
1028 read = pt_section_read(sfix->section, buffer, 2, 0x0ull); in worker_read()
1032 errcode = -pte_invalid; in worker_read()
1036 errcode = pt_section_unmap(sfix->section); in worker_read()
1040 errcode = pt_section_put(sfix->section); in worker_read()
1048 (void) pt_section_unmap(sfix->section); in worker_read()
1051 (void) pt_section_put(sfix->section); in worker_read()
1062 return -pte_internal; in worker_bcache()
1064 errcode = pt_section_get(sfix->section); in worker_bcache()
1071 errcode = pt_section_map(sfix->section); in worker_bcache()
1075 errcode = pt_section_request_bcache(sfix->section); in worker_bcache()
1079 bcache = pt_section_bcache(sfix->section); in worker_bcache()
1081 errcode = -pte_nomem; in worker_bcache()
1085 errcode = pt_section_unmap(sfix->section); in worker_bcache()
1090 return pt_section_put(sfix->section); in worker_bcache()
1093 (void) pt_section_unmap(sfix->section); in worker_bcache()
1096 (void) pt_section_put(sfix->section); in worker_bcache()
1108 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in stress()
1110 ptu_ptr(sfix->section); in stress()
1117 ptu_test(ptunit_thrd_create, &sfix->thrd, worker, sfix); in stress()
1135 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in init_no_bcache()
1137 ptu_ptr(sfix->section); in init_no_bcache()
1139 errcode = pt_section_map(sfix->section); in init_no_bcache()
1142 bcache = pt_section_bcache(sfix->section); in init_no_bcache()
1145 errcode = pt_section_unmap(sfix->section); in init_no_bcache()
1159 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in bcache_alloc_free()
1161 ptu_ptr(sfix->section); in bcache_alloc_free()
1163 errcode = pt_section_map(sfix->section); in bcache_alloc_free()
1166 errcode = pt_section_alloc_bcache(sfix->section); in bcache_alloc_free()
1169 bcache = pt_section_bcache(sfix->section); in bcache_alloc_free()
1171 ptu_uint_eq(bcache->nentries, sfix->section->size); in bcache_alloc_free()
1173 errcode = pt_section_unmap(sfix->section); in bcache_alloc_free()
1176 bcache = pt_section_bcache(sfix->section); in bcache_alloc_free()
1189 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in bcache_alloc_twice()
1191 ptu_ptr(sfix->section); in bcache_alloc_twice()
1193 errcode = pt_section_map(sfix->section); in bcache_alloc_twice()
1196 errcode = pt_section_alloc_bcache(sfix->section); in bcache_alloc_twice()
1199 errcode = pt_section_alloc_bcache(sfix->section); in bcache_alloc_twice()
1202 errcode = pt_section_unmap(sfix->section); in bcache_alloc_twice()
1215 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in bcache_alloc_nomap()
1217 ptu_ptr(sfix->section); in bcache_alloc_nomap()
1219 errcode = pt_section_alloc_bcache(sfix->section); in bcache_alloc_nomap()
1220 ptu_int_eq(errcode, -pte_internal); in bcache_alloc_nomap()
1233 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in memsize_nomap()
1235 ptu_ptr(sfix->section); in memsize_nomap()
1237 errcode = pt_section_memsize(sfix->section, &memsize); in memsize_nomap()
1252 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in memsize_unmap()
1254 ptu_ptr(sfix->section); in memsize_unmap()
1256 errcode = pt_section_map(sfix->section); in memsize_unmap()
1259 errcode = pt_section_unmap(sfix->section); in memsize_unmap()
1262 errcode = pt_section_memsize(sfix->section, &memsize); in memsize_unmap()
1277 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in memsize_map_nobcache()
1279 ptu_ptr(sfix->section); in memsize_map_nobcache()
1281 errcode = pt_section_map(sfix->section); in memsize_map_nobcache()
1286 errcode = pt_section_memsize(sfix->section, &memsize); in memsize_map_nobcache()
1291 errcode = pt_section_unmap(sfix->section); in memsize_map_nobcache()
1305 errcode = pt_mk_section(&sfix->section, sfix->name, 0x1ull, 0x3ull); in memsize_map_bcache()
1307 ptu_ptr(sfix->section); in memsize_map_bcache()
1309 errcode = pt_section_map(sfix->section); in memsize_map_bcache()
1312 errcode = pt_section_alloc_bcache(sfix->section); in memsize_map_bcache()
1315 errcode = pt_section_memsize(sfix->section, &memsize); in memsize_map_bcache()
1318 sfix->section->size * sizeof(struct pt_bcache_entry)); in memsize_map_bcache()
1320 errcode = pt_section_unmap(sfix->section); in memsize_map_bcache()
1330 sfix->section = NULL; in sfix_init()
1331 sfix->file = NULL; in sfix_init()
1332 sfix->name = NULL; in sfix_init()
1334 errcode = ptunit_mkfile(&sfix->file, &sfix->name, "wb"); in sfix_init()
1337 ptu_test(ptunit_thrd_init, &sfix->thrd); in sfix_init()
1348 ptu_test(ptunit_thrd_fini, &sfix->thrd); in sfix_fini()
1350 if (sfix->section) { in sfix_fini()
1351 pt_section_put(sfix->section); in sfix_fini()
1352 sfix->section = NULL; in sfix_fini()
1355 filename = sfix->name; in sfix_fini()
1356 file = sfix->file; in sfix_fini()
1357 sfix->name = NULL; in sfix_fini()
1358 sfix->file = NULL; in sfix_fini()
1361 * with others re-using the temporary filename. in sfix_fini()
1365 * - guaranteed leaking files or in sfix_fini()
1366 * - running the risk of removing someone elses file in sfix_fini()
1372 * non-termporary files. in sfix_fini()
1390 for (thrd = 0; thrd < sfix->thrd.nthreads; ++thrd) in sfix_fini()
1391 ptu_int_eq(sfix->thrd.result[thrd], 0); in sfix_fini()