From owner-freebsd-current@freebsd.org Sat May 18 14:24:40 2019 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 60D8E158E902 for ; Sat, 18 May 2019 14:24:40 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDD4084527 for ; Sat, 18 May 2019 14:24:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-it1-x143.google.com with SMTP id u186so16536437ith.0 for ; Sat, 18 May 2019 07:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Wut0OEC2z4wjLWol9RbwDSu8uJbbx0vn6VRnHec6NeY=; b=Upeb1X2gChj5D+fo+Xmu9XneqAZFz9CUwt8TrNFUDRWJmiGDeAKCAXIRFccEJYEYIi ETSseP8bAeOH9BJVrfzKMJpKbIoQ2fx2kP+vR0zbzskKsCW6rBVt1AktAR47Bb+qdq0i M+bSwWQ5cyvqcW7Ly46J8mxHaP/KolygFTgNoA7jVGk7BePd6rRo+2/vl+0p178N/Rn/ FUytnf/qENdjP94SEJz9dgtfE9ZH+6c2VRdqn0O667ZDAxbpGUHXcwIM6YcWwKQezypa 0xYByoWRgLT3otli6pMXFcE25xHk4X4wCJJCFRJ5besq7sqxM9cMakzCzlq9wbU2Noc6 G5Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Wut0OEC2z4wjLWol9RbwDSu8uJbbx0vn6VRnHec6NeY=; b=pkRGsY+GVwMBGL72hD4/zJpUD1SKyyomSokJVZkBSs3+zEt5dyF0q0BS/cMEhN+tcA GtL+Mgq1P6WAenOyKXSmMUHxeGScBIH82YN6CxrP/SjF6Js2XhALs/7FgwIcPbKzjTk6 uQZGjupoqAsmvKzW3OJ34YfogHtGwKMZ95nnRYLuf8Fj97vGGRc9bmvaA/C/qgZW0dga 4/OEylW/4cHpxudsR+N2Y8KP+EjWu9vSRTViY+uvyClvO2RIXXiGVhKRelpYPxMMLaPd ivAlbwR8ACudYGN8ugT8HriYf1Bb/v3RrV6XFEuAwXQxqyuYpTjv/oOLojdrcXumQc6Y 793Q== X-Gm-Message-State: APjAAAUtqJTFWl/Aly2tIi5CQTcp/MK9aLHDj/nX/5XFWX0DYv/sqV70 YG0PkMxESC5rWZMNxHmmb8M= X-Google-Smtp-Source: APXvYqzZthmUpXEafBETVRNXM8iX9Y6j7HE0MMgoqpSHqLBLWvPg5hVliNeVILJUZA09LNL8hErPlA== X-Received: by 2002:a24:d145:: with SMTP id w66mr6635417itg.71.1558189479292; Sat, 18 May 2019 07:24:39 -0700 (PDT) Received: from raichu (toroon0560w-lp140-01-69-159-36-31.dsl.bell.ca. [69.159.36.31]) by smtp.gmail.com with ESMTPSA id m67sm1946637itc.22.2019.05.18.07.24.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 May 2019 07:24:38 -0700 (PDT) Sender: Mark Johnston Date: Sat, 18 May 2019 10:24:36 -0400 From: Mark Johnston To: Konstantin Belousov Cc: Rebecca Cran , freebsd-current@freebsd.org Subject: Re: panic booting with if_tap_load="YES" in loader.conf Message-ID: <20190518142436.GB7370@raichu> References: <105ad083-ea95-21a7-35be-de01e32578c4@bluestop.org> <20190518053328.GA7370@raichu> <20190518085546.GY2748@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190518085546.GY2748@kib.kiev.ua> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: EDD4084527 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 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, 18 May 2019 14:24:40 -0000 On Sat, May 18, 2019 at 11:55:46AM +0300, Konstantin Belousov wrote: > On Sat, May 18, 2019 at 01:33:28AM -0400, Mark Johnston wrote: > > On Fri, May 17, 2019 at 10:18:57PM -0600, Rebecca Cran wrote: > > > I just updated from r346856 to r347950 and ran into a new panic, caused > > > by having if_tap_load="YES" in /boot/loader.conf - because it's already > > > built-in to the kernel: > > > > I think this patch should fix the panic, but I only compile-tested it. > > I considered having the logic live in preload_delete_name() instead, but > > the boot-time ucode code must still defer the deletion somewhat. > > Try this instead. I will revert r347931 after this landed, or could keep > it alone. I have no strong feeling either way. > diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c > index 1cf09dc5cb7..03fe8a5d096 100644 > --- a/sys/amd64/amd64/machdep.c > +++ b/sys/amd64/amd64/machdep.c > @@ -1616,6 +1616,13 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > bzero((void *)thread0.td_kstack, kstack0_sz); > physfree += kstack0_sz; > > + /* > + * Initialize enough of thread0 for delayed invalidation to > + * work very early. Rely on thread0.td_base_pri > + * zero-initialization, it is reset to PVM at proc0_init(). > + */ > + pmap_thread_init_invl_gen(&thread0); > + I think pmap_thread_init_invl_gen() also needs to initialize invl_gen->saved_pri to 0. > /* > * make gdt memory segments > */ > diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c > index 7997a9f65dc..ecd701399fc 100644 > --- a/sys/amd64/amd64/pmap.c > +++ b/sys/amd64/amd64/pmap.c > @@ -700,9 +700,12 @@ pmap_delayed_invl_start_u(void) > invl_gen = &td->td_md.md_invl_gen; > PMAP_ASSERT_NOT_IN_DI(); > lock_delay_arg_init(&lda, &di_delay); > + pri = td->td_base_pri; > + if (pri <= PVM) > + goto again; > thread_lock(td); > pri = td->td_base_pri; > - if (pri < PVM) { > + if (pri <= PVM) { > invl_gen->saved_pri = 0; > } else { > invl_gen->saved_pri = pri;