From owner-freebsd-current@freebsd.org Sat Aug 4 13:05:47 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 73CC9106AA00 for ; Sat, 4 Aug 2018 13:05:47 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 233BF75535 for ; Sat, 4 Aug 2018 13:05:47 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 B6419181CE for ; Sat, 4 Aug 2018 13:05:46 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf1-f52.google.com with SMTP id u202-v6so5979121lff.9 for ; Sat, 04 Aug 2018 06:05:46 -0700 (PDT) X-Gm-Message-State: AOUpUlGBygNvuhWqoqFnWnMyOYM2ddpdcbdtCYV5nRqva6F8og3RCXI1 iwoga+OIhkIZZuZkkkb2WHC9iSEq6dd9tmpRKt0= X-Google-Smtp-Source: AAOMgpeT+tWvtCMroH+ClCP76bnzH0WrkQnKJq+ZH7PFf3OiBn3JV+aNjNztUHdbeFIWRb6FsK2kwfFPUNDmuRhGdUc= X-Received: by 2002:a19:138b:: with SMTP id 11-v6mr7393174lft.74.1533387945191; Sat, 04 Aug 2018 06:05:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:5742:0:0:0:0:0 with HTTP; Sat, 4 Aug 2018 06:05:24 -0700 (PDT) In-Reply-To: <20180804083720.GJ6049@kib.kiev.ua> References: <20180804083720.GJ6049@kib.kiev.ua> From: Kyle Evans Date: Sat, 4 Aug 2018 08:05:24 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: panic: mutex pmap not owned at ... efirt_machdep.c:255 To: Konstantin Belousov Cc: freebsd-current Current 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 13:05:47 -0000 On Sat, Aug 4, 2018 at 3:37 AM, Konstantin Belousov 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.