Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Aug 2017 06:56:46 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86
Message-ID:  <201708050656.v756uk48076256@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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()) {



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