svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86

Dexuan Cui decui at microsoft.com
Wed Aug 9 04:09:18 UTC 2017


Hi jkim,
The patch breaks FreeBSD VM on Hyper-V.

identify_hypervisor() is moved from identify_cpu() to an earlier place, but the global 
variable cpu_feature2 used by the function is still initialized in identify_cpu().

I'm not sure about the background of your patch. Can you please have a look?

Thanks,
-- Dexuan

> -----Original Message-----
> From: owner-src-committers at freebsd.org [mailto:owner-src-
> committers at freebsd.org] On Behalf Of Jung-uk Kim
> Sent: Friday, August 4, 2017 23:57
> To: src-committers at freebsd.org; svn-src-all at freebsd.org; svn-src-
> head at freebsd.org
> Subject: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386
> x86/include x86/x86
> 
> Author: jkim
> Date: Sat Aug  5 06:56:46 2017
> New Revision: 322076
> URL:
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsvnweb.fr
> eebsd.org%2Fchangeset%2Fbase%2F322076&data=02%7C01%7Cdecui%40micr
> osoft.com%7C5a826235e08b415fc3cb08d4dbcf2b80%7C72f988bf86f141af91ab
> 2d7cd011db47%7C1%7C0%7C636375130217192047&sdata=%2BcZhlr%2B2zX5S
> S1eA32fWMpzckNHOQlGz8UHLXCaUN0s%3D&reserved=0
> 
> 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()) {



More information about the svn-src-all mailing list