From nobody Mon May 20 18:59:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1685378134; cv=none; d=zohomail.com; s=zohoarc; b=RryXje8pyIQ5d8p1MFee2lwtsKIFa2a7mkLt3tWH6l5Ys19Z+y8QpKjnkkxH9+xKXXjeGGXd54wZpox9knB7yqZjmXrbD3HFuPdm20iCbAMIMP8uql1/puOoY2ZfNsBQ5sG9uWYMt6PPe/jyO+O9s0i0QgbsOn4gpTnGMK7W+gM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685378134; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qfeyIkfFAr5AZqbTRIVxcHNkUWjZkhSXQl0W5yCglzA=; b=UFiVBH/vimqwdoZQ5Dvsu/11KYI/yex23uGgsmPUzSgj98Ryd4vH7hzyQTRbOC8w++IGh5S2LjRB7GdWOpfDHh4JUSwB/VpmygEV6kDOHdcLSfUZSsHmlXKu9O8guyFOjmbcJexFB9W+FWwuMJKjW8X7OwSqt4agt7da5Lbc4jc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685378134752761.9024358860748; Mon, 29 May 2023 09:35:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3fpD-0003M0-8p; Mon, 29 May 2023 12:34:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3fp6-0003LA-8c for qemu-devel@nongnu.org; Mon, 29 May 2023 12:34:20 -0400 Received: from mga03.intel.com ([134.134.136.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3fp3-000763-VO for qemu-devel@nongnu.org; Mon, 29 May 2023 12:34:20 -0400 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2023 09:34:15 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.28]) by fmsmga008.fm.intel.com with ESMTP; 29 May 2023 09:34:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685378057; x=1716914057; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gbgnB1zu57ADLHW0NaG4NBp7Kwj1jx45mnQ8rIdMkvE=; b=WjYU4NoVYjIKunrqcParlLRPt8HSor+Xnn3h5AfmdzZWA9d9pC0/YnF4 wttMjmfOtKkPOVb50lEGUuCMrLcFaZK4eNlN34veYyMHyScogdGB9KD58 kt2LQCdBeFvbjU+kCBK9WNW/aa+XBJIrUeD9RyxcJIHFjdDg6h/KCAA8+ +qaZXaUyE5yeEief2kmIKf93KZeZL693zKumZ5KNmNTvcTlnHd/RBkjMH f+MAM7Idg4FRt1h21HkxCkn2Xq0uQLfBznzlXWP7Avi4a+GxZSgg7pgCD qdmLjaZyAdArt73GMTnXQy8ZSSUz/Wt2KiqQy/lVAITLrpQNkmLxQbiy3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="357991688" X-IronPort-AV: E=Sophos;i="6.00,201,1681196400"; d="scan'208";a="357991688" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="771215608" X-IronPort-AV: E=Sophos;i="6.00,201,1681196400"; d="scan'208";a="771215608" From: Zhao Liu To: "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha Cc: qemu-devel@nongnu.org, Zhenyu Wang , Zhao Liu Subject: [PATCH 1/3] hw/smbios: Fix smbios_smp_sockets caculation Date: Tue, 30 May 2023 00:43:41 +0800 Message-Id: <20230529164343.467793-2-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230529164343.467793-1-zhao1.liu@linux.intel.com> References: <20230529164343.467793-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=134.134.136.65; envelope-from=zhao1.liu@linux.intel.com; helo=mga03.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.16, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1685378136255100003 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Here're 2 mistakes: 1. 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of smp.cores but doesn't fix original smp.cores uses. And because of the introduction of cluster, now smp.cores means the number of cores in one cluster. So smp.cores * smp.threads just means the cpus in a cluster not in a socket. 2. smp.cpus means the number of initial online cpus, not the total number of cpus. For such topology calculation, smp.max_cpus should be considered. Since the number of sockets has already been recorded in smp structure, use smp.sockets directly. Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struc= t CpuTopology") Signed-off-by: Zhao Liu --- hw/smbios/smbios.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index d2007e70fb05..d67415d44dd8 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -1088,8 +1088,7 @@ void smbios_get_tables(MachineState *ms, smbios_build_type_2_table(); smbios_build_type_3_table(); =20 - smbios_smp_sockets =3D DIV_ROUND_UP(ms->smp.cpus, - ms->smp.cores * ms->smp.threads); + smbios_smp_sockets =3D ms->smp.sockets; assert(smbios_smp_sockets >=3D 1); =20 for (i =3D 0; i < smbios_smp_sockets; i++) { --=20 2.34.1 From nobody Mon May 20 18:59:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1685378134; cv=none; d=zohomail.com; s=zohoarc; b=VRau7gExkzckD7Df+ptgeQ6BWtNV6we9o32vlsrTPP7fl3SLstMZtUsHAtXgIsGLK1gPFSULtv5DQSQ7oZbgoe8JjQOCwAuGZfL/9lsJl/mEoKL8a6BUkTSikzh5MBV39BPbHPvDb0CbwGYbOXHfgLiGRqZseQKd2Rde/0vCEAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685378134; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P2aBvGaWcl2J/oHyJiYTqRifla/5r9wcjf0M3yd8BLg=; b=AOIF6+sDcrTkbRvW3pia5DabQx8AKjhClD6Uj2lmSACCR1rcQknCpbSQz0elgEjTAYaEhJi5XcYxF3b5lNWot9drF5dXT9ERHZ0ZZEdwH7RWKDIYOhruzxPHXQ8BS/IDb1dI/6aMQclMPAodbaJEWEAE2jp6v0GLKPqk31qEi7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16853781347694.013595317112504; Mon, 29 May 2023 09:35:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3fpD-0003ME-Jm; Mon, 29 May 2023 12:34:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3fp6-0003LB-AU for qemu-devel@nongnu.org; Mon, 29 May 2023 12:34:20 -0400 Received: from mga03.intel.com ([134.134.136.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3fp4-00076S-KL for qemu-devel@nongnu.org; Mon, 29 May 2023 12:34:20 -0400 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2023 09:34:17 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.28]) by fmsmga008.fm.intel.com with ESMTP; 29 May 2023 09:34:15 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685378058; x=1716914058; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pKr273Dx34J7BBEG7udj0OoqHPV+n96yVyK9wUcBmTM=; b=UDjr7kFNtDt9k1dx1NulpwlonJ7QcWkGv3TMGzan17WluBqCCL96exgo ujlLJdhhhGlUSc0h4qpJreXx0Z4cLkrXyKQOR0bDw6XJ08FztChJEbwi8 xEYNdiZLyN3CC3+IZBhLsaAtnBOGbTJPBPwLryAokehAKg0Q24KPiHJyg RU5lSs9FLonomf46Qo6APY+8E31mH+uo/N/M+DC56qCXReB3TnrWaE+Sv R8w/LZC+kD6flCHxNnJMz6QBBcKOjwSbPu1q0iV/PvxF/5I1ZBxdFCXMk UIaZjqUy8XqUBb2wdY0M8rKsMo1TK/Fnz6GewMQpt5EIuo+18VGRLgVta A==; X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="357991690" X-IronPort-AV: E=Sophos;i="6.00,201,1681196400"; d="scan'208";a="357991690" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="771215615" X-IronPort-AV: E=Sophos;i="6.00,201,1681196400"; d="scan'208";a="771215615" From: Zhao Liu To: "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha Cc: qemu-devel@nongnu.org, Zhenyu Wang , Zhao Liu Subject: [PATCH 2/3] hw/smbios: Fix thread count in type4 Date: Tue, 30 May 2023 00:43:42 +0800 Message-Id: <20230529164343.467793-3-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230529164343.467793-1-zhao1.liu@linux.intel.com> References: <20230529164343.467793-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=134.134.136.65; envelope-from=zhao1.liu@linux.intel.com; helo=mga03.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.16, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1685378136581100006 Content-Type: text/plain; charset="utf-8" From: Zhao Liu From SMBIOS 3.0 specification, thread count field means: Thread Count is the total number of threads detected by the BIOS for this processor socket. It is a processor-wide count, not a thread-per-core count. [1] So here we should use threads per socket other than threads per core. [1] SMBIOS 3.0.0, section 7.5.8, Processor Information - Thread Count Fixes: c97294ec1b9e ("SMBIOS: Build aggregate smbios tables and entry point= ") Signed-off-by: Zhao Liu --- hw/smbios/smbios.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index d67415d44dd8..f80a701cdfc1 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -713,6 +713,7 @@ static void smbios_build_type_4_table(MachineState *ms,= unsigned instance) { char sock_str[128]; size_t tbl_len =3D SMBIOS_TYPE_4_LEN_V28; + unsigned cpus_per_socket =3D ms->smp.max_cpus / ms->smp.sockets; =20 if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64) { tbl_len =3D SMBIOS_TYPE_4_LEN_V30; @@ -750,14 +751,14 @@ static void smbios_build_type_4_table(MachineState *m= s, unsigned instance) t->core_count =3D (ms->smp.cores > 255) ? 0xFF : ms->smp.cores; t->core_enabled =3D t->core_count; =20 - t->thread_count =3D (ms->smp.threads > 255) ? 0xFF : ms->smp.threads; + t->thread_count =3D (cpus_per_socket > 255) ? 0xFF : cpus_per_socket; =20 t->processor_characteristics =3D cpu_to_le16(0x02); /* Unknown */ t->processor_family2 =3D cpu_to_le16(0x01); /* Other */ =20 if (tbl_len =3D=3D SMBIOS_TYPE_4_LEN_V30) { t->core_count2 =3D t->core_enabled2 =3D cpu_to_le16(ms->smp.cores); - t->thread_count2 =3D cpu_to_le16(ms->smp.threads); + t->thread_count2 =3D cpu_to_le16(cpus_per_socket); } =20 SMBIOS_BUILD_TABLE_POST; --=20 2.34.1 From nobody Mon May 20 18:59:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1685378107; cv=none; d=zohomail.com; s=zohoarc; b=Ot6CC8SBpIs46TdxHtNdz20DnR6Ni1OtHPOcK68utE0TtCGRraQCTvPb7lAR7C1d9N8VkOsQpBy898WHrMaQuqA+8Ua6E1McuQ9kCafCApVLUF9apa/Rxk4r8CKntJeVW7Xwxx32URm2YCyfobJB7T9pIXD2ODruMPwrBPBlJ0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685378107; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p47jol7eBOOJ4C9+ZhCtVcQTopkO3/mxUKwb2ny9Ucw=; b=ZoLHqK5VK+QBPzAOzJ+dHLKav8gHeLWgHbggqoqD/56728U3gdSXBN9zvo2sEjvD+7W81/sYs4vjwPe52swkKvyndbqI8R607JqByBqLHGrpCtTu8av9XbReVkM584k/TiwJv/C79W0Ulu8lust7//P7xZb9GXpr3PtegpZTLXs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16853781070661001.3365995392071; Mon, 29 May 2023 09:35:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3fpF-0003MT-46; Mon, 29 May 2023 12:34:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3fpA-0003La-Rf for qemu-devel@nongnu.org; Mon, 29 May 2023 12:34:24 -0400 Received: from mga03.intel.com ([134.134.136.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3fp6-00075s-0R for qemu-devel@nongnu.org; Mon, 29 May 2023 12:34:21 -0400 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2023 09:34:19 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.28]) by fmsmga008.fm.intel.com with ESMTP; 29 May 2023 09:34:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685378060; x=1716914060; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zvFuRLI9smAGYPpwowT9/Rn2/EsH7SSFkJPHWVone30=; b=PEUb0fhobGn4g2RYVgvd3pDDKTKY9LcWUrQuFIq1zlYlgI4ra0/LkpkM G0XVM4yzJOxK/9pvGoIF7Z7pIPEdD2fcuGo6WY85+i2wvSWAgG/HHP9hH 5OpP3P4ODdJL43ByRfJIp9ICs0mqe+SXCh8UJnyCS5/JWHhpRRYc7+LFZ ZxdCGoVD8yS1Tnl8cHbmK5FciahDkSep2rR4lGQqEaCCfzY6pU4G0NQDd 32cA2lQZU3Wm4to7EftHFfTS+vtcx66a6EgoNHRNja8sO5NJQjBuZztNa 4z+Btx5Y2nO4xy6NnD0rWD8a9SLQ650yC5L3cdpxt9YavFWT/L0Ly4Uha g==; X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="357991693" X-IronPort-AV: E=Sophos;i="6.00,201,1681196400"; d="scan'208";a="357991693" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="771215628" X-IronPort-AV: E=Sophos;i="6.00,201,1681196400"; d="scan'208";a="771215628" From: Zhao Liu To: "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha Cc: qemu-devel@nongnu.org, Zhenyu Wang , Zhao Liu Subject: [PATCH 3/3] hw/smbios: Fix core count in type4 Date: Tue, 30 May 2023 00:43:43 +0800 Message-Id: <20230529164343.467793-4-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230529164343.467793-1-zhao1.liu@linux.intel.com> References: <20230529164343.467793-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=134.134.136.65; envelope-from=zhao1.liu@linux.intel.com; helo=mga03.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.16, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1685378108802100004 Content-Type: text/plain; charset="utf-8" From: Zhao Liu From SMBIOS 3.0 specification, core count field means: Core Count is the number of cores detected by the BIOS for this processor socket. [1] Before 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology"), MachineState.smp.cores means "the number of cores in one package", and it's correct to use smp.cores for core count. But 003f230e37d7 changes the smp.cores' meaning to "the number of cores in one die" and doesn't change the original smp.cores' use in smbios as well, which makes core count in type4 go wrong. Fix this issue with the correct "cores per socket" caculation. [1] SMBIOS 3.0.0, section 7.5.6, Processor Information - Core Count Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struc= t CpuTopology") Signed-off-by: Zhao Liu --- hw/smbios/smbios.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index f80a701cdfc1..32e26bffa2df 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -714,6 +714,7 @@ static void smbios_build_type_4_table(MachineState *ms,= unsigned instance) char sock_str[128]; size_t tbl_len =3D SMBIOS_TYPE_4_LEN_V28; unsigned cpus_per_socket =3D ms->smp.max_cpus / ms->smp.sockets; + unsigned cores_per_socket =3D cpus_per_socket / ms->smp.threads; =20 if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64) { tbl_len =3D SMBIOS_TYPE_4_LEN_V30; @@ -748,7 +749,7 @@ static void smbios_build_type_4_table(MachineState *ms,= unsigned instance) SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset); SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part); =20 - t->core_count =3D (ms->smp.cores > 255) ? 0xFF : ms->smp.cores; + t->core_count =3D (cores_per_socket > 255) ? 0xFF : cores_per_socket; t->core_enabled =3D t->core_count; =20 t->thread_count =3D (cpus_per_socket > 255) ? 0xFF : cpus_per_socket; @@ -757,7 +758,7 @@ static void smbios_build_type_4_table(MachineState *ms,= unsigned instance) t->processor_family2 =3D cpu_to_le16(0x01); /* Other */ =20 if (tbl_len =3D=3D SMBIOS_TYPE_4_LEN_V30) { - t->core_count2 =3D t->core_enabled2 =3D cpu_to_le16(ms->smp.cores); + t->core_count2 =3D t->core_enabled2 =3D cpu_to_le16(cores_per_sock= et); t->thread_count2 =3D cpu_to_le16(cpus_per_socket); } =20 --=20 2.34.1