Re: Panic "vm_fault_lookup: fault on nofault entry" amd64 r362008 -> r362045

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Thu, 11 Jun 2020 19:44:21 +0300
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
_at__at_ -1698,7 +1698,7 _at__at_ 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;
 	}
_at__at_ -1759,13 +1759,10 _at__at_ 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
_at__at_ -1773,13 +1770,10 _at__at_ 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
_at__at_ -1787,24 +1781,20 _at__at_ 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);
 }
 
 /*
Received on Thu Jun 11 2020 - 14:44:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:24 UTC