Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3941016rwd; Tue, 23 May 2023 00:16:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Ay1tKaCCP9QRtXl+x63CvTEB93M5h3KtJ8jBb2laAIRNsx+5vD/jsJ+Nn9PotJBzmDPkM X-Received: by 2002:a05:6a20:ba4:b0:100:ccb8:91fd with SMTP id i36-20020a056a200ba400b00100ccb891fdmr12190763pzh.22.1684826201791; Tue, 23 May 2023 00:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684826201; cv=none; d=google.com; s=arc-20160816; b=TqrlQaIrXPyHKYIrtyqCiGPmLKXHbmYwXAQtS7K9VRFAgyDzpE3Cdn/4Dx/pvFr03q stnOmDhnB5paG7euLW7q7yL2/SIgpyEshYEIVxjocadtBNoWNQX9Tcr1kqFvVXa5FeWO Rd4Er0WwKsLvzdBlK465G9trhThTU6+85ua+E6JGNqNkw8HTIkN2Jk0cvIaogfxw2E+j zGXeqHgx9FdddyKT+ysZ1JrA9qhJmOluh50Wu0YSgs8KqEXBtBREJ5Q26B6Z1cJdHecc N0JUTbBs7p7L+J3A+grPmkWH3apmxCFXfgmIZjmLQK4oKQTV6/pIs8OpszrK2FT19yiG ocKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Ex1tFxvKrAnpGLQRQ3xEj2hakDnV5kwPAUrcxK4mQsI=; b=crJ2tA+AMJtxKAO/O5p+8racFFd5EpS2FBcVraDJLEPukcDUBXckM56QUTdwELwLWg gakFLfduhsica4g8wqIoqPyoAdZcH1KgqmJGMD8H1KZEH/DXcvGoNnNywHCbvpXr7bOA nhrV1IiNTGG9z68TyqDrjJOKHeqPAk/ZtPttvYw03+M7giB/NAlSvFHCH3Rai1+e5fW1 9/BjA3Yy9S6xTGV36yPa77tSKk+RumKabYO2oUduTvTPNtRaR+g229x/3zcpUBzQm+Lf 6YmDKaPaXNrx1fdoWRDhE/OiSx3sTd7YoSlE3IoXtLWkBvrs3FZqKFaAi8uKsIFpjaGz knig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZruPuJCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j29-20020a637a5d000000b00534869d75d0si1062874pgn.767.2023.05.23.00.16.27; Tue, 23 May 2023 00:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZruPuJCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235298AbjEWG7i (ORCPT + 99 others); Tue, 23 May 2023 02:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235243AbjEWG7c (ORCPT ); Tue, 23 May 2023 02:59:32 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEAEC119; Mon, 22 May 2023 23:59:30 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34N5wRZp003873; Tue, 23 May 2023 06:59:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=Ex1tFxvKrAnpGLQRQ3xEj2hakDnV5kwPAUrcxK4mQsI=; b=ZruPuJCtWanF7CwfQcjXF9ptTGyrWWC1pTET0BsUMdfAo3WCvuEAmCfcMQcGAlsr30mZ np4urwGv/ado1BliI2rz7sxrOe7UlOUOnk39yN30rbUWeA0Ppb6uVXvousqHWSnvVHYg t0Ffrnehp5Yebgf0CJSd7Fyf155DFQffsnrJ5fhoYcuCHZvwGfvQzK/Afn3tf5aVObvh Abtun+LdQqJwe0nxrsLfhcGFNl+OTfw+GnwJs5Q4ULDJSQsTD66BUaGr1LAKM2Yq9OJ0 TQvhLEs+c59504mFMYbh4Xe0aO6lusgNh+WrcYMiPRWCmd9RYNTIwxANVmCrveXGNWJa aA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qrf778wtn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 May 2023 06:59:01 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34N6x0og015738 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 May 2023 06:59:00 GMT Received: from [192.168.143.77] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 22 May 2023 23:58:59 -0700 Message-ID: <1e99521e-1e15-b7ec-30be-1f6a86ea728f@quicinc.com> Date: Mon, 22 May 2023 23:58:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v5 7/7] ufs: core: Add error handling for MCQ mode Content-Language: en-US To: Bart Van Assche , , , , , , , , CC: , Alim Akhtar , "James E.J. Bottomley" , open list References: <7b884263c9db9a9666086a345ede85bb56d9dfc7.1683872601.git.quic_nguyenb@quicinc.com> <5065e9ca-d5ce-22fc-4089-651cfacb7166@acm.org> From: "Bao D. Nguyen" In-Reply-To: <5065e9ca-d5ce-22fc-4089-651cfacb7166@acm.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: IfqR3gXU64h5IlsWlu252i4gctquHXUk X-Proofpoint-ORIG-GUID: IfqR3gXU64h5IlsWlu252i4gctquHXUk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-23_03,2023-05-22_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305230056 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/19/2023 4:03 PM, Bart Van Assche wrote: > On 5/11/23 23:28, Bao D. Nguyen wrote: >> @@ -6378,18 +6407,36 @@ static bool ufshcd_abort_all(struct ufs_hba *hba) >>       bool needs_reset = false; >>       int tag, ret; >> -    /* Clear pending transfer requests */ >> -    for_each_set_bit(tag, &hba->outstanding_reqs, hba->nutrs) { >> -        ret = ufshcd_try_to_abort_task(hba, tag); >> -        dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag, >> -            hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1, >> -            ret ? "failed" : "succeeded"); >> -        if (ret) { >> -            needs_reset = true; >> -            goto out; >> +    if (is_mcq_enabled(hba)) { >> +        struct ufshcd_lrb *lrbp; >> +        int tag; >> + >> +        for (tag = 0; tag < hba->nutrs; tag++) { >> +            lrbp = &hba->lrb[tag]; >> +            if (!ufshcd_cmd_inflight(lrbp->cmd)) >> +                continue; >> +            ret = ufshcd_try_to_abort_task(hba, tag); >> +            dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag, >> +                hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1, >> +                ret ? "failed" : "succeeded"); >> +            if (ret) { >> +                needs_reset = true; >> +                goto out; >> +            } >> +        } >> +    } else { >> +        /* Clear pending transfer requests */ >> +        for_each_set_bit(tag, &hba->outstanding_reqs, hba->nutrs) { >> +            ret = ufshcd_try_to_abort_task(hba, tag); >> +            dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag, >> +                hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1, >> +                ret ? "failed" : "succeeded"); >> +            if (ret) { >> +                needs_reset = true; >> +                goto out; >> +            } >>           } >>       } > > Please move the ufshcd_cmd_inflight() check into ufshcd_try_to_abort_task() > such that the same code path can be used for MCQ and legacy mode. Hi Bart, Because the ufshcd_try_to_abort_task() is shared by sdb and mcq modes, I feel a bit uncomfortable using the new function ufshcd_cmd_inflight() in ufshcd_try_to_abort_task(). In this patch series, I am trying to avoid changing the sdb error handling logic as much as possible; only add error handling support for mcq mode. If you feel there is a very good benefit in making the change, I would give it a try. Otherwise, I would prefer not touching sdb error handling code that has been working well. Please let me know. Thanks, Bao > > Thanks, > > Bart.