Author: kib
Date: Thu Jun 11 17:25:20 2020
New Revision: 362065
URL: https://svnweb.freebsd.org/changeset/base/362065

Log:
  Restore TLB invalidations done before smp started.
  
  In particular, invalidation of the preloaded modules text to allow
  execution from it was broken after D25188/r362031.
  
  Reviewed by:  markj
  Reported by:  delphij, dhw
  Sponsored by: The FreeBSD Foundation
  MFC after:    13 days

Modified:
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/x86/x86/mp_x86.c
==============================================================================
--- head/sys/x86/x86/mp_x86.c   Thu Jun 11 16:51:13 2020        (r362064)
+++ head/sys/x86/x86/mp_x86.c   Thu Jun 11 17:25:20 2020        (r362065)
@@ -1698,7 +1698,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector
        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, pma
     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 add
     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);
 }
 
 /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to