Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp775493ybl; Thu, 23 Jan 2020 07:32:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxwxw9Nxgb2YmJURW1MxWndAyYFG1hXEdy6NFebVkZnd5ZGBgvTBL+8CIQ9Xc3Pf5tFkqTd X-Received: by 2002:a9d:6510:: with SMTP id i16mr11154210otl.142.1579793534161; Thu, 23 Jan 2020 07:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579793534; cv=none; d=google.com; s=arc-20160816; b=DAeS9m+AW+I/9W3O2MMjIKNzwbmegom3wCVFkqQ8iuHvSoN6rDA6/CacK+v2+exXKy Y3mAAdEKZlz7O3a4LIe70Ih9Z90ccq5XQtRS/FQebBW76K0GF8UIGDSsXiklBIuRWftP ZC8LEeBecGJ5TPru/ErqiuJ2xMvIRVBC/b0EOqY5hOaDQhHZkCt9I4KecpYIyg5ofixm XfvbmYnZ3P6sOcHZoUM+fnAdDeCY0evKPxKBrHSs/VLHAJzPK5qwySM1JkLwzSF25joa 9+7YgYvZKy4x52CR2PIFwF49Y9di0hRO1oMxBd4PB36yYeRD82YrjUoqLa6riF2Ia+mU 7hcQ== 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; bh=dJBGS4e0jWaAWLLcuuHxgK6M1UmjccQT8Vf0obsUZeE=; b=veugFhrxrBxwCIMy+3IxSuXRI0GjULi0OxjyJ4OLxMAUIDTp7zqEkp2vyWCszZlIqI 0wnqYr4m3cD9x6Mgx2iwDnqtmu24hlTT842FxwE3dsFFSrwJjn1KqgwLfErxWKVatFY+ crQyUYmC3aopIQXEag+8mrY1kbQicEOFA7QP6XWESL51n75Ah4Mx6gFvj/0xyiKRJWTS fO/NxPpwN2wpzjN8A6COU03Z7cNWm0I3h1EO5IGPjHkX/5zITAWI37BoAtOdO6hhjz2n t4w4vZhF2cZ2GPZlmU+jJ0pnlVz84rVafBpoUZHsEjsfR3iv0GROG1AS3u1648GNrE+i xNKg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si1273618otp.147.2020.01.23.07.32.01; Thu, 23 Jan 2020 07:32:14 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729019AbgAWPat (ORCPT + 99 others); Thu, 23 Jan 2020 10:30:49 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:39440 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727278AbgAWPas (ORCPT ); Thu, 23 Jan 2020 10:30:48 -0500 Received: by mail-ot1-f65.google.com with SMTP id 77so3095969oty.6; Thu, 23 Jan 2020 07:30:48 -0800 (PST) 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=dJBGS4e0jWaAWLLcuuHxgK6M1UmjccQT8Vf0obsUZeE=; b=Y9yFrQ9PyknN7p4NsknuKCrrfpYSDR+Zh0lFxOVz2yG7Om5A0Kj/VWxWzH6jQxO9oG UsCpKRTzBmzz/CPGVStPWJDnVYsEhleBaKSqzM4egLuFnX1alArFvhDLE8e0zKlvcQHV g4dYV31ZIeIn2qKQae3HJKqiA0ovAWmILIGlZyv2E0PIInZ3ixwXyD14oVFT7kAvnVIZ DdcEICmv+GWfXyku8BrnAvsoJytM+eF4CyD5IwgUGykeFHpX/FemNZM/rW5rss+D0kTL 0BBqNrmpuZIc3zKDL2c1NEcUao/kEoPaFaH9YCMEkqYW4w4qyQyxrbgjkv2MhzeQEScq hmCA== X-Gm-Message-State: APjAAAUCDdG4VFagodb9UERtUkoY4B2jKrR8InBnnRN3AMAbpCgMzjkj lyMdQDAyFfWGhjMn+XRFLC48a+kS3bLcIBFHK0c= X-Received: by 2002:a05:6830:1e67:: with SMTP id m7mr11717398otr.262.1579793447589; Thu, 23 Jan 2020 07:30:47 -0800 (PST) MIME-Version: 1.0 References: <20200122151617.531-1-ggherdovich@suse.cz> In-Reply-To: <20200122151617.531-1-ggherdovich@suse.cz> From: "Rafael J. Wysocki" Date: Thu, 23 Jan 2020 16:30:36 +0100 Message-ID: Subject: Re: [PATCH v5 0/6] Add support for frequency invariance for (some) x86 To: Giovanni Gherdovich Cc: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Len Brown , "Rafael J . Wysocki" , "the arch/x86 maintainers" , Linux PM , Linux Kernel Mailing List , Mel Gorman , Matt Fleming , Viresh Kumar , Juri Lelli , Paul Turner , Vincent Guittot , Quentin Perret , Dietmar Eggemann , Doug Smythies , Ionela Voinescu 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 Wed, Jan 22, 2020 at 4:10 PM Giovanni Gherdovich wrote: > > v4 at https://lore.kernel.org/lkml/20191113124654.18122-1-ggherdovich@suse.cz/ > > Changes wrt v4: > > - Removing conditional access in the function arch_scale_freq_capacity() > and initialize arch_freq_scale to 1024 to account for when freq > invariance isn't enabled (Ionela V.) > - In case the max frequency can't be read in MSRs, do not enable frequency > invariance at all (Ionela V., Peter Z.). > - Renames: > variables: > arch_cpu_freq -> arch_freq_scale > arch_max_freq -> arch_max_freq_ratio > ... and others > functions: > init_scale_freq -> init_counter_refs > set_cpu_max_freq -> init_freq_invariance > {core,skx,knl...}_set_cpu_max_freq -> {core,skx,knl...}_set_max_freq_ratio > ... and others > - Use the same function for parsing SKX and GLM registers (Peter Z.) > - Pass a parameter to the function parsing KNL registers (Peter Z.) > - Fix a bug whereby refs to [am]perf were initialized only on cpu #0 > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > Cover Letter from v4: > > v3 at https://lore.kernel.org/lkml/20191111180549.12166-1-ggherdovich@suse.cz/ > > Changes wrt v3: > > - Add definition of function set_arch_max_freq if !CONFIG_SMP > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > Cover Letter from v3: > > v2 at https://lore.kernel.org/lkml/20191002122926.385-1-ggherdovich@suse.cz/ > > Changes wrt v2: > > - Removing the tick_disable mechanism. Frequency scale-invariance isn't > just about helping schedutil choose better frequencies, but also > providing the scheduler load balancer with better metrics. All users of > PELT signals benefit from this feature. The tick_disable patch disabled > frequency invariant calculation when a specific driver is in use > (intel_pstate in active mode). > > - static_branch_enable(&arch_scale_freq_key) is now called earlier, right > after we learn that X86_FEATURE_APERFMPERF is available. Previously Peter > Z. commented "if we can't tell the max_freq we don't want to use the > invariant stuff.". I've decided to do it differently: if we can't tell > the max_freq, then it's because the CPU encodes max_freq in MSRs in a way > this patch doesn't understand, and we assume max_p is the max_freq which > seems like a safe bet. As a reminder, max_freq=max_p is encoded by > setting arch_max_freq=1024 as default value. I'm open to feedback. > > - Refactoring the switch case statement in set_cpu_max_freq() as Rafael > W. Now the first patch doesn't hint at what the following patch will > bring along. > > - Handling the case were turbo is disabled at runtime and a _PPC ACPI > notification is issued, as requested by Rafael W. This happens eg. when > some laptop model is disconnected from AC. (Patch #6) > > - Handling all Intel x86_64 micro-arches. > > - A note for Srinivas P., who expressed concern for Atoms: on Atom CPUs the > max_freq is set to the highest turbo level, as a power-efficiency > oriented measure. In this way the ratio curr_freq/max_freq tends to be > lower, PELT signals are consequently lower, and schedutil doesn't push > too hard on speed. (Patches #4 and #5). > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > Cover Letter from v2: > > v1 at https://lore.kernel.org/lkml/20190909024216.5942-1-ggherdovich@suse.cz/ > > Changes wrt v1: > > - add x86-specific implementation of arch_scale_freq_invariant() using a > static key that checks for the availability of APERF and MPERF > - refer to GOLDMONT_D instead of GOLDMONT_X, according to recent rename > - set arch_cpu_freq to 1024 from x86_arch_scale_freq_tick_disable() to prevent > PELT from being fed stale data > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > Cover Letter from v1: > > This is a resend with of Peter Zijlstra's patch to support frequency > scale-invariance on x86 from May 2018 [see 1]. I've added some modifications > and included performance test results. If Peter doesn't mind, I'm slapping my > name on it :) > > The changes from Peter's original implementation are: > > 1) normalizing against the 4-cores turbo level instead or 1-core turbo > 2) removing the run-time search for when the above value isn't found in the > various Intel MSRs -- the base frequency value is taken in that case. > > The section "4. KNOWN LIMITATIONS" in the first patch commit message addresses > the reason why this approach was dropped back in 2018, and explains that the > performance gains outweight that issue. > > The second patch from Srinivas is taken verbatim from the May 2018 submission > as it still applies. > > I apologies for the length of patch #1 commit message; I've made a table of > contents with summaries of each section that should make easier to skim > through the content. > > This submission incorporates the feedback and requests for additional tests > received during the presentation made at OSPM 2019 in Pisa three months ago. > > [1] https://lore.kernel.org/lkml/20180516044911.28797-2-srinivas.pandruvada@linux.intel.com/ > > Giovanni Gherdovich (6): > x86,sched: Add support for frequency invariance > x86,sched: Add support for frequency invariance on SKYLAKE_X > x86,sched: Add support for frequency invariance on XEON_PHI_KNL/KNM > x86,sched: Add support for frequency invariance on ATOM_GOLDMONT* > x86,sched: Add support for frequency invariance on ATOM > x86: intel_pstate: handle runtime turbo disablement/enablement in > freq. invariance > > arch/x86/include/asm/topology.h | 25 ++++ > arch/x86/kernel/smpboot.c | 290 +++++++++++++++++++++++++++++++++++++++- > drivers/cpufreq/intel_pstate.c | 1 + > kernel/sched/core.c | 1 + > kernel/sched/sched.h | 7 + > 5 files changed, 323 insertions(+), 1 deletion(-) > All looks good to me, so Acked-by: Rafael J. Wysocki for the whole series (and I'm assuming that it will go it through the tip tree). Thanks!