Changeset fc10e1b in mainline for kernel/test
- Timestamp:
- 2018-09-07T16:34:11Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d2c91ab
- Parents:
- 508b0df1 (diff), e90cfa6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/test
- Files:
-
- 6 edited
-
atomic/atomic1.c (modified) (1 diff)
-
mm/falloc2.c (modified) (2 diffs)
-
synch/rcu1.c (modified) (9 diffs)
-
synch/semaphore1.c (modified) (3 diffs)
-
synch/workq-test-core.h (modified) (3 diffs)
-
thread/thread1.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/atomic/atomic1.c
r508b0df1 rfc10e1b 36 36 atomic_t a; 37 37 38 atomic_s et(&a, 10);39 if (atomic_ get(&a) != 10)40 return "Failed atomic_s et()/atomic_get()";38 atomic_store(&a, 10); 39 if (atomic_load(&a) != 10) 40 return "Failed atomic_store()/atomic_load()"; 41 41 42 42 if (atomic_postinc(&a) != 10) 43 43 return "Failed atomic_postinc()"; 44 if (atomic_ get(&a) != 11)45 return "Failed atomic_ get() after atomic_postinc()";44 if (atomic_load(&a) != 11) 45 return "Failed atomic_load() after atomic_postinc()"; 46 46 47 47 if (atomic_postdec(&a) != 11) 48 48 return "Failed atomic_postdec()"; 49 if (atomic_ get(&a) != 10)50 return "Failed atomic_ get() after atomic_postdec()";49 if (atomic_load(&a) != 10) 50 return "Failed atomic_load() after atomic_postdec()"; 51 51 52 52 if (atomic_preinc(&a) != 11) 53 53 return "Failed atomic_preinc()"; 54 if (atomic_ get(&a) != 11)55 return "Failed atomic_ get() after atomic_preinc()";54 if (atomic_load(&a) != 11) 55 return "Failed atomic_load() after atomic_preinc()"; 56 56 57 57 if (atomic_predec(&a) != 10) 58 58 return "Failed atomic_predec()"; 59 if (atomic_ get(&a) != 10)60 return "Failed atomic_ get() after atomic_predec()";59 if (atomic_load(&a) != 10) 60 return "Failed atomic_load() after atomic_predec()"; 61 61 62 62 return NULL; -
kernel/test/mm/falloc2.c
r508b0df1 rfc10e1b 117 117 const char *test_falloc2(void) 118 118 { 119 atomic_s et(&thread_count, THREADS);120 atomic_s et(&thread_fail, 0);119 atomic_store(&thread_count, THREADS); 120 atomic_store(&thread_fail, 0); 121 121 122 122 for (unsigned int i = 0; i < THREADS; i++) { … … 130 130 } 131 131 132 while (atomic_ get(&thread_count) > 0) {133 TPRINTF("Threads left: % " PRIua "\n",134 atomic_ get(&thread_count));132 while (atomic_load(&thread_count) > 0) { 133 TPRINTF("Threads left: %zu\n", 134 atomic_load(&thread_count)); 135 135 thread_sleep(1); 136 136 } 137 137 138 if (atomic_ get(&thread_fail) == 0)138 if (atomic_load(&thread_fail) == 0) 139 139 return NULL; 140 140 -
kernel/test/synch/rcu1.c
r508b0df1 rfc10e1b 238 238 239 239 240 static atomic_t nop_callbacks_cnt = { 0 };240 static atomic_t nop_callbacks_cnt = 0; 241 241 /* Must be even. */ 242 242 static const int nop_updater_iters = 10000; … … 268 268 static bool do_nop_callbacks(void) 269 269 { 270 atomic_s et(&nop_callbacks_cnt, 0);270 atomic_store(&nop_callbacks_cnt, 0); 271 271 272 272 size_t exp_cnt = nop_updater_iters * get_thread_cnt(); … … 282 282 size_t loop_cnt = 0, max_loops = 15; 283 283 284 while (exp_cnt != atomic_ get(&nop_callbacks_cnt) && loop_cnt < max_loops) {284 while (exp_cnt != atomic_load(&nop_callbacks_cnt) && loop_cnt < max_loops) { 285 285 ++loop_cnt; 286 286 TPRINTF("."); … … 361 361 typedef struct { 362 362 rcu_item_t rcu; 363 atomic_count_t start_time;363 size_t start_time; 364 364 } seq_item_t; 365 365 … … 367 367 static errno_t seq_test_result = EOK; 368 368 369 static atomic_t cur_time = { 1 };370 static atomic_count_t max_upd_done_time = { 0 };369 static atomic_t cur_time = 1; 370 static size_t max_upd_done_time = { 0 }; 371 371 372 372 static void seq_cb(rcu_item_t *rcu_item) … … 399 399 for (size_t i = 0; i < work->read_cnt; ++i) { 400 400 rcu_read_lock(); 401 atomic_count_t start_time = atomic_postinc(&cur_time);401 size_t start_time = atomic_postinc(&cur_time); 402 402 403 403 for (volatile size_t d = 0; d < 10 * i; ++d) { … … 448 448 seq_test_result = EOK; 449 449 max_upd_done_time = 0; 450 atomic_s et(&cur_time, 1);450 atomic_store(&cur_time, 1); 451 451 452 452 const size_t iters = 100; … … 821 821 { 822 822 barrier_t *b = member_to_inst(item, barrier_t, rcu_item); 823 atomic_s et(&b->done, 1);823 atomic_store(&b->done, 1); 824 824 } 825 825 … … 835 835 } 836 836 837 atomic_s et(&barrier->done, 0);837 atomic_store(&barrier->done, 0); 838 838 839 839 rcu_call(&barrier->rcu_item, barrier_callback); 840 840 rcu_barrier(); 841 841 842 if (1 == atomic_ get(&barrier->done)) {842 if (1 == atomic_load(&barrier->done)) { 843 843 free(barrier); 844 844 return true; -
kernel/test/synch/semaphore1.c
r508b0df1 rfc10e1b 73 73 { 74 74 int i, j, k; 75 atomic_count_t consumers;76 atomic_count_t producers;75 size_t consumers; 76 size_t producers; 77 77 78 78 waitq_initialize(&can_start); … … 82 82 thread_t *thrd; 83 83 84 atomic_s et(&items_produced, 0);85 atomic_s et(&items_consumed, 0);84 atomic_store(&items_produced, 0); 85 atomic_store(&items_consumed, 0); 86 86 87 87 consumers = i * CONSUMERS; 88 88 producers = (4 - i) * PRODUCERS; 89 89 90 TPRINTF("Creating % " PRIua " consumers and %" PRIua "producers...",90 TPRINTF("Creating %zu consumers and %zu producers...", 91 91 consumers, producers); 92 92 … … 115 115 waitq_wakeup(&can_start, WAKEUP_ALL); 116 116 117 while ((items_consumed .count != consumers) || (items_produced.count!= producers)) {118 TPRINTF("% " PRIua " consumers remaining, %" PRIua "producers remaining\n",119 consumers - items_consumed .count, producers - items_produced.count);117 while ((items_consumed != consumers) || (items_produced != producers)) { 118 TPRINTF("%zu consumers remaining, %zu producers remaining\n", 119 consumers - items_consumed, producers - items_produced); 120 120 thread_sleep(1); 121 121 } -
kernel/test/synch/workq-test-core.h
r508b0df1 rfc10e1b 149 149 { 150 150 for (int i = 0; i < WAVES; ++i) { 151 atomic_s et(&call_cnt[i], 0);151 atomic_store(&call_cnt[i], 0); 152 152 } 153 153 … … 179 179 180 180 for (int i = 0; i < WAVES; ++i) { 181 while (atomic_ get(&call_cnt[i]) < exp_call_cnt &&181 while (atomic_load(&call_cnt[i]) < exp_call_cnt && 182 182 sleep_cnt < max_sleep_cnt) { 183 183 TPRINTF("."); … … 190 190 191 191 for (int i = 0; i < WAVES; ++i) { 192 if (atomic_ get(&call_cnt[i]) == exp_call_cnt) {193 TPRINTF("Ok: % " PRIua "calls in wave %d, as expected.\n",194 atomic_ get(&call_cnt[i]), i);192 if (atomic_load(&call_cnt[i]) == exp_call_cnt) { 193 TPRINTF("Ok: %zu calls in wave %d, as expected.\n", 194 atomic_load(&call_cnt[i]), i); 195 195 } else { 196 196 success = false; 197 TPRINTF("Error: % " PRIua "calls in wave %d, but %zu expected.\n",198 atomic_ get(&call_cnt[i]), i, exp_call_cnt);197 TPRINTF("Error: %zu calls in wave %d, but %zu expected.\n", 198 atomic_load(&call_cnt[i]), i, exp_call_cnt); 199 199 } 200 200 } -
kernel/test/thread/thread1.c
r508b0df1 rfc10e1b 46 46 thread_detach(THREAD); 47 47 48 while (atomic_ get(&finish)) {48 while (atomic_load(&finish)) { 49 49 TPRINTF("%" PRIu64 " ", THREAD->tid); 50 50 thread_usleep(100000); … … 56 56 { 57 57 unsigned int i; 58 atomic_count_t total = 0;58 size_t total = 0; 59 59 60 atomic_s et(&finish, 1);61 atomic_s et(&threads_finished, 0);60 atomic_store(&finish, 1); 61 atomic_store(&threads_finished, 0); 62 62 63 63 for (i = 0; i < THREADS; i++) { … … 75 75 thread_sleep(10); 76 76 77 atomic_s et(&finish, 0);78 while (atomic_ get(&threads_finished) < total) {79 TPRINTF("Threads left: % " PRIua "\n", total - atomic_get(&threads_finished));77 atomic_store(&finish, 0); 78 while (atomic_load(&threads_finished) < total) { 79 TPRINTF("Threads left: %zu\n", total - atomic_load(&threads_finished)); 80 80 thread_sleep(1); 81 81 }
Note:
See TracChangeset
for help on using the changeset viewer.
