From patchwork Wed Jun 23 06:01:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 465889 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1426871jao; Tue, 22 Jun 2021 23:01:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMYsfuOATsgdgv956LGd3KusIZg929lIOyDfjfgNqPm2sKk2vwSbJO+5+sH2wmByx4GIX4 X-Received: by 2002:a6b:3119:: with SMTP id j25mr5577664ioa.64.1624428087701; Tue, 22 Jun 2021 23:01:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624428087; cv=none; d=google.com; s=arc-20160816; b=sBIRLn7Drdu2jQ4loke8VDGHWFoastrxtPMWrkq7LbI4+U1v8eK8iSM8kTWkDekvmn YKoSHGl5s+w8zFUnUOCkYlFwI+I6edhrzsydolM+XvKaVUZIgzgiVDknYvSfsoIlS2KN gBzYdUpDIux3A2zWS4hFUZeIttDyH1+SXjm7R5y7UmKqW83E8an/S8x6fSbL3cEfpPV6 +Odsd+mYdrsiqCdm5XxIViO16364vMsTor98hL2lWqai5jJibXyouZVJkV5vbnyBuXrN ngqH5KMmYL45fgzi1byBdRBLmhy2nZcCj5cwJ2ZL0layT7El+hoS95zl0waWAm0sOaE/ 2vRQ== 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=vmGY3Ot51goPk1p3Lpw0VjAdttnKcLZKJGX8mraQh2o=; b=nSg5jjNx6rqzsM/wJdqatL42pOwAjJIRIBLVKkAtl5lseJHWXkw3SvWxEPhOnD7YnB LEDDEqxOYqHJwPSdQWj/OpY2SzCWjcaq6S4B0sCn87E2AeyB0JPxkcgWWPKfcwbxpSd4 U+Afi5Uj8i3gr532b29Z2BKW/EzhHePSJoctNJk2fu/shSS4GC42+eGurC63WW10EuK/ Ut7PzvqThL84Fz33Ug2O6u0p66jBldA72rZzGiblPITXFUWexpZQ1pw/iOkgfeGo7xun u/XSBNmSHv9++qpn6vjEW1UPH2IMKBvRG/wEs+Rh0eI/QMuqhUFzFKRKHBA+wFI4OGCA ti/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xiOA5cyT; 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 u18si23249266iol.87.2021.06.22.23.01.27; Tue, 22 Jun 2021 23:01:27 -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=xiOA5cyT; 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 S229726AbhFWGDm (ORCPT + 8 others); Wed, 23 Jun 2021 02:03:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbhFWGDm (ORCPT ); Wed, 23 Jun 2021 02:03:42 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EED9C061574 for ; Tue, 22 Jun 2021 23:01:25 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id o21so593587pll.6 for ; Tue, 22 Jun 2021 23:01:25 -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=vmGY3Ot51goPk1p3Lpw0VjAdttnKcLZKJGX8mraQh2o=; b=xiOA5cyTFfc7S50F/mYLiqzVw1IFhFzB9y/ImgSmau0rWxS23AkEhsBHcXg75Y1iF9 MVVrrKTQ89JaDL72+ucoBqraZHPUx5IR4o2U3oob+lry76W5SVF4GmHCN7T3OABWCk0S X3ZWZTkbpww41Hw/mIoSM6Ouyx7r2WJN6e1H3ToMQnfX8bS2/VtW4zN8S4uREHvB7Tdt o/uLYdYmbP6xWREgQMFHwiaCV9UkQ1o+zCphSE1EDYg87osTGIeC8HnvOt/6JVaopqoa oT6OVjWnvK+CDAuYQKY9bYPt5XMvMPc/MWYke0ZfX4kuMa2Uy2bAv9EFBfxNAvAC9CEM k7iA== 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=vmGY3Ot51goPk1p3Lpw0VjAdttnKcLZKJGX8mraQh2o=; b=K4nw/N3ZJA3GQiD4bBBI1JIABGv8/yQ5+6RYQNc2St/ky11EAX32ZwZLeXszDAJ76t aM1NNrAFIkf1G5ynhLacc9CvqOoGJGaW+fDKi2GcXvrLA3TU0XJRAFz5ln3sKAeziN9T RQDVIUMN3Gv6Qhv51NURPevqL/MHZUPwVxTcbJzudCaqzXHCpGSm91GFNqfwpQK2BnjX s8cXcr4sQ8EJxbzc4u74jjVvlrUY12r6qobb6UrO0uLbiGfDxhjAGSIZKE55lfu4Md2Y WJGtu+DHVmzkJLdyZtQ8NDU8uqehgz3DmVQyqS47+6h+9zt3DzI6GzHFyGGmTpey/ocN XwvQ== X-Gm-Message-State: AOAM5326IgwrTpD/Noh5GcIZvDnVmNXm6WUwGSBkPm8OZHQfBo3VTxBR uWQgj7xtcwREogL5ErJ7qMsyxw== X-Received: by 2002:a17:90a:fa83:: with SMTP id cu3mr7985858pjb.164.1624428084712; Tue, 22 Jun 2021 23:01:24 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id x20sm1122301pfh.112.2021.06.22.23.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 23:01:23 -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.1 3/4] cpufreq: powernv: Migrate to ->exit() callback instead of ->stop_cpu() Date: Wed, 23 Jun 2021 11:31:14 +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 --- V4->V4.1: - s/powerenv/powernv/ 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, };