1 Star 0 Fork 24

MendeZ/libvirt_anolis

forked from src-anolis-os/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libvirt-cpu_x86-Consolidate-signature-match-in-x86DecodeUseCandidate.patch 2.92 KB
一键复制 编辑 原始数据 按行查看 历史
From 99a298a4a0575bf0072f504c4b8e4551400c44c0 Mon Sep 17 00:00:00 2001
Message-Id: <99a298a4a0575bf0072f504c4b8e4551400c44c0@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 Apr 2022 11:58:07 +0200
Subject: [PATCH] cpu_x86: Consolidate signature match in x86DecodeUseCandidate
Checking the signature in two different places makes no sense since the
code in between can only mark the candidate as the best option so far,
which is what the second signature match does as well.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 35ce086667e68e8f546cf36473591dd7c19c72eb)
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/cpu/cpu_x86.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 5cb9caef8a..f007487824 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2020,15 +2020,22 @@ x86DecodeUseCandidate(virCPUx86Model *current,
}
/* Ideally we want to select a model with family/model equal to
- * family/model of the real CPU. Once we found such model, we only
+ * family/model of the real CPU and once we found such model, we only
* consider candidates with matching family/model.
*/
- if (signature &&
- virCPUx86SignaturesMatch(current->signatures, signature) &&
- !virCPUx86SignaturesMatch(candidate->signatures, signature)) {
- VIR_DEBUG("%s differs in signature from matching %s",
- cpuCandidate->model, cpuCurrent->model);
- return 0;
+ if (signature) {
+ if (virCPUx86SignaturesMatch(current->signatures, signature) &&
+ !virCPUx86SignaturesMatch(candidate->signatures, signature)) {
+ VIR_DEBUG("%s differs in signature from matching %s",
+ cpuCandidate->model, cpuCurrent->model);
+ return 0;
+ }
+
+ if (!virCPUx86SignaturesMatch(current->signatures, signature) &&
+ virCPUx86SignaturesMatch(candidate->signatures, signature)) {
+ VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
+ return 1;
+ }
}
if (cpuCurrent->nfeatures > cpuCandidate->nfeatures) {
@@ -2037,16 +2044,6 @@ x86DecodeUseCandidate(virCPUx86Model *current,
return 1;
}
- /* Prefer a candidate with matching signature even though it would
- * result in longer list of features.
- */
- if (signature &&
- virCPUx86SignaturesMatch(candidate->signatures, signature) &&
- !virCPUx86SignaturesMatch(current->signatures, signature)) {
- VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
- return 1;
- }
-
VIR_DEBUG("%s does not result in shorter feature list than %s",
cpuCandidate->model, cpuCurrent->model);
return 0;
--
2.35.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shuaijiakun/libvirt_anolis.git
git@gitee.com:shuaijiakun/libvirt_anolis.git
shuaijiakun
libvirt_anolis
libvirt_anolis
a8.9-virt-stream-an

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385