From patchwork Wed Jun 23 04:24:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 465885 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1371208jao; Tue, 22 Jun 2021 21:25:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjI9uaBSCaEIqk7xHpC1QKjBen0Bg2Anhu/KiNc62Q7wynCIQP4rjMowqVqQYtDWihkMM3 X-Received: by 2002:a05:6402:27ce:: with SMTP id c14mr9487290ede.118.1624422304345; Tue, 22 Jun 2021 21:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624422304; cv=none; d=google.com; s=arc-20160816; b=hTNy3iKwyIWPdheDND/x8XffkdumjvWKpmcHV+wkBGKHWaRiYp+/cUmvOSHIDdyGZt 2QdQlWI4mcwKUqAQ0L2bF13ml4T6XxJmyBj6l+2oVSCSQdtFzojclixh8RW/cpqVEpkl Uywubi8mt/yWLh/fwp8lAdZxw8LKEM1Bpnniz8P45AcsagCppS3LMo7pvdCzseyivxtx SI/TES/gNkvhsbzFWHQy+opl3oMxN5OHQ/epuSG8z0qeKBeg4jjnMkZ/UuE915Ngp6Gs qAQ6IGMjVPnLmIf1IVVFnnJCtlt0UCFka5JKRQXyvmTV16XlxgPLWusucugHj/IKiclj U1Vg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5xjI9Ft4Ufb3P2xW78lRK4EZEZNp1oyWp3i4UsHjcOQ=; b=i/iej8nJEeTJEz38/XN8qDuyypUftBA3jiyN3tRf3/w5NBOi81poYPAGYPh6AWXUs+ nouXassqnYGLzKuAfOBK1PL3Ty4QlxP7jT9rVu293dOsz36rOdVF9Z5JRD/Uo0N8CA0s d9Tir3PPZHXPZ9DTERlEUr5Y/JzE1SFWP4UwzQKLehvb/qaUKOfXTY1hLtsJpXU1ucYy TnzyoSTt/h2y2l129jEtTrWPwsgqZauSco8oBDXFQsjO4xu5rBIq/rdKDU4q9DnbZLX4 tYf54jzbcXd4VZoWc1gcqNgGzX+Cy19ul0K3vPuJA4oHm/5bF1JTBShTz/mJzqOkdgEH MHBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rpEpW02s; 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 y4si24223394edi.355.2021.06.22.21.25.04; Tue, 22 Jun 2021 21:25:04 -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=rpEpW02s; 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 S230004AbhFWE1Q (ORCPT + 8 others); Wed, 23 Jun 2021 00:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbhFWE1P (ORCPT ); Wed, 23 Jun 2021 00:27:15 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAE94C061756 for ; Tue, 22 Jun 2021 21:24:58 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id n12so653371pgs.13 for ; Tue, 22 Jun 2021 21:24:58 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=5xjI9Ft4Ufb3P2xW78lRK4EZEZNp1oyWp3i4UsHjcOQ=; b=rpEpW02sCPhAeieY8YKGZpRQeFRKEWmgMaE/6CSFjFaN3ZcJZrsCDugxR2bqzcf/ET f34P8r8jQDJcqMM1MW2PNQZaNAn0zjuzXiQU0avd9m1CbrdadKJotqml96+36krP5uME pFS+DHTXViUW1+Cwucw0l5O4mxwrLMM+EoltAJUOJ7PkNxXydoZ4RfaycOF7Fx4bcYkN BElFXjNeV79s9YLlgwqrMGEWAvWILYCnUXvD88slIsbJURe9UmZVQ0pndtKQ3U27qgBt AuvFxv3fazKLMWj/oYdOwU2Y2VM1CLJYZc8lhbK5TC70puMICaMOSq3FOcVupklEbmAm xbng== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5xjI9Ft4Ufb3P2xW78lRK4EZEZNp1oyWp3i4UsHjcOQ=; b=ZS6qGmJZ8edIpKmjwq3zo0e1dEmz/GKwCNWmOxP+7WFMA7YwmNotKMNWo2K4OtiSwJ J0TrFq5sGw5KkpN88cRX4iC4im9xaY8NB3xPmizVDWpk14C3aQ2teGcvSiR8xPtpjZnQ 7kBrU14vKm5SbuWvMvWElsck3A8RReHw9TsDSVyh6zyPZn7MxXjMVueOZAg5pTSoQDsh JYeZHoB0WWyItHI6DlY295rXrrItEYLWRgN25tEXjaf2x6O+a80T+zPqFWmhKtjDQ8AI cKDFf+ogDHfrHW7/638UYXJZyu4jKi8NoPyFee9/UNxppOW94LjK8O92UyaA1XCY1GCA jPJw== X-Gm-Message-State: AOAM530Hc8J/1ifrM7bcdBIenGWYn6vAeEnqte2TTLzKSLv6ckrCbzT+ fqjyKaIzzds8LjGKz5PCvgO1+BL/qLBllg== X-Received: by 2002:a62:3344:0:b029:28c:6f0f:cb90 with SMTP id z65-20020a6233440000b029028c6f0fcb90mr6866556pfz.58.1624422298462; Tue, 22 Jun 2021 21:24:58 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id 11sm779676pfh.182.2021.06.22.21.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:24:58 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH V4 1/4] cpufreq: cppc: Migrate to ->exit() callback instead of ->stop_cpu() Date: Wed, 23 Jun 2021 09:54:39 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org commit 367dc4aa932b ("cpufreq: Add stop CPU callback to cpufreq_driver interface") added the stop_cpu() callback to allow the drivers to do clean up before the CPU is completely down and its state can't be modified. At that time the CPU hotplug framework used to call the cpufreq core's registered notifier for different events like CPU_DOWN_PREPARE and CPU_POST_DEAD. The stop_cpu() callback was called during the CPU_DOWN_PREPARE event. This is no longer the case, cpuhp_cpufreq_offline() is called only once by the CPU hotplug core now and we don't really need two separate callbacks for cpufreq drivers, i.e. stop_cpu() and exit(), as everything can be done from the exit() callback itself. Migrate to using the exit() callback instead of stop_cpu(). Signed-off-by: Viresh Kumar --- drivers/cpufreq/cppc_cpufreq.c | 46 ++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 22 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 2f769b1630c5..be4f62e2c5f1 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -182,27 +182,6 @@ static int cppc_verify_policy(struct cpufreq_policy_data *policy) return 0; } -static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy) -{ - struct cppc_cpudata *cpu_data = policy->driver_data; - struct cppc_perf_caps *caps = &cpu_data->perf_caps; - unsigned int cpu = policy->cpu; - int ret; - - cpu_data->perf_ctrls.desired_perf = caps->lowest_perf; - - ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls); - if (ret) - pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", - caps->lowest_perf, cpu, ret); - - /* Remove CPU node from list and free driver data for policy */ - free_cpumask_var(cpu_data->shared_cpu_map); - list_del(&cpu_data->node); - kfree(policy->driver_data); - policy->driver_data = NULL; -} - /* * The PCC subspace describes the rate at which platform can accept commands * on the shared PCC channel (including READs which do not count towards freq @@ -352,6 +331,29 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) return ret; } +static int cppc_cpufreq_cpu_exit(struct cpufreq_policy *policy) +{ + struct cppc_cpudata *cpu_data = policy->driver_data; + struct cppc_perf_caps *caps = &cpu_data->perf_caps; + unsigned int cpu = policy->cpu; + int ret; + + cpu_data->perf_ctrls.desired_perf = caps->lowest_perf; + + ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls); + if (ret) + pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n", + caps->lowest_perf, cpu, ret); + + /* Remove CPU node from list and free driver data for policy */ + free_cpumask_var(cpu_data->shared_cpu_map); + list_del(&cpu_data->node); + kfree(policy->driver_data); + policy->driver_data = NULL; + + return 0; +} + static inline u64 get_delta(u64 t1, u64 t0) { if (t1 > t0 || t0 > ~(u32)0) @@ -451,7 +453,7 @@ static struct cpufreq_driver cppc_cpufreq_driver = { .target = cppc_cpufreq_set_target, .get = cppc_cpufreq_get_rate, .init = cppc_cpufreq_cpu_init, - .stop_cpu = cppc_cpufreq_stop_cpu, + .exit = cppc_cpufreq_cpu_exit, .set_boost = cppc_cpufreq_set_boost, .attr = cppc_cpufreq_attr, .name = "cppc_cpufreq", From patchwork Wed Jun 23 04:24:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 465886 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1371259jao; Tue, 22 Jun 2021 21:25:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1bCDcI3QS/qlM8DJlRQEKVqcCr0WQ6lOI+POfkU6qR6go+wG82C+6pZrlLtiLL5uaL4lY X-Received: by 2002:a17:906:1dc5:: with SMTP id v5mr7602290ejh.212.1624422309969; Tue, 22 Jun 2021 21:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624422309; cv=none; d=google.com; s=arc-20160816; b=0UAZydeHFII6BH4c7sDgxfTGHKp5dE4RpZke+7sonhxpYc4oe89SQ6RfUa2VPheFgn qYX0LgODeiM1SCO3U8GPpLBY8ZrhBiQIHI3rToEyNzoTecErxEUkqBJQ6/6OHY0N8nnH fthn8LE3f8DNyhTcZA9LOKAgku5xW4Sl0ox1eJY6Iebq0jMcrGI0E37utfdTOINsbrfa gn1f6XeaUWSAhWEbIpUFgWub2yCDOocJh1vA+mzsZg8sgEAPpp8tO6rQGiASqwnyINhO KzmelV8SpoEms8C8P3p67QDx4l6Q0WL2j3EIsn6JaPW3tVOQGQuL3O+IAAkFpjGX1+At ebpQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EPOEQ7pRTnNWs9xaNPcoV7k6Yz2O7yBdc0WvhyMJhVY=; b=b3+Rstpf6Lzz9D48UDsBky+kAIxOr7inkTfXMm7P75GxkHqzKbt5wIKHC2452bsx4k Xdb73OXQnLYnGwBROUBdQ6kMAZl8mWCLsUVSL4Ise63RPOaI2EnKAGZxhR34uEkbDh1o ZpTfWBQMZh3ZLBjYZHPeIqSWmlNfJJW+zktt6uRynrFLOF7GummYwdz0A8o4IQKEGzfM 7ZTirInWxXZzixiinOLlU6DV+aFSHEN0SVeXn7GkraLCQcqnyGKFF0rQWUbV5hNIPcUK pdlhLH+sP/tSGNxBNpiiTP36XBg1Hx3fNJga2G9u8/PORBLZ1oD8It9vJ7RNHJdluwif rehg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b8ZR4og0; 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 zd9si729615ejb.524.2021.06.22.21.25.09; Tue, 22 Jun 2021 21:25:09 -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=b8ZR4og0; 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 S230455AbhFWE1Z (ORCPT + 8 others); Wed, 23 Jun 2021 00:27:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbhFWE1W (ORCPT ); Wed, 23 Jun 2021 00:27:22 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEADFC06175F for ; Tue, 22 Jun 2021 21:25:01 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id i6so1323229pfq.1 for ; Tue, 22 Jun 2021 21:25:01 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=EPOEQ7pRTnNWs9xaNPcoV7k6Yz2O7yBdc0WvhyMJhVY=; b=b8ZR4og0732gAR3c1QYoPDfJ0QOfR/MZV3Znls5zMiLv1QapescQpW0mD0cXuEw5Y+ 3ryskYMHsIw99NYuadcF4O8zZpYOnknde2t3RqK3gw6O00rMiPD5u6zLv9ZPRTnmPtqS QaibiMZ53wEa0Jnl4UvoisAz+Mq2Sd/rYN+VPqYLh+AeOXqhwxYhgYlhJ/KIAbBLM2u/ RWaqb4dhS1RkSbnBFmzrpXoZteqOa4XE8SvRzjqKDRyngP1oIPE3ybe5u+9TezGMdJET G/83PxfoCv7PcITInYuigzvIk8yHyiE9S5Cp0CbNDM2i6M9FELfdjrys21Wt+7pVpMRy 9m9A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=EPOEQ7pRTnNWs9xaNPcoV7k6Yz2O7yBdc0WvhyMJhVY=; b=kD/5pkqT8Y8a25gudn1tZO+rmWvRIQ+9J7AiEyW4yepkHOPZweVBXP/nJ/HhhZI3av nDSRIHeMKU5rrWiak8XN4RKMjmnYwgD14U7UmUI4o0N0UKB2So9jqvbJDguu+NvzFUG+ ws3NzCcCRKId0DGWduS/+1sTyXbirPTuOu2gyAfqoZqy+z2yGIB9hZ+vc75bzhfVgfXr TkikdVz9gDPNK06abzyuyWXeUBDgP+A8gaAYNbsc3j1XzqrkegQ4vhPXI8FTYcZD6ncn KfJ7kodcBS8v+PENn9N/HDxGFl/d92xn/icGG2f0URQyLrRLn3jobag/tDgvtUIV8OxJ Zk9Q== X-Gm-Message-State: AOAM530HCiMnBGYnnqjXGlApkPBAnkGpxivaT5i+KRwiWtTthMWCfnR6 rxogQuUGtu0+lgr63DhT6omzeQ== X-Received: by 2002:aa7:954c:0:b029:2f5:33fc:1073 with SMTP id w12-20020aa7954c0000b02902f533fc1073mr6933781pfq.79.1624422301480; Tue, 22 Jun 2021 21:25:01 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id v3sm802496pfb.126.2021.06.22.21.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:25:01 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Srinivas Pandruvada , Len Brown , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Dirk Brandewie , linux-kernel@vger.kernel.org Subject: [PATCH V4 2/4] cpufreq: intel_pstate: Migrate to ->offline() instead of ->stop_cpu() Date: Wed, 23 Jun 2021 09:54:40 +0530 Message-Id: <6144911f36d3d1f5faddf81d744bd39946843f6b.1624421816.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org commit 367dc4aa932b ("cpufreq: Add stop CPU callback to cpufreq_driver interface") added the stop_cpu() callback to allow the drivers to do clean up before the CPU is completely down and its state can't be modified. At that time the CPU hotplug framework used to call the cpufreq core's registered notifier for different events like CPU_DOWN_PREPARE and CPU_POST_DEAD. The stop_cpu() callback was called during the CPU_DOWN_PREPARE event. This is no longer the case, cpuhp_cpufreq_offline() is called only once by the CPU hotplug core now and we don't really need to separately call stop_cpu() for cpufreq drivers. Migrate to using the offline() callbacks instead of stop_cpu(). Cc: Dirk Brandewie Signed-off-by: Viresh Kumar --- drivers/cpufreq/intel_pstate.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) -- 2.31.1.272.g89b43f80a514 Signed-off-by: Rafael J. Wysocki Acked-by: Viresh Kumar diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 0e69dffd5a76..b4c0ff7f5b71 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2335,6 +2335,8 @@ static int intel_pstate_cpu_offline(struct cpufreq_policy *policy) pr_debug("CPU %d going offline\n", cpu->cpu); + intel_pstate_clear_update_util_hook(policy->cpu); + if (cpu->suspended) return 0; @@ -2374,13 +2376,6 @@ static int intel_pstate_cpu_online(struct cpufreq_policy *policy) return 0; } -static void intel_pstate_stop_cpu(struct cpufreq_policy *policy) -{ - pr_debug("CPU %d stopping\n", policy->cpu); - - intel_pstate_clear_update_util_hook(policy->cpu); -} - static int intel_pstate_cpu_exit(struct cpufreq_policy *policy) { pr_debug("CPU %d exiting\n", policy->cpu); @@ -2451,7 +2446,6 @@ static struct cpufreq_driver intel_pstate = { .resume = intel_pstate_resume, .init = intel_pstate_cpu_init, .exit = intel_pstate_cpu_exit, - .stop_cpu = intel_pstate_stop_cpu, .offline = intel_pstate_cpu_offline, .online = intel_pstate_cpu_online, .update_limits = intel_pstate_update_limits, From patchwork Wed Jun 23 04:24:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 465887 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1371272jao; Tue, 22 Jun 2021 21:25:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyTI9Z5XnlmtzBSMbQlT/jbcuwERyydmOqd90k+fmiqUGG+JnD9Ym/hELJ3ubYeRjH9hnL X-Received: by 2002:a05:6402:358:: with SMTP id r24mr9659524edw.69.1624422310815; Tue, 22 Jun 2021 21:25:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624422310; cv=none; d=google.com; s=arc-20160816; b=HW9ErExnt7wpdPLDDarB21Qzy2fmQ/7VEJQ01h/THx3/h2Xc7gVhUSW01wrgyAp0PG kn1iFRELbAy+S+lDLrA0RRrFTrxNWxf+6aTfcmI2kPLaKsDzr/+tMxAyAS1Jj6UntcRb SL6y67I0KzVZI8TEVDSHHzz9cj6yjm9m678McoK/k6wgJU6ulzW1jrtuCzVwRxlg/2Jq bGwIZ2KNtIzNmOCuSH23z+SEBO+qSztZC7hAZAp9I/nMK5b4YAeAddQsqPLNzTMiv4vZ GSw4CBHEy+OhbunfnQUL/Q94BPz7BoGcYUGgvxRyr3M2t9NWIBJ1uOr4AnHk0LBgHS6S hF0A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6a7/7P/WOJQ+/PmIgspG1zB1PV41tmG6f1/nfdy7CoM=; b=IhYWQUEp6Mcc3GGtrxoSjkI6OT0FYaZChQBxW5GEuHN9DY8KkMN/Gr42iqMUJYna+k FU8mmJwN1mJFfQaKhYJl7oj7x/PkymRHhBeefKewBxr++vfMOQufL3LIqQzGoZfQuugB Zd9kDr2Zbc6HNxFwjgzrZdbO5mZf2eGqemO/cjrpzJM1SHo7infZPXvUpmwmbazfcebJ i+BwSkMQ2nW8jF7ehHLW0aR+tXTbuafwLgs9tk+gDnQTKmPnXf4vXPwJ8GCfCCvb/c01 VIu/o8LF6B+95TeZef/+bC5y+UC/RJK1eGK3mEhZ6V//KBdyLlpSWNYjvgLlkVGDQFB2 JAGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t+6xWab1; 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 zd9si729615ejb.524.2021.06.22.21.25.10; Tue, 22 Jun 2021 21:25:10 -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=t+6xWab1; 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 S230429AbhFWE1Z (ORCPT + 8 others); Wed, 23 Jun 2021 00:27:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230116AbhFWE1W (ORCPT ); Wed, 23 Jun 2021 00:27:22 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 501C8C061766 for ; Tue, 22 Jun 2021 21:25:05 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id u18so1278579pfk.11 for ; Tue, 22 Jun 2021 21:25:05 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=6a7/7P/WOJQ+/PmIgspG1zB1PV41tmG6f1/nfdy7CoM=; b=t+6xWab1VxarnVqfUhkbXR1Ff5de0zTzo6XWVJnzQqjtYQbcC0d0cwq4YGD7lFkZPL 3VCCQ7GyVb0fc4NVhfd/P5AuT6vvj8LMYcV0/Okt3M12xDfYFLcdTNd7rLbPP6G68KMG jJgp22S2nIfWa1lhHXimlMG3L8KN6gVp+UbHs4gidPoZnMN0hCN6L/361N2/NoVK+Ir+ iPlUq/8muUIcSsjjbPXhs0T21QyPAq2VdPnsrhetmIYDy/jKyl5y/5fVsP/VLneiminp VsYSBgGBoYAkDjGRKIxwWgctQSbsV2gmtktRZUjk+InzJza/FNeuXGeywqk8f4y+4FPV e3+w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=6a7/7P/WOJQ+/PmIgspG1zB1PV41tmG6f1/nfdy7CoM=; b=JKJntAZ3B0kNuhI8+UuNQlj/nxkurKjPzgRCnAZQqypvOhIlhEQ6Xl8tN1R0Uv8p59 4N1ywuMWNCg8BFaX9OrB34BgkusvQuR+PNjW0pG2q3QpfYKeBp9EMST3Cw2cI4mFZLQi rf5MsnAbbYgDyNaXLA3M0IfUNs+UMnovoi/Hro0a4F4xA48WuCVENSLyV95brlkuQgnU vIvsI+TncB+CpelNo+XshUfB2a8wt+JFk+Dr2+WZ/rHgMvuklTtcbd9weQtBD0AEdcnn ixlBw0u09MXa2MSqfOcry+7UXYh7gqfRsdf5yxsF2SVjTZNaPugcS6XJMv8QckgO0OCT RNsg== X-Gm-Message-State: AOAM532uabCDYfDiTDEd8spI/U0M5ANxZbO7WW64Shkd20qS29AdrVNk NTSyAaX8Awq2Q8csNfbSqViOrw== X-Received: by 2002:a63:6dca:: with SMTP id i193mr1944100pgc.107.1624422304847; Tue, 22 Jun 2021 21:25:04 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id b9sm748602pfm.124.2021.06.22.21.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:25:04 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Cc: linux-pm@vger.kernel.org, Vincent Guittot , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 3/4] cpufreq: powerenv: Migrate to ->exit() callback instead of ->stop_cpu() Date: Wed, 23 Jun 2021 09:54:41 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org commit 367dc4aa932b ("cpufreq: Add stop CPU callback to cpufreq_driver interface") added the stop_cpu() callback to allow the drivers to do clean up before the CPU is completely down and its state can't be modified. At that time the CPU hotplug framework used to call the cpufreq core's registered notifier for different events like CPU_DOWN_PREPARE and CPU_POST_DEAD. The stop_cpu() callback was called during the CPU_DOWN_PREPARE event. This is no longer the case, cpuhp_cpufreq_offline() is called only once by the CPU hotplug core now and we don't really need two separate callbacks for cpufreq drivers, i.e. stop_cpu() and exit(), as everything can be done from the exit() callback itself. Migrate to using the exit() callback instead of stop_cpu(). Signed-off-by: Viresh Kumar --- drivers/cpufreq/powernv-cpufreq.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index e439b43c19eb..005600cef273 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -875,7 +875,15 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) static int powernv_cpufreq_cpu_exit(struct cpufreq_policy *policy) { - /* timer is deleted in cpufreq_cpu_stop() */ + struct powernv_smp_call_data freq_data; + struct global_pstate_info *gpstates = policy->driver_data; + + freq_data.pstate_id = idx_to_pstate(powernv_pstate_info.min); + freq_data.gpstate_id = idx_to_pstate(powernv_pstate_info.min); + smp_call_function_single(policy->cpu, set_pstate, &freq_data, 1); + if (gpstates) + del_timer_sync(&gpstates->timer); + kfree(policy->driver_data); return 0; @@ -1007,18 +1015,6 @@ static struct notifier_block powernv_cpufreq_opal_nb = { .priority = 0, }; -static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy) -{ - struct powernv_smp_call_data freq_data; - struct global_pstate_info *gpstates = policy->driver_data; - - freq_data.pstate_id = idx_to_pstate(powernv_pstate_info.min); - freq_data.gpstate_id = idx_to_pstate(powernv_pstate_info.min); - smp_call_function_single(policy->cpu, set_pstate, &freq_data, 1); - if (gpstates) - del_timer_sync(&gpstates->timer); -} - static unsigned int powernv_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq) { @@ -1042,7 +1038,6 @@ static struct cpufreq_driver powernv_cpufreq_driver = { .target_index = powernv_cpufreq_target_index, .fast_switch = powernv_fast_switch, .get = powernv_cpufreq_get, - .stop_cpu = powernv_cpufreq_stop_cpu, .attr = powernv_cpu_freq_attr, }; From patchwork Wed Jun 23 04:24:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 465888 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1371364jao; Tue, 22 Jun 2021 21:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwFi+xAa62xZk2iSRD7xuoGKG0J+394cBH65zat2qZZHf9S2TJTVNuzLFWFUbk194EjJFE X-Received: by 2002:a17:906:c108:: with SMTP id do8mr7920319ejc.74.1624422319585; Tue, 22 Jun 2021 21:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624422319; cv=none; d=google.com; s=arc-20160816; b=r7NNEmMzhqXwfOodT9F2XfcSZw0eZVPtayHq/t/tZJ/irekDGYScix3Wj+pxGRkXIB Dzr7wtIO/eZaZ0BH2GqgxOnlD2pxq8+0ZyrBWlnuYIgr8obqfuncNTH/I8BOvWyTSAvF EJADTysKwnQc3cveBsCAaAgbZy1CVum+jB4gDIXsvkJZaIOvnK31JYzE0hf/8boIEPsG xjlPsKug0jTZQxJdMjH4LvE8OIHMw9s7fqGeJ5/n7S10EWo+z5Br872uC+KhZxn3YrWB Q5MItP6lNEQ+LIgD5DzrL2Gs+suPN+BFrfr5XRp15DoKy3NZ/uCiJay2v+Xid2ZT1kZd SX5A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IsYDkx5V1mJjZwOsL/IXqLmlqBdgt7SKxZu32NLqyoA=; b=ILpqUOoGJOiBt1xJ+Nh1GjQ3lPl5LNOXvpXOKWWv8fDUTIn95Ex7JmGyVAl8qd0jDt NAhCjqayu344VI4e0J+ApCx9Ti3vJjn9tWMERp66Xo063D5KRUfsMgUXMHGJt1o6Ik3T PHrb/hadIwt2rWA1hVaEz3C+Vr5RNtp/mCZqWTJ9GFpGZJj8/eYluj2SgBdurb90vmVt 1O/Iz3uOn+Lhghv2WrbLKn4dNwz6ezrSczwI5X5zLW2voYfK/Nt/a+BYDTG4umhHbaqE AXELkZLkdm06v2or1+P0Q7WF6ut63bjexRy2hMsbsuqJfN3gmtw7M96s49GgxLrc8h9S z7iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KoW+3L+n; 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 y12si9524069edr.174.2021.06.22.21.25.19; Tue, 22 Jun 2021 21:25:19 -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=KoW+3L+n; 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 S230436AbhFWE10 (ORCPT + 8 others); Wed, 23 Jun 2021 00:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbhFWE1Z (ORCPT ); Wed, 23 Jun 2021 00:27:25 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB946C061574 for ; Tue, 22 Jun 2021 21:25:08 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id y14so657390pgs.12 for ; Tue, 22 Jun 2021 21:25:08 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=IsYDkx5V1mJjZwOsL/IXqLmlqBdgt7SKxZu32NLqyoA=; b=KoW+3L+nAzHaFgbRElzs5uOdutafEIWxBC8B5+GDKPJmQleXVfldK7z7iqfjfcts1Q rPL0kfSafE8oFpk6vrVZuNwIRU6AgR8g80QroxtsUVS3fgsrxmhUjcHJybPvXNrlECFn AAucYr0aZJMlHLGw09t3jUjQgj2XGLYNcQaGeuAUDeAoyhWbX1LrqiB6kBBDGV/8z/CN ++aB+n41chkQUj2WNQ3WqdialMd1lKj6yKzDF0hXvNUGzITEYsvfRPlJpIra4FVwPNQk b7US4tsXnrqo0EG6dj8k2TY/Ebg3EXPdt97zdZ9/IXIIO+2y6YkdmcBVH7hSDt3Fb6qh gNqQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=IsYDkx5V1mJjZwOsL/IXqLmlqBdgt7SKxZu32NLqyoA=; b=I52eohotLMaS11bjoOBqVhks1AB5+J+KJmun1OOFMplRr0cnXQNiY/esU0a2Q5oPz9 OsnLsrkmStYRSLn7gNJtjObFGx1/59hkN6ZupmuRNKwOfCGPVj/5skFLoouQyWTf0+// 8qJslZa/SSmJ/00LR7+sIvJvzXJlgd7zQJkZPYNwUh4iHEWMLE2C5aFxiyUnA1XSEsLC J6WAW3hd7BCufZAGzL0A5UsKDaIuJYM6aAi6ew34jCrgKnL6j0EEMH+B6mvCq8g4vyez s/Dc56cAIn6/qYiewTEIIczqO4lvNMUcAiMFvojzqNlb5aMpT1dOMALJhaQHmJfsKG9u bYPQ== X-Gm-Message-State: AOAM530oKnSzHT4hB3nb6czw8DlRmIAAexmZR6xWUBS6ywnPHEW+FSeM 3q/NEfBCX9LK1/8/rw+NgsxuPg== X-Received: by 2002:a63:5743:: with SMTP id h3mr1946424pgm.362.1624422308452; Tue, 22 Jun 2021 21:25:08 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id u11sm3770311pjf.46.2021.06.22.21.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:25:08 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Jonathan Corbet , Alex Shi Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 4/4] cpufreq: Remove stop_cpu() callback Date: Wed, 23 Jun 2021 09:54:42 +0530 Message-Id: <56e8fadcecf014ef0786499fbf4e93975b123483.1624421816.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Now that all users of stop_cpu() are migrated to use other callbacks, lets remove its support from the core. Signed-off-by: Viresh Kumar --- Documentation/cpu-freq/cpu-drivers.rst | 3 --- Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst | 3 --- drivers/cpufreq/cpufreq.c | 3 --- include/linux/cpufreq.h | 1 - 4 files changed, 10 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/Documentation/cpu-freq/cpu-drivers.rst b/Documentation/cpu-freq/cpu-drivers.rst index a697278ce190..74fac797c396 100644 --- a/Documentation/cpu-freq/cpu-drivers.rst +++ b/Documentation/cpu-freq/cpu-drivers.rst @@ -71,9 +71,6 @@ And optionally .exit - A pointer to a per-policy cleanup function called during CPU_POST_DEAD phase of cpu hotplug process. - .stop_cpu - A pointer to a per-policy stop function called during - CPU_DOWN_PREPARE phase of cpu hotplug process. - .suspend - A pointer to a per-policy suspend function which is called with interrupts disabled and _after_ the governor is stopped for the policy. diff --git a/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst index 0ca2cb646666..9570e9c9e939 100644 --- a/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst +++ b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst @@ -76,9 +76,6 @@ 并且可选择 .exit - 一个指向per-policy清理函数的指针,该函数在cpu热插拔过程的CPU_POST_DEAD 阶段被调用。 - .stop_cpu - 一个指向per-policy停止函数的指针,该函数在cpu热插拔过程的CPU_DOWN_PREPARE - 阶段被调用。 - .suspend - 一个指向per-policy暂停函数的指针,该函数在关中断且在该策略的调节器停止 后被调用。 diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cbab834c37a0..5e4b5316d254 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1606,9 +1606,6 @@ static int cpufreq_offline(unsigned int cpu) policy->cdev = NULL; } - if (cpufreq_driver->stop_cpu) - cpufreq_driver->stop_cpu(policy); - if (has_target()) cpufreq_exit_governor(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 353969c7acd3..2e2267a36502 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -371,7 +371,6 @@ struct cpufreq_driver { int (*online)(struct cpufreq_policy *policy); int (*offline)(struct cpufreq_policy *policy); int (*exit)(struct cpufreq_policy *policy); - void (*stop_cpu)(struct cpufreq_policy *policy); int (*suspend)(struct cpufreq_policy *policy); int (*resume)(struct cpufreq_policy *policy);