Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1489781pxj; Sat, 12 Jun 2021 10:02:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyVglxfzQ2oGi29RPjfFh1STWFok3vFYx8XCbYpD3HEU14atuUhwyS00bTHg+nzOERvKnT X-Received: by 2002:a05:6402:1c88:: with SMTP id cy8mr6351288edb.80.1623517374206; Sat, 12 Jun 2021 10:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623517374; cv=none; d=google.com; s=arc-20160816; b=mCF2Mn5Rnbcrd5W1po5QIkeSw4pA8P6ZJAW/XqJwdCJTkYWIYirdKQqaqJkI2klA8D dEu8sUvikO3KdzAO5sL/3mHb/oVttr6XSZioJ2TvPkJFbqt53azRYPTHecqz8eBkk17A TJy2ctTJSQiPYQzzlkMdsGc02KmXIP5E/l96Se3AVKIjjRObVLUPf1CHkkgXKZf0MVDQ q47M0wWOprkUl8bnV/UMormXrZnhuQ+ffIIP9afF4fPQQhMuGj5dZxXTNK+xHixpC1qU MimyPfoaZwdPar1ya8Qiqz1JPn+d/p5XCuvB6NUPdlB3fcK49EWIVMHNzxi29AZLFYh3 3d9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=JdcjtmqL1ch2nmFbckHGJtJUs97DirKkuMcWSJqmreY=; b=S8p6EiL/oM1PgK9nngLQwf56MyEN7Vnmt/rd6mDn00axYGTHDnIkLk/mcY4OYNgvCO upQZgr0Dm+ZPcguJkfakMjDkLlVTkar4SaziW0b7liOLq270Bz7QgOa2BhSl/cNV6wk4 zkRn+tBXWF25UjzDMABNmYHjiWKzhbbpxYHhHTw3M104r2XQFNHCdw1169gniBS+G/XC oZTs4Ck/t+yZ+9XX6OsZcOql7yu7EXSta3cNqCQ1UQoP64SsYBhsl4YNQmEkLK6Pg1kp il+3iC4QEWMQlR2UW1mudj24L3Wx/NsU7f4H2ExpMuLoEfN6LZbi+NqUGHkc/ytzQfeB d3lQ== 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 n16si7408682edt.262.2021.06.12.10.02.19; Sat, 12 Jun 2021 10:02:54 -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 S231433AbhFLQxN (ORCPT + 99 others); Sat, 12 Jun 2021 12:53:13 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:35359 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231309AbhFLQxM (ORCPT ); Sat, 12 Jun 2021 12:53:12 -0400 Received: by mail-pf1-f180.google.com with SMTP id h12so7100094pfe.2; Sat, 12 Jun 2021 09:50:56 -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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JdcjtmqL1ch2nmFbckHGJtJUs97DirKkuMcWSJqmreY=; b=loBPBC5n5r109pa6b6VWAYZUfs9UdWGp0luzRkKP10F2U64YWTdSRah+Cn75/4jA3W kVNTXA6uH4tcAHu9ZJFOkgzFB3zATTgG5HDROr1ckQysXndQc9Yhln9AaVGY2QEYGU6+ Qx3hLO5FU3aLr0u3XZ0uqxpgNXkeuJ6ZL6C89Q/skAWjM0fh5z48yySJu1gDl/1uOBmH Av959+Xc4rY1Q/kEPg9adRUasGBXbgFo6QhOIwgMCKm76det7tjEJW3Rft8ISKVqpyoO 56nl/BGkkrcm0bpOema4ORxACF5CZL4Jypet5H+WoOftpx1jFzjWcTWAbDxWggLaEgDr mVOw== X-Gm-Message-State: AOAM531SuHRRBzxOck418YZDEA1weiKxUI5FnSGlqpWB1lTHRGCTP6FA QuTwaWn6PGGMj1pFl7a7fWah2S0LcjRL0A== X-Received: by 2002:aa7:96e3:0:b029:2ec:e8a1:3d66 with SMTP id i3-20020aa796e30000b02902ece8a13d66mr13751530pfq.79.1623516654172; Sat, 12 Jun 2021 09:50:54 -0700 (PDT) Received: from [192.168.3.217] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id j3sm8123472pfe.98.2021.06.12.09.50.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Jun 2021 09:50:53 -0700 (PDT) Subject: Re: [PATCH v3 8/9] scsi: ufs: Update the fast abort path in ufshcd_abort() for PM requests To: Can Guo Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, ziqichen@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Jaegeuk Kim , open list References: <1623300218-9454-1-git-send-email-cang@codeaurora.org> <1623300218-9454-9-git-send-email-cang@codeaurora.org> <16f5bd448c7ae1a45fcb23133391aa3f@codeaurora.org> From: Bart Van Assche Message-ID: <926d8c4a-0fbf-a973-188a-b10c9acaa444@acm.org> Date: Sat, 12 Jun 2021 09:50:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <16f5bd448c7ae1a45fcb23133391aa3f@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/12/21 12:07 AM, Can Guo wrote: > Sigh... I also want my life and work to be easier... How about reducing the number of states and state transitions in the UFS driver? One source of complexity is that ufshcd_err_handler() is scheduled independently of the SCSI error handler and hence may run concurrently with the SCSI error handler. Has the following already been considered? - Call ufshcd_err_handler() synchronously from ufshcd_abort() and ufshcd_eh_host_reset_handler() instead of asynchronously. - Call scsi_schedule_eh() from ufshcd_uic_pwr_ctrl() and ufshcd_check_errors() instead of ufshcd_schedule_eh_work(). These changes will guarantee that all commands have completed or timed out before ufshcd_err_handler() is called. I think that would allow to remove e.g. the following code from the error handler: ufshcd_scsi_block_requests(hba); /* Drain ufshcd_queuecommand() */ down_write(&hba->clk_scaling_lock); up_write(&hba->clk_scaling_lock); Thanks, Bart.