Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1146536pxj; Fri, 18 Jun 2021 00:06:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzT93ZZ8f3WOk8yO7GD8J7gtGEhg5tw2HHYNgryvgSu+RNbfiEYqO65zA+/ptF1nVc9lVxC X-Received: by 2002:a92:c705:: with SMTP id a5mr6400032ilp.36.1624000011058; Fri, 18 Jun 2021 00:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624000011; cv=none; d=google.com; s=arc-20160816; b=tDgSIGBJpytjQHv/vRIu1pZYuGd5vFarXzSU7aNyoG6mliq+wft9GsGvYFvj4SHB/F sBOA/nkycl6fml2++b1hDSsD6vFbZC/kP67VRl4Nf2JVNW8bavmFA8T5E8VzcvzB9Qhr LCAwSngnx3qRg/8tJROTdEQbgq7YpMnWWjWrBYHbApUNjxWOSs7O38X7+kxUhpCtHpIy 6tMaLbsRWpyhZdLQ9kRUz6RU2Rn0OSb5UWt2c9epyi0a1kkzEbJ5vcgsrsvcKLuVDhaJ jFoF6FJWEgletndQQpCVTAS0Ue5xpks2Yac0Kok693Mqcsv3IDMI61TDoopf9srTjcEP LrJA== 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=MqSK1zOymUxxq/T/RdAPgHK3/+Z9VBscAJFGiuft+WE=; b=Vwz2smvHGH+aFOUS5nvFgWpji4Q6djFlXoCkmQZRnalWiOTZuegkUZK5LZo4m86qcJ fNsyOKDTTtByNy2KUqD45g3DmKrOu/0GJ8H3pHGU0qgXbcGwJshjJz6JonCMn0BjlO7E S9iHioHGh6Uzrtzp8tU60JTJ/DQHT3jTakQUbAl5REpBqTh3sopVoOirRDV0yyWfw0uR k161/fA06lTvY3jFyQBb6fpCXKKnIUhVxSCNnVq4Pmrg5R5E/hofqxOFanxAWSRcR77m DtO9zYr7lSqU1+Cgn3hxdVFdje1jVG/OtTb2CNn2sZmguAxFOl25rMdN+xuMUIGV83tJ b7sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jP8eVoUm; 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 p18si8741941iop.37.2021.06.18.00.06.38; Fri, 18 Jun 2021 00:06:50 -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=jP8eVoUm; 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 S231695AbhFRDYv (ORCPT + 99 others); Thu, 17 Jun 2021 23:24:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbhFRDYu (ORCPT ); Thu, 17 Jun 2021 23:24:50 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5019FC06175F for ; Thu, 17 Jun 2021 20:22:41 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id o10-20020a17090aac0ab029016e92770073so5038316pjq.5 for ; Thu, 17 Jun 2021 20:22:41 -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=MqSK1zOymUxxq/T/RdAPgHK3/+Z9VBscAJFGiuft+WE=; b=jP8eVoUmuigO/jQApq8Ze876NJSFHzAqT6HwtfW8AAg9FbfPQhrfV2TZCkRyjjH5HO WicCMQs4wDMQWSlcOJYGarpinR3uniubQcC2kDvhsPKihq7qtzppn6+s+1uxTZCGiQbl G+ahlp5ARFwSHmojJKhhWbaV9sRfAXxmQ069tTJQ8YIMC/c7dzy5w4i0W1HUDA4YJ3Wj A+ffuYVHlur3Ui8R0FAtJz60rMGB1DbnjbhhK3ZmYaMEDb8bRKrj5FM+XGpSZgIgVTI7 rHhx85acp5Oq2bhRacLWgBfbgMun3tBf3cvoCT+ocKOQj8CSzbLxgncrxmvPlvmwNm4q 9rPQ== 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=MqSK1zOymUxxq/T/RdAPgHK3/+Z9VBscAJFGiuft+WE=; b=OtKCMk5p2rXidDjK/tiefQRSr24ZzRqBz7hnhd5Q091aVXlJY/HyNdccqsEP9tnqYd oS/xz9YVS0S5jEei2Eiw+TvdpKAdJZfe9j3zu6ZccIAMTM5eOoBpQV2pCo1cVKqJlxs/ TOp3/ck1iZ6T3iH8B7uYHC+BMD1t96xKCx+hXxKbSoTGisgaYc+bzLK/wNY8Gp0FwauH ZQEVsbGrBy+Mci3YTolMHfnNIZeaI+pp8eOjL2DzWXuCRjVDIhfRyyHgHG1k3rhPv5Wo Nioi9maF+ElWBah8k38Zc3RAogpu7OyLp7ANgtuNzD1TId+rM2cNwN0vNQDhuBa3RoAr /HZA== X-Gm-Message-State: AOAM531pmx2UOY2XEKV+6KRINFFiCUNFqQJXgxK8ytdhfLWnqDTUaRMg TN6CeCCeMxM6zUSpN/eDdX2JgQ== X-Received: by 2002:a17:90a:f0c2:: with SMTP id fa2mr7498294pjb.191.1623986560775; Thu, 17 Jun 2021 20:22:40 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id 23sm6122897pjw.28.2021.06.17.20.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 20:22:40 -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 V3 2/3] cpufreq: intel_pstate: Migrate away from ->stop_cpu() callback Date: Fri, 18 Jun 2021 08:52:36 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: <5c8da9d378dee39d9c6063713b093f51d271fa9d.1623825358.git.viresh.kumar@linaro.org> References: <5c8da9d378dee39d9c6063713b093f51d271fa9d.1623825358.git.viresh.kumar@linaro.org> 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 to separately call stop_cpu() for cpufreq drivers. Migrate to using the exit() and offline() callbacks instead of stop_cpu(). We need to clear util hook from both the callbacks, exit() and offline(), since it is possible that only exit() gets called sometimes (specially on errors) or both get called at other times. intel_pstate_clear_update_util_hook() anyway have enough protection in place if it gets called a second time and will return early then. Cc: Dirk Brandewie Signed-off-by: Viresh Kumar --- V2->V3: - Update intel_pstate_cpu_offline() as well. - Improved commit log. drivers/cpufreq/intel_pstate.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 0e69dffd5a76..8f8a2d9d7daa 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,17 +2376,12 @@ 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 +2448,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, -- 2.31.1.272.g89b43f80a514