Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1251875rwl; Wed, 5 Apr 2023 14:11:38 -0700 (PDT) X-Google-Smtp-Source: AKy350aVJStk0198SrtSzDjRkd8V01Z3ZN7wO/R+/1KAC/TG5B1PN9g6QFKXS+NyFVmzvEtHQjI3 X-Received: by 2002:a17:906:9bd1:b0:8b1:bab0:aa3d with SMTP id de17-20020a1709069bd100b008b1bab0aa3dmr4224664ejc.8.1680729098281; Wed, 05 Apr 2023 14:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680729098; cv=none; d=google.com; s=arc-20160816; b=bNEtq8GkqDxbEjdJ3Wm8EjRTENVMtx3S4fExorTOcgFHi/P9JKn+tZfX74mwU23D83 7rj0XjmKYjGWCBjzoVLznPRH2zAmNNSO7KXMNzAQ1xyVt/4ixl3rERQ80dW3S8ZrFsnQ xrnNUhEQdt6eoEjQkRMwNa1b5jnKcidRxCVLDJrn7NAE5sh+8PvpvVlSBJOBRj7ccak7 36pG8/L21JiY6kXRmiEWuW/PlvlSONwaMuv8CdOSTWWe70qiHoSjy334nqB3goO1Me0J 2uv0qO+u5tXJEeU9MIKyLbK9/QU16WRV43ZevPmmQ2MbsVdXmyd5KFSkoxvvHP702RXq tBpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6MLGKvl/FzbLKzi4k20FGuOr9OHamYGW4v4bUuCe4Pw=; b=xZTE7x4GL+vodzk/ipzO/o4W4Y/A+Gbtf/avwsWAAmrP9UYt9y9h4eDWvytTE4Q7BL ntLvo13KGpXly3jO6dQBCpqau276+zpupuZ6pwGbRTkTSrwUGtJQeDymX90al2gxpJIP HegRVjVOZ/dcK65tpN6LO9k1NjL4/xVokZaYy1n63lcaTC++w+RB9DeYy3KmbCWMqfVm VoKniIc4zCncwi7csJ+CZG0PidvroZb24NOBG0UOoo0J5QEWyFpBZO+W+UmFa3eUCZI0 WzVCp5cJbt5iL9w9tNomefR9X3ifIso0+UBKHZa9zGrU4QLst+KakfoqpDOoq5Lkz2fJ HITQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=n28dxYva; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a6-20020a170906684600b008d518d4bf7dsi2828904ejs.562.2023.04.05.14.11.13; Wed, 05 Apr 2023 14:11:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=n28dxYva; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234430AbjDEVJo (ORCPT + 99 others); Wed, 5 Apr 2023 17:09:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234380AbjDEVJf (ORCPT ); Wed, 5 Apr 2023 17:09:35 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA4F883C2 for ; Wed, 5 Apr 2023 14:09:22 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id y35so22586417pgl.4 for ; Wed, 05 Apr 2023 14:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680728960; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6MLGKvl/FzbLKzi4k20FGuOr9OHamYGW4v4bUuCe4Pw=; b=n28dxYvaxPfq5JUzsQqU6kb+bImfDaBPK4ACVIjk36q9wbwO2Ix5OhdxzRqVx+gjh7 vPGDsy2Z/CkVDlg0sacBgvwyhP7Cr0CdN6fmm+V+cxa8+RtEgXZfvRyRNCKyvdMkH3IG AZIFu3+14yJXDRgL1cAXUeLDtssdqJhhsK3uUP9LNJOKnlmtgEbiGDaecgZ2kxcyuk+W ieFXO/j1UfguA8IRQyx5S+9eNafvz99yFQpPT34J9xYi+XPsnNySq6lG7R9Y+uCWDb48 YGdH1N2wSkTT52iPU+n1BLdHUrV7R+KBKxYE48TbebgWoPnGhsUXfQZtwsoUmHH5p6Uh UXGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680728960; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6MLGKvl/FzbLKzi4k20FGuOr9OHamYGW4v4bUuCe4Pw=; b=0bSNQWwcMQuRovPJ6+e9503UZznNQF9c9t4ux9qa13An+HwWm7URc0vrwkjgmatby+ W5U2raeJmYWs8/1BYU5+GAwEkuQldDLxEkDJIaBMbzsfVSRRHLuvbu7WfnDwMRCHi3Bq cJAb3PGsz0XcXAR7zbsiXKkX7nmFinjJsWwwYteu52OD/IFKf8W676T1cWBUPCmBnfNz SOKD3/IISttS+FB7IekPZCBxgi7+zQeZLybd6533gGBojLl7S7DqedNWS+9coBLptkGp A2NQICDhDaWRAJMiUjWVUFidFVOtyi352ijcHGg+vUIrSWvjpi4YCIeTVg6UOFvrGNT+ V4PA== X-Gm-Message-State: AAQBX9fKlniroIosYgp2ny7wOtQawhcVvKegXYSuQgfwPOzerrlE5VFR v6Bj5oU/SMFZs66bHSubD3cdH814fmMt/RjLJAiQPQ== X-Received: by 2002:a65:430c:0:b0:514:3d3d:da5a with SMTP id j12-20020a65430c000000b005143d3dda5amr427665pgq.3.1680728960348; Wed, 05 Apr 2023 14:09:20 -0700 (PDT) MIME-Version: 1.0 References: <20230330224348.1006691-1-davidai@google.com> <20230405080548.GW4253@hirez.programming.kicks-ass.net> In-Reply-To: <20230405080548.GW4253@hirez.programming.kicks-ass.net> From: Saravana Kannan Date: Wed, 5 Apr 2023 14:08:43 -0700 Message-ID: Subject: Re: [RFC PATCH 0/6] Improve VM DVFS and task placement behavior To: Peter Zijlstra Cc: David Dai , "Rafael J. Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Paolo Bonzini , Jonathan Corbet , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-15.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 5, 2023 at 1:06=E2=80=AFAM Peter Zijlstra wrote: > > On Thu, Mar 30, 2023 at 03:43:35PM -0700, David Dai wrote: > > Hi, > > > > This patch series is a continuation of the talk Saravana gave at LPC 20= 22 > > titled "CPUfreq/sched and VM guest workload problems" [1][2][3]. The gi= st > > of the talk is that workloads running in a guest VM get terrible task > > placement and DVFS behavior when compared to running the same workload = in > > the host. Effectively, no EAS for threads inside VMs. This would make p= ower > > and performance terrible just by running the workload in a VM even if w= e > > assume there is zero virtualization overhead. > > > > We have been iterating over different options for communicating between > > guest and host, ways of applying the information coming from the > > guest/host, etc to figure out the best performance and power improvemen= ts > > we could get. > > > > The patch series in its current state is NOT meant for landing in the > > upstream kernel. We are sending this patch series to share the current > > progress and data we have so far. The patch series is meant to be easy = to > > cherry-pick and test on various devices to see what performance and pow= er > > benefits this might give for others. > > > > With this series, a workload running in a VM gets the same task placeme= nt > > and DVFS treatment as it would when running in the host. > > > > As expected, we see significant performance improvement and better > > performance/power ratio. If anyone else wants to try this out for your = VM > > workloads and report findings, that'd be very much appreciated. > > > > The idea is to improve VM CPUfreq/sched behavior by: > > - Having guest kernel to do accurate load tracking by taking host CPU > > arch/type and frequency into account. > > - Sharing vCPU run queue utilization information with the host so that = the > > host can do proper frequency scaling and task placement on the host s= ide. > > So, not having actually been send many of the patches I've no idea what > you've done... Please, eradicate this ridiculous idea of sending random > people a random subset of a patch series. Either send all of it or none, > this is a bloody nuisance. Sorry, that was our intention, but had a scripting error. It's been fixed. I have a script to use with git send-email's --to-cmd and --cc-cmd option. It uses get_maintainers.pl to figure out who to email, but it gets trickier for a patch series that spans maintainer trees. v2 and later will have everyone get all the patches. > Having said that; my biggest worry is that you're making scheduler > internals into an ABI. I would hate for this paravirt interface to tie > us down. The only 2 pieces of information shared between host/guest are: 1. Host CPU frequency -- this isn't really scheduler internals and will map nicely to a virtual cpufreq driver. 2. A vCPU util value between 0 - 1024 where 1024 corresponds to the highest performance point across all CPUs (taking freq, arch, etc into consideration). Yes, this currently matches how the run queue util is tracked, but we can document the interface as "percentage of max performance capability", but representing it as 0 - 1024 instead of 0-100. That way, even if the scheduler changes how it tracks util in the future, we can still keep this interface between guest/host and map it appropriately on the host end. In either case, we could even have a Windows guest where they might track vCPU utilization differently and still have this work with the Linux host with this interface. Does that sound reasonable to you? Another option is to convert (2) into a "CPU frequency" request (but without latching it to values in the CPUfreq table) but it'll add some unnecessary math (with division) on the guest and host end. But I'd rather keep it as 0-1024 unless you really want this 2nd option. -Saravana