From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3506C74A21 for ; Wed, 10 Jul 2019 16:05:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D25892064A for ; Wed, 10 Jul 2019 16:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728161AbfGJQFp (ORCPT ); Wed, 10 Jul 2019 12:05:45 -0400 Received: from mga02.intel.com ([134.134.136.20]:51715 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726617AbfGJQFp (ORCPT ); Wed, 10 Jul 2019 12:05:45 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2019 09:05:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,475,1557212400"; d="scan'208";a="168350732" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.165]) by orsmga003.jf.intel.com with ESMTP; 10 Jul 2019 09:05:44 -0700 Date: Wed, 10 Jul 2019 09:05:44 -0700 From: Sean Christopherson To: Zhang Yang Cc: kvm@vger.kernel.org, pbonzini@redhat.com Subject: Re: [PATCH] KVM: x86: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN Message-ID: <20190710160544.GB4348@linux.intel.com> References: <20190708164751.88385-1-w90p710@gmail.com> <20190709145650.GC25369@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Jul 10, 2019 at 08:42:30PM +0800, Zhang Yang wrote: > Yes, In fact we had a trouble with the small window, the system monitor > found that the host machine's sys is very high now and then. Based on our's > tracing, we found that timer interrupt always hit after local_irq_enable, the > guest tick would be always accounted to system time. after applying this > patch, the phenomenon disappears. Fun. Rather than switching to guest_exit(), I think it'd be better to unconditionally open an irq window in order to minimize the overhead. I'll send a patch, it's easier to explain with code :-)