Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3482355imu; Sun, 11 Nov 2018 16:06:39 -0800 (PST) X-Google-Smtp-Source: AJdET5e+VbJdXLlJREhCiggRaT/GavOO8d7pYt1uXGkNuiUOAhue8VdsrmlpFsvD4vLwfisXGIEF X-Received: by 2002:a17:902:5a4d:: with SMTP id f13mr770440plm.49.1541981199830; Sun, 11 Nov 2018 16:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981199; cv=none; d=google.com; s=arc-20160816; b=enXJThW9Yc9UT87M2Sw4wPBc/slAYX1QaA+rmHdMR12wi38RkaVbzHOamzq4+JT7v0 k1uLt62COSGVLlYVgt1a7EP7e+awS8mn0d1cZPmm+glLRjf3tCcbhyRt1y98d6uZ8S+N AFjd2HbrCWQjavqi4FYM5pUeujbUmrim75osHptj017TgW4XH2lOJKmDjgDNQrHoz1Gb ddHhci/dH9IxmjeReAOm9hzlllhx5Xvwnx6MUTWeV1K5CCkGlJ5KqkheFRmdqZJZVxeI qehwoT0uJ4QwvZ5M09UJyuBi6AV9qmKqVFrkbLMeZLG+KMX1aEWODFgjywKJZSd73MpQ Dsaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Cilkn3QOKAYfRI7spLDZiqQIdABPjz4sbfR7JcPNODM=; b=GZ5Zwbhi3A4uwxqcTLttuP3EwyRov+U3LvB1EgrafJja4xOUg13xupCHwvTO4tJ9cA bmfbO69eyUOzBYyihzJw0iZ1JLrY9HXpWkp1lC45ACn4BIakMsR21lnq5ovU0mufIn1a SGGI6J2NG8qII8lD4Eb1CZqph7keuWrk0UBOIcVgJsX3M+9eazlDffV/UGyxYmUvgZvi dpdSbjZ2cSFn4rxidPi3Xs1MF4XUAyMjMPb8Bqb0RT/aHoeMmd5kPYgAqAF+WvQKlNp/ MOjANaWpdSTBvjox+V7PSoqbeSPONKeksVP1acyWdSeO0ISD2hlToqeYBH93P5JVvPdk kGXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oYvziUZ2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a62-v6si17072443pfb.266.2018.11.11.16.06.24; Sun, 11 Nov 2018 16:06:39 -0800 (PST) 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=oYvziUZ2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732219AbeKLJ4a (ORCPT + 99 others); Mon, 12 Nov 2018 04:56:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:34152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730995AbeKLIRl (ORCPT ); Mon, 12 Nov 2018 03:17:41 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 642D7215EA; Sun, 11 Nov 2018 22:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975265; bh=+3/qLX+Ss2De3DtbR0bXT6jcS+jBws7MwoA5xftZ0jI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYvziUZ27aGxYNdRaDJvsgFg/XW3Ryyre8FkY4aVs7Fi87IoLHowMziDXydipfcvS 2tRsQjUIpzQmU7VL2RpnQYMSDrz0MOqG5K9MZ2b8UygErcskFFBwDWzc1DAJA9gNQG +SbUBwxfQzlBU2dsaP22IYGKuI5/bR5Y7uiz0Ri4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Green , Douglas Anderson , Stephen Boyd , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 138/361] scsi: ufs: Schedule clk gating work on correct queue Date: Sun, 11 Nov 2018 14:18:05 -0800 Message-Id: <20181111221639.842633609@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ufs/ufshcd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1691,8 +1691,9 @@ static void __ufshcd_release(struct ufs_ 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)