From patchwork Wed Jun 16 06:40:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 461374 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp315663jae; Tue, 15 Jun 2021 23:41:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrDCZBXGQ2g2W5aECP/3XY58jhZfr1b/vREoqZLtpWrcxZDGmxiAf13zVdvLeGmcIM0qDM X-Received: by 2002:a05:6402:214:: with SMTP id t20mr2373112edv.20.1623825676089; Tue, 15 Jun 2021 23:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623825676; cv=none; d=google.com; s=arc-20160816; b=lepH6wEr1uw6aUabfx0B8FbSv0BVuWJaD9KkhYgdLmMRook4J1QexT75zHrMbiKZqB 4sQkujP7Oi15ti6wd1WzsUEIILTfTuqPr9avAngdYZ+vL6Hv2VC/rVTisS7CVP8X5PZi NgE1QxRbNwH5T71aVP3QIjHabgQS5zhqIF0hxiqo9GgP3vsCiAPbVagCB5h0qdz7VpdA fTZAkgtpVeds07WEjlk+nlGvZNHwJO414ZSrQatOPJV08uFiA3Aq66bbCkvCwstZJR+M BvZm3DgJ6PZlr/nURTjFqrGXxB4eLNGJfecTBZD7wmQ0QbeKCHUFWt/rrXuF5icAZju5 dLWA== 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=fz11juIXRTsN2CkblLASRPlH50UahybE8Lfos2/Sc4GcJcCxVpE1PTX8vyJw98grh/ ceHx+1P9xX2WhS550FC9Z6kiBpO2D3Hc+EmpFRHfKiWqYFod5hDyNXSDPjUy8MEgrCz+ Y6XzaqWSosqTJEM4ep6akHknC1fgPSXONWVz1ULrPvifmIjsK5e+UKgRk5xNWf4i1dqy 0Z91BoicuiUaMT3sJXJIntdfQxJzCdJzEjXShBSiXXlOeClv/zGwDNASvXqJzFQc+EyC vWDRfvEXWdUpGRyQpOilOnaNHTa9MhCjgP7uCiGEHctBLCtfNTHBHMrVvJg2gm8Fw3jt 6+kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AaZ5K1mn; 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 z22si1323178edd.361.2021.06.15.23.41.15; Tue, 15 Jun 2021 23:41:16 -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=AaZ5K1mn; 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 S231489AbhFPGnT (ORCPT + 8 others); Wed, 16 Jun 2021 02:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbhFPGnK (ORCPT ); Wed, 16 Jun 2021 02:43:10 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2933CC061141 for ; Tue, 15 Jun 2021 23:40:37 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id h12so1393969pfe.2 for ; Tue, 15 Jun 2021 23:40:37 -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=AaZ5K1mn3CqmF3UBf4tp5pwmUSIgZiJ2GY9eGrKPV91JA0u+SN8DMJeZc39ZH7mo5G rTDQuIYUJSvNepfzbvSymEQZhPeHkr4VfyKosdavqblrMSGbkHLg7bDHooR0jSL3UYQD gvLk4vTuQsUTmeWWca9pavgqcxXuZXD0eB5d2j/lYFmaTiwFDoEIs8fOgcn9eRXeSSDr Jpylt+434GLrL/4l2GPYABmT+pFmGjyU659JGlCMSmqdyy0AluezexzjLRBTPjS0SFmt 5IMYSm8AvJUaRkvczyU5cIr1DUUJq59IdQVvZKFvQ1G8xMS3X/vYfGEaDhqInrFITye/ 7X0Q== 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=T2/wACZklkwQwEK48Ps968S+WaNIzl1qAfDaD/c31sS43KAdc73WrXTqgxxyVr8wI2 OpWmq5Ti7QnIrQubdhMcLnmvL9FbBPht2R8NDNyqXXNbDirkLVaaHag5Q0ULimvZbng1 Z5wtjN5XRchdvtzVlWcnaHX5W9RtqdY4WivteGa2IjBMkkI33VAfM4rkoJKixqhW1l8q TaPGcS/HQqYrHxZmik4PfLuRg85MMjDcXg4NsHDD+mBtpAxmZ+UT7t2AgSfphbtaqlLo orkyvuaKdKpYIQ01m9DFYcy3saOb+75Mv12dRfYqwbiQNzzc/vY+fVSYw6k7D07lWN1l wJ2Q== X-Gm-Message-State: AOAM532ShT7kniT7M6a/nQ1vmV6XDFrS4lee80MfowezTfhqQZTJWZVS CiGdzYQjdAChLQBoAbA2m9eMqg== X-Received: by 2002:a65:52c8:: with SMTP id z8mr3573567pgp.50.1623825636758; Tue, 15 Jun 2021 23:40:36 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id a15sm1074707pfl.100.2021.06.15.23.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 23:40:35 -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 V2 1/3] cpufreq: cppc: Migrate to ->exit() callback instead of ->stop_cpu() Date: Wed, 16 Jun 2021 12:10:26 +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 16 06:40:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 461375 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp315721jae; Tue, 15 Jun 2021 23:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxsoaUP5lB94biiFzD6ZMAmkDwsVDd3OG3KzpN2qE/G6tsw8rmZK/FXWJ5r9E5qLDNzraD X-Received: by 2002:a05:6402:22fa:: with SMTP id dn26mr2249899edb.230.1623825680907; Tue, 15 Jun 2021 23:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623825680; cv=none; d=google.com; s=arc-20160816; b=CemmqGZMsQR1yWCpuMiPvLSr9xtlZTHk3I068gMe/uGJSlRopFYwROxwN1kIFWCkXn QBpRF8VOnHPKiYpxlpkumzQieqvCRqDJsEJ+zvI2OFxUWJLpBhMaLWFhHQdsHskIfSkN Al0lhCarevcICBj1zKlhaqbi8cmxPiXSpRkAiCMkEKrA1tTXMcTZrevanvZtN+hIyABZ Wn7LyOko6vLteWNEMrvNUngpB1/1NhaM0r+zH+aMz7GtJKpiQ5g0DZaDTm6+6ZP0/v2n Ov+xExnTChzQDP7l+xGX+AHxnTyowBXqit62PwsuwpHGLUbHiyH+KkGMMZrcu3Ao0VdD tzGQ== 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=SdbF+pw9w6thId4kMOV09HnHCGHiD/yfDYRnksndebs=; b=TBKxK/BQd6/KCIg69B85pU70JA17KCuSj4SnHGnKhm9LhOWzLpiOrBgiAVrsqpQk8K d6I3FAmcxiOgwoRHDmy6OUTshkylnWZ58W+ngGADbO12x+VCSaSM1gY4WRjXmBj/jw/O eng/ZI8d0bxCt/qlerAEblzDVxlbJ5uFt61Zu8ClE90cOB33XXqiBMdGSrD0ToXD2Ro7 b2DCUFR1Td3Wg2nGXRMI+VHE314Q5GRCemmrT6pUOZlG33UpG6K/kZ/Ugjg/yDhTbDzy TKbISFuq8eti9gz82ValUVaTbTsMe4o0r2Wi4Y0Krjv3wh/ZyfH06uRU0xwrP6lfmXzq KMGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nXI/8wPT"; 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 du7si1365593ejc.108.2021.06.15.23.41.20; Tue, 15 Jun 2021 23:41:20 -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="nXI/8wPT"; 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 S231668AbhFPGnX (ORCPT + 8 others); Wed, 16 Jun 2021 02:43:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231452AbhFPGnP (ORCPT ); Wed, 16 Jun 2021 02:43:15 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E88BC061280 for ; Tue, 15 Jun 2021 23:40:40 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id s17-20020a17090a8811b029016e89654f93so3369604pjn.1 for ; Tue, 15 Jun 2021 23:40:40 -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=SdbF+pw9w6thId4kMOV09HnHCGHiD/yfDYRnksndebs=; b=nXI/8wPTHmLYi7m6rc31G8HW1u1f7eOwKHz1Eoe5JKFBQduFs8tx4GoZgR6/4REgKy 0iGqadwkMNxEtm9VgBlc+Jhov/OMNbakx3LjYuVg+R4OVWHwdUUsEN+4lwbyJnXTnnnA E8vv1tsmXjwGJM3uprhF51d91BWBIjos/E7KchUHmUn9BMEa8cY+ZA+JSq/n9sBKBYCF yGXgOUrt9s7IMDML2KV45s41xzg+hLVqasz63FqZGDRVuWGAjOXET2ux2ZKhfz5fqQzP LiMrCo22aycvdJ5AYPfuuKOaOlgY2IgT85A1o6PE1hCNF7SbFoZCyR3WMUZ7+44ZyxIF fYow== 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=SdbF+pw9w6thId4kMOV09HnHCGHiD/yfDYRnksndebs=; b=JOrWlNskQPSGc1J5AS1MhR1MbPCf/UuZmJmTUAWthngkqhkpSYaTjhqLMFKZAhBG6L /Rj2n2QyD3uxu1ksx1biyBwG1fFz9iQ5DPKqaBeS/3zswIeQKRA0dVNus2V1WDBXuzkY ulDPwM05o9PESnLyBzpWo3qgSRszKhibEqdibNcAv/UsXm6BwfTIBq7kCZjK5szsF3OV ijT2X/7LmoB31XdUDL8AaxWod2pB9sjBWMv6RzqjADNHcJnAs39fAZ9EpzyUEpHWlH6e ZdNlGg/Kk8HdfVSe+T2iPJMSNVoBzajC+PggYJEs+woPp1w5fu2NhEOX9lAgpNSS22H3 SqWA== X-Gm-Message-State: AOAM531iWS6DFeOOsSK5XPQxZd4b+EbR7O4kSfkDbNKmDhDlF0t2jf5B Nh+n+btW1ZAc2vOxPvDGh+gYMQ== X-Received: by 2002:a17:90b:234f:: with SMTP id ms15mr3339763pjb.202.1623825639884; Tue, 15 Jun 2021 23:40:39 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id u7sm1241674pgl.39.2021.06.15.23.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 23:40:39 -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 V2 2/3] cpufreq: intel_pstate: Migrate to ->exit() callback instead of ->stop_cpu() Date: Wed, 16 Jun 2021 12:10:27 +0530 Message-Id: <5c8da9d378dee39d9c6063713b093f51d271fa9d.1623825358.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 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(). Cc: Dirk Brandewie Signed-off-by: Viresh Kumar --- drivers/cpufreq/intel_pstate.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 0e69dffd5a76..37ad42926904 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2374,17 +2374,11 @@ 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); + intel_pstate_clear_update_util_hook(policy->cpu); policy->fast_switch_possible = false; return 0; @@ -2451,7 +2445,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 16 06:40:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 461376 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp315726jae; Tue, 15 Jun 2021 23:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtL7qAEQtbniBx29YCblB2gs3NiGMBavESgc9BC0nJFUTj9T7gScsYP2X92nDP0H2S8fqw X-Received: by 2002:a50:fc84:: with SMTP id f4mr2314290edq.252.1623825681368; Tue, 15 Jun 2021 23:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623825681; cv=none; d=google.com; s=arc-20160816; b=D5NOtZfZry5/uhq/PKozwV16obBRqR7FFQCDDIG1lgD4Wgzv6emjiLTRSiig90g6rq bIpKRw5t/7QOls0EbZgxlDR4xr04uFAaGdnYZMvEC+YAcFKeMl5LEbiKGjIONB0HJ9wQ R3fSur5fBdhrYrDW1KwKs+Za9CjJ7cLPb0SgnOvRbAYolLlONFIdZDjZxbwQZgyzuk51 /eC2VhbBOFg/U32CxV+rRpYHiwu3E9hHox6XUiteSGOEHyIYuV4l5N1yFtibuo0dEZH/ BmOAybfuGUl5Y3fFCq+2w3YjJ4El+bBcBiEytSDysvWSSJUHTBP+iY0dy0CTKGu+sXGI wV1Q== 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=Yn/Ed8BFS0Vy5rLTDBwe/6BN9B9t3/X/uVpVORjHMKEs16mTCjPwP+oZQ8bT9LgOO8 fl8htCn8j5FtHRqngu1sJ2+ipH1n73w6PkSWrCm/I3VkZ4qC8UeZeBWgtnLGm+hV9VRB rMDcQMANA0F7TChy+zmAdQkcGHbrwiWdajkc/mlqaog0WnQxzP3OLqQ4ExFhQyx5szO3 ILmzEtfTWtii6g04laIuFcH5Pvwf/vt2WsfCOpX++Rz1elIooNO8EVvSj9OrjW3AfoSq jlcMuOY/79g6Azr+nPnltFYt9Qw0qR2tBtOzx9wZbEar4LIGePcv1XOh2PDJQonIAbQ0 odLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iaSacDYc; 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 du7si1365593ejc.108.2021.06.15.23.41.21; Tue, 15 Jun 2021 23:41:21 -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=iaSacDYc; 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 S231678AbhFPGnX (ORCPT + 8 others); Wed, 16 Jun 2021 02:43:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231665AbhFPGnP (ORCPT ); Wed, 16 Jun 2021 02:43:15 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36BDAC061147 for ; Tue, 15 Jun 2021 23:40:43 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id i34so1145290pgl.9 for ; Tue, 15 Jun 2021 23:40:43 -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=iaSacDYcEtxx/MsUryuoNYhVhvHu4/YAkds2/zlwCB5k3q0y2bYgm4bQ+SkVbx9+6M sL+eo2HDNGjujx3quAQKcufA7TPDTnmQ34Zm2uRuUZQ7EVEg6pRInFALPcFJDi/G4FeU JM+8EF3W3lK3P0olWSBysQvMYp5H1p/T1UHp4EwL9eQra+NRK3mWgqSB10pa6Xm0h6mD Mtavp70tvXNUNPU0w0yhJAvLA9TN2AN66SDTsI1FKMNlUs76adVIbz6RafNE+/xiteUJ k1R4bKmJKLpa2zg5qEmGb0RpLC2SvthSi/zripD16l53LCfCBQ4Cgu8nhWWTxoBznDjc MFZw== 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=RGSQ3rkt8QoryoMbNyjhQDlQczfHt1HJaHhCsEbF5u6S9k7gxNIncqEpSE4uHTfhQm vVW6giXkbDLpR/3VVWOaF8CoBYBDIFhztd+FybHeBo082D9Ji6rEWCCfZg/ttlsk4Mr2 P5beGodJcTec0UQD3wC8T5UuFzH2O54QRHspWWQWUN5rxWki6s5HpO5csStCe2Rni91n e+Kxn1/vjTuaDRVTTYQywQLTlTbfzs2Uan4Rs2xQs4V1Z+Svxcvf2wMdcWVDn+4mkXXN LK/lnTHRQaWLYe55iKEke87lWKL0v1qeyotvtAD9e5q6+Vo9WwqOZHEeKIPSW2TPM6dV WpMA== X-Gm-Message-State: AOAM531ltV3iuPrRgvClrqzBlPprr7DgT+69tnhYPfo/Ww7k1nPoyUMJ PAfB89clGr+9u/nrh3v0jUogbIjNQq+pHA== X-Received: by 2002:aa7:949d:0:b029:2ef:d1ca:ddd3 with SMTP id z29-20020aa7949d0000b02902efd1caddd3mr8026579pfk.39.1623825642747; Tue, 15 Jun 2021 23:40:42 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id s21sm1167876pgo.42.2021.06.15.23.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 23:40:42 -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 V2 3/3] cpufreq: powerenv: Migrate to ->exit() callback instead of ->stop_cpu() Date: Wed, 16 Jun 2021 12:10:28 +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, };