Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Aug 2017 13:02:42 -0400
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Dexuan Cui <decui@microsoft.com>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Cc:        Yanmin Qiao <yaqia@microsoft.com>, Hongjiang Zhang <honzhan@microsoft.com>
Subject:   Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86
Message-ID:  <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org>
In-Reply-To: <KL1P15301MB0008FB78F813459914B41EDABF8B0@KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM>
References:  <201708050656.v756uk48076256@repo.freebsd.org> <KL1P15301MB0008FB78F813459914B41EDABF8B0@KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW
Content-Type: multipart/mixed; boundary="WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ";
 protected-headers="v1"
From: Jung-uk Kim <jkim@FreeBSD.org>
To: Dexuan Cui <decui@microsoft.com>,
 "src-committers@freebsd.org" <src-committers@freebsd.org>,
 "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,
 "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Cc: Yanmin Qiao <yaqia@microsoft.com>, Hongjiang Zhang <honzhan@microsoft.com>
Message-ID: <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org>
Subject: Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386
 x86/include x86/x86
References: <201708050656.v756uk48076256@repo.freebsd.org>
 <KL1P15301MB0008FB78F813459914B41EDABF8B0@KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM>
In-Reply-To: <KL1P15301MB0008FB78F813459914B41EDABF8B0@KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM>

--WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ
Content-Type: multipart/mixed;
 boundary="------------370644EAE7D50A34E0B3E01F"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------370644EAE7D50A34E0B3E01F
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 08/09/2017 00:09, Dexuan Cui wrote:
> Hi jkim,
> The patch breaks FreeBSD VM on Hyper-V.
>=20
> identify_hypervisor() is moved from identify_cpu() to an earlier place,=
 but the global=20
> variable cpu_feature2 used by the function is still initialized in iden=
tify_cpu().
>=20
> I'm not sure about the background of your patch. Can you please have a =
look?

Can you please test the attached patch?

Jung-uk Kim

--------------370644EAE7D50A34E0B3E01F
Content-Type: text/x-patch;
 name="cpuid.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="cpuid.diff"

Index: sys/amd64/amd64/machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/amd64/amd64/machdep.c	(revision 322319)
+++ sys/amd64/amd64/machdep.c	(working copy)
@@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
=20
 	kmdp =3D init_ops.parse_preload_data(modulep);
=20
+	identify_cpu();
 	identify_hypervisor();
=20
 	/* Init basic tunables, hz etc */
@@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
 	    !=3D NULL)
 		vty_set_preferred(VTY_VT);
=20
-	identify_cpu();		/* Final stage of CPU initialization */
+	finishidentcpu();	/* Final stage of CPU initialization */
 	initializecpu();	/* Initialize CPU registers */
 	initializecpucache();
=20
Index: sys/i386/include/md_var.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/i386/include/md_var.h	(revision 322319)
+++ sys/i386/include/md_var.h	(working copy)
@@ -59,7 +59,6 @@ void	doreti_popl_es(void) __asm(__STRING(doreti_po
 void	doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault));
 void	doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs));
 void	doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault));
-void	finishidentcpu(void);
 void	fill_based_sd(struct segment_descriptor *sdp, uint32_t base);
 void	i686_pagezero(void *addr);
 void	sse2_pagezero(void *addr);
Index: sys/x86/include/x86_var.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/x86/include/x86_var.h	(revision 322319)
+++ sys/x86/include/x86_var.h	(working copy)
@@ -115,6 +115,7 @@ void	cpu_probe_amdc1e(void);
 void	cpu_setregs(void);
 void	dump_add_page(vm_paddr_t);
 void	dump_drop_page(vm_paddr_t);
+void	finishidentcpu(void);
 void	identify_cpu(void);
 void	identify_hypervisor(void);
 void	initializecpu(void);
Index: sys/x86/x86/identcpu.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/x86/x86/identcpu.c	(revision 322319)
+++ sys/x86/x86/identcpu.c	(working copy)
@@ -1372,23 +1372,12 @@ fix_cpuid(void)
 	return (false);
 }
=20
-/*
- * Final stage of CPU identification.
- */
-#ifdef __i386__
+#ifdef __amd64__
 void
-finishidentcpu(void)
-#else
-void
 identify_cpu(void)
-#endif
 {
-	u_int regs[4], cpu_stdext_disable;
-#ifdef __i386__
-	u_char ccr3;
-#endif
+	u_int regs[4];
=20
-#ifdef __amd64__
 	do_cpuid(0, regs);
 	cpu_high =3D regs[0];
 	((u_int *)&cpu_vendor)[0] =3D regs[1];
@@ -1401,8 +1390,20 @@ identify_cpu(void)
 	cpu_procinfo =3D regs[1];
 	cpu_feature =3D regs[3];
 	cpu_feature2 =3D regs[2];
+}
 #endif
=20
+/*
+ * Final stage of CPU identification.
+ */
+void
+finishidentcpu(void)
+{
+	u_int regs[4], cpu_stdext_disable;
+#ifdef __i386__
+	u_char ccr3;
+#endif
+
 	cpu_vendor_id =3D find_cpu_vendor_id();
=20
 	if (fix_cpuid()) {

--------------370644EAE7D50A34E0B3E01F--

--WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ--

--icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAlmLQDIACgkQfJ+WJvzb
8Ub0pwf/T59R175CWocqyBfEXVKgvQj0xzk5nJPTvbSNknVvbn+aLNbcJq0qPflj
fskzMxqWw8rfSGwtkJke8Up1VMwKBybT1b73f7Bq7TrBlkcp6YX2frsMaALjqHtu
Dbrgz3RCDx+P99Hz9+GzwNqrI2sg276IMX/QD9fPtBZo0estB+oDC07TrEBq0wYx
lzE4LDwBInoWwLBCgYm1WZOE8va0iANycEDULGQd7vWgDA9CKhxgM9sjYn7w8ay1
emPpx5/0HcUEN1EC4yOHu7jqfqYH1SzEezbGzZ/zeH22HErGOrCncVRwW3f6bTEB
A2XI0NeWiha/3llOYxy8/N6FRNYSjQ==
=wIVS
-----END PGP SIGNATURE-----

--icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?331d02b4-a315-70e5-7fe9-2e767554a148>