HExSA-Lab / nautilus

Nautilus Aerokernel
Other
44 stars 60 forks source link

NK Barrier notify field bug #42

Closed MJChku closed 3 years ago

MJChku commented 3 years ago

bug discription in nk_barrier_wait(barrier) implementation, after every threads gets out, barrier->notify is not set back to zero; On every reuse of this barrier, it has no effect; I found this bug when I test on pthread library tests.

Changes Made to Nautilus (please include): in src/nautilus/barrier.c function nk_barrier_wait

if (atomic_inc_val(barrier->remaining) == init_count) {
        bspin_unlock(&barrier->lock);
    }

to

 if (atomic_inc_val(barrier->remaining) == init_count) {
        atomic_cmpswap(barrier->notify, 1, 0); 
        bspin_unlock(&barrier->lock);
 }

Additional context Add any other context about the problem here.

khale commented 3 years ago

Fixed by #44