From owner-svn-src-all@freebsd.org Thu Apr 25 22:53:57 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 2D25015807E7; Thu, 25 Apr 2019 22:53:57 +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 BDC6A6F5B8; Thu, 25 Apr 2019 22:53:56 +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 937EF291D; Thu, 25 Apr 2019 22:53:56 +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 x3PMruxT028616; Thu, 25 Apr 2019 22:53:56 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3PMru86028614; Thu, 25 Apr 2019 22:53:56 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201904252253.x3PMru86028614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 25 Apr 2019 22:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346717 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 346717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BDC6A6F5B8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,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: Thu, 25 Apr 2019 22:53:57 -0000 Author: rgrimes Date: Thu Apr 25 22:53:55 2019 New Revision: 346717 URL: https://svnweb.freebsd.org/changeset/base/346717 Log: 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. Reviewed by: Patrick Mooney Approved by: bde and/or phk (mentor), jhb (maintainer) MFC: 3 days Differential Revision: https://reviews.freebsd.org/D18998 Modified: head/usr.sbin/bhyve/bhyverun.h head/usr.sbin/bhyve/smbiostbl.c Modified: head/usr.sbin/bhyve/bhyverun.h ============================================================================== --- head/usr.sbin/bhyve/bhyverun.h Thu Apr 25 22:53:25 2019 (r346716) +++ head/usr.sbin/bhyve/bhyverun.h Thu Apr 25 22:53:55 2019 (r346717) @@ -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: head/usr.sbin/bhyve/smbiostbl.c ============================================================================== --- head/usr.sbin/bhyve/smbiostbl.c Thu Apr 25 22:53:25 2019 (r346716) +++ head/usr.sbin/bhyve/smbiostbl.c Thu Apr 25 22:53:55 2019 (r346717) @@ -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; }