Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1847578lqz; Mon, 1 Apr 2024 21:49:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGNkjLDwrV6TRh6f9vE4hkNvDTRoP1qdffhvVG4vUs7sZRZJGDTmQtTEUhTGG283yHYW5lKt6pDEGbxmCb/1Ba8OkUgB4A6cQf/33v8A== X-Google-Smtp-Source: AGHT+IEWI59SGEf4rR4tjU2Tad+jSsLu2+P+fPX27daRkx95ggZjZ/ueUgmGuoz173hUdI+g9PeU X-Received: by 2002:a81:8396:0:b0:615:20db:4a4d with SMTP id t144-20020a818396000000b0061520db4a4dmr863855ywf.35.1712033363322; Mon, 01 Apr 2024 21:49:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712033363; cv=pass; d=google.com; s=arc-20160816; b=TeTET/iRndpzVK7TEM1uvcJi1RBjiI4Lb1H1m1RO5ZDvf9aCZdSgRM/1VOv/S/bSuO NS1Nm2U9RSa/ufabttRoAk8HCCn0TSwUprPhhLXXXVENxFtDAxsRfCHJBpMYQM0qs6yq Yf7aU4FhWpM3yvzOU99CAxZECodLaUKwZuhB1KAAao1OvCXHsAci4fcO6ePJY7jOJBtw gWLJvijP6ZwLnQ7p0o8ssOwlm2gsYdTmd37E+tgUWJBPAFhe3hE2x+20WGAtEPEbCNeD QhtUCgnTtQD8Xw4Ww8bycE1HviqbicYGNSMD6V6ekn1MeziGqPWs+yGvnYoKhiVWP/fR DHHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xnkvCW7tpzPvgGJ7rNnr+2m6b2IPe68pf9CXGlt8DWc=; fh=PiAPv5rqktdoNjcVGf1HreJnTtcDSG4q4VtmHm7u3io=; b=kHKkW3bllWa1RiDAqu3lUXWjFVXGykChNM2jgTu7ckewH324Ng+9HP2jb18EXn90FO 19jVIv6+2twMN6VEmBfqC2A6DpX7bHl9JzXbPnPkmdlZa0NipTqmqyB8qp4DVtnny3jw 2qkKTd5l8mn3D2MmUSbfLVeN7VIyn7pWIYnzRwQWTgsaTzZ6995NVz8nLmiiYhSFvCA5 smfMc7WLjq+BtQP4RcCybepq7bOU17GAgF7nP1TcWdQDXalNYyMPgILuXqF8h5G5sFVj RC5v82eoNh8HvkvLLNEOocTJtOVCMvksLF7o0bfs+1cV59yDBuS2sZjJguh24gs4f4uM wNnA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m7e1aHdr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-127389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127389-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k3-20020ac85fc3000000b0043433a9c06dsi773177qta.221.2024.04.01.21.49.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 21:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m7e1aHdr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-127389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127389-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 144951C228BD for ; Tue, 2 Apr 2024 04:49:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2B2D1863F; Tue, 2 Apr 2024 04:49:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m7e1aHdr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D048A1805A; Tue, 2 Apr 2024 04:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712033348; cv=none; b=M1ufl/BLkbL7JzuJAVisHYRwaryBvhLkqLcxcsL1Or6QwLo11y3NXJdqug50QndG/lWr5gbrvAHh9v3IDxG/9gcXWTxwaSBBqBPSVuoximbMCS0sI4lfq8KWa7t9VaecR8OLc7I1JS8gwtsp9WVxMH5fXm/8QTe7s0m6wVoX1K8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712033348; c=relaxed/simple; bh=deMFv+Z09/77uIkYSHktk8oFwZLK0t351nIYxAQ2gRE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iPKqkvJ5BRSpZlHbL0JIdX0eFGpjCnq5u0vr7MyWF5Bn7T65wanxb6PmsrlcfPLCBiAs7KllthGJMtwfEcI8MMvP59WuBv8wlATk0aOHcZMy7rVPdubUrqkeqsfYEf3RRXQ+eThpARHgN34O2Nb+nZH7zT8ix8B8ZYO4UCO5X3Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m7e1aHdr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF3DAC433F1; Tue, 2 Apr 2024 04:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712033348; bh=deMFv+Z09/77uIkYSHktk8oFwZLK0t351nIYxAQ2gRE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m7e1aHdrquLZ1SSrWYYFmKfk5TYJPrV5F4/qWbTyHS03KjurdMgYJv7NZosoYZi9h RTnF/OX7x1HBPNAxeeyiT1g/g5GCOpPzRj20qvTP1aZqyXLYuaLczdGChNSdFGqTVg 1r4+bhu/piMyEJImGRX4yfM3dy6zqFrhWVx/Q07KXe/WaqNRQgCBya5mtNl6c7SHWA Klf10yo7DHEiqBb5BkE4oCtxV4mT7FyHdOZtrmalRA/FTzDkPrQMUuuTPlJLeSEeqK Yo1ZTWa1/Iu0iqpYVvuAlN1Uy3qBIzFVJCmxk6t2W4lj4QuX7zIWop9elALiF/CvpR eMv9Klc9S/c4g== Date: Tue, 2 Apr 2024 10:19:00 +0530 From: Manivannan Sadhasivam To: Andrew Halaney Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Janek Kotas , Alim Akhtar , Avri Altman , Bart Van Assche , Can Guo , Anjana Hari , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 10/11] scsi: ufs: core: Remove unnecessary wmb() after ringing doorbell Message-ID: <20240402044900.GE2933@thinkpad> References: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> <20240329-ufs-reset-ensure-effect-before-delay-v5-10-181252004586@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240329-ufs-reset-ensure-effect-before-delay-v5-10-181252004586@redhat.com> On Fri, Mar 29, 2024 at 03:46:52PM -0500, Andrew Halaney wrote: > Currently, the doorbell is written to and a wmb() is used to commit it > immediately. > > wmb() ensures that the write completes before following writes occur, > but completion doesn't mean that it isn't stored in a buffer somewhere. > The recommendation for ensuring this bit has taken effect on the device > is to perform a read back to force it to make it all the way to the > device. This is documented in device-io.rst and a talk by Will Deacon on > this can be seen over here: > > https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 > > But, completion and taking effect aren't necessary to guarantee here. > > There's already other examples of the doorbell being rung that don't do > this. The writel() of the doorbell guarantees prior writes by this > thread (to the request being setup for example) complete prior to the > ringing of the doorbell, and the following > wait_for_completion_io_timeout() doesn't require any special memory > barriers either. > > With that in mind, just remove the wmb() altogether here. > > Fixes: ad1a1b9cd67a ("scsi: ufs: commit descriptors before setting the doorbell") > Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam - Mani > --- > drivers/ufs/core/ufshcd.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index dfa4f827766a..a2f2941450fd 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -7090,10 +7090,7 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, > > /* send command to the controller */ > __set_bit(task_tag, &hba->outstanding_tasks); > - > ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); > - /* Make sure that doorbell is committed immediately */ > - wmb(); > > spin_unlock_irqrestore(host->host_lock, flags); > > > -- > 2.44.0 > > -- மணிவண்ணன் சதாசிவம்