From: Jason Gunthorpe <jgg-uk2M96/98Pc@public.gmane.org>
To: Yixian Liu <liuyixian-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 for-next 1/2] RDMA/hns: Add detailed comments for mb() call
Date: Thu, 28 Dec 2017 08:55:19 -0700 [thread overview]
Message-ID: <20171228155519.GT25436@ziepe.ca> (raw)
In-Reply-To: <1514470683-6972-2-git-send-email-liuyixian-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
On Thu, Dec 28, 2017 at 10:18:02PM +0800, Yixian Liu wrote:
> This patch adds more detailed comments when we call the
> memory barrier function, such as rmb, wmb and mb. Three
> mb() callers are deleted since they are unnecessary.
>
> v3:
> 1. Subsitute rmb() with dma_rmb() according to Jason's comment,
> since using dma_rmb() is enough.
This is such a big improvement, thanks
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> index 6100ace..47ef90b 100644
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> @@ -3963,7 +3963,10 @@ static void set_eq_cons_index_v1(struct hns_roce_eq *eq, int req_not)
> {
> roce_raw_write((eq->cons_index & HNS_ROCE_V1_CONS_IDX_M) |
> (req_not << eq->log_entries), eq->doorbell);
> - /* Memory barrier */
> +
> + /* Make sure we update the consumer index of EQ before
> + * accessing it later
> + */
> mb();
> }
This (and the other one below like it) is the only one that puzzles
me..
What are you trying to accomplish here? It looks like cons_index is
the tail pointer for a ring that the device DMA's into? And the
dma_rmb seems properly placed, so no barrier should be needed for DMA
when updating the tail pointer.
Is the barrier attempting to protect eq->cons_index in system memory?
If yes, shouldn't it be an atomic and/or locked?
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
next prev parent reply other threads:[~2017-12-28 15:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-28 14:18 [PATCH v3 for-next 0/2] Bugfixes for eq support in hns Yixian Liu
[not found] ` <1514470683-6972-1-git-send-email-liuyixian-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-12-28 14:18 ` [PATCH v3 for-next 1/2] RDMA/hns: Add detailed comments for mb() call Yixian Liu
[not found] ` <1514470683-6972-2-git-send-email-liuyixian-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-12-28 15:55 ` Jason Gunthorpe [this message]
[not found] ` <20171228155519.GT25436-uk2M96/98Pc@public.gmane.org>
2017-12-29 10:19 ` Liuyixian (Eason)
2017-12-28 14:18 ` [PATCH v3 for-next 2/2] RDMA/hns: Fix alignment problem of the doorbell Yixian Liu
[not found] ` <1514470683-6972-3-git-send-email-liuyixian-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-12-28 15:57 ` Jason Gunthorpe
[not found] ` <20171228155712.GU25436-uk2M96/98Pc@public.gmane.org>
2017-12-29 10:29 ` Liuyixian (Eason)
[not found] ` <aa43b6d4-bb56-ed2f-33c9-c047e27a0a59-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-12-29 17:47 ` Jason Gunthorpe
[not found] ` <20171229174717.GB6513-uk2M96/98Pc@public.gmane.org>
2018-01-02 3:07 ` Liuyixian (Eason)
2017-12-29 6:48 ` Leon Romanovsky
[not found] ` <20171229064843.GU3494-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-12-29 7:26 ` Liuyixian (Eason)
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=20171228155519.GT25436@ziepe.ca \
--to=jgg-uk2m96/98pc@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 \
--cc=liuyixian-hv44wF8Li93QT0dZR+AlfA@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