From patchwork Tue Aug 12 11:33:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 4712321 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 86C36C0338 for ; Tue, 12 Aug 2014 11:34:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEE6E20166 for ; Tue, 12 Aug 2014 11:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD57120127 for ; Tue, 12 Aug 2014 11:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751904AbaHLLeF (ORCPT ); Tue, 12 Aug 2014 07:34:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36506 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751850AbaHLLeE (ORCPT ); Tue, 12 Aug 2014 07:34:04 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7CBXwWu007277 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Aug 2014 07:33:58 -0400 Received: from [10.16.186.145] (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7CBXuar032393; Tue, 12 Aug 2014 07:33:57 -0400 Message-ID: <53E9FBA4.2080609@redhat.com> Date: Tue, 12 Aug 2014 07:33:56 -0400 From: Prarit Bhargava User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131028 Thunderbird/17.0.10 MIME-Version: 1.0 To: Viresh Kumar CC: Stephen Boyd , Saravana Kannan , "Rafael J. Wysocki" , Linux Kernel Mailing List , Lenny Szubowicz , "linux-pm@vger.kernel.org" Subject: Re: [PATCH] cpufreq, store_scaling_governor requires policy->rwsem to be held for duration of changing governors [v2] References: <53DB6B81.6050400@redhat.com> <53DBCBE8.6010809@codeaurora.org> <53DBE764.8050109@redhat.com> <53DBEC27.7050803@codeaurora.org> <53E0B657.4070007@redhat.com> <53E1556B.5070304@codeaurora.org> <53E1FEE5.80305@redhat.com> <20140806150831.GB32301@codeaurora.org> <53E35122.3040806@redhat.com> In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 08/12/2014 05:03 AM, Viresh Kumar wrote: > On 7 August 2014 15:45, Viresh Kumar wrote: >> On 7 August 2014 15:42, Prarit Bhargava wrote: >>> That should have done it. What are your CPUFREQ configs? >> >> You can check the same .config I attached last time for that :) >> >> CONFIG_CPU_FREQ=y >> CONFIG_CPU_FREQ_GOV_COMMON=y >> CONFIG_CPU_FREQ_STAT=y >> CONFIG_CPU_FREQ_STAT_DETAILS=y >> # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set >> # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set >> # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set >> CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y >> CONFIG_CPU_FREQ_GOV_PERFORMANCE=y >> CONFIG_CPU_FREQ_GOV_POWERSAVE=y >> CONFIG_CPU_FREQ_GOV_USERSPACE=y >> CONFIG_CPU_FREQ_GOV_ONDEMAND=y >> CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y Viresh, sorry for my late reply -- I got distracted by another issue. >> >> >> Anyway, has anybody tried to test what I have been trying now? >> @Prarit: You can try that on your x86 box as well, which has a >> single cluster or group of CPUs sharing clock line. > Okay, this is what I have and I can reproduce this *easily* 100% of the time. I've used your above config options and have enabled LOCKDEP. In order to restore the locking, I've applied the following patch to the cpufreq core (sorry for the cut-and-paste): I do a cat /sys/devices/system/cpu/cpu2/cpufreq/conservative/* echo ondemand > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor and then I immediately see the stack trace. P. > Ping!! > --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d9fdedd..dfda238 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2192,9 +2192,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *polic /* end old governor */ if (old_gov) { __cpufreq_governor(policy, CPUFREQ_GOV_STOP); - up_write(&policy->rwsem); __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); - down_write(&policy->rwsem); } /* start new governor */ @@ -2203,9 +2201,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *polic if (!__cpufreq_governor(policy, CPUFREQ_GOV_START)) goto out; - up_write(&policy->rwsem); __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); - down_write(&policy->rwsem); } /* new governor failed, so re-start old one */ I've modified the acpi-cpufreq driver to include (sorry for the cut-and-paste) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index b0c18ed..97653c3 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -884,6 +884,9 @@ static struct freq_attr *acpi_cpufreq_attr[] = { }; static struct cpufreq_driver acpi_cpufreq_driver = { + .flags = CPUFREQ_STICKY | + CPUFREQ_HAVE_GOVERNOR_PER_POLICY | + CPUFREQ_NEED_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = acpi_cpufreq_target, .bios_limit = acpi_processor_get_bios_limit,