From patchwork Mon Nov 18 03:54:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11248845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89DE913A4 for ; Mon, 18 Nov 2019 03:55:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A65D206B6 for ; Mon, 18 Nov 2019 03:55:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="oeSqlZom"; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="H65Eo8gy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726822AbfKRDzB (ORCPT ); Sun, 17 Nov 2019 22:55:01 -0500 Received: from a27-10.smtp-out.us-west-2.amazonses.com ([54.240.27.10]:49240 "EHLO a27-10.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbfKRDzB (ORCPT ); Sun, 17 Nov 2019 22:55:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574049299; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=Khjp9idUetqKkgihK8iOQyiq9dNb53Oa0Bjyc3Bj4LY=; b=oeSqlZom4jtk/k+FuqnVydiv5KWmHWSz5CmheYRqo3UlgtjP8n8Hvoh8w9ApKRWg ClhEesK7O67ZMQZCU4NvNcxiQYL6E38WW7PyKKsUx7ytoo8ymtxzEwf9r1FH7yAVN5i r4WRlbcUOEksye6puaepqF9QkhqKwLSJgN9MKt6Q= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574049299; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=Khjp9idUetqKkgihK8iOQyiq9dNb53Oa0Bjyc3Bj4LY=; b=H65Eo8gyugftpAkX1Wk3AOdxMMRJr5gxKlfyp649WBR/r81WEQ0+84acmU83sWFf +9rLqHLMYPIj8T0Nzh6BB5OXdBjs1Bc7ijhYJkgUltMocJtrEXrUknruWgTGfcOYGDF oSzq6Ei+kLzWlZjIoF4mbn+jISjK6b0zh2R/HW/0= 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=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3DDEAC43383 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Tomas Winkler , Venkat Gopalakrishnan , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 3/4] scsi: ufs: Avoid messing up the compl_time_stamp of lrbs Date: Mon, 18 Nov 2019 03:54:59 +0000 Message-ID: <0101016e7ca63d9d-c9360196-acbf-4e53-9041-ccf8935f0d2b-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1574049277-13477-1-git-send-email-cang@codeaurora.org> References: <1574049277-13477-1-git-send-email-cang@codeaurora.org> X-SES-Outgoing: 2019.11.18-54.240.27.10 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To be on the safe side, do not touch one lrb after clear its slot in the lrb_in_use bitmap to avoid messing up the next task which would possibly occupy this lrb. Signed-off-by: Can Guo Tested-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 8e7c362..5950a7c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4902,12 +4902,14 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, cmd->result = result; /* Mark completed command as NULL in LRB */ lrbp->cmd = NULL; + lrbp->compl_time_stamp = ktime_get(); clear_bit_unlock(index, &hba->lrb_in_use); /* Do not touch lrbp after scsi done */ cmd->scsi_done(cmd); __ufshcd_release(hba); } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE || lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) { + lrbp->compl_time_stamp = ktime_get(); if (hba->dev_cmd.complete) { ufshcd_add_command_trace(hba, index, "dev_complete"); @@ -4916,8 +4918,6 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, } if (ufshcd_is_clkscaling_supported(hba)) hba->clk_scaling.active_reqs--; - - lrbp->compl_time_stamp = ktime_get(); } /* clear corresponding bits of completed commands */