Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2016 18:20:35 +0100
From:      Martin Simmons <martin@lispworks.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        threads@freebsd.org, arch@freebsd.org
Subject:   Re: Robust mutexes implementation
Message-ID:  <201605051720.u45HKZ76021094@higson.cam.lispworks.com>
In-Reply-To: <20160505131029.GE2422@kib.kiev.ua> (message from Konstantin Belousov on Thu, 5 May 2016 16:10:29 %2B0300)
References:  <20160505131029.GE2422@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
There is a potential bug in enqueue_mutex when it tests m1 == NULL and m1 !=
NULL.  These tests only work because m_lock is the first slot in struct
pthread_mutex and hence 0 in curthread->robust_list is converted to NULL
(rather than a negative value).

Also, is it safe to assume memory ordering between the assignments of
m->m_lock.m_rb_lnk and curthread->robust_list?  Maybe it is OK because the
kernel will never read curthread->robust_list until after the CPU executing
enqueue_mutex has passed a memory barrier?

__Martin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605051720.u45HKZ76021094>