From patchwork Mon Aug 25 10:41:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 35894 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7366E203C0 for ; Mon, 25 Aug 2014 10:41:33 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf106907571pde.7 for ; Mon, 25 Aug 2014 03:41:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=HWDRAswZi6Qvu/NYsj7Mo2stJyk600nKnCqLmmOO8pE=; b=V1Rz2WtjBs3qAM7Sr3O9sr3DSeFN1UoL/HXziwY+rLRn0byFyMautPeBUkTadj8uv/ OSPnR3ZUPquPp5SbZrs3LJkFrpZJksH8pqob6moZIr3IQZNv6wt4XKvoi3/CnX2IGOG0 VJtlvLReQ1Ts9LOr/enJR6tscpNqPDHPSNfPiFYhWIQ5ENRXuWxaP4/qzXiX/1c4t/Mp /WXwuxitUYZkuVanPO4eBuCk3bFLfqGzk3XqEQSSO3a7luYpz3COF9pSTrIRQ/ZFlU// 9lknNBGvti2txDf6T4s6FEJOLsmc35swEXQ1/97Zkr4OQerl17z7ddbK0/Kgzd8rYlii WFCg== X-Gm-Message-State: ALoCoQkRL7RvHwcavVPqLf7BhlDpWvJd6tb4T76FfQ01sQCfnetCTBJJTD9sVUwCpCiRuQjfq+lN X-Received: by 10.69.29.234 with SMTP id jz10mr13742180pbd.1.1408963287899; Mon, 25 Aug 2014 03:41:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.113 with SMTP id e104ls1983085qgd.33.gmail; Mon, 25 Aug 2014 03:41:27 -0700 (PDT) X-Received: by 10.52.164.80 with SMTP id yo16mr4626099vdb.44.1408963287798; Mon, 25 Aug 2014 03:41:27 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id ym14si17126386vdc.50.2014.08.25.03.41.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 03:41:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so15116079vcb.28 for ; Mon, 25 Aug 2014 03:41:27 -0700 (PDT) X-Received: by 10.220.202.9 with SMTP id fc9mr5198106vcb.40.1408963286802; Mon, 25 Aug 2014 03:41:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp106952vcb; Mon, 25 Aug 2014 03:41:26 -0700 (PDT) X-Received: by 10.70.7.164 with SMTP id k4mr27824054pda.6.1408963285824; Mon, 25 Aug 2014 03:41:25 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yv2si52684329pbc.46.2014.08.25.03.41.25 for ; Mon, 25 Aug 2014 03:41:25 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755202AbaHYKlX (ORCPT + 26 others); Mon, 25 Aug 2014 06:41:23 -0400 Received: from mail-oi0-f46.google.com ([209.85.218.46]:54595 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753506AbaHYKlW (ORCPT ); Mon, 25 Aug 2014 06:41:22 -0400 Received: by mail-oi0-f46.google.com with SMTP id i138so9540521oig.33 for ; Mon, 25 Aug 2014 03:41:21 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.80.33 with SMTP id o1mr1444033obx.78.1408963281728; Mon, 25 Aug 2014 03:41:21 -0700 (PDT) Received: by 10.182.233.170 with HTTP; Mon, 25 Aug 2014 03:41:21 -0700 (PDT) In-Reply-To: References: <1408015178-21745-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> <53F57E51.4060200@gmail.com> <53F6AF66.10204@linux.vnet.ibm.com> Date: Mon, 25 Aug 2014 16:11:21 +0530 Message-ID: Subject: Re: [PATCH] cpufreq: powernv: Register the driver with reboot notifier From: Viresh Kumar To: Preeti U Murthy Cc: Shilpasri G Bhat , "Rafael J. Wysocki" , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List , Shilpasri G Bhat , "linuxppc-dev@lists.ozlabs.org" Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 25 August 2014 16:00, Viresh Kumar wrote: > Its not that I am doubting if this will work or not. But this Hack is using > routines not meant for this purpose. And that being a core routine, > things aren't that straightforward anymore. Well if you want a working HACK for solving this, what about following ? /* @@ -317,6 +321,19 @@ static struct cpufreq_driver powernv_cpufreq_driver = { .attr = powernv_cpu_freq_attr, }; +static int powernv_cpufreq_reboot_notifier(struct notifier_block *nb, + unsigned long action, void *unused) +{ + /* TODO: Get policy & index */ + powernv_cpufreq_target_index(policy, index); + rebooting = true; + return NOTIFY_DONE; +} + +static struct notifier_block powernv_cpufreq_reboot_nb = { + .notifier_call = powernv_cpufreq_reboot_notifier, +}; + static int __init powernv_cpufreq_init(void) { int rc = 0; @@ -328,12 +345,15 @@ static int __init powernv_cpufreq_init(void) return rc; } - return cpufreq_register_driver(&powernv_cpufreq_driver); + rc = cpufreq_register_driver(&powernv_cpufreq_driver); + register_reboot_notifier(&powernv_cpufreq_reboot_nb); + return rc; } module_init(powernv_cpufreq_init); static void __exit powernv_cpufreq_exit(void) { + unregister_reboot_notifier(&powernv_cpufreq_reboot_nb); cpufreq_unregister_driver(&powernv_cpufreq_driver); } module_exit(powernv_cpufreq_exit); --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index af49688..d6a1742 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -34,6 +34,7 @@ #define POWERNV_MAX_PSTATES 256 static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1]; +static bool rebooting; /* * Note: The set of pstates consists of contiguous integers, the @@ -283,6 +284,9 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy, { struct powernv_smp_call_data freq_data; + if (unlikely(rebooting)) + return -EBUSY; + freq_data.pstate_id = powernv_freqs[new_index].driver_data;