Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934564AbcJ0Cdz (ORCPT ); Wed, 26 Oct 2016 22:33:55 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34540 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933459AbcJ0Cdx (ORCPT ); Wed, 26 Oct 2016 22:33:53 -0400 MIME-Version: 1.0 In-Reply-To: <20161026140109.GB3452@potion> References: <1477304593-3453-1-git-send-email-wanpeng.li@hotmail.com> <20161024150323.GB2247@potion> <20161024152737.GB3197@potion> <20161025114334.GD3197@potion> <20161026140109.GB3452@potion> From: Wanpeng Li Date: Thu, 27 Oct 2016 10:33:51 +0800 Message-ID: Subject: Re: [PATCH 6/5] KVM: x86: fix periodic lapic timer with hrtimers To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Cc: Paolo Bonzini , "linux-kernel@vger.kernel.org" , kvm , Yunhong Jiang , Wanpeng Li Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u9R2YDxc005053 Content-Length: 1717 Lines: 47 2016-10-26 22:01 GMT+08:00 Radim Krčmář : > 2016-10-26 14:08+0800, Wanpeng Li: >> 2016-10-26 14:02 GMT+08:00 Wanpeng Li : >>> 2016-10-25 19:43 GMT+08:00 Radim Krčmář : >>>> I will have some comments, because it would be nicer if it measured the >>>> latency ... expected_expiration is not computed correctly. >>> >>> It measured the latency from guest programs the clock event device to >>> interrupt injected to guest after timer fire. > > No. It never computed the time when the timer fires, the test measured > the duration of the period. > > Imagine that the dashed line below is a timeline. Pipe is idealized > firing of the periodic timer and caret is the time when the guest read > time in the interrupt. The number below caret is the latency. > > The period is 7. > > -------------------------------------------- > | | | | | | | > ^ ^ ^ ^ ^ ^ ^ > 1 2 3 1 2 1 1 > > The test would report "latencies" as: > > 1 1 1 -2 1 -1 0 > > because it used now() + period to compute the next expected expiration > > Similarly in this case, > -------------------------------------------- > | | | | | | | > ^ ^ ^ ^ ^ ^ > 6 6 6 6 6 6 > > The latency is always 6, but the test would report > > 6 0 0 0 0 0 > > And if we improved the latency by 1, you'd only see the difference in > the first number. The test measured the duration of the period. Agreed, thanks for the details. :) Regards, Wanpeng Li