Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3404461pxj; Sun, 20 Jun 2021 20:12:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcsEi6u2V3p8jV76wADnYBs6quOgIJlHs4JYawOrI7Tf2OSa5rhqoIitQS/EX0oHkBSHdJ X-Received: by 2002:a92:cbd0:: with SMTP id s16mr16183658ilq.19.1624245133145; Sun, 20 Jun 2021 20:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624245133; cv=none; d=google.com; s=arc-20160816; b=B6xp4ZqfezEpHh/UklHo2lonAUZKZQOs0R3FIN0P8WNDwtW7bD0JAoRrJ1ITGxboN3 s1G8i4acOU6i1+qCDInqwLuK92Sykkcp82hsXHCYF/kaexekgEf4FtMXud1HCJYW8aH6 uWivxlF1BJhpNde6H5b+C+4is/QgwCQG5B1ppo9qwqbIm9/plQ2XnRaR7JThtDhierNV HDOWO2ZQRDmYxx7ehFmThww48S/2AsfwsEondx0sVl0V+2evqXJrkY3QBNLQfkd+yVb0 IxAGPJ0NGB4pjokojB2NFmdDYIDgwyvrSpJqXKz4O2iuvrlKvfXBqKzEWaV1UOIQzoCL tNtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=m3qVLmPqXTkn2QcO19eSXMz6mJEyfIae5C0oRCwTDbw=; b=Sylduw3tg6fSM155u0AhOCmlx/N8XqbGOzFzKr4bW9cNmoVPRI4UMPfAPjbgomU2gd eopTDOQOOvA4vx9i1UHIJ3YsT5dU5N8KTOT9s+Vjm8+ouiu2ZtABiaxefMGh1MAZBJ8a O37nsGZAOIIRpvCrMWOkPVlRg4n+6SNJY/gXUGtP4AKZVOm0sX8TW7HjF/ri7TKxVBRY OHv4EkTl0ZsnZaGfMlur59sOY0zgoguKqKGnNIrebJPdkxUN2SltsdbkvFmNxUt3P9i/ j+6Mxt4MXW7rZtFBCUJVc3tbX5cfFVQsVJ7b7w4CDslFedsU3Nxpsx1bTVBY2khQKwBO Awrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CNIyupoY; 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 o1si4546779ils.95.2021.06.20.20.11.59; Sun, 20 Jun 2021 20:12:13 -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=CNIyupoY; 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 S229984AbhFUDMJ (ORCPT + 99 others); Sun, 20 Jun 2021 23:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbhFUDMH (ORCPT ); Sun, 20 Jun 2021 23:12:07 -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 EA85CC061756 for ; Sun, 20 Jun 2021 20:09:52 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id e22so6801091pgv.10 for ; Sun, 20 Jun 2021 20:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=m3qVLmPqXTkn2QcO19eSXMz6mJEyfIae5C0oRCwTDbw=; b=CNIyupoYyrLVei4yPnyB4/Fv9SicuTjksAdw3wdy6B/wiCoIifqizrppLUsmOJX9iq V/EJopL6ZI+zv9TNYFh+BlVq9GD601W+4uJvDfReSSSLjSMJI6/ff9KXf4HlP5YUb1T2 L5LgbPjCWaiqVxmjrbvhSJ+hYEHTs5Sl/Jq475VtgIGAbjSBumqI8BwRvarHScN/i957 UWQKcC32pOXuQs1pGNgdx4QmkgE6+LFIWxqPSUYHBvd95vw6JaOKNyVADdHZt+Eu3ffr YzjZDFgI6MLRJ+bqPhlebRViBme5hhplaY8WZCczTDHfObZs3dhC2j+jm9C4DDTCVIrK OzJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=m3qVLmPqXTkn2QcO19eSXMz6mJEyfIae5C0oRCwTDbw=; b=fRN2fHNRFI5vj7HhJr5y3M0gcPKXUdaa33LrQankrRl1Zu00xx5H/mwgWJuigKNeyc UgSZYQNXPXKGoUKW1fmtUdu6JEWeYBBWEZBGqBOiBAjvYka4Hn+4POnSsU7jHPO6G+L4 6qDmczN1dVEzyAJaP284116ZQOAyp+5o47Guw6XxrmtGhkMClbtc2gpbIGlNY8Wm4LbL /BIQVk14usR8fSAr81EVHN/L2/SYKQgDQi+HmyZLiO1eaF/zgxaRQFOIwvBICvK0OCBj JExtFxM+nqBQkUywqE5Jpk6ytgKtqFXCayVg79Wn6g2JJ2SnEf+JdpcCekd93WIpzyrp bh2Q== X-Gm-Message-State: AOAM530iaf+UyYlOFQ14Yq5BwA/s/vetYXl4Iid5n3hknrpUUNTb5HA1 x49K87z23yGPdMBg1hMQ4bCE3snHVj7v8w== X-Received: by 2002:a63:1324:: with SMTP id i36mr21597068pgl.44.1624244992132; Sun, 20 Jun 2021 20:09:52 -0700 (PDT) Received: from localhost ([136.185.134.182]) by smtp.gmail.com with ESMTPSA id j10sm10610139pjz.36.2021.06.20.20.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Jun 2021 20:09:51 -0700 (PDT) Date: Mon, 21 Jun 2021 08:39:49 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Rafael Wysocki , Srinivas Pandruvada , Len Brown , Linux PM , Vincent Guittot , Dirk Brandewie , Linux Kernel Mailing List Subject: Re: [PATCH V3 2/3] cpufreq: intel_pstate: Migrate away from ->stop_cpu() callback Message-ID: <20210621030949.tng5xzq7dm7ngaez@vireshk-i7> References: <5c8da9d378dee39d9c6063713b093f51d271fa9d.1623825358.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18-06-21, 14:00, Rafael J. Wysocki wrote: > On Fri, Jun 18, 2021 at 5:22 AM Viresh Kumar wrote: > > > > 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); > > This change is not needed now, because ->offline always runs before > ->exit if present. Not necessarily, we don't call ->offline() for many error paths in cpufreq_online(). offline() only comes into play after driver is registered properly once. -- viresh