linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Kalderon, Michal" <Michal.Kalderon@cavium.com>
Cc: 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>,
	"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>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 3/3] RDMA/qedr: eliminate duplicate barriers on weakly-ordered archs #2
Date: Tue, 3 Apr 2018 14:03:48 -0600	[thread overview]
Message-ID: <20180403200348.GB21167@ziepe.ca> (raw)
In-Reply-To: <CY1PR0701MB201215C9F38E8760732B595088A50@CY1PR0701MB2012.namprd07.prod.outlook.com>

On Tue, Apr 03, 2018 at 07:42:28AM +0000, Kalderon, Michal wrote:
> > 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. 

As Sinan said, the consensus is that wmb();writel(); is redundant if
the only purpose of the wmb is to order DMA and system memory.

So can you review these patches on that basis please? Is the WMB doing
something else, eg SMP related? If yes, please send a patch adding
appropriate comments.

Thanks,
Jason

  parent reply	other threads:[~2018-04-03 20:03 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
2018-04-03 17:47       ` Sinan Kaya
2018-04-03 20:03       ` Jason Gunthorpe [this message]
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=20180403200348.GB21167@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=Ariel.Elior@cavium.com \
    --cc=Michal.Kalderon@cavium.com \
    --cc=dledford@redhat.com \
    --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).