From owner-freebsd-current@freebsd.org Sat Aug 4 14:59:05 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9B28106DE6F for ; Sat, 4 Aug 2018 14:59:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64A517B0C2; Sat, 4 Aug 2018 14:59:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id F3D2418CEC; Sat, 4 Aug 2018 14:59:04 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf1-f49.google.com with SMTP id l16-v6so6085828lfc.13; Sat, 04 Aug 2018 07:59:04 -0700 (PDT) X-Gm-Message-State: AOUpUlHZR/vn8LUxKqe9k5Xr+cZ4q4d9TZ4Hupawf2ygP7j7n3zK6u7w mUM2DV5NKVsTLxCxVwrw2d5yJ+86bLY4dA3Ro74= X-Google-Smtp-Source: AAOMgpeTUtwrsHk0gvdDDs+LJvbCqdP94sqi7ZZzKQ7zlN3U6PhffES9+2+TG8AtZtcbidwmWHTlcV5+7imIO1suwkA= X-Received: by 2002:a19:1586:: with SMTP id 6-v6mr6958738lfv.51.1533394743569; Sat, 04 Aug 2018 07:59:03 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:5742:0:0:0:0:0 with HTTP; Sat, 4 Aug 2018 07:58:43 -0700 (PDT) In-Reply-To: <1533394281.9860.5.camel@freebsd.org> References: <20180804083720.GJ6049@kib.kiev.ua> <20180804131352.GL6049@kib.kiev.ua> <1533394281.9860.5.camel@freebsd.org> From: Kyle Evans Date: Sat, 4 Aug 2018 09:58:43 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: panic: mutex pmap not owned at ... efirt_machdep.c:255 To: Ian Lepore Cc: Konstantin Belousov , freebsd-current Current , Eitan Adler Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Aug 2018 14:59:06 -0000 On Sat, Aug 4, 2018 at 9:51 AM, Ian Lepore wrote: > On Sat, 2018-08-04 at 08:56 -0500, Kyle Evans wrote: >> On Sat, Aug 4, 2018 at 8:13 AM, Konstantin Belousov > 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 > > > ail.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/efir >> > > > > t_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 > > What do we do on 32-bit arm that has no dmap but may have efi runtime > support? > This should probably just be compiled out for !arm64 && !x86 - its sole purpose was to compensate for outdated loader.efi that hasn't done the SetVirtualAddressMap. EFI on 32-bit ARM is "new" enough that it shouldn't have this problem.