| @@ -212,27 +212,27 @@ run_worker_tests(npf_t *npf) | | | @@ -212,27 +212,27 @@ run_worker_tests(npf_t *npf) |
212 | test_npf = kmem_zalloc(sizeof(npf_t), KM_SLEEP); | | 212 | test_npf = kmem_zalloc(sizeof(npf_t), KM_SLEEP); |
213 | atomic_store_release(&test_npf->arg, &task_done); | | 213 | atomic_store_release(&test_npf->arg, &task_done); |
214 | test_npf->ebr = npf_ebr_create(); | | 214 | test_npf->ebr = npf_ebr_create(); |
215 | | | 215 | |
216 | error = npf_worker_addfunc(test_npf, worker_test_task); | | 216 | error = npf_worker_addfunc(test_npf, worker_test_task); |
217 | assert(error == 0); | | 217 | assert(error == 0); |
218 | | | 218 | |
219 | /* Enlist the NPF instance. */ | | 219 | /* Enlist the NPF instance. */ |
220 | npf_worker_enlist(test_npf); | | 220 | npf_worker_enlist(test_npf); |
221 | | | 221 | |
222 | /* Wait for the task to be done. */ | | 222 | /* Wait for the task to be done. */ |
223 | while (!atomic_load_acquire(&task_done) && retry--) { | | 223 | while (!atomic_load_acquire(&task_done) && retry--) { |
224 | npf_worker_signal(test_npf); | | 224 | npf_worker_signal(test_npf); |
225 | kpause("gctest", false, mstohz(1), NULL); | | 225 | kpause("gctest", false, MAX(1, mstohz(1)), NULL); |
226 | } | | 226 | } |
227 | | | 227 | |
228 | CHECK_TRUE(atomic_load_acquire(&task_done)); | | 228 | CHECK_TRUE(atomic_load_acquire(&task_done)); |
229 | npf_worker_discharge(test_npf); | | 229 | npf_worker_discharge(test_npf); |
230 | | | 230 | |
231 | /* Clear the parameter and signal again. */ | | 231 | /* Clear the parameter and signal again. */ |
232 | atomic_store_release(&test_npf->arg, NULL); | | 232 | atomic_store_release(&test_npf->arg, NULL); |
233 | npf_worker_signal(test_npf); | | 233 | npf_worker_signal(test_npf); |
234 | | | 234 | |
235 | npf_ebr_destroy(test_npf->ebr); | | 235 | npf_ebr_destroy(test_npf->ebr); |
236 | kmem_free(test_npf, sizeof(npf_t)); // npfk_destroy() | | 236 | kmem_free(test_npf, sizeof(npf_t)); // npfk_destroy() |
237 | } | | 237 | } |
238 | | | 238 | |