From patchwork Tue Mar 20 02:50:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10296145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D0425602C2 for ; Tue, 20 Mar 2018 03:00:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFB4229095 for ; Tue, 20 Mar 2018 03:00:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B40BE290B6; Tue, 20 Mar 2018 03:00:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A94AE29095 for ; Tue, 20 Mar 2018 03:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zuV19ysURrbvijvlv1rzaFcrQ7TGZCGKx2AGE8+Kg+4=; b=TNXn+p+roTcTSe GoOe/ipqROr+tqkG8HWbDd83M5zMru4DGcC3SNwbECfjTeVmg2MULZddSHh/L8hwZQSdx7pFJaAr1 Ntt5f3bn3veuera9DOV2nAvpkupBMY46VlCPq4lw+29ylw3gDJeBw/bXmnJuyVtbMG1BLnIw72U/a HmoINeekE8gW8ZN9JOmsJPrb/b60en5CBW2HSbXeLuCEC6K+oGEyh6ENHIZcqT6JWIuYjO6ylVK/3 W0V9OsBytLI/zwqWYDFGfdN8Qi2DTKgdkbUlAQUlxgE/J4SmUIxrsniOifXCOIcfOXpmrxLe1GlU0 eb1W/dIqiBuIJ/O+0Utg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ey7VE-0003YH-FJ; Tue, 20 Mar 2018 02:59:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ey7VB-0003OI-Sf for linux-arm-kernel@bombadil.infradead.org; Tue, 20 Mar 2018 02:59:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Yf6eQgEFoDjW4jXoBlrNaA0qYdevyDVqY2+KPL3rhCI=; b=EMrxgfrI84kQLtBESQ0sIotpvU ZaE7vnHNYqUVyn2gcooA+H64ZCQGf29sxZ0fJBybGujkLXOdyzYbTwOwaNHDgqB1jbIDpokQiaiAQ iTztNakmuxe5rF4aTmVOOv7pn6AVRovlzd7xhCnAWJ359hpI6PdLVQXKZTCmasH7KVTQ/6ygThDun WKnG2VKOlrMKRwpkiW0R0V8LPNwsGqsL1IdE9YUXdPMBl+BM2Po67mP6yNiMKs80qsL/JRQzOPgLn lYZ0iMHbUykwdEUlQ44XSHwMPBYA5dWa26LfDWO5EFMs502SzcPGN1Sd28QxrLGWcD8B8qFCxYTR1 hHE0KuMQ==; Received: from smtp.codeaurora.org ([198.145.29.96]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ey7MI-0000pL-66 for linux-arm-kernel@lists.infradead.org; Tue, 20 Mar 2018 02:50:43 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7CF7860F6B; Tue, 20 Mar 2018 02:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521514233; bh=5iEz6F+cE53acOy9eJzhM5s93Skgi312BeMzer4uRzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnS24z6wbi578wa5iz4o7UsgzO7ijrNhFhMNrovDHzfEGBAFibulnbhI/R9U4zFh9 IexEc7QrEEpeBQ5nhbRYp1vswecYnf3Yvs9vgDsTmOTQo3EnM49mtG9wB91TuGDMnD T7Sz0wiJOGj1H9iKg/MmiOPF9AzG2RwJjiJGSA+4= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 647D560F92; Tue, 20 Mar 2018 02:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521514228; bh=5iEz6F+cE53acOy9eJzhM5s93Skgi312BeMzer4uRzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PGph8JNP0o5i+RcabxDYn0PgJ7QEBrMg/5bEyXGSZdf/XFXr+vfUcvkv40zBKJYJw UBz470ZVSnt8gKokWP73tXQdrtYAiRNxsNicWI5BgCklY3t164Wq9nkAHhHY3HSrhC aDaRLSljcMeUyuhxErmxqblKHo9fOhRr1SGm5qpE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 647D560F92 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-scsi@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org Subject: [PATCH v4 7/7] scsi: csiostor: Eliminate duplicate barriers on weakly-ordered archs Date: Mon, 19 Mar 2018 22:50:07 -0400 Message-Id: <1521514207-10695-8-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521514207-10695-1-git-send-email-okaya@codeaurora.org> References: <1521514207-10695-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180320_025042_488361_F1F9014C X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Varun Prakash , Sinan Kaya , Peter Senna Tschudin , Romain Perier , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Code includes barrier() followed by writel(). writel() already has a barrier on some architectures like arm64. This ends up CPU observing two barriers back to back before executing the register write. Create a new wrapper function with relaxed write operator. Use the new wrapper when a write is following a barrier(). Signed-off-by: Sinan Kaya --- drivers/scsi/csiostor/csio_hw.h | 4 ++++ drivers/scsi/csiostor/csio_wr.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h index 30f5f52..9fd8b00 100644 --- a/drivers/scsi/csiostor/csio_hw.h +++ b/drivers/scsi/csiostor/csio_hw.h @@ -512,6 +512,10 @@ struct csio_hw { csio_reg((_h)->regstart, (_r))) #define csio_wr_reg16(_h, _v, _r) writew((_v), \ csio_reg((_h)->regstart, (_r))) + +#define csio_wr_reg32_relaxed(_h, _v, _r) \ + writel_relaxed((_v), csio_reg((_h)->regstart, (_r))) + #define csio_wr_reg32(_h, _v, _r) writel((_v), \ csio_reg((_h)->regstart, (_r))) #define csio_wr_reg64(_h, _v, _r) writeq((_v), \ diff --git a/drivers/scsi/csiostor/csio_wr.c b/drivers/scsi/csiostor/csio_wr.c index c0a1778..db26222 100644 --- a/drivers/scsi/csiostor/csio_wr.c +++ b/drivers/scsi/csiostor/csio_wr.c @@ -984,7 +984,7 @@ csio_wr_issue(struct csio_hw *hw, int qidx, bool prio) wmb(); /* Ring SGE Doorbell writing q->pidx into it */ - csio_wr_reg32(hw, DBPRIO_V(prio) | QID_V(q->un.eq.physeqid) | + csio_wr_reg32_relaxed(hw, DBPRIO_V(prio) | QID_V(q->un.eq.physeqid) | PIDX_T5_V(q->inc_idx) | DBTYPE_F, MYPF_REG(SGE_PF_KDOORBELL_A)); q->inc_idx = 0;