From owner-svn-src-all@freebsd.org Fri May 24 05:47:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 422D31598FAA; Fri, 24 May 2019 05:47:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB7687576A; Fri, 24 May 2019 05:47:16 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2EB818782; Fri, 24 May 2019 05:47:16 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4O5lG4N032013; Fri, 24 May 2019 05:47:16 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O5lG0I032011; Fri, 24 May 2019 05:47:16 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905240547.x4O5lG0I032011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 24 May 2019 05:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348226 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 348226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DB7687576A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 05:47:17 -0000 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; }