From 7e0f315531fdc3c24b6b9a0bb9d391b4cb52780e Mon Sep 17 00:00:00 2001 From: Tomáš Mózes Date: Fri, 14 Apr 2023 19:03:31 +0200 Subject: Xen 4.17.1-pre-patchset-0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomáš Mózes --- ...prevent-overflow-with-high-frequency-TSCs.patch | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 0009-x86-time-prevent-overflow-with-high-frequency-TSCs.patch (limited to '0009-x86-time-prevent-overflow-with-high-frequency-TSCs.patch') diff --git a/0009-x86-time-prevent-overflow-with-high-frequency-TSCs.patch b/0009-x86-time-prevent-overflow-with-high-frequency-TSCs.patch new file mode 100644 index 0000000..a9401d7 --- /dev/null +++ b/0009-x86-time-prevent-overflow-with-high-frequency-TSCs.patch @@ -0,0 +1,34 @@ +From a7a26da0b59da7233e6c6f63b180bab131398351 Mon Sep 17 00:00:00 2001 +From: Neowutran +Date: Tue, 20 Dec 2022 13:46:38 +0100 +Subject: [PATCH 09/89] x86/time: prevent overflow with high frequency TSCs + +Make sure tsc_khz is promoted to a 64-bit type before multiplying by +1000 to avoid an 'overflow before widen' bug. Otherwise just above +4.294GHz the value will overflow. Processors with clocks this high are +now in production and require this to work correctly. + +Signed-off-by: Neowutran +Reviewed-by: Jan Beulich +master commit: ad15a0a8ca2515d8ac58edfc0bc1d3719219cb77 +master date: 2022-12-19 11:34:16 +0100 +--- + xen/arch/x86/time.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c +index b01acd390d..d882b43cf0 100644 +--- a/xen/arch/x86/time.c ++++ b/xen/arch/x86/time.c +@@ -2585,7 +2585,7 @@ int tsc_set_info(struct domain *d, + case TSC_MODE_ALWAYS_EMULATE: + d->arch.vtsc_offset = get_s_time() - elapsed_nsec; + d->arch.tsc_khz = gtsc_khz ?: cpu_khz; +- set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000); ++ set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000UL); + + /* + * In default mode use native TSC if the host has safe TSC and +-- +2.40.0 + -- cgit v1.2.3-65-gdbad