Hello,
On Sun, May 08, 2022 at 10:13:20PM +0200, Alexander Bluhm wrote:
> On Sun, May 08, 2022 at 09:19:23PM +0200, Alexander Bluhm wrote:
> > I will run my tests with the diff below.
>
> With the third chunk reboot hangs during reordering libraries in
> vmmaplk. So this needs more thought.
rw_do_exit() looks odd:
335 /* membar_exit_before_atomic() has to precede call of this function. */
336 void
337 rw_do_exit(struct rwlock *rwl, unsigned long wrlock)
338 {
339 unsigned long owner, set;
340
341 do {
342 owner = rwl->rwl_owner;
343 if (wrlock)
344 set = 0;
345 else
346 set = (owner - RWLOCK_READ_INCR) & ~RWLOCK_WAIT;
347 } while (__predict_false(rw_cas(&rwl->rwl_owner, owner, set)));
348
349 if (owner & RWLOCK_WAIT)
350 wakeup(rwl);
351 }
what bothers me is the situation where there are
more than one reader. The line 350 is executed by
the first reader which drops the lock. So the process
woken up by wakeup(rwl) are going to find out the
lock is still occupied by remaining readers.
regards
sashan