Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2033858pxj; Sun, 13 Jun 2021 06:36:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQcB5QxjAMHHgeoApG4/dVB+eiPgC0uGioDO405R+TZSkWFLVUvAnQLEyvuGcmqcc50xFx X-Received: by 2002:a50:eb8f:: with SMTP id y15mr12979697edr.285.1623591369749; Sun, 13 Jun 2021 06:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623591369; cv=none; d=google.com; s=arc-20160816; b=Go1oNm6lYvwQeAao/7wl9qw1+Y7oUFu1HEJy0FIS6xOazTbHrLGhNugnaYF7sGic6F +ip+D0xrBHYgBVROP+oZnkvNUvFFsPrNEygPeD3tKMBfXryE1JRbZFy5y4aeGFBywa1P ANxVva/5meETVizebitP6VU17rg6FJm7D5M2s5bKhHChDLWkW8T+dxdPLil5P/OtTfNG BdlBe8BMbXC/ihZ1v7ZYH5SeAGBRqzUIpldLM66rWPklkobJ26eRlUH5XGBj2sAFUsWy 8In3R3JkZ4U1A2XchRzRPQ52AyZpJsPY9ObjnhPaK5gPG2+rXHFbd8osRq5zwJWuee5X g3TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=v8jXqJ5ky/IEKt0B6ubAeEGws7ANAZpKE8P/QO1P2dQ=; b=mhN6EWph17hx32xHvATZuCV29RY9xXPn+5ACoU1SFF7qjbWnDlVPKGowu48T+A9K/o 6OKPPJOr0AslZc4ixKxPZyr5ZdIO9hS6zp7k0B0fd7skJ6lvb97iAxZAsXy3LG+rQaFh TS6fbsJqH/435cEnGSoyCvWJx6OX6MJOdPqv1HjE6BdkNdz4wDEs+2q6qlq/kCuzlWI9 JP3Su84xsKCgp2PvQE3ulf8SSsX2mAKGgKrJXQtrF/MFGzW4U1kwW5VZ4PUM3XKXp1iT 2ru5ZUY48Oy/vwuDTot3GGVW+xk4nMkygTUG07sKSRHNh4p+pkr6F4LXrAa5y/08WHQA fG4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jg+wu9oP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v28si10006448ejk.538.2021.06.13.06.35.46; Sun, 13 Jun 2021 06:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jg+wu9oP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbhFMNcm (ORCPT + 99 others); Sun, 13 Jun 2021 09:32:42 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:59818 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231733AbhFMNcm (ORCPT ); Sun, 13 Jun 2021 09:32:42 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623591041; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=v8jXqJ5ky/IEKt0B6ubAeEGws7ANAZpKE8P/QO1P2dQ=; b=jg+wu9oPSQeRP7/pcJv0jms0FNXQnSpDnx6IFr6aD7qOzsiF34wyqpvVKOAULDu8lz9ZzkBM LTwgRa6gMpop0ofeOjUnFvUhCyE4L+VNsYeook5NTcdK7Z618MrGqPlnGjb3wauXUDHUE+qS NGQlPir/V6rI7XouYK5Z4IIEknM= X-Mailgun-Sending-Ip: 198.61.254.9 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 smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 60c608748491191eb301e441 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sun, 13 Jun 2021 13:30:28 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3F5E6C4323A; Sun, 13 Jun 2021 13:30:28 +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=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 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: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 68092C433F1; Sun, 13 Jun 2021 13:30:27 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sun, 13 Jun 2021 21:30:27 +0800 From: Can Guo To: Bart Van Assche Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, ziqichen@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Jaegeuk Kim , open list Subject: Re: [PATCH v3 4/9] scsi: ufs: Complete the cmd before returning in queuecommand In-Reply-To: <5df201d5-ab7f-a9fc-36aa-6dd174e9cee2@acm.org> References: <1623300218-9454-1-git-send-email-cang@codeaurora.org> <1623300218-9454-5-git-send-email-cang@codeaurora.org> <80926df7e3e41088e59ce5e0dbdec28a@codeaurora.org> <5df201d5-ab7f-a9fc-36aa-6dd174e9cee2@acm.org> Message-ID: <3f39da79b40b53240636e848cd65feac@codeaurora.org> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-06-12 23:50, Bart Van Assche wrote: > On 6/12/21 12:38 AM, Can Guo wrote: >> On 2021-06-12 04:52, Bart Van Assche wrote: >>> On 6/9/21 9:43 PM, Can Guo wrote: >>>> @@ -2768,15 +2778,6 @@ static int ufshcd_queuecommand(struct >>>> Scsi_Host *host, struct scsi_cmnd *cmd) >>>>      WARN_ON(ufshcd_is_clkgating_allowed(hba) && >>>>          (hba->clk_gating.state != CLKS_ON)); >>>> >>>> -    if (unlikely(test_bit(tag, &hba->outstanding_reqs))) { >>>> -        if (hba->wl_pm_op_in_progress) >>>> -            set_host_byte(cmd, DID_BAD_TARGET); >>>> -        else >>>> -            err = SCSI_MLQUEUE_HOST_BUSY; >>>> -        ufshcd_release(hba); >>>> -        goto out; >>>> -    } >>>> - >>>>      lrbp = &hba->lrb[tag]; >>>>      WARN_ON(lrbp->cmd); >>>>      lrbp->cmd = cmd; >>> >>> Can the code under "if (unlikely(test_bit(tag, >>> &hba->outstanding_reqs)))" be deleted instead of moving it? I don't >>> think that it is useful to verify whether the block layer tag >>> allocator >>> works correctly. Additionally, I'm not aware of any similar code in >>> any >>> other SCSI LLD. >> >> ufshcd_abort() aborts PM requests differently from other requests - >> it simply evicts the cmd from lrbp [1], schedules error handler and >> returns SUCCESS (the reason why I am doing it this way is in patch >> #8). >> >> After ufshcd_abort() returns, the tag shall be released, the logic >> here is to prevent subsequent cmds re-use the lrbp [1] before error >> handler recovers the device and host. > > Thanks for the background information. However, this approach sounds > cumbersome to me. For PM requests, please change the UFS driver such > that calling scsi_done() for aborted requests is postponed until error > handling has finished and delete the code shown above from > ufshcd_queuecommand(). I will delete the code in next version, since I believe the hba_state checks before the code is enough to achieve the same purpose, so this code becomes redundant. Thanks, Can Guo. > > Thanks, > > Bart.