Author: jkim
Date: Sat Aug  5 06:56:46 2017
New Revision: 322076
URL: https://svnweb.freebsd.org/changeset/base/322076

Log:
  Detect hypervisors early.  We used to set lower hz on hypervisors by default
  but it was broken since r273800 (and r278522, its MFC to stable/10) because
  identify_cpu() is called too late, i.e., after init_param1().
  
  MFC after:    3 days

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/i386/i386/machdep.c
  head/sys/x86/include/x86_var.h
  head/sys/x86/x86/identcpu.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c      Sat Aug  5 06:46:06 2017        
(r322075)
+++ head/sys/amd64/amd64/machdep.c      Sat Aug  5 06:56:46 2017        
(r322076)
@@ -1537,6 +1537,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
 
        kmdp = init_ops.parse_preload_data(modulep);
 
+       identify_hypervisor();
+
        /* Init basic tunables, hz etc */
        init_param1();
 

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c        Sat Aug  5 06:46:06 2017        
(r322075)
+++ head/sys/i386/i386/machdep.c        Sat Aug  5 06:56:46 2017        
(r322076)
@@ -2185,6 +2185,8 @@ init386(int first)
        else
                init_static_kenv(NULL, 0);
 
+       identify_hypervisor();
+
        /* Init basic tunables, hz etc */
        init_param1();
 

Modified: head/sys/x86/include/x86_var.h
==============================================================================
--- head/sys/x86/include/x86_var.h      Sat Aug  5 06:46:06 2017        
(r322075)
+++ head/sys/x86/include/x86_var.h      Sat Aug  5 06:56:46 2017        
(r322076)
@@ -116,6 +116,7 @@ void        cpu_setregs(void);
 void   dump_add_page(vm_paddr_t);
 void   dump_drop_page(vm_paddr_t);
 void   identify_cpu(void);
+void   identify_hypervisor(void);
 void   initializecpu(void);
 void   initializecpucache(void);
 bool   fix_cpuid(void);

Modified: head/sys/x86/x86/identcpu.c
==============================================================================
--- head/sys/x86/x86/identcpu.c Sat Aug  5 06:46:06 2017        (r322075)
+++ head/sys/x86/x86/identcpu.c Sat Aug  5 06:56:46 2017        (r322076)
@@ -1252,7 +1252,7 @@ static const char *const vm_pnames[] = {
        NULL
 };
 
-static void
+void
 identify_hypervisor(void)
 {
        u_int regs[4];
@@ -1403,7 +1403,6 @@ identify_cpu(void)
        cpu_feature2 = regs[2];
 #endif
 
-       identify_hypervisor();
        cpu_vendor_id = find_cpu_vendor_id();
 
        if (fix_cpuid()) {
_______________________________________________
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