Date: Sat, 4 Aug 2018 17:27:41 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Kyle Evans <kevans@freebsd.org> Cc: freebsd-current Current <freebsd-current@freebsd.org>, Eitan Adler <eadler@freebsd.org> Subject: Re: panic: mutex pmap not owned at ... efirt_machdep.c:255 Message-ID: <20180804142741.GN6049@kib.kiev.ua> In-Reply-To: <CACNAnaFUto6gSaDx3vrgnSykRfBhV_Mgx4OLaXJgENvgqjgSHg@mail.gmail.com> References: <CAF6rxg=4OnHEJa1OnJerMeEKD66nZg3j-H-XZ-9YAA1TE_NoDQ@mail.gmail.com> <CACNAnaFv9Gj%2BM2Gb8FbwY5q56dnTR6OgjZ5qth9gjr8LreHeow@mail.gmail.com> <20180804083720.GJ6049@kib.kiev.ua> <CACNAnaGZJxm=_oM_f0xinUe2NZ=tZn3w%2BnLTE62_r9EAm0UuTA@mail.gmail.com> <20180804131352.GL6049@kib.kiev.ua> <CACNAnaFUto6gSaDx3vrgnSykRfBhV_Mgx4OLaXJgENvgqjgSHg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 04, 2018 at 08:56:58AM -0500, Kyle Evans wrote: > On Sat, Aug 4, 2018 at 8:13 AM, Konstantin Belousov <kostikbel@gmail.com> wrote: > > On Sat, Aug 04, 2018 at 08:05:24AM -0500, Kyle Evans wrote: > >> On Sat, Aug 4, 2018 at 3:37 AM, Konstantin Belousov <kostikbel@gmail.com> wrote: > >> > On Fri, Aug 03, 2018 at 11:27:02PM -0500, Kyle Evans wrote: > >> >> > >> >> This seems odd- pmap lock is acquired at [1], then asserted shortly > >> >> later at [2]... I avoid some of this stuff as well as I can, but is it > >> >> actually possible for PCPU_GET(...) acquired curpmap to not match > >> >> curthread->td_proc->p_vmspace->vm_pmap in this context? > >> >> > >> >> [1] https://svnweb.freebsd.org/base/head/sys/dev/efidev/efirt.c?view=markup#l260 > >> >> [2] https://svnweb.freebsd.org/base/head/sys/amd64/amd64/efirt_machdep.c?view=markup#l254 > >> > There could be that curpcpu not yet synced with proc0 pmap. It could be > >> > fixed. > >> > > >> > But it is not clear to me why efi_arch_enter() is called there. I see > >> > the check for GetTime belonging to the range described by a map descriptor. > >> > I do not see why do you need an enter into the EFI context for comparing > >> > integers. > >> > >> This probably could have been documented better, but efi_runtime > >> pointer may (always?) point into runtime service memory that isn't > >> valid/available at that point, so we get a fault and panic when > >> dereferencing it to grab rt_gettime address. We ran into this wall > >> when adding the check originally. > > Wouldn't it be enough to access it by translating physical address into > > DMAP ? > > Ah, sure, sure. [1] is proper form, yeah? > > [1] https://people.freebsd.org/~kevans/efi-dmap.diff I would brace it with #ifdef PHYS_TO_DMAP, #error otherwise. Also, it might make sense to check against dmaplimit as well (on arm64 it is called PHYS_IN_DMAP(), sight). So it might make sense to define MD function in arch/efirt_machdep.c to translate table' address into the KVA.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180804142741.GN6049>