Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2414246ybg; Thu, 30 Jul 2020 21:07:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0YrOM6ilj8xQcW3g0d2MADcS+WmT2XAoxI4/J4FqKhowGP0GDrMfKDRf3znrlyWiGBcOu X-Received: by 2002:aa7:d814:: with SMTP id v20mr2055824edq.296.1596168443932; Thu, 30 Jul 2020 21:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596168443; cv=none; d=google.com; s=arc-20160816; b=McIiyK7UruzUMZ4t2tGNutvSkvUbzdy7eRjsz26hexzkUwx+jee7JMo9vU3bpGgf4W /+WOCp4pgMH1RkglmhJA19K85h56lOZHjeQswigzv9Y3uX7E38pv0X0y6eXkSsbJMupt y63frT/a+tGCOB3WCGEjD6aOM5kBXiqgjH46yoHL9YBQWzktp6FFNeFiQftZNFPGIApy gfsUI9XdfgsTNy84ShgVbagCGaoNaQsb5Qb93Bg3MHE1zuniCVshUBuV98gFSgRpOPEn ALqwjxcHXoNPhOd4/K4U16Fv8rS+5E5AQyBv8WCNdZEcsX+OoxInxGgK/+83SiAtn7uK 3tyQ== 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:autocrypt:from:references:cc:to:subject; bh=QQ35CE9yJFKcx/uvB2EsoL6aQNmrJJ39h4x1UksSOeI=; b=Ot9CgHvLDPCfweuA1M29boxtvyrcWE2Rc9yiw+acaSwpnoYB5Wt5z3yOTsyHUZ6NX3 DjFID4pUQDfoQeG6++flhTXtJ5nDSSYOrSoyHkdgslyAQ0DrJS5Jw46wGCxYO80QRvqW 1xiUt5ouBZKJnVqw4WdRLGIHJhDvSo+avuoDkn8N49P9WlGTupswyDL2wxewio/cbugA EBlSdGCH/YNCZgEg0FXfCFaq/43btGRBA1pjcUFqH8B7IdaYqN02uHdiZYQMsveD9QW8 Z3PRBhpbhCJJbnyUmzFXkSp2OfH2hhzhPSQHvg/3kbVVq+IipltTr8pHRD3adLkuVQKV jkqg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t25si4569234ejy.380.2020.07.30.21.06.57; Thu, 30 Jul 2020 21:07:23 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726150AbgGaEGq (ORCPT + 99 others); Fri, 31 Jul 2020 00:06:46 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:40725 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbgGaEGp (ORCPT ); Fri, 31 Jul 2020 00:06:45 -0400 Received: by mail-pj1-f68.google.com with SMTP id t15so6556585pjq.5; Thu, 30 Jul 2020 21:06:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=QQ35CE9yJFKcx/uvB2EsoL6aQNmrJJ39h4x1UksSOeI=; b=oCx+OmtDmgcsKf4YV1IAtnHqhz2Y2qhro0Yby9520SONIWBEE4vGbr/7AEmTzsHiaC ENPpUWZbkekLE0dIoQ2AMdn4UfxLEDJujY7rHCZGZiPXokRNbo7z2o98NSAidR2AmgQ7 Ev0s4tZJe85EkW5GeA5nZ2vvC8qa7Ik1jx26X6pNvlgDHab5ALPNAKkj+WxA6PfBMDy+ 4pUAl3GnLEmAq92Jl+ERBx7zpGTO/s2hu/LKEsnpCf2hXEHhkyzaKYsqy9F0FJkmscj9 +o4ShmPav8WOVhuLbG8RiLpE+uwVVvF25ry4cyuhP0lmp7xwHEGtdyoTSYdZWHwMrfuK 8UAw== X-Gm-Message-State: AOAM530q1ohsa0E8RzsK4H2iDp3RM6SIZBb12aBcnuwXbxsTwXq4nCeS 7DMnmlmfnuvDlHvwaL0aCro= X-Received: by 2002:a17:902:ff13:: with SMTP id f19mr2147996plj.326.1596168404804; Thu, 30 Jul 2020 21:06:44 -0700 (PDT) Received: from [192.168.50.147] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id r8sm8054046pfg.147.2020.07.30.21.06.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jul 2020 21:06:43 -0700 (PDT) Subject: Re: [PATCH v4] scsi: ufs: Cleanup completed request without interrupt notification To: Stanley Chu , Avri Altman Cc: "linux-scsi@vger.kernel.org" , "martin.petersen@oracle.com" , "alim.akhtar@samsung.com" , "jejb@linux.ibm.com" , "beanhuo@micron.com" , "asutoshd@codeaurora.org" , "cang@codeaurora.org" , "matthias.bgg@gmail.com" , "linux-mediatek@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kuohong.wang@mediatek.com" , "peter.wang@mediatek.com" , "chun-hung.wu@mediatek.com" , "andy.teng@mediatek.com" , "chaotian.jing@mediatek.com" , "cc.chou@mediatek.com" References: <20200724140246.19434-1-stanley.chu@mediatek.com> <1596159018.17247.53.camel@mtkswgap22> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOr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MxjO8Hgc ++w1mLeRUvda3i4/U8wDT3SWuHcB3DWlcppECLkAEQEAAYkBHwQYAQIACQUCVI67igIbDAAK CRBxXD01xc4QCZ4dB/0QrnEasxjM0PGeXK5hcZMT9Eo998alUfn5XU0RQDYdwp6/kMEXMdmT oH0F0xB3SQ8WVSXA9rrc4EBvZruWQ+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <97f1dfb0-41b6-0249-3e82-cae480b0efb6@acm.org> Date: Thu, 30 Jul 2020 21:06:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1596159018.17247.53.camel@mtkswgap22> 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 2020-07-30 18:30, Stanley Chu wrote: > On Mon, 2020-07-27 at 11:18 +0000, Avri Altman wrote: >> Looks good to me. >> But better wait and see if Bart have any further reservations. > > Would you have any further suggestions? Today is the first time that I took a look at ufshcd_abort(). The approach of that function looks wrong to me. This is how I think that a SCSI LLD abort handler should work: (1) Serialize against the completion path (__ufshcd_transfer_req_compl()) such that it cannot happen that the abort handler and the regular completion path both call cmd->scsi_done(cmd) at the same time. I'm not sure whether an existing synchronization object can be used for this purpose or whether a new synchronization object has to be introduced to serialize scsi_done() calls from __ufshcd_transfer_req_compl() and ufshcd_abort(). (2) While holding that synchronization object, check whether the SCSI command is still outstanding. If so, submit a SCSI abort TMR to the device. (3) If the command has been aborted, call scsi_done() and return SUCCESS. If aborting failed and the command is still in progress, return FAILED. An example is available in srp_abort() in drivers/infiniband/ulp/srp/ib_srp.c. Bart.