linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kalderon, Michal" <Michal.Kalderon@cavium.com>
To: Sinan Kaya <okaya@codeaurora.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"timur@codeaurora.org" <timur@codeaurora.org>,
	"sulrich@codeaurora.org" <sulrich@codeaurora.org>
Cc: "linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Elior, Ariel" <Ariel.Elior@cavium.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Elior, Ariel" <Ariel.Elior@cavium.com>
Subject: RE: [PATCH v5 3/3] RDMA/qedr: eliminate duplicate barriers on weakly-ordered archs #2
Date: Tue, 3 Apr 2018 07:42:28 +0000	[thread overview]
Message-ID: <CY1PR0701MB201215C9F38E8760732B595088A50@CY1PR0701MB2012.namprd07.prod.outlook.com> (raw)
In-Reply-To: <ac46b4e4-7e6c-c15f-06eb-01b1e4893d50@codeaurora.org>

> From: Sinan Kaya [mailto:okaya@codeaurora.org]
> Sent: Tuesday, April 03, 2018 5:30 AM
> To: linux-rdma@vger.kernel.org; timur@codeaurora.org;
> sulrich@codeaurora.org
> Cc: linux-arm-msm@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> Kalderon, Michal <Michal.Kalderon@cavium.com>; Elior, Ariel
> <Ariel.Elior@cavium.com>; Doug Ledford <dledford@redhat.com>; Jason
> Gunthorpe <jgg@ziepe.ca>; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v5 3/3] RDMA/qedr: eliminate duplicate barriers on
> weakly-ordered archs #2
> 
> On 3/22/2018 12:26 PM, Sinan Kaya wrote:
> > @@ -860,7 +860,7 @@ static void doorbell_cq(struct qedr_cq *cq, u32
> cons, u8 flags)
> >  	wmb();
> >  	cq->db.data.agg_flags = flags;
> >  	cq->db.data.value = cpu_to_le32(cons);
> > -	writeq(cq->db.raw, cq->db_addr);
> > +	writeq_relaxed(cq->db.raw, cq->db_addr);
> 
> Given the direction to get rid of wmb() in front of writeX() functions, I have
> been reviewing this code. Under normal circumstances, I can get rid of all
> wmb() as follows.
> 
> However, I started having my doubts now. Are these wmb() used as a SMP
> barrier too?
> I can't find any smp_Xmb() in drivers/infiniband/hw/qedr directory.

Your doubts are in place. You initial patch series modified writel to writel_relaxed
Simply removing the wmb is dangerous. The wmb before writel are used to make sure the
HW observes the changes in memory before we trigger the doorbell. Smp barriers here
wouldn't suffice, as on a single processor. we still need to make sure memory is updated
and not remained in cache when HW accesses it.
Reviewing the qedr barriers, I can find places where this may have not been necessary, 
But definitely you can't simply remove this wmb barriers. 

> 
> static void doorbell_cq(struct qedr_cq *cq, u32 cons, u8 flags)  {
> -       /* Flush data before signalling doorbell */
> -       wmb();
>         cq->db.data.agg_flags = flags;
>         cq->db.data.value = cpu_to_le32(cons);
>         writeq(cq->db.raw, cq->db_addr); @@ -1870,8 +1868,7 @@ static int
> qedr_update_qp_state(struct qedr_dev *dev,
>                          */
> 
>                         if (rdma_protocol_roce(&dev->ibdev, 1)) {
> -                               wmb();
> -                               writel_relaxed(qp->rq.db_data.raw, qp->rq.db);
> +                               writel(qp->rq.db_data.raw, qp->rq.db);
>                                 /* Make sure write takes effect */
>                                 mmiowb();
>                         }
> @@ -3275,8 +3272,7 @@ int qedr_post_send(struct ib_qp *ibqp, struct
> ib_send_wr *wr,
>          * unchanged). For performance reasons we avoid checking for this
>          * redundant doorbell.
>          */
> -       wmb();
> -       writel_relaxed(qp->sq.db_data.raw, qp->sq.db);
> +       writel(qp->sq.db_data.raw, qp->sq.db);
> 
>         /* Make sure write sticks */
>         mmiowb();
> @@ -3362,9 +3358,6 @@ int qedr_post_recv(struct ib_qp *ibqp, struct
> ib_recv_wr *wr,
> 
>                 qedr_inc_sw_prod(&qp->rq);
> 
> -               /* Flush all the writes before signalling doorbell */
> -               wmb();
> 
> 
> 
> 
> 
> --
> Sinan Kaya
> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
> Technologies, Inc.
> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux
> Foundation Collaborative Project.

  reply	other threads:[~2018-04-03  7:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1521736009-23387-1-git-send-email-okaya@codeaurora.org>
2018-03-22 16:26 ` [PATCH v5 1/3] RDMA/bnxt_re: Eliminate duplicate barriers on weakly-ordered archs Sinan Kaya
2018-03-22 16:26 ` [PATCH v5 2/3] RDMA/i40iw: " Sinan Kaya
2018-03-23 19:15   ` Sinan Kaya
2018-03-22 16:26 ` [PATCH v5 3/3] RDMA/qedr: eliminate duplicate barriers on weakly-ordered archs #2 Sinan Kaya
2018-04-03  2:29   ` Sinan Kaya
2018-04-03  7:42     ` Kalderon, Michal [this message]
2018-04-03 17:47       ` Sinan Kaya
2018-04-03 20:03       ` Jason Gunthorpe
2018-04-04 11:54         ` Kalderon, Michal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY1PR0701MB201215C9F38E8760732B595088A50@CY1PR0701MB2012.namprd07.prod.outlook.com \
    --to=michal.kalderon@cavium.com \
    --cc=Ariel.Elior@cavium.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=okaya@codeaurora.org \
    --cc=sulrich@codeaurora.org \
    --cc=timur@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).