From patchwork Tue Aug 27 22:01:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 2850399 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 2CE7ABF546 for ; Tue, 27 Aug 2013 22:01:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4861A20399 for ; Tue, 27 Aug 2013 22:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 173AF2037D for ; Tue, 27 Aug 2013 22:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753686Ab3H0WB3 (ORCPT ); Tue, 27 Aug 2013 18:01:29 -0400 Received: from smtp.codeaurora.org ([198.145.11.231]:43023 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753261Ab3H0WB2 (ORCPT ); Tue, 27 Aug 2013 18:01:28 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E0AF013EF33; Tue, 27 Aug 2013 22:01:27 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id CC79F13EFA7; Tue, 27 Aug 2013 22:01:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from sboyd-linux.qualcomm.com (i-global252.qualcomm.com [199.106.103.252]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0B62A13EF33; Tue, 27 Aug 2013 22:01:26 +0000 (UTC) From: Stephen Boyd To: Viresh Kumar Cc: linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J . Wysocki" Subject: [PATCH] cpufreq: Don't use smp_processor_id() in preemptible context Date: Tue, 27 Aug 2013 15:01:24 -0700 Message-Id: <1377640884-16827-1-git-send-email-sboyd@codeaurora.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1377629249-1177-1-git-send-email-sboyd@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Workqueues are preemptible even if works are queued on them with queue_work_on(). Let's just use the policy->cpu argument here instead of using smp_processor_id() to silence the warning. BUG: using smp_processor_id() in preemptible [00000000] code: kworker/3:2/674 caller is gov_queue_work+0x28/0xb0 CPU: 0 PID: 674 Comm: kworker/3:2 Tainted: G W 3.10.0 #30 Workqueue: events od_dbs_timer [] (unwind_backtrace+0x0/0x11c) from [] (show_stack+0x10/0x14) [] (show_stack+0x10/0x14) from [] (debug_smp_processor_id+0xbc/0xf0) [] (debug_smp_processor_id+0xbc/0xf0) from [] (gov_queue_work+0x28/0xb0) [] (gov_queue_work+0x28/0xb0) from [] (od_dbs_timer+0x108/0x134) [] (od_dbs_timer+0x108/0x134) from [] (process_one_work+0x25c/0x444) [] (process_one_work+0x25c/0x444) from [] (worker_thread+0x200/0x344) [] (worker_thread+0x200/0x344) from [] (kthread+0xa0/0xb0) [] (kthread+0xa0/0xb0) from [] (ret_from_fork+0x14/0x3c) Signed-off-by: Stephen Boyd --- Also found this one. I'm tracking down a pretty bad hotplug/sysfs race on 3.10. I've applied all the stable patches but I'm seeing this still. I'll start another thread on this WARNING: at kernel/mutex.c:341 __mutex_lock_slowpath+0x14c/0x410() DEBUG_LOCKS_WARN_ON(l->magic != l) Modules linked in: CPU: 0 PID: 1960 Comm: sh Tainted: G W 3.10.0 #32 [] (unwind_backtrace+0x0/0x11c) from [] (show_stack+0x10/0x14) [] (show_stack+0x10/0x14) from [] (warn_slowpath_common+0x4c/0x6c) [] (warn_slowpath_common+0x4c/0x6c) from [] (warn_slowpath_fmt+0x2c/0x3c) [] (warn_slowpath_fmt+0x2c/0x3c) from [] (__mutex_lock_slowpath+0x14c/0x410) [] (__mutex_lock_slowpath+0x14c/0x410) from [] (mutex_lock+0x20/0x3c) [] (mutex_lock+0x20/0x3c) from [] (cpufreq_governor_dbs+0x568/0x5f8) [] (cpufreq_governor_dbs+0x568/0x5f8) from [] (__cpufreq_governor+0xdc/0x1a4) [] (__cpufreq_governor+0xdc/0x1a4) from [] (__cpufreq_set_policy+0x278/0x2c0) [] (__cpufreq_set_policy+0x278/0x2c0) from [] (store_scaling_min_freq+0x80/0x9c) [] (store_scaling_min_freq+0x80/0x9c) from [] (store+0x58/0x90) [] (store+0x58/0x90) from [] (sysfs_write_file+0x100/0x148) [] (sysfs_write_file+0x100/0x148) from [] (vfs_write+0xcc/0x174) [] (vfs_write+0xcc/0x174) from [] (SyS_write+0x38/0x64) [] (SyS_write+0x38/0x64) from [] (ret_fast_syscall+0x0/0x30) drivers/cpufreq/cpufreq_governor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index b9b20fd..523af48 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -137,7 +137,7 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy, return; if (!all_cpus) { - __gov_queue_work(smp_processor_id(), dbs_data, delay); + __gov_queue_work(policy->cpu, dbs_data, delay); } else { for_each_cpu(i, policy->cpus) __gov_queue_work(i, dbs_data, delay);