Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 709835 Details for
Bug 859282
divide by zero in kvm_write_tsc
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
kvm-x86-handle-host-tsc-calibration-failure
kvm-x86-handle-host-tsc-calibration-failure.patch (text/plain), 2.24 KB, created by
Marcelo Tosatti
on 2013-03-13 23:33:52 UTC
(
hide
)
Description:
kvm-x86-handle-host-tsc-calibration-failure
Filename:
MIME Type:
Creator:
Marcelo Tosatti
Created:
2013-03-13 23:33:52 UTC
Size:
2.24 KB
patch
obsolete
> >Note: commit ID from kvm.git repo. > >https://git.kernel.org/cgit/virt/kvm/kvm.git/ > >commit 03ba32cae66e3798d697e582633af2c7dd6907e5 >Author: Marcelo Tosatti <mtosatti@redhat.com> >Date: Mon Mar 11 23:10:24 2013 -0300 > > VMX: x86: handle host TSC calibration failure > > If the host TSC calibration fails, tsc_khz is zero (see tsc_init.c). > Handle such case properly in KVM (instead of dividing by zero). > > https://bugzilla.redhat.com/show_bug.cgi?id=859282 > > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> > Signed-off-by: Gleb Natapov <gleb@redhat.com> > >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >index 35b4912..b67985a 100644 >--- a/arch/x86/kvm/x86.c >+++ b/arch/x86/kvm/x86.c >@@ -1079,6 +1079,10 @@ static void kvm_set_tsc_khz(struct kvm_vcpu *vcpu, u32 this_tsc_khz) > u32 thresh_lo, thresh_hi; > int use_scaling = 0; > >+ /* tsc_khz can be zero if TSC calibration fails */ >+ if (this_tsc_khz == 0) >+ return; >+ > /* Compute a scale to convert nanoseconds in TSC cycles */ > kvm_get_time_scale(this_tsc_khz, NSEC_PER_SEC / 1000, > &vcpu->arch.virtual_tsc_shift, >@@ -1156,20 +1160,23 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr) > ns = get_kernel_ns(); > elapsed = ns - kvm->arch.last_tsc_nsec; > >- /* n.b - signed multiplication and division required */ >- usdiff = data - kvm->arch.last_tsc_write; >+ if (vcpu->arch.virtual_tsc_khz) { >+ /* n.b - signed multiplication and division required */ >+ usdiff = data - kvm->arch.last_tsc_write; > #ifdef CONFIG_X86_64 >- usdiff = (usdiff * 1000) / vcpu->arch.virtual_tsc_khz; >+ usdiff = (usdiff * 1000) / vcpu->arch.virtual_tsc_khz; > #else >- /* do_div() only does unsigned */ >- asm("idivl %2; xor %%edx, %%edx" >- : "=A"(usdiff) >- : "A"(usdiff * 1000), "rm"(vcpu->arch.virtual_tsc_khz)); >+ /* do_div() only does unsigned */ >+ asm("idivl %2; xor %%edx, %%edx" >+ : "=A"(usdiff) >+ : "A"(usdiff * 1000), "rm"(vcpu->arch.virtual_tsc_khz)); > #endif >- do_div(elapsed, 1000); >- usdiff -= elapsed; >- if (usdiff < 0) >- usdiff = -usdiff; >+ do_div(elapsed, 1000); >+ usdiff -= elapsed; >+ if (usdiff < 0) >+ usdiff = -usdiff; >+ } else >+ usdiff = USEC_PER_SEC; /* disable TSC match window below */ > > /* > * Special case: TSC write with a small delta (1 second) of virtual
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 859282
: 709835