From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753071AbcGFHqu (ORCPT ); Wed, 6 Jul 2016 03:46:50 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33266 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbcGFHqp (ORCPT ); Wed, 6 Jul 2016 03:46:45 -0400 Subject: Re: [PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running To: Wanpeng Li , kvm , Radim Krcmar , Yunhong Jiang , Wanpeng Li , "linux-kernel@vger.kernel.org" , Jan Kiszka References: <20160706051051.7869-1-haozhong.zhang@intel.com> <20160706060558.sklnb3qso6tnmbrs@hz-desktop> From: Paolo Bonzini Message-ID: <6d2cd9ce-da0e-8b61-e3a9-78be3b32a6e4@redhat.com> Date: Wed, 6 Jul 2016 09:46:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160706060558.sklnb3qso6tnmbrs@hz-desktop> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/07/2016 08:05, Haozhong Zhang wrote: >> > >> > Nested preemption timer is emulated by hrtimer, so it doesn't >> > influence vmcs02, why this is needed? > Nested (L2) preemption timer is not affected for sure, and this patch > is to fix another problem caused by using L1 preemption timer for L1 > TSC deadline timer. When we use L1 VMX preemption timer for L1 TSC > deadline timer, we intend to use the pin-based exec config and the VMX > preemption timer value in vmcs01. However, when L2 guest is running, > vmcs02 is loaded as the current VMCS so that a different VMX > preemption timer config is used (i.e. VMX preemption timer is disabled > in prepare_vmcs02()). If we still use preemption timer for L1 TSC > deadline timer at this moment, then L1 TSC deadline timer will not be > able to be triggered when L2 guest is running. The right fix then is to set the pin-based controls in prepare_vmcs02, based on vcpu->arch.hv_deadline_tsc. Paolo