1 Star 0 Fork 71

tzr/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
conf-Use-unsigned-long-long-for-timer-frequency.patch 3.25 KB
一键复制 编辑 原始数据 按行查看 历史
From efd4f6469f9f5f6d3a34d250cd80faf59a8dc373 Mon Sep 17 00:00:00 2001
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 11 Nov 2020 16:50:16 +0100
Subject: [PATCH 068/108] conf: Use unsigned long long for timer frequency
Although the code in qemuProcessStartValidateTSC works as if the
timer frequency was already unsigned long long (by using an appropriate
temporary variable), the virDomainTimerDef structure actually defines
frequency as unsigned long, which is not guaranteed to be 64b.
Fixes support for frequencies higher than 2^32 - 1 on 32b systems.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3c7c7cd4d82c2f9a5a59bbd06673b8cd1eb23ce3)
---
src/conf/domain_conf.c | 6 +++---
src/conf/domain_conf.h | 2 +-
src/qemu/qemu_command.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a33f9144f5..9c83f4e347 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13951,7 +13951,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
}
}
- ret = virXPathULong("string(./@frequency)", ctxt, &def->frequency);
+ ret = virXPathULongLong("string(./@frequency)", ctxt, &def->frequency);
if (ret == -1) {
def->frequency = 0;
} else if (ret < 0) {
@@ -22259,7 +22259,7 @@ virDomainTimerDefCheckABIStability(virDomainTimerDefPtr src,
if (src->name == VIR_DOMAIN_TIMER_NAME_TSC) {
if (src->frequency != dst->frequency) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Target TSC frequency %lu does not match source %lu"),
+ _("Target TSC frequency %llu does not match source %llu"),
dst->frequency, src->frequency);
return false;
}
@@ -27355,7 +27355,7 @@ virDomainTimerDefFormat(virBufferPtr buf,
if (def->name == VIR_DOMAIN_TIMER_NAME_TSC) {
if (def->frequency > 0)
- virBufferAsprintf(buf, " frequency='%lu'", def->frequency);
+ virBufferAsprintf(buf, " frequency='%llu'", def->frequency);
if (def->mode != -1) {
const char *mode
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 15b9e79d69..c0a323d465 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2078,7 +2078,7 @@ struct _virDomainTimerDef {
int track; /* host|guest */
/* frequency & mode are only valid for name='tsc' */
- unsigned long frequency; /* in Hz, unspecified = 0 */
+ unsigned long long frequency; /* in Hz, unspecified = 0 */
int mode; /* auto|native|emulate|paravirt */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 27b2eef8e5..42f6e10b33 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6761,7 +6761,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
break;
case VIR_DOMAIN_TIMER_NAME_TSC:
if (timer->frequency > 0)
- virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency);
+ virBufferAsprintf(&buf, ",tsc-frequency=%llu", timer->frequency);
break;
case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
switch (timer->tickpolicy) {
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tom0392/libvirt.git
git@gitee.com:tom0392/libvirt.git
tom0392
libvirt
libvirt
master

搜索帮助