Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2020 19:44:21 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        David Wolfskill <david@catwhisker.org>, Xin Li <delphij@delphij.net>, Mark Johnston <markj@freebsd.org>, current@freebsd.org
Subject:   Re: Panic "vm_fault_lookup: fault on nofault entry" amd64 r362008 -> r362045
Message-ID:  <20200611164421.GQ48478@kib.kiev.ua>
In-Reply-To: <20200611163331.GC1392@albert.catwhisker.org>
References:  <20200611130500.GW1392@albert.catwhisker.org> <20200611132129.GL48478@kib.kiev.ua> <20200611132924.GX1392@albert.catwhisker.org> <20200611134658.GM48478@kib.kiev.ua> <20200611154456.GY1392@albert.catwhisker.org> <20200611155143.GN48478@kib.kiev.ua> <20200611161156.GB1392@albert.catwhisker.org> <20200611162417.GD32928@raichu> <20200611163331.GC1392@albert.catwhisker.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 11, 2020 at 09:33:31AM -0700, David Wolfskill wrote:
> On Thu, Jun 11, 2020 at 12:24:17PM -0400, Mark Johnston wrote:
> > ...
> > > Unfortunately, I ran out of time to do further experiments for now; I'll
> > > need to do some work-related things for a while, but thought that this
> > > might at least provide some useful information.
> > > 
> > > Here is what I commented out:
> > > 
> > > g1-55(12.1-S)[2] grep KIB boot/loader.conf
> > > # KIB coretemp_load="YES"
> > > # KIB iwn5000fw_load="YES"
> > > # KIB linux_load="YES"
> > > # KIB nvidia-modeset_load="YES"
> > > # KIB cuse_load="YES"
> > > # KIB geom_eli_load="YES"
> > > # KIB filemon_load="YES"
> > 
> > Thanks.  I'm able to reproduce a somewhat similar problem in bhyve: if I
> > preload iwn5000fw.ko, a r362045 kernel fails to boot very early with
> > 
> > ---<<BOOT>>---
> > ACPI: Failed to map RSDT
> > APIC: Could not find any APICs.
> > panic: running without device atpic requires a local APIC
> 
> Ah -- excellent (that you are able to pretty much reproduce this).  And
> it explains why my build machine wasn't affected: it doesn't use
> wireless drivers at all.
> 
> > Reverting r362035 allows the kernel to boot again, but so does adding a
> > few printf() calls to the pmap and ACPI code.
> 
> Kinky. :-}

This should fix noexec for modules.

diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c
index 81db4d7ca85..cb84fc95691 100644
--- a/sys/x86/x86/mp_x86.c
+++ b/sys/x86/x86/mp_x86.c
@@ -1698,7 +1698,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap,
 	int cpu;
 
 	/* It is not necessary to signal other CPUs while in the debugger. */
-	if (kdb_active || KERNEL_PANICKED()) {
+	if (kdb_active || KERNEL_PANICKED() || !smp_started) {
 		curcpu_cb(pmap, addr1, addr2);
 		return;
 	}
@@ -1759,13 +1759,10 @@ void
 smp_masked_invltlb(cpuset_t mask, pmap_t pmap, smp_invl_cb_t curcpu_cb)
 {
 
-	if (smp_started) {
-		smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0,
-		    curcpu_cb);
+	smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0, curcpu_cb);
 #ifdef COUNT_XINVLTLB_HITS
-		ipi_global++;
+	ipi_global++;
 #endif
-	}
 }
 
 void
@@ -1773,13 +1770,10 @@ smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pmap_t pmap,
     smp_invl_cb_t curcpu_cb)
 {
 
-	if (smp_started) {
-		smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0,
-		    curcpu_cb);
+	smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0, curcpu_cb);
 #ifdef COUNT_XINVLTLB_HITS
-		ipi_page++;
+	ipi_page++;
 #endif
-	}
 }
 
 void
@@ -1787,24 +1781,20 @@ smp_masked_invlpg_range(cpuset_t mask, vm_offset_t addr1, vm_offset_t addr2,
     pmap_t pmap, smp_invl_cb_t curcpu_cb)
 {
 
-	if (smp_started) {
-		smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap,
-		    addr1, addr2, curcpu_cb);
+	smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap, addr1, addr2,
+	    curcpu_cb);
 #ifdef COUNT_XINVLTLB_HITS
-		ipi_range++;
-		ipi_range_size += (addr2 - addr1) / PAGE_SIZE;
+	ipi_range++;
+	ipi_range_size += (addr2 - addr1) / PAGE_SIZE;
 #endif
-	}
 }
 
 void
 smp_cache_flush(smp_invl_cb_t curcpu_cb)
 {
 
-	if (smp_started) {
-		smp_targeted_tlb_shootdown(all_cpus, IPI_INVLCACHE, NULL,
-		    0, 0, curcpu_cb);
-	}
+	smp_targeted_tlb_shootdown(all_cpus, IPI_INVLCACHE, NULL, 0, 0,
+	    curcpu_cb);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200611164421.GQ48478>