Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp598193ybd; Wed, 26 Jun 2019 03:34:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjO03r8ZjIZuntR86I4gze3ym/IioL2iYsD0pxDFLoZW6FQ7E+rNwJsscqtI3kETQQWFR/ X-Received: by 2002:a17:902:4e25:: with SMTP id f34mr4575587ple.305.1561545252345; Wed, 26 Jun 2019 03:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561545252; cv=none; d=google.com; s=arc-20160816; b=XqbG9mhAzVua9wZ0bkIaMQU7aUj7X6u7j1xg7mZu+IxBdHxWXAzVDxgzy1rOPprpU1 fyhKG+UBoZsiMy8wGZb1Wx/pRNt3J+ZXOEpEs5GeYvYh5kC6GMJkQaelCNjAGkAZdIHq 5Zk6CxO0bWLNWRGTP3wGyVuJ8wVDXzvWueMrNPvNVLliht9Oeae+2amBME71KPeMhd+6 el5Mo5Y+iZJlIGYagPizHtISFiyO5MqWbqmeIdw/CveZijbDHFWX2cB6rO2YQf2URzkO 6sDYCpTK0bX1U9hzEDubX5LXIEACTxiuYyQfA1YCtBiu9ncIiRrkMDyDXqSdc9FPGYqr H4Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=U7qtGNUKYt8uoCK8vHNryMcWzNcqWyhxBqGijQypffw=; b=ePrRrSWKZC/EZFj8vrMWqEFoWvHEeohFOuzl5v/63reaC/eNdYwRjjBwD7T0hjOMi/ gIVjTFSkb6V5iMUib+NqjC59S6vdIherkZ23czIKHYqJ1uvWDUYY2pIUUdCegsc2iw0U H8lRDXKbV60HLD6ihk2O6/hRHJV9GiN0xll8OwQWVuAa+baczChgQ/7OhJ+yTuYqXTWY TA4ufrXqjaAVRMnUKeAjUOVM+ymfa9AKZqjljWSlwFkjzWOBjYV4l7QC2qXTF7A/1xGb hte2q0d9XuuIlLe4ZKa0QgakKyk0zd/XBCpavBtRbE3CGirEA/5jtRgjE3Jvy8x9xAuo wgQA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si2973544plz.148.2019.06.26.03.33.55; Wed, 26 Jun 2019 03:34:12 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbfFZKdk (ORCPT + 99 others); Wed, 26 Jun 2019 06:33:40 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:46716 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726347AbfFZKdk (ORCPT ); Wed, 26 Jun 2019 06:33:40 -0400 Received: from p5b06daab.dip0.t-ipconnect.de ([91.6.218.171] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hg5F5-0003yZ-6N; Wed, 26 Jun 2019 12:33:31 +0200 Date: Wed, 26 Jun 2019 12:33:30 +0200 (CEST) From: Thomas Gleixner To: Wanpeng Li cc: Peter Zijlstra , Paolo Bonzini , Radim Krcmar , Marcelo Tosatti , KarimAllah , LKML , kvm Subject: Re: cputime takes cstate into consideration In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Jun 2019, Wanpeng Li wrote: > After exposing mwait/monitor into kvm guest, the guest can make > physical cpu enter deeper cstate through mwait instruction, however, > the top command on host still observe 100% cpu utilization since qemu > process is running even though guest who has the power management > capability executes mwait. Actually we can observe the physical cpu > has already enter deeper cstate by powertop on host. Could we take > cstate into consideration when accounting cputime etc? If MWAIT can be used inside the guest then the host cannot distinguish between execution and stuck in mwait. It'd need to poll the power monitoring MSRs on every occasion where the accounting happens. This completely falls apart when you have zero exit guest. (think NOHZ_FULL). Then you'd have to bring the guest out with an IPI to access the per CPU MSRs. I assume a lot of people will be happy about all that :) Thanks, tglx