Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4778376ybl; Mon, 9 Dec 2019 16:45:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxeDmanwiBl55lzJrEza1ltxhohhEFUY6mm0f7O1RcYg9ZEYokWfB29SNnWeTpTX7IoReDs X-Received: by 2002:aca:b48a:: with SMTP id d132mr1704013oif.111.1575938723027; Mon, 09 Dec 2019 16:45:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575938723; cv=none; d=google.com; s=arc-20160816; b=CfA5jSVFQ6OgXAgXoeH54z09qky8i3uvLHnVtlMhIFKznbvkiNnRSa2MQeyas9RQyC 8CUXXSvYwEtUt95K7mJjJ6RW8dPd1G132ImqPgbPxpAwyrGuXbe+wvhcpH5ft6u4Dyaw bRImx58ldHbk3hHVKPmZcVvH0FHLqm6Gf+g8fv+AmQ1h3HgqkYs1FHMV37F7htaV7d7u nu7em6HtGGu3y8BnJNYl2vuxaThUn2TdH/J7KKnjKPzgQYVQn9zpcm34iEVjewL4A+6h PNMcHHnbMtXU4JtwciegKNpa69K+CEheeMNzxZd6bT/wXuYqw7pCEK119wF3fzMCp1Wk xpMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VUGiVOpo+ESHTZ/q7ZXEUplweHGdxyWpw0bewKvKrKo=; b=rjaG2dY1SFA1BaVeZK4xTBOsRL1wv1BWM5v6QMR1aYrYZx4JAY75eDTLv6pgshLNKV 7gtRpGRm982/b158fB8pw8GfqpTr55cwstIYgHRsCAHazxzWGptorfqY7pBU8VCjV1qa ZUjP6r4pkftPQneiFqT3UoWdRilVjc6gNvbduGktQUpYpHudCBNJiZRKSHlDnbFUc+VD 1/Q72LwGS4N5WUAWG8+cUySj7g/yWicp7iSPbZMsnnt9/fXsROh8RVxBGNli9+bRUZFQ yRCsf+EhrO8cy9NhhlRcSmOwEo5nK0cCa9BFUH8aF/M6rNhf46lAdmvwfzYfifhNNNcI cQyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HJ9uvRBy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q124si909651oig.228.2019.12.09.16.45.09; Mon, 09 Dec 2019 16:45:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HJ9uvRBy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727487AbfLJAoh (ORCPT + 99 others); Mon, 9 Dec 2019 19:44:37 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:34871 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727213AbfLJAoh (ORCPT ); Mon, 9 Dec 2019 19:44:37 -0500 Received: by mail-oi1-f195.google.com with SMTP id k196so8249904oib.2; Mon, 09 Dec 2019 16:44:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VUGiVOpo+ESHTZ/q7ZXEUplweHGdxyWpw0bewKvKrKo=; b=HJ9uvRByiIhcvlGFLAHIo3zMt4Bje8/0vzIZNo1QGmiVYLM6CmrM02L5Aa5UGwxX/y KHhHo/C6Td7K4qbcProiLzKd6BKblDRDsqoaeYh/qIOWRPQGo3OxmXiYU/uzdFCeRaKp UeAjDdXnhEPe+FwHRCTsw4148aTuISMtFE1qzMOtpvrxfQeC3eSpAodTKOXa8D/HIn/U eFxPghOlpHFFabkmcygBN926ZrR4AE6vUJ9U6mG94WJhziyQ2tVEW6L9w4WzEg8ntK8A aypYKtpXvik972wulYD4sleX8awhjUBrG/xoQ+1OHAnP1KaI50QqtuDmCJfLWOX5qriu l7hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VUGiVOpo+ESHTZ/q7ZXEUplweHGdxyWpw0bewKvKrKo=; b=j3fFaBllJaaknEK1q8f441Ilrr9zmwzpdAWJt1eW3h8SQRSR4HZzlgYDk197wI5jAK xnKCIIJnk2v0dBsWtWyEZ1MPua7PmCSsUwG7DuJHb32GxsDu9HW7NdhZ/KXqO7VeubAe vMFVX07R74iVaQqDRrHD/sww4cWlHdPwMXFLkdc5Z0K9FId46Ub0N46nZk70I71Rv2Z7 YcVzbrSwrWgSgrsSFmIJ+6JBlYi9Q9V8hmmc0U3PdB+Qx1v0FifaiABdIAB/9lF8EnCh tZ9Euurtd0DUO6D/p36gfuXOathlo40Wa8KK8Jbwp/GIoJAmu3r5d4NLOLR1I6GmFpok fD8Q== X-Gm-Message-State: APjAAAU6zMo5RJxokSnY7xW4kTldem62fNv6AAViKPJ+7EUe77eMsx03 Mz5Kv8MLArD6iwP5ITJpJt4tApMZiKLlYMhczGo= X-Received: by 2002:aca:758c:: with SMTP id q134mr1786606oic.33.1575938676514; Mon, 09 Dec 2019 16:44:36 -0800 (PST) MIME-Version: 1.0 References: <20190626145413.GE6753@char.us.oracle.com> <20190626161608.GM3419@hirez.programming.kicks-ass.net> <20190626183016.GA16439@char.us.oracle.com> <1561575336.25880.7.camel@amazon.de> <20190626192100.GP3419@hirez.programming.kicks-ass.net> <1561577254.25880.15.camel@amazon.de> In-Reply-To: <1561577254.25880.15.camel@amazon.de> From: Wanpeng Li Date: Tue, 10 Dec 2019 08:44:25 +0800 Message-ID: Subject: Re: cputime takes cstate into consideration To: "Raslan, KarimAllah" Cc: "peterz@infradead.org" , "boris.ostrovsky@oracle.com" , "kvm@vger.kernel.org" , "joao.m.martins@oracle.com" , "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "konrad.wilk@oracle.com" , "mtosatti@redhat.com" , "pbonzini@redhat.com" , "ankur.a.arora@oracle.com" , Frederic Weisbecker Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Jun 2019 at 03:27, Raslan, KarimAllah wrote: > > On Wed, 2019-06-26 at 21:21 +0200, Peter Zijlstra wrote: > > On Wed, Jun 26, 2019 at 06:55:36PM +0000, Raslan, KarimAllah wrote: > > > > > > > > If the host is completely in no_full_hz mode and the pCPU is dedicated to a > > > single vCPU/task (and the guest is 100% CPU bound and never exits), you would > > > still be ticking in the host once every second for housekeeping, right? Would > > > not updating the mwait-time once a second be enough here? > > > > People are trying very hard to get rid of that remnant tick. Lets not > > add dependencies to it. > > > > IMO this is a really stupid issue, 100% time is correct if the guest > > does idle in pinned vcpu mode. > > One use case for proper accounting (obviously for a slightly relaxed definition > or *proper*) is *external* monitoring of CPU utilization for scaling group > (i.e. more VMs will be launched when you reach a certain CPU utilization). > These external monitoring tools needs to account CPU utilization properly. Except cputime accounting, the other gordian knot is qemu main loop, libvirt, kthreads etc can't be offload to the other hardware like smart nic, these stuff will contend with vCPUs even if MWAIT/HLT instructions are executing in the guest. There is a HLT activity state in CPU VMCS which indicates the logical processor is inactive because it executed the HLT instruction, but SDM 24.4.2 mentioned that execution of the MWAIT instruction may put a logical processor into an inactive state, however, this VMCS field never reflects this state. Wanpeng