Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp371228rdb; Thu, 21 Dec 2023 11:30:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWnmEaADmFGyAQf6rgIzTM9LTya9F+imfvEWNu+LLR2Q0YGN5RTIdGzxuSNCY/GiTi7c7l X-Received: by 2002:a05:6e02:1d9d:b0:35f:b744:93de with SMTP id h29-20020a056e021d9d00b0035fb74493demr98941ila.128.1703187024803; Thu, 21 Dec 2023 11:30:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703187024; cv=none; d=google.com; s=arc-20160816; b=NpnqKPv79xIf3l2BernWILb4Eg4R1XTahImd4twqcC1X0Ua1w2A/jgAnoKZT/YZ+vb ULiDHR0rVxy35ZaJVdkpwFlD9QRDbuN1I/ktLWiGo/1LVv9URnD0PNRwLdCyHMqRDyAB UxmbxjPcZsINsEJ6NdoDp4gNE8KJXugRazBocswHXpNFY4N0WOtig9tJHtJwINlis2WC APPX0prQlSWtpQuag5eEJUcS2u4bVYueovu0QW8KsARd7tsRgFKQjIwovXdNkSPtMzKQ gsGSgOoOMM17KYrd1inUTUscXURzEQ+c027rW3NHeuqBQtFTdA16P6ItiGIQ0v/yjN8L Tb/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=d1dx7ZnncvUoc4xiYNPKPOmold5iHR3uYlgOM1Y/vcQ=; fh=St3gBNrE8qj4SMa3Y0xyhxPw88DcH7AOacWDC6HX5R8=; b=MF10BIoes6bVCRNXXXIVRmHahepkZSBuWeH+womsLCLjieaI8doE0cHrBy9/LCLJ2Q nkm0CqIma50+sPBA6p9xNGKmH5kPQO45Ihs1e8xMz6dfZNf70za71o0h1xZT0OIYLtAG 7V5ooinomB9X4xlSCHUB98PVx9tGmKDypfl7skA1BDUAEtKolnDm5rBbgIjQk32oJ7iL t8dmz1AWcrVEmCmXbbVeCVafFFO9odCUrlnxlmiuHW2crWPqvlK5QuV0hihUR4mnM8Kq IlVUXbWN6BEpWKCEg+LE76u3wN+LX0qcGJL0XSe1M6CntCCl4Z4RC1oyFs15vvjUXi6m YKpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-9001-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9001-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c26-20020a631c1a000000b005c673af4e7bsi2018398pgc.393.2023.12.21.11.30.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:30:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9001-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-9001-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9001-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5AE552834C3 for ; Thu, 21 Dec 2023 19:30:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A22B697B1; Thu, 21 Dec 2023 19:30:14 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71053651A4; Thu, 21 Dec 2023 19:30:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d3fc184b6dso7336335ad.2; Thu, 21 Dec 2023 11:30:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703187012; x=1703791812; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d1dx7ZnncvUoc4xiYNPKPOmold5iHR3uYlgOM1Y/vcQ=; b=PzdaNrOKT8O4K+hl3t1nMAGDnoRCyOsOuSa5yZpyOqdBj1jNfMQp59rNtVjYATLEV5 Ntsv2JTnUCnLZe2w9zwwhMeF7k+6dPohjqjqmhicrMqScbi7lkxa3ZFAn7T2wTQG8Fy6 mi62uWPbtC2b/1DZb2aJ6rhgu+Z4vRbNDfBePNNM6WGHhX4TkxY33MmQVmP5+0k8OUtW BN+vUknp0DNXpgUFR8jBoBr1gWYUqPf2KdfmmHz73YWkmeFiYdnUkKQ0LqbxyouPDnOm 9vCgO370LEIiILUdf238XjBTbIelCznZ3pxkZGH0T2EZZWmRaRMDcnK7wrF7CQwXAZ/k xilw== X-Gm-Message-State: AOJu0Yz2QxyymH3ZKDx8pcSIYzCQMmWjw7DoprCw/GTRwRIhQwTOYASB RXrzhKaAVhaJJkSC1zkAF9U= X-Received: by 2002:a17:902:f691:b0:1d4:17e3:2cbd with SMTP id l17-20020a170902f69100b001d417e32cbdmr97375plg.80.1703187011665; Thu, 21 Dec 2023 11:30:11 -0800 (PST) Received: from ?IPV6:2620:0:1000:8411:872c:d7b7:41e9:3edd? ([2620:0:1000:8411:872c:d7b7:41e9:3edd]) by smtp.gmail.com with ESMTPSA id l17-20020a170902eb1100b001bf11cf2e21sm1995752plb.210.2023.12.21.11.30.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Dec 2023 11:30:11 -0800 (PST) Message-ID: <8f02738d-1b0d-4288-a971-c56d9fca0843@acm.org> Date: Thu, 21 Dec 2023 11:30:09 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC v3 08/11] scsi: ufs: core: Perform read back after disabling interrupts Content-Language: en-US To: Andrew Halaney , Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Janek Kotas , Alim Akhtar , Avri Altman , Can Guo Cc: Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> <20231221-ufs-reset-ensure-effect-before-delay-v3-8-2195a1b66d2e@redhat.com> From: Bart Van Assche In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-8-2195a1b66d2e@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/21/23 11:09, Andrew Halaney wrote: > Currently, interrupts are cleared and disabled prior to registering the > interrupt. An mb() is used to complete the clear/disable writes before > the interrupt is registered. > > mb() ensure that the write completes, but completion doesn't mean that > it isn't stored in a buffer somewhere. The recommendation for > ensuring these bits have 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 > > Let's do that to ensure these bits hit the device. Because the mb()'s > purpose wasn't to add extra ordering (on top of the ordering guaranteed > by writel()/readl()), it can safely be removed. > > Fixes: 199ef13cac7d ("scsi: ufs: avoid spurious UFS host controller interrupts") > Signed-off-by: Andrew Halaney > --- > drivers/ufs/core/ufshcd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index 7bfb556e5b8e..bb603769b029 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -10568,7 +10568,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) > * Make sure that UFS interrupts are disabled and any pending interrupt > * status is cleared before registering UFS interrupt handler. > */ > - mb(); > + ufshcd_readl(hba, REG_INTERRUPT_ENABLE); > > /* IRQ registration */ > err = devm_request_irq(dev, irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba); Reviewed-by: Bart Van Assche