From patchwork Mon Jun 21 09:19:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 464491 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:102:0:0:0:0 with SMTP id x2csp2377261jao; Mon, 21 Jun 2021 02:20:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbac5AQNuNjQp6mdJEgOAMg+hQ8fw6ble1RAWOhKjIb3mxHEkoMil7wZA0dE7wCt4gThVX X-Received: by 2002:a02:8627:: with SMTP id e36mr6157460jai.142.1624267215595; Mon, 21 Jun 2021 02:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624267215; cv=none; d=google.com; s=arc-20160816; b=iPdIB6Z6wABeAxRXg9kGak1IvPEmTm9rDkYpoTCwqfN9C/5hEtcB53nGlTbo2QdAub oIOqRyXWapFFtkrp7q8W5LC/QUdzcfV++BkP3+88pIOBxIDV5XE2E92jNIFivjPhK3+Q kIYNt77X9kNvdkR479ZFehFGgJTB/mR8dsCmD3uCc2MKO+9kQxOxRE0aVQ2oKCpfJMlM oA2hO2CMeF2k9We0KoTdRHrWvRK7pQoKOxkqLeQX/ZzNB/rea+bCayhenQ6tk2G5WGbz hjjOcXbTbeZvCEDHQLaYo6Kjzp1vJsQm/49lwpsF96vs6VISFDCyEyzDctNRFLepK7Gm sv0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xucopJdQYEMHhZQ7dqqB8UQAFZOXBMVYsdXdizA97FA=; b=sNxPJV0MLadVbAgopeKixfrxrmDXn3LWXEIi2U6G3Xr0OWg8BSuRhJLu028MnWpPoH ko6vFDG7/7/D6RPllCfpu1Hfue15ZVsp+bvip2ZeAvGUbGELHzNK5HIzI1UfvK1Ut+jF DF6auOGe0x2BZ7akw32yjpHunBKKSrFPYzsI/LOljRjJhiDLi7PJflzxkBwayDpoNDsW xdqIWaSbCateIar+HwSPxbMelwSFxhtS4q5T3mBZ/FCIdyE4T2KTFP+kSbjNo2fwdgEx uCI6/NmoctLSFxrXbA8AryKWQ+tP6BwUQUgQVDlnvqgoNCyIKIXgceY2gQviSQATVwYO /M1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vgHziPNR; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v126si1153344iof.68.2021.06.21.02.20.15; Mon, 21 Jun 2021 02:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vgHziPNR; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbhFUJW2 (ORCPT + 8 others); Mon, 21 Jun 2021 05:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhFUJW1 (ORCPT ); Mon, 21 Jun 2021 05:22:27 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8CB0C061574 for ; Mon, 21 Jun 2021 02:20:12 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id g4so9607565pjk.0 for ; Mon, 21 Jun 2021 02:20:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xucopJdQYEMHhZQ7dqqB8UQAFZOXBMVYsdXdizA97FA=; b=vgHziPNRBMyZcOclBhC3U0MKPvE9Hn1g1zorbrtQPSjbwjjMHtxuehLkK5jav4xtQP 0MsgvldXgiQbvefMiSDkhR0TiOaOfA3sw7mIbn4hm//b6lkh2TSQ/YwZbqiwf9k6q/yl MpAFGvVHz6gQ8nfIE6QxXJhawJXd93wnismO4+HeCAIO4326OoyrTnZPgapwS53dgSOD 2mJPLOYkN9tz8rtAKlyp/n7wxonyxaqipTjoEzSm04OT0zO3uTSx3e8XZY026j5NTswn 9c2xHcwYqnPU4NA+I6izG4vBuEs9oAjRCzer7DlyPRnQZtSsiugwN/QrvqdekmRETZ34 n7rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xucopJdQYEMHhZQ7dqqB8UQAFZOXBMVYsdXdizA97FA=; b=RM1z68BVZtgrNlGyHiUkTRbEElkYeCCsM3HA+AFXsu94r/xXEgcU5KrjI9jLgB5qCy km3qWTnCCXheUbptwRVns8rpPkiQSOPKJjOT7WPJmYTESSgitriBHiauVRuoaykLrB+L Qg4K+vB8HnlM5of238X/Quh5LFg0ZYvqrXCNAVen9Uc/doJrtrM6cn0/rcNGxnWrT3hC FmCFf1iyHpaZr+BNH7BDD/ZWLHGuDBLhgJ0aIR3f8RO1xjqLoeue3TSrnnqav22M6Qiz Tcgg0ynqv/V+uj2ydOBWZ7yDC38t6e15RgBUImV20N4+bRw6/+AQK8+dC8Bt+uRq4Hfj N9Hg== X-Gm-Message-State: AOAM532SuzKeyOSl3MN9e7EB7Iyn29pourPLeRM9xXSEoV8jIRFh8ayT DWBNhRaFg6bTexWuWqQb2YJbCw== X-Received: by 2002:a17:902:e313:b029:125:827f:c621 with SMTP id q19-20020a170902e313b0290125827fc621mr1847055plc.25.1624267212333; Mon, 21 Jun 2021 02:20:12 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id w123sm7828850pff.186.2021.06.21.02.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 02:20:11 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Ionela Voinescu , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Greg Kroah-Hartman , Ingo Molnar , Juri Lelli , Mel Gorman , Peter Zijlstra , "Rafael J. Wysocki" , Steven Rostedt , Sudeep Holla , Vincent Guittot , Viresh Kumar , Will Deacon Cc: linux-pm@vger.kernel.org, Qian Cai , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E. McKenney" , "Rafael J. Wysocki" Subject: [PATCH V3 0/4] cpufreq: cppc: Add support for frequency invariance Date: Mon, 21 Jun 2021 14:49:33 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hello, Changes since V2: - We don't need start_cpu() and stop_cpu() callbacks anymore, we can make it work using policy ->init() and exit() alone. - Two new cleanup patches 1/4 and 2/4. - Improved commit log of 3/4. - Dropped WARN_ON(local_freq_scale > 1024), since this can occur on counter's overlap (seen with Vincent's setup). - Handle stuff from init/exit() callbacks only. Changes since V1: - Few of the patches migrating users to ->exit() callback are posted separately. - The CPPC patch was completely reverted and so the support for FIE is again added here from scratch. - The start_cpu() and stop_cpu() interface is reworked a little so stop_cpu() is only ever called for a CPU if start_cpu() was called for it earlier. - A new patch to implement RCU locking in arch_topology core to avoid some races. - Some cleanup and very clear/separate paths for FIE in cppc driver now. -------------------------8<------------------------- CPPC cpufreq driver is used for ARM servers and this patch series tries to provide counter-based frequency invariance support for them in the absence for architecture specific counters (like AMUs). This was reverted earlier for the 5.13 kernel after Qian Cai reported kernel oops during suspend/resume. This is based of v5.13-rc7 + a cleanup patchset: https://lore.kernel.org/linux-pm/cover.1623825358.git.viresh.kumar@linaro.org/ All the patches are pushed here together for people to run. https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git/log/?h=cpufreq/cppc This is tested on my Hikey platform (without the actual read/write to performance counters), with this script for over an hour: while true; do for i in `seq 1 7`; do echo 0 > /sys/devices/system/cpu/cpu$i/online; done; for i in `seq 1 7`; do echo 1 > /sys/devices/system/cpu/cpu$i/online; done; done The same is done by Vincent on ThunderX2 and no issues were seen. I would like to get this merged for 5.14, since it was recently reverted from 5.13. And that it is still an independent change to a single driver and topology APIs that no one is using apart from arm64 topology stuff. Thanks. -- Viresh Viresh Kumar (4): cpufreq: cppc: Fix potential memleak in cppc_cpufreq_cpu_init cpufreq: cppc: Pass structure instance by reference arch_topology: Avoid use-after-free for scale_freq_data cpufreq: CPPC: Add support for frequency invariance drivers/base/arch_topology.c | 27 +++- drivers/cpufreq/Kconfig.arm | 10 ++ drivers/cpufreq/cppc_cpufreq.c | 287 +++++++++++++++++++++++++++++---- include/linux/arch_topology.h | 1 + kernel/sched/core.c | 1 + 5 files changed, 292 insertions(+), 34 deletions(-) -- 2.31.1.272.g89b43f80a514 Tested-by: Qian Cai