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, };