Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp335881ybl; Wed, 22 Jan 2020 22:51:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzPSUbBH0emeMvWDZ1HdH5AqEwenZw7T0q+D6lxwZpLfd7QDycuGVbxmwwl0O+Hh2UhrDOE X-Received: by 2002:a9d:1d02:: with SMTP id m2mr9857555otm.45.1579762295203; Wed, 22 Jan 2020 22:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579762295; cv=none; d=google.com; s=arc-20160816; b=m3BXlYDJHNBqUmZh3ECwLaH8XNpEjM2+ujiIJF8qO2iJYLBE+efV3uEk3fYxs6YtHR CK2TPLGuhf1daud9dMN+3tq8CiSX8DZ1wvqR1sw/D3ntwopHdoYDMCVRWpM/hvVeyqlq CWg45q4+h8ch1WqvRhb3GERLNNzp606wZ/Kd/Pusqmn8xl/B1edtdxbm2nG6hYoBj7AK uS0reAoP24ZmB+1d33f9/8hJ9fYuSG7+QugyLqcl3LaS4Q9EJLsmVjPS0pRFGuf/yxJa VhfoqIB04WSlWqgUGmW+ydyd4dzKx0OR+hLP8ie23VSsAkN/LEqQkjxb/GOxjyHANZjz pGbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=bswcAiv/CdeJKAnXJ38wrotIhNQOHnYzuVA95WQWG8w=; b=A53fkmZ81dgTyoCzEg1at2f2XCSzOiXa1wtNfJKneoOft30WxQhqCgECrzasStkjmY JRmoygRit9UAmNbiGye+FPWJxhB21kh58VRg5Ct2i2SpPX+P+izwBNs17ReoT1koZMmk 0ObY2IV6EwoyAhK9Z4GYkobobCz0tEJYypUPC0DwtP6z6GwoRtt6NRHVMVhvHumpD1bf HZ/H3HDfqq38jpIsd4lXtD4jI2cPOmK/RnGgwHfaXIDw0BZ0mZRdCrpnFzwBgcXTQtaP l9DHcm5HWSnHJbvAUGFbGsNHER0bcdFsRvNTF/aRoyyNNmLrt87snwrRQMPZvY7Z6P4H 2bog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=hO6SQkaX; 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 o14si476928oie.257.2020.01.22.22.51.21; Wed, 22 Jan 2020 22:51:35 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=hO6SQkaX; 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 S1725989AbgAWGuW (ORCPT + 99 others); Thu, 23 Jan 2020 01:50:22 -0500 Received: from mail25.static.mailgun.info ([104.130.122.25]:30870 "EHLO mail25.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgAWGuV (ORCPT ); Thu, 23 Jan 2020 01:50:21 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1579762221; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=bswcAiv/CdeJKAnXJ38wrotIhNQOHnYzuVA95WQWG8w=; b=hO6SQkaXFj3fFR3S1Sne/hbgE+1LZggtzRCWsKRHbeqNUCccoLtGwnDMmyAegoqReDj5mKzC EPAPtabhhw9CZKsH7QGDcZgODd8tb5McJ4n1/9aT/ip6l3L9KFxfshjjm0KSWkSIfkPEBLNJ EKSCtE+Q4HPDH64sk0uvAB+/wkU= X-Mailgun-Sending-Ip: 104.130.122.25 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e29422b.7feba64c59d0-smtp-out-n02; Thu, 23 Jan 2020 06:50:19 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 939F9C433A2; Thu, 23 Jan 2020 06:50:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hongwus) by smtp.codeaurora.org (Postfix) with ESMTPSA id A5249C43383; Thu, 23 Jan 2020 06:50:16 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 23 Jan 2020 14:50:16 +0800 From: hongwus@codeaurora.org To: Can Guo Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Venkat Gopalakrishnan , Tomas Winkler , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 5/8] scsi: ufs: Fix ufshcd_hold() caused scheduling while atomic In-Reply-To: <1579759946-5448-6-git-send-email-cang@codeaurora.org> References: <1579759946-5448-1-git-send-email-cang@codeaurora.org> <1579759946-5448-6-git-send-email-cang@codeaurora.org> Message-ID: <8b8347dbb9a32c71ba2e6992f30a974c@codeaurora.org> X-Sender: hongwus@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Can, On 2020-01-23 14:12, Can Guo wrote: > The async version of ufshcd_hold(async == true), which is only called > in queuecommand path as for now, is expected to work in atomic context, > thus it should not sleep or schedule out. When it runs into the > condition > that clocks are ON but link is still in hibern8 state, it should bail > out > without flushing the clock ungate work. > > Signed-off-by: Can Guo > --- > drivers/scsi/ufs/ufshcd.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 4dfd705..c316a07 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -1542,6 +1542,11 @@ int ufshcd_hold(struct ufs_hba *hba, bool async) > */ > if (ufshcd_can_hibern8_during_gating(hba) && > ufshcd_is_link_hibern8(hba)) { > + if (async) { > + rc = -EAGAIN; > + hba->clk_gating.active_reqs--; > + break; > + } > spin_unlock_irqrestore(hba->host->host_lock, flags); > flush_work(&hba->clk_gating.ungate_work); > spin_lock_irqsave(hba->host->host_lock, flags); It looks good to me. Reviewed-by: Hongwu Su