Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7937301rwr; Wed, 10 May 2023 15:08:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7iTdDAnstzUoiav3XWD4X88w0cGf4Wsz/smsPMd+r2nDmfo6bi1mr/sG9JqxCWWM+JGzdm X-Received: by 2002:a17:902:d50c:b0:1a0:57dd:b340 with SMTP id b12-20020a170902d50c00b001a057ddb340mr22947039plg.64.1683756516787; Wed, 10 May 2023 15:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683756516; cv=none; d=google.com; s=arc-20160816; b=U/Nm4V6YE1aMtjkG9LG+Ldd2Cu+1+66WUyNSrBqiqY9ovF1DQjE5wzjWhymTduBNkD 9sP7Ahvg+2UIQV1h9nyL80FmG9+XuAtZGZQQ7FtN0cwJGNCN94AC7ncUvV85TmJRVYx+ HOQgP5F5EytA8zkkX+h80995oMk2dZyq63/+g2prVmGHD6lTtKByQvGSFh8qUcimr9Ks nHVY5kEBaTm5k4soshYS9w1+inS/ObMY+cdK/z7oJ5vKCnvvZuE0goYdxTH4WlNyj04M YO9vUf4fUPr0YHi7SjyCsnTcVvbUgV4tNZHAaC158elxR5rsRE+lSv58LhT96m9V+O2q jXyQ== 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=Ev0c8UkGcZy/QLlUdjHVUK5oJqUNTLHWrEFmmuvEiRo=; b=Pi821Czr3BDaPzdCzFyTh8XCBLUeAmWQmp38S02SRF1qhltV024h8Nm2r/9cwDj1xE ewrIU+3lBP74SAN0/1QMzBMryI+fAb5qBXSMQSJVXxkfNer1qIcC7vpOhwwUj2kP8LYD zFHBQ54nICqf5RAM5H1CqG8Y6mvOulOrBKKA6fwWMmWwOl/KECOxsRDyOIzOlv/AM8Od BYbvavS5BYO8BNsNELSMwSY/zYGAnmzdhtJmsUqGo+1JqXKCiRoGYBkAxilJY4jwWi0D f+sUJn6c0rDADga+svkReVBiWS7KjVEvE669t+KG8nsZ6cW2tQHc2WnMOPQYTc7bn3ae UULA== 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 k6-20020a170902694600b001ab23cbe13bsi4623435plt.104.2023.05.10.15.08.24; Wed, 10 May 2023 15:08:36 -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 S236161AbjEJWBD (ORCPT + 99 others); Wed, 10 May 2023 18:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjEJWBA (ORCPT ); Wed, 10 May 2023 18:01:00 -0400 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75DA11BC6; Wed, 10 May 2023 15:00:59 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1aaea3909d1so73616645ad.2; Wed, 10 May 2023 15:00:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683756059; x=1686348059; 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=Ev0c8UkGcZy/QLlUdjHVUK5oJqUNTLHWrEFmmuvEiRo=; b=FNm1o2cp1wvHHC4Paeo50MMbiVOnXBVpYYiNZ1Zy2Q1rpzPnbZFFkX5u+6HIBvJDOy MlD1n4RMNCoQdtIuRIUN7mRWrEMbC9nUST3GbU2C9EKB8TTML/JSEm/7leLdwDNZrcrm jGfCYFrKiSBnxCX37Zbssqoo5zvxD15jFxRjk2ItagYqALWrR9IxgI+fboPjP2TNaOU1 5Um/2vzTx6Iy4BWRP0Z5I/wDBMjlYUgCdIVWnK6FNXY2TWfqL9K15vRWBL/CPPJmcWUR BtU+BHe6JJvDC5eja7zW2AULRbBijSHDY5HheFCzovZ1mrO6nuYcchFs2ihtX9mG+2a0 q88Q== X-Gm-Message-State: AC+VfDyMmfb6UsvzZyb8xl4wcl/07ZwP1v3WThL9X2XfOduqUyIFUnUv 0B2VHf6sUxVR3X6X7MbQdjI= X-Received: by 2002:a17:903:41d0:b0:1ac:4412:bd9 with SMTP id u16-20020a17090341d000b001ac44120bd9mr23684415ple.3.1683756058747; Wed, 10 May 2023 15:00:58 -0700 (PDT) Received: from ?IPV6:2001:4958:15a0:30:d8b7:fa5f:6808:3db3? ([2001:4958:15a0:30:d8b7:fa5f:6808:3db3]) by smtp.gmail.com with ESMTPSA id x5-20020a170902b40500b0019a6cce2060sm4276477plr.57.2023.05.10.15.00.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 May 2023 15:00:58 -0700 (PDT) Message-ID: <590cbc0e-51a5-5738-cb2e-7619adf2e4be@acm.org> Date: Wed, 10 May 2023 15:00: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 v3 4/7] ufs: mcq: Add support for clean up mcq resources 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" , Arthur Simchaev , open list References: From: Bart Van Assche In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 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_H3,RCVD_IN_MSPIKE_WL, 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/9/23 22:24, Bao D. Nguyen wrote: > +bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd) > +{ > + struct request *rq; > + > + if (!cmd) > + return false; > + > + rq = scsi_cmd_to_rq(cmd); > + if (!rq || !blk_mq_request_started(rq)) > + return false; > + > + return true; The return value of scsi_cmd_to_rq() is never NULL so please remove the !rq test. > @@ -7450,8 +7499,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) > > ufshcd_hold(hba, false); > reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); > - /* If command is already aborted/completed, return FAILED. */ > - if (!(test_bit(tag, &hba->outstanding_reqs))) { > + if (!is_mcq_enabled(hba) && !test_bit(tag, &hba->outstanding_reqs)) { > + /* If command is already aborted/completed, return FAILED. */ > dev_err(hba->dev, > "%s: cmd at tag %d already completed, outstanding=0x%lx, doorbell=0x%x\n", > __func__, tag, hba->outstanding_reqs, reg); With the above change, the doorbell register is read even in MCQ mode. Shouldn't reading the doorbell register be skipped in MCQ mode? Thanks, Bart.