Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp419336pxk; Wed, 9 Sep 2020 08:42:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE/KN15YxvC5YY5jzxrBX9C0RLcfwbuQTAJhMD4vcKbPyKrdQyQWclhA1gYUAxKAISqFoO X-Received: by 2002:aa7:c154:: with SMTP id r20mr4747175edp.337.1599666133871; Wed, 09 Sep 2020 08:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599666133; cv=none; d=google.com; s=arc-20160816; b=XuGtHrs76VoOLiBhaa+SJCbTieGC3d5I7gOKJUIQJiPVEQG7WVqp+yEKciz6jJDXaq NauywaJiAsFNtmpc/NVmroTSkOJgPLmU+qSXx8JP2dkMesrdn5iaMw+kBrQ4m2dW/9P4 +w0ztNzenx9c2dVc7UHhOvIR/6P1rYlGfgEQSKMlrjkTC9xj/sKY3djTx0GTnu6iZJU1 XtAe9X49EtaNxUJAt5xD4myAenfv1NeBZTT+2ZxWE74SLjrsPNAPhZkR/3OLCR5KLXab vZ/0EDkBjq5WsbL8msNoP6R4C8L7A8yUClEhpN7KE5oyk//TSJdCT52LHtCxyWO3iehJ Z+mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject:ironport-sdr :ironport-sdr; bh=cOfD/z05IcaicVfwa77hFFyX5KiWIGwueGMdxbDKX4A=; b=nThHjl8zybOqvlTg28F4xAXgK5te4mhPWc3lDuIceXXZb9HTjv3UdK3nzeiDyx9t10 Vk+Oqwg2NrjpIi2AB8pTG0DNKQRVSM+AcfCQv6Ga4dDf68FrFiNZ5ZvXI0Lm9Z0Smhjp kK6B52+PBJN4qRHpbG+7QdTL5Dv9grfJ7hP4PJOG5y0r1W2xp2lD96vEnW7rwnHTraGz m0qAHAAnWR9L70SOqYMb+Wjhie5RIHeer0kDTXAL8YoEWw5rZyy7aX21vAHe+iysYOew R1y2lpdx9fKLtuPsJPU9nuuiWLqQ+WVEBlhV6sv1aGzmHAWSkOG9XSoldBYtVKkhFBbc XOkw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si1723100edv.513.2020.09.09.08.41.49; Wed, 09 Sep 2020 08:42:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730257AbgIIPkV (ORCPT + 99 others); Wed, 9 Sep 2020 11:40:21 -0400 Received: from mga12.intel.com ([192.55.52.136]:54861 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729960AbgIIPik (ORCPT ); Wed, 9 Sep 2020 11:38:40 -0400 IronPort-SDR: d1GsyPyiZwWl4ulR8RjseG6zBdSS6PjRyZuDHyuknB86r0CQoMEqmk0pBLDgeZQVDq6Q59/8V3 Ryo2CoYYBR5w== X-IronPort-AV: E=McAfee;i="6000,8403,9738"; a="137847942" X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="137847942" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2020 07:06:32 -0700 IronPort-SDR: oEEFyWNbpQPRngTVKDuAJbpVTYcGsbTmtgnm2tPuu4g6/whgj+UfS89DoVGczN9funvDt7PqXc WIPiKHHJT1Qg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="328919425" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.190]) ([10.237.72.190]) by fmsmga004.fm.intel.com with ESMTP; 09 Sep 2020 07:06:29 -0700 Subject: Re: [PATCH V2] scsi: ufs-pci: Add LTR support for Intel controllers From: Adrian Hunter To: "Martin K. Petersen" Cc: "James E . J . Bottomley" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Alim Akhtar , Avri Altman , Can Guo , Stanley Chu References: <20200827072030.24655-1-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Wed, 9 Sep 2020 17:06:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/09/20 12:27 pm, Adrian Hunter wrote: > On 2/09/20 5:12 am, Martin K. Petersen wrote: >> >> Adrian, >> >>> Intel host controllers support the setting of latency tolerance. >>> Accordingly, implement the PM QoS ->set_latency_tolerance() callback. The >>> raw register values are also exposed via debugfs. >> >> Does not apply to 5.10/scsi-queue. Please rebase. Thanks! >> > > Hi > > Thanks for processing this. > > The 5.10/scsi-queue branch seems to be missing the following fix. If you cherry > pick that, then it applies. Now there seem to be conflicts between 5.10/scsi-queue and v5.9-rc4. I am not sure what I can do? ~/git/scsi-mkp$ git branch -v --list 5.10/scsi-queue * 5.10/scsi-queue 2e9defc7e918 [ahead 427, behind 97] scsi: ufs: Fix a race condition between error handler and runtime PM ops ~/git/scsi-mkp$ git rebase --onto v5.9-rc4 v5.9-rc1 First, rewinding head to replay your work on top of it... Applying: scsi: ufs: Add checks before setting clk-gating states Applying: scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config() Applying: scsi: ufs-qcom: Remove testbus dump in ufs_qcom_dump_dbg_regs Applying: scsi: ufs: Add some debug information to ufshcd_print_host_state() Applying: scsi: ufs: Fix concurrency of error handler and other error recovery paths Applying: scsi: ufs: Recover HBA runtime PM error in error handler Applying: scsi: ufs: Move dumps in IRQ handler to error handler Applying: scsi: ufs: Fix a race condition between error handler and runtime PM ops Applying: scsi: ufs: Properly release resources if a task is aborted successfully Using index info to reconstruct a base tree... M drivers/scsi/ufs/ufshcd.c Falling back to patching base and 3-way merge... Auto-merging drivers/scsi/ufs/ufshcd.c CONFLICT (content): Merge conflict in drivers/scsi/ufs/ufshcd.c error: Failed to merge in the changes. Patch failed at 0009 scsi: ufs: Properly release resources if a task is aborted successfully Use 'git am --show-current-patch' to see the failed patch Resolve all conflicts manually, mark them as resolved with "git add/rm ", then run "git rebase --continue". You can instead skip this commit: run "git rebase --skip". To abort and get back to the state before "git rebase", run "git rebase --abort". ~/git/scsi-mkp$ git diff diff --cc drivers/scsi/ufs/ufshcd.c index d9386f85c255,efb40b1b95b4..000000000000 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@@ -6640,12 -6636,8 +6640,14 @@@ static int ufshcd_abort(struct scsi_cmn goto out; } ++<<<<<<< HEAD +cleanup: + scsi_dma_unmap(cmd); + ++======= ++>>>>>>> scsi: ufs: Properly release resources if a task is aborted successfully spin_lock_irqsave(host->host_lock, flags); - ufshcd_outstanding_req_clear(hba, tag); - hba->lrb[tag].cmd = NULL; + __ufshcd_transfer_req_compl(hba, (1UL << tag)); spin_unlock_irqrestore(host->host_lock, flags); out: ~/git/scsi-mkp$ git am --show-current-patch | head -25 commit 8bb2dde069d860e7ea379862a7d0e8ee01cec5e9 Author: Can Guo Date: Sun Aug 9 05:15:55 2020 -0700 scsi: ufs: Properly release resources if a task is aborted successfully In current UFS task abort hook, namely ufshcd_abort(), if one task is aborted successfully, clk_gating.active_reqs held by this task is not decreased, which makes clk_gating.active_reqs stay above zero forever, thus clock gating would never happen. Instead of releasing resources of one task "manually", use the existing func __ufshcd_transfer_req_compl(). This change also eliminates a possible race of scsi_dma_unmap() from the real completion in IRQ handler path. Link: https://lore.kernel.org/r/1596975355-39813-10-git-send-email-cang@codeaurora.org Fixes: 1ab27c9cf8b6 ("ufs: Add support for clock gating") CC: Stanley Chu Reviewed-by: Stanley Chu Reviewed-by: Asutosh Das Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen