public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg-uk2M96/98Pc@public.gmane.org>
To: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH v1 rdma-core 1/2] bnxt_re/lib: fix the memory barrier call during poll-cq
Date: Thu, 9 Nov 2017 11:05:21 -0700	[thread overview]
Message-ID: <20171109180521.GM7063@ziepe.ca> (raw)
In-Reply-To: <1510225840-20034-2-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>

On Thu, Nov 09, 2017 at 06:10:39AM -0500, Devesh Sharma wrote:
> Putting a read barrier before issuing a read on valid bit
> is incorrect. When checking for the validity of CQE in the
> CQ buffer the code must wait for the read-barrier to finish
> after issuing a read operation on CQE valid bit.
> 
> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
>  providers/bnxt_re/main.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

This is probably fine

> +	uint8_t valid = 0;
> +
> +	valid = ((le32toh(hdr->flg_st_typ_ph) &
> +		  BNXT_RE_BCQE_PH_MASK) == cq->phase);

Hrm,

Techincally this should be something like

le32toh(atomic_read(hdr->flg_st_typ_ph))

And the the kernel version of this should be using READ_ONCE()

In user space we should probably create a

 udma_from_device_read_once(x)

That incorporates the barrier and the 'access_once' semantics..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-11-09 18:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 11:10 [PATCH v1 rdma-core 0/2] libbnxt_re bug fixes Devesh Sharma
     [not found] ` <1510225840-20034-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-11-09 11:10   ` [PATCH v1 rdma-core 1/2] bnxt_re/lib: fix the memory barrier call during poll-cq Devesh Sharma
     [not found]     ` <1510225840-20034-2-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-11-09 18:05       ` Jason Gunthorpe [this message]
     [not found]         ` <20171109180521.GM7063-uk2M96/98Pc@public.gmane.org>
2017-11-10 11:31           ` Devesh Sharma
     [not found]             ` <CANjDDBggw1wKuyh6OobsxPpe1U7esnFgD9evCoTYDV2FvnjTTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-10 17:30               ` Jason Gunthorpe
2017-11-09 11:10   ` [PATCH v1 rdma-core 2/2] bnxt_re/lib: increment psn in case of 0 length packets Devesh Sharma
2017-11-09 11:54   ` [PATCH v1 rdma-core 0/2] libbnxt_re bug fixes Leon Romanovsky

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=20171109180521.GM7063@ziepe.ca \
    --to=jgg-uk2m96/98pc@public.gmane.org \
    --cc=devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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