Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5312968pxj; Tue, 22 Jun 2021 21:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkPArAuvzAJHA8Tt+q6XkbcSchC7m+tRC4gc8IesxIc+9Ni31FvJFNjqkS0/opsrCtGvK3 X-Received: by 2002:a6b:6617:: with SMTP id a23mr5360973ioc.0.1624422364015; Tue, 22 Jun 2021 21:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624422364; cv=none; d=google.com; s=arc-20160816; b=08a8RwzeTgRJ96zTv4w6vrvpkSu79UiSrpDYWx2XU+3qYb0tS0Tw6nPj+CSL8DJJL9 z4dP/m+0cCriLSc+BuOzhdSm3LGtt2LwhxmsvzzlfEkOVyTDuDyBz8T0g/q6bes/jZ0n tuRDs9ag3/wsfc8WQegQ5jqtdFvJFksFLdj/8pM4/6y1OoPwqSCCBf/cbyDaTXSOoo5p 7+C/0Hp+qWY7EimkBpCC6lxMQ40LAtEQgM+9eB5Uw0Dfr01jodYJkqk23iEIhE2T2rGy rJB99EfVeOGcMhVYHJ0/ArdhWCCNisnZqNlPLYCxmhA7E3USIxMQjK2T0xF7NN+W7aAP RBVQ== 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=GL9laJDSWdiYqcnWqE/K/Ly+ZbYku13wRkEWMthpKFJlgiag70r2+cnXOTYIAqIWuD 2IjLnWG4uxBT2dp3OFtP5yBauOsCGQ8T+1jczVkszZUtG9M2NVIzSmxW0fK94IXNjMd0 wgAxIerJ8ChYRfSJxroXPMYxnM2Lx3EbEO4P+T3eUhgW9NGO7lCSUjxaM7jI/O18SsYb KqpDUNmOn4XTXnV+G8+aQOIZRlUZbYknnvNPUzoepdNv8bxsEsCjC4bXo91h8w32Fils SEZGfmWltVuY3y9VofiNesUZwDh1eDxCoTSwc02eCIrvbhRVnGSWnArgWNYCi2FOjGK4 BnQw== 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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 a17si886065ilk.149.2021.06.22.21.25.52; Tue, 22 Jun 2021 21:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S230415AbhFWE1Z (ORCPT + 99 others); Wed, 23 Jun 2021 00:27:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhFWE1W (ORCPT ); Wed, 23 Jun 2021 00:27:22 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8F8C061756 for ; Tue, 22 Jun 2021 21:25:05 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id t32so1318246pfg.2 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=Lgk2O2/Rv6aeE6zr4dJksJGEFTUcBCOb6vkzMxyULkezl2QVtWyCIGbMLKfEqCCVWn 9u8Zt/HQmibf81KHSXwADTL8jog/4EUYz3PeP5g0WUeI90/Dm8Euc87avcKP5TFAUjJx +TW5qImIOOIu9Upt4Fa/xvM7dhCu0yfLkotyqHwjFiyL0tR9EIcnT0lM21jl0TX86so2 amEA7xrehUczu6Pf7apVueFQO0kDd/8cA0TjtBmW+O9kVXeL/Yd51Lr54WhlEdgcjIvS lgmjrNiD44MXUOEKb4NM0jKRKZ0mLXb3HNa6Tfo82XCh+Z1m+I5gPmQVZXWVxje363WU JGdQ== X-Gm-Message-State: AOAM530bME298OUxLrPwtSlfs5Vw1O46J4ez7GtpnlXxS1rdHE3tY09M rVcnTZOJ/z7ipqMKNQcdp0bnZg== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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, }; -- 2.31.1.272.g89b43f80a514