Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp460853pxa; Tue, 11 Aug 2020 07:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVIWTQqV76GSOG9QUZwoB4/nv1d3pmdy7DfzRQKXmr7Ycivcv99P6XiisbB8pNullKMHGD X-Received: by 2002:a50:e719:: with SMTP id a25mr25051998edn.15.1597155642539; Tue, 11 Aug 2020 07:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597155642; cv=none; d=google.com; s=arc-20160816; b=N5tzmfkSgxbBoeWzZUoacfQ+5Q5AHYRSvDsXth8sFqGhlWGde6f1WyEtgQNipRPUvh Kzvgj2sxt7XN1wCeXYOLo/Cu7qJxvrG6dqZJAN8tdNkEu6YE7wAVBFDknQLHueDb/Ryf mK25zqa3khzZGfCmrVV0bjRcQq4Ga88YZEWttst0nO+2Tl2JDbzm+ktZb8oSlNnC1llY 3k/LmrCzO6yrKudbOdgfSFy/2bPriYd3eJImCZpBXYM665g8QHXJOTHbhmCaq/prS8cQ WH2RqJ7a6y/4OU1JhABqOVula/TlSwu0Q9fcMkL9K06UBvktW2Feiw7Za1OwKp/dDdY4 y9QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=XTS1vpDtg3OP4CRvjP9CPhkq94c+0NX17v/BpymKceQ=; b=a/r+eS/KRZKquocIu9zutyQ6TStXjvSDfusy3MvOIZ6hfEID9K6aFWfQg4r2mN6gRs xSvJ4k8vP4PDhF5gN6ulXEEc2yOE+SHpcWQy+k4E64b2roFp+QsVr4mrZ8otwIa57YwE 39KIRaLwdBfBiYrHQ0IOmqBZr6RVpJhIVjwpccVwAXiAaSMcPalTST0Zy8fJQUE/m84E frLLOjKIKnLd5Zu6/SVDpUQiXdybM9UcqPnnYNJvudMr4Sli+6fp7EQEL4IfcVnbtRgo ISsDFH+L/g/CMbKUI0NpqKRggEqd+FlPEfu5fLasUj2ZxA1Yv/ylI4aYpwdg7YzO6nu7 UeCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uNytucz+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a18si3490695edt.468.2020.08.11.07.20.19; Tue, 11 Aug 2020 07:20:42 -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=@gmail.com header.s=20161025 header.b=uNytucz+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbgHKOTl (ORCPT + 99 others); Tue, 11 Aug 2020 10:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728516AbgHKOTl (ORCPT ); Tue, 11 Aug 2020 10:19:41 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B78E7C06174A; Tue, 11 Aug 2020 07:19:40 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id qc22so13287532ejb.4; Tue, 11 Aug 2020 07:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XTS1vpDtg3OP4CRvjP9CPhkq94c+0NX17v/BpymKceQ=; b=uNytucz+Um9k8rX3Op2FkCbsHVQ5HlfOhgD+4S4w/v3zz/qoLvVOgJ66rdJe0mmrSr itD46RWboOS8QDoQvh4aQ2SMK01lhJzEf7z7cd2JYzKh1pWzY1yhK1o4IurDSLSL844B MP/wEwC5PPnT/mKeduKHpXrhwSzxsIuxsX4c/VQtHhmMfDOLgAhqON6Y+wcpz2oZPhG7 6mdaNTAsp0XdzVemFpfY/10P4FZFC0ZNJWSDEU1mER4jrm1QJXBg1CMxOhNhzfuTfVsY RB92YENATa3QNVVnaZDHXn35YijQpo27AMlH8oT48MhjYZY4G9ejUKnlVw1avfJGDzB4 vSAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XTS1vpDtg3OP4CRvjP9CPhkq94c+0NX17v/BpymKceQ=; b=ejwqRgaTz76cmgE0R8U8l219ej6C8t3JgD17s6v2eZHcXc69S3gE3TIegMDv9f8cfq CgQFHwjzLBthH/sJHxS8fTQkfvqq1R6+WYb3vzTjCALfKnhz2l9Da7Ou4s/N397AKcmh AT2ZftovjyZNZIJaES3IlNKfjMTki6Ydg6RnEd8Kp53PeGWv1Wqez+wr/NYoT28Js3fc Ek3mJMeGKKabo1O6foVwnp3bXeq1fnqeII6uKyZGIEJ2Cg79Um1YAIqV8DlDKgji5kLs cEk3jOm2lK64jjfyL6cufqNe3/6NDykLWqmVPrP1r6qTEI5l4fKzVBx4h88U0OLDBvFU 2Hpw== X-Gm-Message-State: AOAM5307R9SSi3Xl6mrJyjcXRMFchhKI/dm5EoyYhAyYoXS4AtizhjWj nnbbZSe/VTt4jJVXsosjX8Y= X-Received: by 2002:a17:906:924d:: with SMTP id c13mr25818352ejx.518.1597155579514; Tue, 11 Aug 2020 07:19:39 -0700 (PDT) Received: from localhost.localdomain ([2a01:598:b888:52c9:44c:d55b:5f94:2fc4]) by smtp.gmail.com with ESMTPSA id q15sm1467050edc.74.2020.08.11.07.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2020 07:19:38 -0700 (PDT) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] scsi: ufs: Cleanup completed request without interrupt notification Date: Tue, 11 Aug 2020 16:18:58 +0200 Message-Id: <20200811141859.27399-2-huobean@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200811141859.27399-1-huobean@gmail.com> References: <20200811141859.27399-1-huobean@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanley Chu If somehow no interrupt notification is raised for a completed request and its doorbell bit is cleared by host, UFS driver needs to cleanup its outstanding bit in ufshcd_abort(). Otherwise, system may behave abnormally by below flow: After ufshcd_abort() returns, this request will be requeued by SCSI layer with its outstanding bit set. Any future completed request will trigger ufshcd_transfer_req_compl() to handle all "completed outstanding bits". In this time, the "abnormal outstanding bit" will be detected and the "requeued request" will be chosen to execute request post-processing flow. This is wrong because this request is still "alive". Signed-off-by: Stanley Chu Reviewed-by: Can Guo Signed-off-by: Bean Huo --- drivers/scsi/ufs/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 307622284239..66fe814c8725 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6492,7 +6492,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) /* command completed already */ dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n", __func__, tag); - goto out; + goto cleanup; } else { dev_err(hba->dev, "%s: no response from device. tag = %d, err %d\n", @@ -6526,6 +6526,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) goto out; } +cleanup: scsi_dma_unmap(cmd); spin_lock_irqsave(host->host_lock, flags); -- 2.17.1