From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757387AbaCFBMn (ORCPT ); Wed, 5 Mar 2014 20:12:43 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:60845 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1756643AbaCFBMl (ORCPT ); Wed, 5 Mar 2014 20:12:41 -0500 From: "Rafael J. Wysocki" To: Saravana Kannan Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com Subject: Re: [PATCH V2 3/3] cpufreq: initialize governor for a new policy under policy->rwsem Date: Thu, 06 Mar 2014 02:27:51 +0100 Message-ID: <8531650.WA9Z5RdLht@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.13.0+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <5317CAE9.5090107@codeaurora.org> References: <98b7ae22d936456bf830aa749556a115969cfa47.1393904428.git.viresh.kumar@linaro.org> <1571634.sBIk9PhU1o@vostro.rjw.lan> <5317CAE9.5090107@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, March 05, 2014 05:10:01 PM Saravana Kannan wrote: > On 03/05/2014 05:06 PM, Rafael J. Wysocki wrote: > > On Thursday, March 06, 2014 02:04:39 AM Rafael J. Wysocki wrote: > >> On Tuesday, March 04, 2014 11:44:01 AM Viresh Kumar wrote: > >>> policy->rwsem is used to lock access to all parts of code modifying struct > >>> cpufreq_policy but wasn't used on a new policy created from __cpufreq_add_dev(). > >>> > >>> Because of which if we call cpufreq_update_policy() repeatedly on one CPU and do > >>> offline/online of another CPU then we might see these crashes: > >>> > >>> Unable to handle kernel NULL pointer dereference at virtual address 00000020 > >>> pgd = c0003000 > >>> [00000020] *pgd=80000000004003, *pmd=00000000 > >>> Internal error: Oops: 206 [#1] PREEMPT SMP ARM > >>> > >>> PC is at __cpufreq_governor+0x10/0x1ac > >>> LR is at cpufreq_update_policy+0x114/0x150 > >>> > >>> ---[ end trace f23a8defea6cd706 ]--- > >>> Kernel panic - not syncing: Fatal exception > >>> CPU0: stopping > >>> CPU: 0 PID: 7136 Comm: mpdecision Tainted: G D W 3.10.0-gd727407-00074-g979ede8 #396 > >>> > >>> [] (notifier_call_chain+0x40/0x68) from [] (__blocking_notifier_call_chain+0x40/0x58) > >>> [] (__blocking_notifier_call_chain+0x40/0x58) from [] (blocking_notifier_call_chain+0x14/0x1c) > >>> [] (blocking_notifier_call_chain+0x14/0x1c) from [] (cpufreq_set_policy+0xd4/0x2b8) > >>> [] (cpufreq_set_policy+0xd4/0x2b8) from [] (cpufreq_init_policy+0x30/0x98) > >>> [] (cpufreq_init_policy+0x30/0x98) from [] (__cpufreq_add_dev.isra.17+0x4dc/0x7a4) > >>> [] (__cpufreq_add_dev.isra.17+0x4dc/0x7a4) from [] (cpufreq_cpu_callback+0x58/0x84) > >>> [] (cpufreq_cpu_callback+0x58/0x84) from [] (notifier_call_chain+0x40/0x68) > >>> [] (notifier_call_chain+0x40/0x68) from [] (__cpu_notify+0x28/0x44) > >>> [] (__cpu_notify+0x28/0x44) from [] (_cpu_up+0xf4/0x1dc) > >>> [] (_cpu_up+0xf4/0x1dc) from [] (cpu_up+0x5c/0x78) > >>> [] (cpu_up+0x5c/0x78) from [] (store_online+0x44/0x74) > >>> [] (store_online+0x44/0x74) from [] (sysfs_write_file+0x108/0x14c) > >>> [] (sysfs_write_file+0x108/0x14c) from [] (vfs_write+0xd0/0x180) > >>> [] (vfs_write+0xd0/0x180) from [] (SyS_write+0x38/0x68) > >>> [] (SyS_write+0x38/0x68) from [] (ret_fast_syscall+0x0/0x30) > >>> > >>> Fix these by taking locks at appropriate places in __cpufreq_add_dev() as well. > >>> > >>> Reported-by: Saravana Kannan > >>> Suggested-by: Srivatsa S. Bhat > >>> Signed-off-by: Viresh Kumar > >> > >> I've rebased this one on top of 3.14-rc5 and queued it up for 3.14-rc6. > >> > >> Please check the bleeding-edge branch for the result. > > > > Actually, I think I'll queue up [2-3/3] for 3.14-rc6 instead. > > > > Pretty close to having this tested and reported back. So, if you can > wait, that would be better. Should probably see an email by Fri evening PST. OK It won't hurt if they stay in bleeding-edge/linux-next till then, though. Thanks! -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.