Re: [PATCH v2 1/2] KVM: nVMX/nSVM: Fix bug which sets vcpu->arch.tsc_offset to L1 tsc_offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/11/18 17:05, Liran Alon wrote:
> 
> 
>> On 25 Nov 2018, at 19:47, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>>
>> On 08/11/18 10:51, Liran Alon wrote:
>>> From: Leonid Shatz <leonid.shatz@xxxxxxxxxx>
>>>
>>> Since commit e79f245ddec1 ("X86/KVM: Properly update 'tsc_offset' to
>>> represent the running guest"), vcpu->arch.tsc_offset meaning was
>>> changed to always reflect the tsc_offset value set on active VMCS.
>>> Regardless if vCPU is currently running L1 or L2.
>>>
>>> However, above mentioned commit failed to also change
>>> kvm_vcpu_write_tsc_offset() to set vcpu->arch.tsc_offset correctly.
>>> This is because vmx_write_tsc_offset() could set the tsc_offset value
>>> in active VMCS to given offset parameter *plus vmcs12->tsc_offset*.
>>> However, kvm_vcpu_write_tsc_offset() just sets vcpu->arch.tsc_offset
>>> to given offset parameter. Without taking into account the possible
>>> addition of vmcs12->tsc_offset. (Same is true for SVM case).
>>>
>>> Fix this issue by changing kvm_x86_ops->write_tsc_offset() to return
>>> actually set tsc_offset in active VMCS and modify
>>> kvm_vcpu_write_tsc_offset() to set returned value in
>>> vcpu->arch.tsc_offset.
>>> In addition, rename write_tsc_offset() argument to clearly indicate
>>> it specifies a L1 TSC offset.
>>>
>>> Fixes: e79f245ddec1 ("X86/KVM: Properly update 'tsc_offset' to represent the running guest")
>>>
>>> Reviewed-by: Liran Alon <liran.alon@xxxxxxxxxx>
>>> Reviewed-by: Mihai Carabas <mihai.carabas@xxxxxxxxxx>
>>> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx>
>>> Signed-off-by: Leonid Shatz <leonid.shatz@xxxxxxxxxx>
>>
>> I queued v1, and will send a replacement for patch 2 of this miniseries.
>>
>> Paoo
> 
> Paolo, I think this commit should go to the stable tree as it fixes a regression issue.

Yes, I added the stable tag in my pull request to Linus.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux