svn commit: r348226 - stable/12/usr.sbin/bhyve

Rodney W. Grimes rgrimes at FreeBSD.org
Fri May 24 05:47:17 UTC 2019


Author: rgrimes
Date: Fri May 24 05:47:16 2019
New Revision: 348226
URL: https://svnweb.freebsd.org/changeset/base/348226

Log:
  MFC: r346717: Make bhyve SMBIOS table topology aware
  
  When the CPU Topology was added to bhyve in r332298 the SMBIOS table was
  missed, this table passes topology information to the system and was still
  using the old concept of each vCPU is a socket with 1 core and 1 thread.
  This code did not even try to use the old sysctl information to adjust
  this data.
  
  Correct that by building a proper SMBios table, mapping the > 254 cases to
  0 per the SMBios 2.6 specification that is claimed by the structure.
  
  Approved by:		bde (implicit/mentor)

Modified:
  stable/12/usr.sbin/bhyve/bhyverun.h
  stable/12/usr.sbin/bhyve/smbiostbl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/bhyverun.h
==============================================================================
--- stable/12/usr.sbin/bhyve/bhyverun.h	Fri May 24 05:34:21 2019	(r348225)
+++ stable/12/usr.sbin/bhyve/bhyverun.h	Fri May 24 05:47:16 2019	(r348226)
@@ -36,6 +36,7 @@
 
 struct vmctx;
 extern int guest_ncpus;
+extern uint16_t cores, sockets, threads;
 extern char *guest_uuid_str;
 extern char *vmname;
 

Modified: stable/12/usr.sbin/bhyve/smbiostbl.c
==============================================================================
--- stable/12/usr.sbin/bhyve/smbiostbl.c	Fri May 24 05:34:21 2019	(r348225)
+++ stable/12/usr.sbin/bhyve/smbiostbl.c	Fri May 24 05:47:16 2019	(r348226)
@@ -636,7 +636,7 @@ smbios_type4_initializer(struct smbios_structure *temp
 {
 	int i;
 
-	for (i = 0; i < guest_ncpus; i++) {
+	for (i = 0; i < sockets; i++) {
 		struct smbios_table_type4 *type4;
 		char *p;
 		int nstrings, len;
@@ -655,6 +655,16 @@ smbios_type4_initializer(struct smbios_structure *temp
 		*(*endaddr) = '\0';
 		(*endaddr)++;
 		type4->socket = nstrings + 1;
+		/* Revise cores and threads after update to smbios 3.0 */
+		if (cores > 254)
+			type4->cores = 0;
+		else
+			type4->cores = cores;
+		/* This threads is total threads in a socket */
+		if ((cores * threads) > 254)
+			type4->threads = 0;
+		else
+			type4->threads = (cores * threads);
 		curaddr = *endaddr;
 	}
 


More information about the svn-src-all mailing list