Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp114036rwd; Fri, 19 May 2023 16:25:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77vCyi5MbvoIvtoTsm5qZg8wMi9o85lLhGL7FMG/IZgfPIspzvI6X5wbHLOQSb9Zho2VwD X-Received: by 2002:a17:903:2343:b0:1ad:bb89:16f4 with SMTP id c3-20020a170903234300b001adbb8916f4mr4598020plh.50.1684538703717; Fri, 19 May 2023 16:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684538703; cv=none; d=google.com; s=arc-20160816; b=UWDOvhZokxMIviVybnW6fGhGy/DK8baurvqNX0kOaR+gDeJhBCosQ9Sqpz06Wc/a+k W9UUDZB5SHR4g0grpTEK1aR58itXoQA1RJhd1Bkmj7/TsYYwG9xtF/oqGo/1Y7qZBzfZ NGhqF72uroDnhLoD3gSulwhCq4dWlncVIK90xMrgd78UFd2QHHAMzkJWcFqVR8B6yIaq s6PQ6wcd3Xt6ZcMxwjaloFueizVQCQ4WHsJTnOJQpEuf0pbnoKk6LdqpMyPnUeOj3xGs pzRiRwmLbFTK4VB2iEUVJw1aLW2FsvPnZrNwCPNPkJI5j0TLa8j+Z7TNatuo04WD+jMY 4Viw== 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; bh=SQuao/FKgfHtIfhTrNUUz5rFqYNJxGKOnDpvRokVUgw=; b=qWP6iZ/rDVM4Ta7qL/CVOxkI1f5sdRY8fPHirKrco3thzjW6Be9PQZv929i1zOkZDM 690pc+yZAGM9rSzVII73zN48Q0XFgHl27fLNADDNdvhph9+KFCEXrubBXnUt3VNyTCPy 9601/rzjI++4lF1H5wq3TnD6t6ebtocQbKQGbsul+U8oU9bIp9ln3zKiX2pA7Wz3alG4 DypTZaM1EIB/GXs67q0hA+FozvmfR/FbLTcx/Fhci+Bi+CJ3I6g/EcKDh9qsa4p4bd0Y EDTS8YQeklcFdzblqU9nONGnRBvK89muYS8V6segGbNC6J7oe4kSSHecdJMCvNLAXNj/ gNiQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a170902e85000b001adf56751ccsi264805plg.520.2023.05.19.16.24.48; Fri, 19 May 2023 16:25:03 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231646AbjESXEC (ORCPT + 99 others); Fri, 19 May 2023 19:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjESXEB (ORCPT ); Fri, 19 May 2023 19:04:01 -0400 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 635D2107; Fri, 19 May 2023 16:04:00 -0700 (PDT) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-5307502146aso2681987a12.1; Fri, 19 May 2023 16:04:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684537440; x=1687129440; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SQuao/FKgfHtIfhTrNUUz5rFqYNJxGKOnDpvRokVUgw=; b=PBw9KBg4E360nIqD352pQ4gsYd21yOxtuc26HZVLMMFxPTQgHgtB8203k2Xrb8RynR K7m++FQ5SKMWCAJWeueeEro+RV6HNZkfOxwNDT8pRV0viDhPzhXPdE2sGKxXuCnzQiVc w3AI243UWp2AsZPt9aLsjtv5my3OMVWped0DafDnnJEUj0alVY9VnKyLqqRZD7/pgM5G zVWLJhqXHht/VodMWLcyYFgkEbtEZkuUT843r/NzmOeU/9Q8ugM8whR9FId9wxB5FAf9 Tu0ExG9/7/bGAoxRMhHgK0HWA6XQFb5Iu8zdnA2j799njjjItVHvD1QfNJWMTnGCpy34 T75Q== X-Gm-Message-State: AC+VfDxYQfDi6zJ/UTKEsuUmWYNSYSy4mmT1M+N3SpHgpLVTfK82rwl2 I9G1uVe+y9KNH6DmHHKkecxdMwIYx0c= X-Received: by 2002:a17:902:c407:b0:1ac:451d:34b with SMTP id k7-20020a170902c40700b001ac451d034bmr5091242plk.9.1684537439758; Fri, 19 May 2023 16:03:59 -0700 (PDT) Received: from ?IPV6:2620:15c:211:201:102a:f960:4ec2:663d? ([2620:15c:211:201:102a:f960:4ec2:663d]) by smtp.gmail.com with ESMTPSA id j22-20020a170902759600b001ac95be5081sm118615pll.307.2023.05.19.16.03.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 May 2023 16:03:59 -0700 (PDT) Message-ID: <5065e9ca-d5ce-22fc-4089-651cfacb7166@acm.org> Date: Fri, 19 May 2023 16:03:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v5 7/7] ufs: core: Add error handling for MCQ mode Content-Language: en-US To: "Bao D. Nguyen" , quic_asutoshd@quicinc.com, quic_cang@quicinc.com, mani@kernel.org, stanley.chu@mediatek.com, adrian.hunter@intel.com, beanhuo@micron.com, avri.altman@wdc.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, Alim Akhtar , "James E.J. Bottomley" , open list References: <7b884263c9db9a9666086a345ede85bb56d9dfc7.1683872601.git.quic_nguyenb@quicinc.com> From: Bart Van Assche In-Reply-To: <7b884263c9db9a9666086a345ede85bb56d9dfc7.1683872601.git.quic_nguyenb@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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/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. Thanks, Bart.