Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp173566imd; Wed, 31 Oct 2018 16:48:12 -0700 (PDT) X-Google-Smtp-Source: AJdET5fsyEazJ9xZdFN9fG6S6sjF7HhiMZ1Psl8FDOaaIX08cXfLvg8dHBfKPhi4cjaD0QN7YOYk X-Received: by 2002:a63:1e5c:: with SMTP id p28mr5062166pgm.376.1541029692920; Wed, 31 Oct 2018 16:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029692; cv=none; d=google.com; s=arc-20160816; b=muzWG5ckRUF+5swADSAIWKmtMdPE5HbjXxB0naJQ8+G3wMKY/lB36FuwGcZtfFCz+Z 2t33+a6IRKMLHb2d+UIAkly13DBouwcBUZ2YWE3rXJ4dxcXTV6nsCOOwlPgB1rYKxIHn viucjXwMyCEiEYAie+EiZyXweJhAAxyMFsBWAyp231+jhfPkRSihyofs4Gul1XYC6k/q 3CyMWTpw07ncFDAXq3BeaNbLuWy0UZRUfMETxK0VF+Gabmms9x8nF8u/cH8aiLs1gqI9 R8MdPaaM1mQUSeuVPZKXdOjCzJPRu+PnWh20KkT4JT4RXzDGku8AFbk72nXqAz8TH/QW bF/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=NrvC+hcCyZTiamoKHt69XgxyM1WfN7YpnFkF3P+/X/k=; b=HuujsyPBanoGWzTuyJnSs6dnIY+pL5dptoP9Wn/G2Yndq5xCSpHUjrUB5vnbBayBIB gAXZTnuRK0O7//lE1ARviyib5gsIBL3EPIgBlraGbieA93qKnTjEuTQYAeaCzfjbv1R+ jFR4SaJ37oz1ti2Czl8B5m9lgleiYN6h+0ZwYV48yNBblWgAnN9UXjV0XAL3UQnxrbJE ffAUf634NTCXzw5rHtSS+oXQvLhEhd/FhmPTxqqLmdXW/SZsRqJwqlaCkbmn9/F7Qtdu rWMLSmC7EbI6Rb2YiQjKXHsNiJzmy/Lhg109+JZ+7wDtHFEZ5uBjpYHW6O4GdFSw4+UG 1kEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wmjhJPdR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si12148495pls.0.2018.10.31.16.47.58; Wed, 31 Oct 2018 16:48:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wmjhJPdR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728958AbeKAIqr (ORCPT + 99 others); Thu, 1 Nov 2018 04:46:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:54942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728705AbeKAIHS (ORCPT ); Thu, 1 Nov 2018 04:07:18 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 643292081B; Wed, 31 Oct 2018 23:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027227; bh=5I9G2dYuYHbM8b7hQ5md1BXNzHe3WaUGgQqzR0Tnmqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wmjhJPdRd1nXHdXJsWi8ez8gYye/7xpZIDx69uUScD5eej8yMh5tBi14sR/W1R7tx C1dRpZfeaPn/rnuSLrM+2iTVnNWg2pfR/Pyag+OlfEEMqhKtniSEWtHajqRq4WHvBb w6BVHJ4T4zXNuHoxbTEvEJ8QYsRoC6HPdWnC5IIc= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Evan Green , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 093/146] scsi: ufs: Schedule clk gating work on correct queue Date: Wed, 31 Oct 2018 19:04:48 -0400 Message-Id: <20181031230541.28822-93-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Evan Green [ Upstream commit f4bb7704699beee9edfbee875daa9089c86cf724 ] With commit 10e5e37581fc ("scsi: ufs: Add clock ungating to a separate workqueue"), clock gating work was moved to a separate work queue with WQ_MEM_RECLAIM set, since clock gating could occur from a memory reclaim context. Unfortunately, clk_gating.gate_work was left queued via schedule_delayed_work, which is a system workqueue that does not have WQ_MEM_RECLAIM set. Because ufshcd_ungate_work attempts to cancel gate_work, the following warning appears: [ 14.174170] workqueue: WQ_MEM_RECLAIM ufs_clk_gating_0:ufshcd_ungate_work is flushing !WQ_MEM_RECLAIM events:ufshcd_gate_work [ 14.174179] WARNING: CPU: 4 PID: 173 at kernel/workqueue.c:2440 check_flush_dependency+0x110/0x118 [ 14.205725] CPU: 4 PID: 173 Comm: kworker/u16:3 Not tainted 4.14.68 #1 [ 14.212437] Hardware name: Google Cheza (rev1) (DT) [ 14.217459] Workqueue: ufs_clk_gating_0 ufshcd_ungate_work [ 14.223107] task: ffffffc0f6a40080 task.stack: ffffff800a490000 [ 14.229195] PC is at check_flush_dependency+0x110/0x118 [ 14.234569] LR is at check_flush_dependency+0x110/0x118 [ 14.239944] pc : [] lr : [] pstate: 60c001c9 [ 14.333050] Call trace: [ 14.427767] [] check_flush_dependency+0x110/0x118 [ 14.434219] [] start_flush_work+0xac/0x1fc [ 14.440046] [] flush_work+0x40/0x94 [ 14.445246] [] __cancel_work_timer+0x11c/0x1b8 [ 14.451433] [] cancel_delayed_work_sync+0x20/0x30 [ 14.457886] [] ufshcd_ungate_work+0x24/0xd0 [ 14.463800] [] process_one_work+0x32c/0x690 [ 14.469713] [] worker_thread+0x218/0x338 [ 14.475361] [] kthread+0x120/0x130 [ 14.480470] [] ret_from_fork+0x10/0x18 The simple solution is to put the gate_work on the same WQ_MEM_RECLAIM work queue as the ungate_work. Fixes: 10e5e37581fc ("scsi: ufs: Add clock ungating to a separate workqueue") Signed-off-by: Evan Green Reviewed-by: Douglas Anderson Reviewed-by: Stephen Boyd Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c55f38ec391c..54074dd483a7 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1691,8 +1691,9 @@ static void __ufshcd_release(struct ufs_hba *hba) hba->clk_gating.state = REQ_CLKS_OFF; trace_ufshcd_clk_gating(dev_name(hba->dev), hba->clk_gating.state); - schedule_delayed_work(&hba->clk_gating.gate_work, - msecs_to_jiffies(hba->clk_gating.delay_ms)); + queue_delayed_work(hba->clk_gating.clk_gating_workq, + &hba->clk_gating.gate_work, + msecs_to_jiffies(hba->clk_gating.delay_ms)); } void ufshcd_release(struct ufs_hba *hba) -- 2.17.1