Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
tools/testing/nvdimm/test/nfit.c
static int ars_state_init(struct device *dev, struct ars_state *ars_state) { ars_state->ars_status = devm_kzalloc(dev, sizeof(struct nd_cmd_ars_status) + SZ_4K, GFP_KERNEL); if (!ars_state->ars_status) return -ENOMEM; spin_lock_init(&ars_state->lock); return 0; }
[ 1, 0 ]
Linux Kernel
tools/testing/nvdimm/test/nfit.c
static ssize_t fail_cmd_show(struct device *dev, struct device_attribute *attr, char *buf) { int dimm = dimm_name_to_id(dev); if (dimm < 0) return dimm; return sprintf(buf, "%#lx\n", dimm_fail_cmd_flags[dimm]); }
[ 1, 0 ]
Linux Kernel
tools/testing/nvdimm/test/nfit.c
static ssize_t fail_cmd_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { int dimm = dimm_name_to_id(dev); unsigned long val; ssize_t rc; if (dimm < 0) return dimm; rc = kstrtol(buf, 0, &val); if (rc) return rc; dimm_fail_cmd...
[ 0, 0 ]
Linux Kernel
tools/testing/nvdimm/test/nfit.c
static ssize_t fail_cmd_code_show(struct device *dev, struct device_attribute *attr, char *buf) { int dimm = dimm_name_to_id(dev); if (dimm < 0) return dimm; return sprintf(buf, "%d\n", dimm_fail_cmd_code[dimm]); }
[ 1, 0 ]
Linux Kernel
tools/testing/nvdimm/test/nfit.c
static int nfit_test1_alloc(struct nfit_test *t) { struct acpi_nfit_system_address *spa = NULL; size_t nfit_size = sizeof_spa(spa) * 2 + sizeof(struct acpi_nfit_memory_map) * 2 + offsetof(struct acpi_nfit_control_region, window_size) * 2; int i; t->nfit_buf = test_all...
[ 1, 0 ]
Linux Kernel
tools/testing/nvdimm/test/nfit.c
static void nfit_test_release(struct device *dev) { struct nfit_test *nfit_test = to_nfit_test(dev); kfree(nfit_test); }
[ 0, 0 ]
Linux Kernel
tools/testing/nvdimm/test/nfit.c
static __exit void nfit_test_exit(void) { int i; destroy_workqueue(nfit_wq); for (i = 0; i < NUM_NFITS; i++) platform_device_unregister(&instances[i]->pdev); platform_driver_unregister(&nfit_test_driver); nfit_test_teardown(); gen_pool_destroy(nfit_pool); for (i = 0; i < NUM_NFITS; i++) put_de...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/benchmark.c
static long long benchmark_iter(struct radix_tree_root *root, bool tagged) { volatile unsigned long sink = 0; struct radix_tree_iter iter; struct timespec start, finish; long long nsec; int l, loops = 1; void **slot; #ifdef BENCHMARK again: #endif clock_gettime(CLOCK_MONOTONIC, &start); for (l = 0; l ...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/benchmark.c
static void benchmark_size(unsigned long size, unsigned long step) { RADIX_TREE(tree, GFP_KERNEL); long long normal, tagged; benchmark_insert(&tree, size, step); benchmark_tagging(&tree, size, step); tagged = benchmark_iter(&tree, true); normal = benchmark_iter(&tree, false); printv(2, "Size: %8ld, st...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/benchmark.c
void benchmark(void) { unsigned long size[] = {1 << 10, 1 << 20, 0}; unsigned long step[] = {1, 2, 7, 15, 63, 64, 65, 128, 256, 512, 12345, 0}; int c, s; printv(1, "starting benchmarks\n"); printv(1, "RADIX_TREE_MAP_SHIFT = %d\n", RADIX_TREE_MAP_SHIFT); for (c = 0; size[c]; c++) for (s = 0; step[s]; ...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/idr-test.c
int item_idr_free(int id, void *p, void *data) { struct item *item = p; assert(item->index == id); free(p); return 0; }
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/idr-test.c
void idr_replace_test(void) { DEFINE_IDR(idr); idr_alloc(&idr, (void *)-1, 10, 11, GFP_KERNEL); idr_replace(&idr, &idr, 10); idr_destroy(&idr); }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/idr-test.c
int idr_u32_cb(int id, void *ptr, void *data) { BUG_ON(id < 0); BUG_ON(ptr != DUMMY_PTR); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/idr-test.c
void idr_u32_test1(struct idr *idr, u32 handle) { static bool warned = false; u32 id = handle; int sid = 0; void *ptr; BUG_ON(idr_alloc_u32(idr, DUMMY_PTR, &id, id, GFP_KERNEL)); BUG_ON(id != handle); BUG_ON(idr_alloc_u32(idr, DUMMY_PTR, &id, id, GFP_KERNEL) != -ENOSPC); BUG_ON(id != handle); if (!w...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/idr-test.c
int __weak main(void) { rcu_register_thread(); radix_tree_init(); idr_checks(); ida_tests(); radix_tree_cpu_dead(1); rcu_barrier(); if (nr_allocated) printf("nr_allocated = %d\n", nr_allocated); rcu_unregister_thread(); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/iteration_check.c
void my_item_insert(struct xarray *xa, unsigned long index) { XA_STATE(xas, xa, index); struct item *item = item_create(index, 0); int order; retry: xas_lock(&xas); for (order = max_order; order >= 0; order--) { xas_set_order(&xas, index, order); item->order = order; if (xas_find_conflict(&xas))...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/iteration_check.c
static void *untagged_iteration_fn(void *arg) { XA_STATE(xas, &array, 0); void *entry; rcu_register_thread(); while (!test_complete) { xas_set(&xas, 0); rcu_read_lock(); xas_for_each(&xas, entry, ULONG_MAX) { if (xas_retry(&xas, entry)) continue; if (rand_r(&seeds[1]) % 50 == ...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/iteration_check.c
static void *tag_entries_fn(void *arg) { rcu_register_thread(); while (!test_complete) { tag_tagged_items(&array, 0, MAX_IDX, 10, TAG, NEW_TAG); } rcu_unregister_thread(); return NULL; }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/iteration_check_2.c
static void *throbber(void *arg) { struct xarray *xa = arg; rcu_register_thread(); while (!test_complete) { int i; for (i = 0; i < 100; i++) { xa_store(xa, i, xa_mk_value(i), GFP_KERNEL); xa_set_mark(xa, i, XA_MARK_0); } for (i = 0; i < 100; i++) xa_erase(xa, i); } rcu_u...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/iteration_check_2.c
void iteration_test2(unsigned test_duration) { pthread_t threads[2]; DEFINE_XARRAY(array); int i; printv(1, "Running iteration test 2 for %d seconds\n", test_duration); test_complete = false; xa_store(&array, 100, xa_mk_value(100), GFP_KERNEL); xa_set_mark(&array, 100, XA_MARK_0); if (pthread_creat...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/linux/local_lock.h
static inline void local_lock(local_lock_t *lock) {}
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/linux/local_lock.h
static inline void local_unlock(local_lock_t *lock) {}
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/linux/radix-tree.h
static inline void trace_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *head)) { if (kmalloc_verbose) printf("Delaying free of %p to slab\n", (char *)head - offsetof(struct radix_tree_node, rcu_head)); call_rcu(head, func); } #define printv(verbosity...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/linux.c
void kmem_cache_set_non_kernel(struct kmem_cache *cachep, unsigned int val) { cachep->non_kernel = val; }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/linux.c
unsigned long kmem_cache_nr_allocated(struct kmem_cache *cachep) { return cachep->nr_allocated; }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/linux.c
void kmem_cache_free_locked(struct kmem_cache *cachep, void *objp) { assert(objp); uatomic_dec(&nr_allocated); uatomic_dec(&cachep->nr_allocated); if (kmalloc_verbose) printf("Freeing %p to slab\n", objp); if (cachep->nr_objs > 10 || cachep->align) { memset(objp, POISON_FREE, cachep->size); free(...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/linux.c
void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list) { if (kmalloc_verbose) pr_debug("Bulk free %p[0-%lu]\n", list, size - 1); pthread_mutex_lock(&cachep->lock); for (int i = 0; i < size; i++) kmem_cache_free_locked(cachep, list[i]); pthread_mutex_unlock(&cachep->lock); }
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/linux.c
struct kmem_cache *kmem_cache_create(const char *name, unsigned int size, unsigned int align, unsigned int flags, void (*ctor)(void *)) { struct kmem_cache *ret = malloc(sizeof(*ret)); pthread_mutex_init(&ret->lock, NULL); ret->size = siz...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/main.c
void __gang_check(unsigned long middle, long down, long up, int chunk, int hop) { long idx; RADIX_TREE(tree, GFP_KERNEL); middle = 1 << 30; for (idx = -down; idx < up; idx++) item_insert(&tree, middle + idx); item_check_absent(&tree, middle - down - 1); for (idx = -down; idx < up; ...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/maple.c
int mas_ce2_over_count(struct ma_state *mas_start, struct ma_state *mas_end, void *s_entry, unsigned long s_min, void *e_entry, unsigned long e_max, unsigned long *set, int i, bool null_entry) { int count = 0, span = 0; unsigned long retry = 0; ...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/maple.c
static void rcu_reader_setup(struct rcu_reader_struct *reader, unsigned int id, struct rcu_test_struct2 *test) { reader->id = id; reader->test = test; reader->mod = reader->id % 10; reader->del = (reader->mod + 1) % 10; reader->flip = (reader->mod + 2) % 10; reader->add = (read...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/maple.c
static void *rcu_loop(void *ptr) { struct rcu_test_struct *test = (struct rcu_test_struct *)ptr; unsigned long count = test->count; void *entry, *expected; bool update_2 = false; bool update_3 = false; MA_STATE(mas, test->mt, test->range_start, test->range_start); rcu_register_thread(); while (count--...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/maple.c
static noinline void run_check_rcu(struct maple_tree *mt, struct rcu_test_struct *vals) { int i; void *(*function)(void *); pthread_t readers[20]; mt_set_in_rcu(mt); MT_BUG_ON(mt, !mt_in_rcu(mt)); for (i = 0; i < ARRAY_SIZE(readers); i++) { if (i % 2) function...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/maple.c
void maple_tree_tests(void) { farmer_tests(); maple_tree_seed(); maple_tree_harvest(); }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/multiorder.c
void multiorder_iteration(struct xarray *xa) { XA_STATE(xas, xa, 0); struct item *item; int i, j, err; #define NUM_ENTRIES 11 int index[NUM_ENTRIES] = {0, 2, 4, 8, 16, 32, 34, 36, 64, 72, 128}; int order[NUM_ENTRIES] = {1, 1, 2, 3, 4, 1, 0, 1, 3, 0, 7}; printv(1, "Multiorder iteration test\n"); for (i...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/multiorder.c
int __weak main(void) { rcu_register_thread(); radix_tree_init(); multiorder_checks(); rcu_unregister_thread(); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/regression1.c
static void page_rcu_free(struct rcu_head *rcu) { struct page *p = container_of(rcu, struct page, rcu); assert(!p->count); pthread_mutex_destroy(&p->lock); free(p); }
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/regression1.c
static unsigned find_get_pages(unsigned long start, unsigned int nr_pages, struct page **pages) { XA_STATE(xas, &mt_tree, start); struct page *page; unsigned int ret = 0; rcu_read_lock(); xas_for_each(&xas, page, ULONG_MAX) { if (xas_retry(&xas, page)) continue; ...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/tag_check.c
static void __simple_checks(struct radix_tree_root *tree, unsigned long index, int tag) { unsigned long first = 0; int ret; item_check_absent(tree, index); assert(item_tag_get(tree, index, tag) == 0); item_insert(tree, index); assert(item_tag_get(tree, index, tag) == 0); it...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/tag_check.c
void simple_checks(void) { unsigned long index; RADIX_TREE(tree, GFP_KERNEL); for (index = 0; index < 10000; index++) { __simple_checks(&tree, index, 0); __simple_checks(&tree, index, 1); } verify_tag_consistency(&tree, 0); verify_tag_consistency(&tree, 1); printv(2, "before item_kill_tree: %d a...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/tag_check.c
static void thrash_tags(void) { RADIX_TREE(tree, GFP_KERNEL); char *thrash_state; thrash_state = malloc(THRASH_SIZE); memset(thrash_state, 0, THRASH_SIZE); do_thrash(&tree, thrash_state, 0); verify_tag_consistency(&tree, 0); item_kill_tree(&tree); free(thrash_state); }
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/tag_check.c
static void single_check(void) { struct item *items[BATCH]; RADIX_TREE(tree, GFP_KERNEL); int ret; unsigned long first = 0; item_insert(&tree, 0); item_tag_set(&tree, 0, 0); ret = radix_tree_gang_lookup_tag(&tree, (void **)items, 0, BATCH, 0); assert(ret == 1); ret = radix_tree_gang_lookup_tag(&tree...
[ 1, 0 ]
Linux Kernel
tools/testing/radix-tree/tag_check.c
void tag_check(void) { single_check(); extend_checks(); contract_checks(); rcu_barrier(); printv(2, "after extend_checks: %d allocated\n", nr_allocated); __leak_check(); leak_check(); rcu_barrier(); printv(2, "after leak_check: %d allocated\n", nr_allocated); simple_checks(); rcu_barrier(); pri...
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/test.c
struct item *item_tag_set(struct radix_tree_root *root, unsigned long index, int tag) { return radix_tree_tag_set(root, index, tag); }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/test.c
int item_tag_get(struct radix_tree_root *root, unsigned long index, int tag) { return radix_tree_tag_get(root, index, tag); }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/test.c
void item_check_present(struct radix_tree_root *root, unsigned long index) { struct item *item; item = radix_tree_lookup(root, index); assert(item != NULL); item_sanity(item, index); }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/test.c
struct item *item_lookup(struct radix_tree_root *root, unsigned long index) { return radix_tree_lookup(root, index); }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/test.c
void item_kill_tree(struct xarray *xa) { XA_STATE(xas, xa, 0); void *entry; xas_for_each(&xas, entry, ULONG_MAX) { if (!xa_is_value(entry)) { item_free(entry, xas.xa_index); } xas_store(&xas, NULL); } assert(xa_empty(xa)); }
[ 0, 0 ]
Linux Kernel
tools/testing/radix-tree/xarray.c
int __weak main(void) { rcu_register_thread(); radix_tree_init(); xarray_tests(); radix_tree_cpu_dead(1); rcu_barrier(); if (nr_allocated) printf("nr_allocated = %d\n", nr_allocated); rcu_unregister_thread(); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/scatterlist/linux/mm.h
static inline unsigned long page_to_phys(struct page *page) { assert(0); return 0; } #define page_to_pfn(page) ((unsigned long)(page) / PAGE_SIZE) #define pfn_to_page(pfn) (void *)((pfn) * PAGE_SIZE) #define nth_page(page, n) pfn_to_page(page_to_pfn((page)) + (n)) #define __min(t1, t2, min1, min2, x, y) ...
[ 0, 0 ]
Linux Kernel
tools/testing/scatterlist/linux/mm.h
static inline void kunmap_atomic(void *addr) { assert(0); }
[ 0, 0 ]
Linux Kernel
tools/testing/scatterlist/linux/mm.h
static inline void *kmalloc_array(unsigned int n, unsigned int size, unsigned int flags) { return malloc(n * size); }
[ 1, 0 ]
Linux Kernel
tools/testing/scatterlist/linux/mm.h
static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) { if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/scatterlist/main.c
static void fail(struct test *test, struct sg_table *st, const char *cond) { unsigned int i; fprintf(stderr, "Failed on '%s'!\n\n", cond); printf("size = %u, max segment = %u, expected nents = %u\nst->nents = %u, " "st->orig_nents= %u\n", test->size, test->max_seg, test->expected_segments, st...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
snd_config_t *get_alsalib_config(void) { snd_config_t *config; int err; err = snd_config_load_string(&config, alsa_config, strlen(alsa_config)); if (err < 0) { ksft_print_msg("Unable to parse custom alsa-lib configuration: %s\n", snd_strerror(err)); ksft_exit_fail(); } return co...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
static struct card_data *conf_data_by_card(int card, bool msg) { struct card_data *conf; for (conf = conf_cards; conf; conf = conf->next) { if (conf->card == card) { if (msg) ksft_print_msg("using hw card config %s for card %d\n", conf->filename, card); return conf; ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
static int dump_config_tree(snd_config_t *top) { snd_output_t *out; int err; err = snd_output_stdio_attach(&out, stdout, 0); if (err < 0) ksft_exit_fail_msg("stdout attach\n"); if (snd_config_save(top, out)) ksft_exit_fail_msg("config save\n"); snd_output_close(out); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
static char *sysfs_get(const char *sysfs_root, const char *id) { char path[PATH_MAX], link[PATH_MAX + 1]; struct stat sb; ssize_t len; char *e; int fd; if (id[0] == '/') id++; snprintf(path, sizeof(path), "%s/%s", sysfs_root, id); if (lstat(path, &sb) != 0) return NULL; if (S_ISLNK(sb.st_mod...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
static bool test_filename1(int card, const char *filename, const char *sysfs_card_root) { struct card_data *data, *data2; snd_config_t *config, *sysfs_config, *card_config, *sysfs_card_config, *node; snd_config_iterator_t i, next; config = load(filename); if (snd_config_search(con...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
static bool test_filename(const char *filename) { char fn[128]; int card; for (card = 0; card < 32; card++) { snprintf(fn, sizeof(fn), "%s/class/sound/card%d", SYSFS_ROOT, card); if (access(fn, R_OK) == 0 && test_filename1(card, filename, fn)) return true; } return false; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
void conf_free(void) { struct card_data *conf; while (conf_cards) { conf = conf_cards; conf_cards = conf->next; snd_config_delete(conf->config); } }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/conf.c
snd_config_t *conf_by_card(int card) { struct card_data *conf; conf = conf_data_by_card(card, true); if (conf) return conf->config; return NULL; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/mixer-test.c
static void test_ctl_get_value(struct ctl_data *ctl) { int err; if (snd_ctl_elem_info_is_inactive(ctl->info)) { ksft_print_msg("%s is inactive\n", ctl->name); ksft_test_result_skip("get_value.%d.%d\n", ctl->card->card, ctl->elem); return; } /* Can't test reading on an unreadable control */ if (!...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/alsa/mixer-test.c
static bool strend(const char *haystack, const char *needle) { size_t haystack_len = strlen(haystack); size_t needle_len = strlen(needle); if (needle_len > haystack_len) return false; return strcmp(haystack + haystack_len - needle_len, needle) == 0; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/alsa/mixer-test.c
static void test_ctl_write_default(struct ctl_data *ctl) { int err; if (snd_ctl_elem_info_is_inactive(ctl->info)) { ksft_print_msg("%s is inactive\n", ctl->name); ksft_test_result_skip("write_default.%d.%d\n", ctl->card->card, ctl->elem); return; } if (!snd_ctl_elem_info_is_writable(ctl->info)) { ...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/alsa/mixer-test.c
static bool test_ctl_write_valid_enumerated(struct ctl_data *ctl) { int err, i, j; bool fail = false; snd_ctl_elem_value_t *val; snd_ctl_elem_value_alloca(&val); snd_ctl_elem_value_set_id(val, ctl->id); for (i = 0; i < snd_ctl_elem_info_get_count(ctl->info); i++) { for (j = 0; j < snd_ctl_elem_info_g...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/mixer-test.c
static bool test_ctl_write_invalid_integer(struct ctl_data *ctl) { int i; bool fail = false; snd_ctl_elem_value_t *val; snd_ctl_elem_value_alloca(&val); for (i = 0; i < snd_ctl_elem_info_get_count(ctl->info); i++) { if (snd_ctl_elem_info_get_min(ctl->info) != LONG_MIN) { snd_ctl_elem_value_copy(va...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/mixer-test.c
static void test_ctl_event_missing(struct ctl_data *ctl) { ksft_test_result(!ctl->event_missing, "event_missing.%d.%d\n", ctl->card->card, ctl->elem); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/alsa/pcm-test.c
void timestamp_now(timestamp_t *tstamp) { if (clock_gettime(CLOCK_MONOTONIC_RAW, tstamp)) ksft_exit_fail_msg("clock_get_time\n"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/hwcap.c
static void cssc_sigill(void) { asm volatile(".inst 0xdac01c00" : : : "x0"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/hwcap.c
static void sveaes_sigill(void) { asm volatile(".inst 0x4522e400" : : : "z0"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/hwcap.c
static void svebf16_sigill(void) { asm volatile(".inst 0x658aa000" : : : "z0"); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/hwcap.c
static void handle_sigill(int sig, siginfo_t *info, void *context) { ucontext_t *uc = context; seen_sigill = true; uc->uc_mcontext.pc += 4; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/hwcap.c
bool cpuinfo_present(const char *name) { FILE *f; char buf[2048], name_space[30], name_newline[30]; char *s; snprintf(name_space, sizeof(name_space), " %s ", name); snprintf(name_newline, sizeof(name_newline), " %s\n", name); f = fopen("/proc/cpuinfo", "r"); if (!f) { ksft_print_msg("Failed to open ...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/ptrace.c
static bool have_sme(void) { return getauxval(AT_HWCAP2) & HWCAP2_SME; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/ptrace.c
static int do_parent(pid_t child) { int ret = EXIT_FAILURE; pid_t pid; int status; siginfo_t si; while (1) { int sig; pid = wait(&status); if (pid == -1) { perror("wait"); goto error; } /* * This should never happen but it's hard to flag in * the framework. */...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/syscall-abi.c
static void fill_random(void *buf, size_t size) { int i; uint32_t *lbuf = buf; for (i = 0; i < size / sizeof(uint32_t); i++) lbuf[i] = random(); }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/syscall-abi.c
static void setup_ffr(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t svcr) { if ((svcr & SVCR_SM_MASK) && !(getauxval(AT_HWCAP2) & HWCAP2_SME_FA64)) { memset(&ffr_in, 0, sizeof(ffr_in)); return; } /* * It is only valid to set a contiguous set of bits starting * at ...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/syscall-abi.c
static void setup_za(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t svcr) { fill_random(za_in, sizeof(za_in)); memset(za_out, 0, sizeof(za_out)); }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/syscall-abi.c
int sve_count_vls(void) { unsigned int vq; int vl_count = 0; int vl; if (!(getauxval(AT_HWCAP) & HWCAP_SVE)) return 0; for (vq = SVE_VQ_MAX; vq > 0; --vq) { vl = prctl(PR_SVE_SET_VL, vq * 16); if (vl == -1) ksft_exit_fail_msg("PR_SVE_SET_VL failed: %s (%d)\n", strerror(errno), ...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/syscall-abi.c
int main(void) { int i; int tests = 1; srandom(getpid()); ksft_print_header(); tests += sve_count_vls(); tests += (sve_count_vls() * sme_count_vls()) * 3; ksft_set_plan(ARRAY_SIZE(syscalls) * tests); if (getauxval(AT_HWCAP2) & HWCAP2_SME_FA64) ksft_print_msg("SME with FA64\n"); else if (getauxv...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/tpidr2.c
static void putnum(unsigned int num) { char c; if (num / 10) putnum(num / 10); c = '0' + (num % 10); write(1, &c, 1); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/tpidr2.c
static void print_summary(void) { if (tests_passed + tests_failed + tests_skipped != EXPECTED_TESTS) putstr("# UNEXPECTED TEST COUNT: "); putstr("# Totals: pass:"); putnum(tests_passed); putstr(" fail:"); putnum(tests_failed); putstr(" xfail:0 xpass:0 skip:"); putnum(tests_skipped); putstr(" error...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/abi/tpidr2.c
static int write_sleep_read(void) { set_tpidr2(getpid()); msleep(100); return getpid() == get_tpidr2(); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/bti/signal.c
int sigemptyset(sigset_t *s) { unsigned int i; for (i = 0; i < _NSIG_WORDS; ++i) s->sig[i] = 0; return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/bti/signal.c
int sigaddset(sigset_t *s, int n) { if (n < 1 || n > _NSIG) return -EINVAL; s->sig[(n - 1) / _NSIG_BPW] |= 1UL << (n - 1) % _NSIG_BPW; return 0; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/bti/system.c
void __noreturn exit(int n) { syscall(__NR_exit, n); __unreachable(); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/bti/test.c
static void putstr(const char *str) { fdputs(1, str); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/fp-stress.c
static bool child_output_read(struct child_data *child) { char read_data[1024]; char work[1024]; int ret, len, cur_work, cur_read; ret = read(child->stdout, read_data, sizeof(read_data)); if (ret < 0) { if (errno == EINTR) return true; ksft_print_msg("%s: read() failed: %s (%d)\n", child->name...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/fp-stress.c
static void child_output(struct child_data *child, uint32_t events, bool flush) { bool read_more; if (events & EPOLLIN) { do { read_more = child_output_read(child); } while (read_more); } if (events & EPOLLHUP) { close(child->stdout); child->stdout = -1; flu...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/fp-stress.c
static void start_fpsimd(struct child_data *child, int cpu, int copy) { int ret; ret = asprintf(&child->name, "FPSIMD-%d-%d", cpu, copy); if (ret == -1) ksft_exit_fail_msg("asprintf() failed\n"); child_start(child, "./fpsimd-test"); ksft_print_msg("Started %s\n", child->name); }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/fp-stress.c
static void start_sve(struct child_data *child, int vl, int cpu) { int ret; ret = prctl(PR_SVE_SET_VL, vl | PR_SVE_VL_INHERIT); if (ret < 0) ksft_exit_fail_msg("Failed to set SVE VL %d\n", vl); ret = asprintf(&child->name, "SVE-VL-%d-%d", vl, cpu); if (ret == -1) ksft_exit_fail_msg("asprintf() fail...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/fp-stress.c
static void drain_output(bool flush) { int ret = 1; int i; while (ret > 0) { ret = epoll_wait(epoll_fd, evs, tests, 0); if (ret < 0) { if (errno == EINTR) continue; ksft_print_msg("epoll_wait() failed: %s (%d)\n", strerror(errno), errno); } for (i = 0; i < ret; i++) chi...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/rdvl-sme.c
int main(void) { int vl = rdvl_sme(); printf("%d\n", vl); return 0; }
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/sve-ptrace.c
int main(void) { int ret = EXIT_SUCCESS; pid_t child; srandom(getpid()); ksft_print_header(); ksft_set_plan(EXPECTED_TESTS); if (!(getauxval(AT_HWCAP) & HWCAP_SVE)) ksft_exit_skip("SVE not available\n"); child = fork(); if (!child) return do_child(); if (do_parent(child)) ret = EXIT_...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/vec-syscfg.c
static int stdio_read_integer(FILE *f, const char *what, int *val) { int n = 0; int ret; ret = fscanf(f, "%d%*1[\n]%n", val, &n); if (ret < 1 || n < 1) { ksft_print_msg("failed to parse integer from %s\n", what); return -1; } return 0; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/vec-syscfg.c
static int file_read_integer(const char *name, int *val) { FILE *f; int ret; f = fopen(name, "r"); if (!f) { ksft_test_result_fail("Unable to open %s: %d (%s)\n", name, errno, strerror(errno)); return -1; } ret = stdio_read_integer(f, name, val); fclose(f); return r...
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/vec-syscfg.c
static int file_write_integer(const char *name, int val) { FILE *f; f = fopen(name, "w"); if (!f) { ksft_test_result_fail("Unable to open %s: %d (%s)\n", name, errno, strerror(errno)); return -1; } fprintf(f, "%d", val); fclose(f); return 0; }
[ 1, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/vec-syscfg.c
static void proc_write_min(struct vec_data *data) { int ret, new_default, child_vl; if (geteuid() != 0) { ksft_test_result_skip("Need to be root to write to /proc\n"); return; } ret = file_write_integer(data->default_vl_file, ARCH_MIN_VL); if (ret != 0) return; ret = file_read_integer(data->d...
[ 0, 0 ]
Linux Kernel
tools/testing/selftests/arm64/fp/vec-syscfg.c
static void prctl_set_no_child(struct vec_data *data) { int ret, child_vl; if (data->min_vl == data->max_vl) { ksft_test_result_skip("%s only one VL supported\n", data->name); return; } ret = prctl(data->prctl_set, data->min_vl); if (ret < 0) { ksft_test_result_fail("%s prctl set failed for %d: ...
[ 0, 0 ]