[libvirt PATCH] qemu: The TSC tolerance interval should be closed

Jiri Denemark posted 1 patch 3 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/767fb597e275d8f01a15bef5243329dace0c0b0b.1609888062.git.jdenemar@redhat.com
src/qemu/qemu_process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] qemu: The TSC tolerance interval should be closed
Posted by Jiri Denemark 3 years, 3 months ago
The kernel refuses to set guest TSC frequency less than a minimum
frequency or greater than maximum frequency (both computed based on the
host TSC frequency). When writing the libvirt code with a reversed logic
(return success when the requested frequency falls within the tolerance
interval) I forgot to include the boundaries.

Fixes: d8e5b4560006590668d4669f54a46b08ec14c1a2
https://bugzilla.redhat.com/show_bug.cgi?id=1839095

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e7421b415f..e9802809a5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5403,7 +5403,7 @@ qemuProcessStartValidateTSC(virQEMUDriverPtr driver,
               tsc->frequency, virTristateBoolTypeToString(tsc->scaling),
               tolerance);
 
-    if (freq > minFreq && freq < maxFreq) {
+    if (freq >= minFreq && freq <= maxFreq) {
         VIR_DEBUG("Requested TSC frequency is within tolerance interval");
         return 0;
     }
-- 
2.30.0

Re: [libvirt PATCH] qemu: The TSC tolerance interval should be closed
Posted by Peter Krempa 3 years, 3 months ago
On Wed, Jan 06, 2021 at 00:07:42 +0100, Jiri Denemark wrote:
> The kernel refuses to set guest TSC frequency less than a minimum
> frequency or greater than maximum frequency (both computed based on the
> host TSC frequency). When writing the libvirt code with a reversed logic
> (return success when the requested frequency falls within the tolerance
> interval) I forgot to include the boundaries.
> 
> Fixes: d8e5b4560006590668d4669f54a46b08ec14c1a2
> https://bugzilla.redhat.com/show_bug.cgi?id=1839095
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/qemu/qemu_process.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>