Date: Sun, 11 Mar 2018 21:58:00 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Ian Lepore <ian@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r330780 - in head/sys: amd64/include isa x86/isa Message-ID: <20180311195800.GC76926@kib.kiev.ua> In-Reply-To: <201803111922.w2BJMwr8043084@repo.freebsd.org> References: <201803111922.w2BJMwr8043084@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 11, 2018 at 07:22:58PM +0000, Ian Lepore wrote: > Author: ian > Date: Sun Mar 11 19:22:58 2018 > New Revision: 330780 > URL: https://svnweb.freebsd.org/changeset/base/330780 > > Log: > Eliminate atrtc_time_lock, and use atrtc_lock for efirtc locking. > > Modified: > head/sys/amd64/include/efi.h > head/sys/isa/rtc.h > head/sys/x86/isa/atrtc.c > > Modified: head/sys/amd64/include/efi.h > ============================================================================== > --- head/sys/amd64/include/efi.h Sun Mar 11 19:14:01 2018 (r330779) > +++ head/sys/amd64/include/efi.h Sun Mar 11 19:22:58 2018 (r330780) > @@ -48,9 +48,9 @@ > #ifdef _KERNEL > #include <isa/rtc.h> > > -#define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock); > -#define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock); > -#define EFI_TIME_OWNED() mtx_assert(&atrtc_time_lock, MA_OWNED); > +#define EFI_TIME_LOCK() mtx_lock_spin(&atrtc_lock); > +#define EFI_TIME_UNLOCK() mtx_unlock_spin(&atrtc_lock); > +#define EFI_TIME_OWNED() mtx_assert(&atrtc_lock, MA_OWNED); I do not understand how this can work. You changed EFI_TIME_LOCK() to spinlock. As result, the spinlock is taken before efi_enter() is called. efi_enter() locks the pmap and efi_lock, both of which are sleepable mutexes. Also, arch efirt code is allowed to take arch-specific sleepable mutexes and perhaps some spinlocks (but currently does not). The first context switch when either of the listed sleepable mutexes are contested and the thread is taken off CPU would panic. I suspect that some invariants check might fire earlier.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180311195800.GC76926>