From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751688AbdLNBzO (ORCPT ); Wed, 13 Dec 2017 20:55:14 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:39427 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbdLNBzM (ORCPT ); Wed, 13 Dec 2017 20:55:12 -0500 X-Google-Smtp-Source: ACJfBosq9incO+PKKhaD1O2mCrK2rUxuEvHyhttzOTxEBz4Su+8FQwgLOkTTWU6iWAARW2QUtlakxA== Subject: Re: [PATCH RFC 3/7] KVM: timer: synchronize tsc-deadline timestamp for guest To: Konrad Rzeszutek Wilk Cc: pbonzini@redhat.com, rkrcmar@redhat.com, yang.zhang.wz@gmail.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Luo References: <1512722390-3654-1-git-send-email-quan.xu0@gmail.com> <1512722390-3654-4-git-send-email-quan.xu0@gmail.com> <20171208150618.GD12069@x230.dumpdata.com> From: Quan Xu Message-ID: <196f0958-f5bf-0eb3-fbe8-71f1b6e3ff34@gmail.com> Date: Thu, 14 Dec 2017 09:54:55 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171208150618.GD12069@x230.dumpdata.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/12/08 23:06, Konrad Rzeszutek Wilk wrote: > On Fri, Dec 08, 2017 at 04:39:46PM +0800, Quan Xu wrote: >> From: Ben Luo >> >> In general, KVM guest programs tsc-deadline timestamp to >> MSR_IA32_TSC_DEADLINE MSR. This will cause a VM-exit, and >> then KVM handles this timer for guest. >> >> The tsc-deadline timestamp is mostly recorded in share page >> with less VM-exit. We Introduce a periodically working kthread >> to scan share page and synchronize timer setting for guest >> on a dedicated CPU. > That sounds like a race. Meaning the guest may put too small window > and this 'working thread to scan' may not get to it fast enough? yes, you are right. So .. > . > Meaning we miss the deadline to inject the timer in the guest. > > Or is this part of this PV MSR semantics - that it will only work > for certain amount of values and anything less than say 1ms > should not use the PV MSR? .. for these timers, We have to program these tsc-deadline timestamps to MSR_IA32_TSC_DEADLINE as normal, which will cause VM-exit and KVM will signal the working thread through IPI to program timer, instead of registering on current CPU (patch 0004). more detail in patch 0007. Quan Alibaba Cloud