From patchwork Mon Sep 5 12:38:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 9313597 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3433C607D3 for ; Mon, 5 Sep 2016 12:38:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2608928A2C for ; Mon, 5 Sep 2016 12:38:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A47828A3D; Mon, 5 Sep 2016 12:38:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B20B28A2C for ; Mon, 5 Sep 2016 12:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755445AbcIEMiX (ORCPT ); Mon, 5 Sep 2016 08:38:23 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:34077 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755432AbcIEMiV (ORCPT ); Mon, 5 Sep 2016 08:38:21 -0400 Received: by mail-qk0-f193.google.com with SMTP id r128so12340134qkc.1; Mon, 05 Sep 2016 05:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+6H22dKRCAu9k7pVfPmaMsErZ/P2Ts6Miw/K1iSz+bI=; b=esD6D/68sBiieR/7Zrs16OOy5oONkd5bZrszHcxBYMiDgjBxuc2vwWUVriFlbENteW u467IG8WxOpznonijIXXYTvI2AGpJZ2GSFHWGk2bWsgpcFo2PraFhwhh82KmI3QSWPv+ 8G/+fiI6dwTClX6Cn2gQ4stO+jDGMzz99AyumLw0A3VWEC+g0m2Oma6sdGX9WJjuL+41 cn+4lSiVGvq4BZJvyf0h9/VY6cZnvbG5CgYLoS5IzViGPMxBCoH5zCSQOStmv2xuZjdb x6PlSeeFqhUMn0eApIoAzlZBrUNU/HpXUz33HaM+eTDTKiphfpHYx9xqfJio8bPn5kVh 9AqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=+6H22dKRCAu9k7pVfPmaMsErZ/P2Ts6Miw/K1iSz+bI=; b=R+AGLjxRG7lpVtRpz0i99sgOT9TspENgB2GUMIr2oeBF4r0O6Yxu+Fbh/j5XlLoXkw ULNpYKJfjtIduUkkPdWPrcPgToXrm6DyPbJS/IklhnzW3EWbrAajb3UzGO/bko6rcqgt i4Ygzo4nZpKH2VZPw95+MT9bYI9PyRf4wZ4w+omrwCbTvpnIysTl6hwLDB1VpM4hB0va z31mt0t3Bx8PSeR2N7Jh2xaCuLCOg8ARprekmRWv5LZEZc2jLIOt+mVSQPbbrHzIOig0 fUi6FaFq7nutkmq5L5yc7/0qnE6gh2ygDFN7d7rwmt155+NlGSzIllix/rOZJUjzSXS1 KJKQ== X-Gm-Message-State: AE9vXwM2j/nPZc2I/eZ9yncxOZA+FBZwXAXK5Xioi6ZZjOvZT6+ebOVF0lNbpu8WMMWxCA== X-Received: by 10.55.176.4 with SMTP id z4mr40108568qke.222.1473079100810; Mon, 05 Sep 2016 05:38:20 -0700 (PDT) Received: from localhost (dhcp-ec-8-6b-ed-7a-cf.cpe.echoes.net. [72.28.23.141]) by smtp.gmail.com with ESMTPSA id t28sm3801310qtc.46.2016.09.05.05.38.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Sep 2016 05:38:19 -0700 (PDT) Date: Mon, 5 Sep 2016 08:38:13 -0400 From: Tejun Heo To: "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org, Wang Wilbur , Wu Gang , linux-kernel@vger.kernel.org, qiaozhou Subject: [PATCH] power: avoid calling cancel_delayed_work_sync() during early boot Message-ID: <20160905123813.GB20784@mtj.duckdns.org> References: <20160901184503.GD12660@htj.duckdns.org> <6b2fc72b-f99f-f7f1-3221-093943de0950@asrmicro.com> <20160902135007.GF12660@htj.duckdns.org> <20160902142102.GG12660@htj.duckdns.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.2 (2016-07-01) 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 of_clk_init() ends up calling into pm_qos_update_request() very early during boot where irq is expected to stay disabled. pm_qos_update_request() uses cancel_delayed_work_sync() which correctly assumes that irq is enabled on invocation and unconditionally disables and re-enables it. Gate cancel_delayed_work_sync() invocation with kevented_up() to avoid enabling irq unexpectedly during early boot. Signed-off-by: Tejun Heo Reported-and-tested-by: Qiao Zhou Link: http://lkml.kernel.org/r/d2501c4c-8e7b-bea3-1b01-000b36b5dfe9@asrmicro.com --- Rafael, can you please route this patch? Thanks. kernel/power/qos.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 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/kernel/power/qos.c b/kernel/power/qos.c index 97b0df7..168ff44 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -482,7 +482,16 @@ void pm_qos_update_request(struct pm_qos_request *req, return; } - cancel_delayed_work_sync(&req->work); + /* + * This function may be called very early during boot, for example, + * from of_clk_init(), where irq needs to stay disabled. + * cancel_delayed_work_sync() assumes that irq is enabled on + * invocation and re-enables it on return. Avoid calling it until + * workqueue is initialized. + */ + if (keventd_up()) + cancel_delayed_work_sync(&req->work); + __pm_qos_update_request(req, new_value); } EXPORT_SYMBOL_GPL(pm_qos_update_request);