Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5063187ybl; Tue, 14 Jan 2020 02:54:42 -0800 (PST) X-Google-Smtp-Source: APXvYqy7JjDzNUP6AP1cnsNERdSD1sgGVO7FtkGMY/QM1svI2udK37LVGu6wVtS0HrnqLHpSK1vx X-Received: by 2002:a05:6830:1294:: with SMTP id z20mr16083672otp.60.1578999282651; Tue, 14 Jan 2020 02:54:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578999282; cv=none; d=google.com; s=arc-20160816; b=s0Ky8wrXTYJBD2hUURupJHoT72VYQ37D0u/hWdyGzDpypuLIeE2bPoH+SSLkAZB05j oMhTdepGSnLjKc9NWSDouRKIqIdBPeB2pIpOleQkvv7g8cc0o4c4mR2DTdIFrDChnaLr mhX0Es+5EtftulmsZIXqUbcbDxAmqxitEThLt2gKohPo7nd35WGDzX+2QXA7cX+j3FgX XyVHeOYE3yUzBo1GpvFsBwfBgMCHkibWMQtXXCdbS4tXBHC6ua/J7GFcgmN/Io/FpqF6 cfGVp5aI8Me656OuJt8jxpsw8b8Su3WcTVdSGJTrNW9r8sk1efy2c51wwXGn4OOSeb8y zIqg== 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=cn5oQa4AQw8CAHBLFyCfO9lTHCbEgvgO8kS0oRO7bOQ=; b=JZD5BEkbuFWRdJY8nk8DlAB3lFlFMhN1E1OsgAfa9d4AeTG6/EcSC7AyfY2Pfe2Kvr oSoLOD9GYhP3G33spuODP7VVwEXxTJYSX9vEudsoPAYK5mmexQLj6odUUuWuuI+oGip/ KdINNiwDs6D9h50Ya5A3tZ3SScRxlMaiLh2/yyYstLv/stbkBkjt4h9gKQ5UAbj1n5Sv yp6kSFE7QzHT7AVL43PgZT4WTBWe+bSEFD8WOLDtch4kxivomQrMvua5sxXeuevtapeR w3MmWvxzpz1j91riATcDRIh/XOipr/vL+T28AdfYW7/5Fuo86mUrA1uqa0efq/H4NHVq Qfgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="eK2Dg5z/"; 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 f89si1194682otf.231.2020.01.14.02.54.29; Tue, 14 Jan 2020 02:54:42 -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="eK2Dg5z/"; 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 S1729190AbgANKxd (ORCPT + 99 others); Tue, 14 Jan 2020 05:53:33 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:44522 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbgANKxc (ORCPT ); Tue, 14 Jan 2020 05:53:32 -0500 Received: by mail-ot1-f67.google.com with SMTP id h9so12131901otj.11; Tue, 14 Jan 2020 02:53:32 -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=cn5oQa4AQw8CAHBLFyCfO9lTHCbEgvgO8kS0oRO7bOQ=; b=eK2Dg5z/JYnAaAy6xwTmYeSjPvJjm0B44DIx4I1iEs+x7RetgpH2bxuRg9XU2ddA+s yvJk4W4uXxtsjYY10pSPcdvwgzRXoTHfPNCjs7juDha99ypLF/CI+ZiR+1n+LF1MSI9e IsUJNA/MwMJ4PjqXR7xQMKcK42h6yssTx3yuTskJ5v2NhyECfnKY9wcfTtuspvItViB+ xX8MeHMofmTJ4y9xpvMwrXV7olJeP/qyvpr3Ti6vgVGxlnDqDuIawEfZvrocueL5+wdk 5KyZ8gf//54ZLlPevCJT0IC4N6g1jXbzei+H0KkL/lOXS5WmOFrnu8M+HUuzgdONO/yt kOvg== 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=cn5oQa4AQw8CAHBLFyCfO9lTHCbEgvgO8kS0oRO7bOQ=; b=VJsF5j1RR+yWjtX0pzztD4y8JJihtNgn4OOHAWeN0nOYxfxINDb1a34xGbt5FANsvt VZxFUQZ5j6bJKBYvDby3MHf5j2VFqzymnQ+LkT4kPnpCg9TgPgFU6Ba7pIbgdpHMaqya EMDn/mxzDrmQSc2+4xJjX0qRu+sovw/80rudRUyhdMzXEBmTKcBEoJV0+u4RNN6W1Uiu DHRLooGTO1ghVeD8B7LzP8v5lEHU0RjfAuZtw/NJ5DBX0BUk9afaDYGnprcQ4cyaDKZs qN7s//REqU3JrObizTUFbM2RW9beDBsVSJk5bLrg4RX+zLYOhY2o+3sKnAY8uYy8+fay n8SQ== X-Gm-Message-State: APjAAAWITXqLw5LK0grORBZkCevBK1/1MC5Phv+VtAa7LGOIilo7pePr 46E/3gJiRBhPPfV9BwI+CvMGC/ZWTh+S0a1MCcw= X-Received: by 2002:a05:6830:231d:: with SMTP id u29mr2091403ote.185.1578999212027; Tue, 14 Jan 2020 02:53:32 -0800 (PST) MIME-Version: 1.0 References: <1578448201-28218-1-git-send-email-wanpengli@tencent.com> <20200108155040.GB2827@hirez.programming.kicks-ass.net> <00d884a7-d463-74b4-82cf-9deb0aa70971@redhat.com> <20200113104314.GU2844@hirez.programming.kicks-ass.net> <20200113123558.GF2827@hirez.programming.kicks-ass.net> In-Reply-To: <20200113123558.GF2827@hirez.programming.kicks-ass.net> From: Wanpeng Li Date: Tue, 14 Jan 2020 18:53:19 +0800 Message-ID: Subject: Re: [PATCH RFC] sched/fair: Penalty the cfs task which executes mwait/hlt To: Peter Zijlstra Cc: Paolo Bonzini , LKML , kvm , Thomas Gleixner , Marcelo Tosatti , Konrad Rzeszutek Wilk , KarimAllah , Vincent Guittot , Ingo Molnar , Ankur Arora , christopher.s.hall@intel.com, hubert.chrzaniuk@intel.com, Len Brown , Tom Lendacky , "Rafael J. Wysocki" 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 Mon, 13 Jan 2020 at 20:36, Peter Zijlstra wrote: > > On Mon, Jan 13, 2020 at 12:52:20PM +0100, Paolo Bonzini wrote: > > On 13/01/20 11:43, Peter Zijlstra wrote: > > > So the very first thing we need to get sorted is that MPERF/TSC ratio > > > thing. TurboStat does it, but has 'funny' hacks on like: > > > > > > b2b34dfe4d9a ("tools/power turbostat: KNL workaround for %Busy and Avg_MHz") > > > > > > and I imagine that there's going to be more exceptions there. You're > > > basically going to have to get both Intel and AMD to commit to this. > > > > > > IFF we can get concensus on MPERF/TSC, then yes, that is a reasonable > > > way to detect a VCPU being idle I suppose. I've added a bunch of people > > > who seem to know about this. > > > > > > Anyone, what will it take to get MPERF/TSC 'working' ? > > > > Do we really need MPERF/TSC for this use case, or can we just track > > APERF as well and do MPERF/APERF to compute the "non-idle" time? > > So MPERF runs at fixed frequency (when !IDLE and typically the same > frequency as TSC), APERF runs at variable frequency (when !IDLE) > depending on DVFS state. > > So APERF/MPERF gives the effective frequency of the core, but since both > stop during IDLE, it will not be a good indication of IDLE. > > Otoh, TSC doesn't stop in idle (.oO this depends on > X86_FEATURE_CONSTANT_TSC) and therefore the MPERF/TSC ratio gives how > much !idle time there was between readings. Do you have a better solution to penalty vCPU process which mwait/hlt executed inside? :) Wanpeng