From: Bart Van Assche <Bart.VanAssche-Sjgp3cTcYWE@public.gmane.org>
To: "jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
<jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
"maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
<maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
"hch-jcswGhMUV9g@public.gmane.org"
<hch-jcswGhMUV9g@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
"dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org"
<sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
Cc: "danielm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
<danielm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 1/4] IB/core: add support for draining Shared receive queues
Date: Wed, 17 Jan 2018 16:11:15 +0000 [thread overview]
Message-ID: <1516205474.2820.5.camel@wdc.com> (raw)
In-Reply-To: <1516197178-26493-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
On Wed, 2018-01-17 at 15:52 +0200, Max Gurtovoy wrote:
> +/*
> + * __ib_drain_srq() - Block until all Last WQE Reached event arrives, or
> + * timeout expires (best effort).
> + * @qp: queue pair associated with SRQ to drain
> + *
> + * In order to avoid WQE and data segment leakage, one should destroy
> + * QP associated after performing the following:
> + * - moving QP to err state
> + * - wait for the Affiliated Asynchronous Last WQE Reached Event
> + * - drain the CQ
> + */
> +static void __ib_drain_srq(struct ib_qp *qp)
> +{
> + struct ib_qp_attr attr = { .qp_state = IB_QPS_ERR };
> + struct ib_cq *cq;
> + int ret;
> +
> + if (!qp->srq) {
> + WARN_ONCE(1, "QP 0x%p is not associated with SRQ\n", qp);
> + return;
> + }
> +
> + ret = ib_modify_qp(qp, &attr, IB_QP_STATE);
> + if (ret) {
> + WARN_ONCE(ret, "failed to drain shared recv queue: %d\n", ret);
> + return;
> + }
> +
> + if (ib_srq_has_cq(qp->srq->srq_type)) {
> + cq = qp->srq->ext.cq;
> + } else if (qp->recv_cq) {
> + cq = qp->recv_cq;
> + } else {
> + WARN_ONCE(1, "QP 0x%p has no CQ associated with SRQ\n", qp);
> + return;
> + }
> +
> + /*
> + * ULP should invoke ib_notify_qp on IB_EVENT_QP_LAST_WQE_REACHED
> + * arrival, otherwise timeout will expire and leakage may occur.
> + * Use long timeout, for the buggy ULPs/HCAs that don't notify the
> + * QP nor raising IB_EVENT_QP_LAST_WQE_REACHED event.
> + */
> + if (wait_for_completion_timeout(&qp->srq_completion, 10 * HZ) > 0)
> + ib_process_cq_direct(cq, -1);
> +}
Hello Max,
It seems weird to me that __ib_drain_srq() does not follow the same approach as
__ib_drain_rq(). Have you considered to post an additional receive work entry
on the SRQ and to wait until the completion for that work entry is signaled?
That would avoid that a completion has to be added in the ib_qp data structure
and would also avoid that all ULPs that use SRQs have to be modified.
Thanks,
Bart.
next prev parent reply other threads:[~2018-01-17 16:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 13:52 [PATCH 0/4] Last WQE Reached event treatment Max Gurtovoy
[not found] ` <1516197178-26493-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-17 13:52 ` [PATCH 1/4] IB/core: add support for draining Shared receive queues Max Gurtovoy
[not found] ` <1516197178-26493-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-17 15:35 ` Steve Wise
2018-01-18 18:06 ` Bart Van Assche
2018-01-17 16:11 ` Bart Van Assche [this message]
[not found] ` <1516205474.2820.5.camel-Sjgp3cTcYWE@public.gmane.org>
2018-01-18 10:31 ` Max Gurtovoy
2018-01-24 6:39 ` Sagi Grimberg
[not found] ` <11f8c447-065f-ee0c-f88e-ee3a006f8571-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2018-01-24 10:20 ` Max Gurtovoy
2018-01-17 13:52 ` [PATCH 2/4] nvmet-rdma: notify QP on Last WQE Reached event arrival Max Gurtovoy
[not found] ` <1516197178-26493-3-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-17 15:37 ` Steve Wise
2018-01-18 18:04 ` Bart Van Assche
2018-01-17 13:52 ` [PATCH 3/4] iser-target: remove dead code Max Gurtovoy
2018-01-17 13:52 ` [PATCH 4/4] IB/srpt: notify QP on Last WQE Reached event arrival Max Gurtovoy
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=1516205474.2820.5.camel@wdc.com \
--to=bart.vanassche-sjgp3ctcywe@public.gmane.org \
--cc=danielm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sagi-NQWnxTmZq1alnMjI0IkVqw@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