linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Yixian Liu <liuyixian@huawei.com>
Cc: dledford@redhat.com, leon@kernel.org, linux-rdma@vger.kernel.org,
	linuxarm@huawei.com
Subject: Re: [PATCH v7 for-next 2/2] RDMA/hns: Delayed flush cqe process with workqueue
Date: Tue, 28 Jan 2020 16:05:05 -0400	[thread overview]
Message-ID: <20200128200505.GB8107@ziepe.ca> (raw)
In-Reply-To: <1579081753-2839-3-git-send-email-liuyixian@huawei.com>

On Wed, Jan 15, 2020 at 05:49:13PM +0800, Yixian Liu wrote:
> diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
> index fa38582..ad7ed07 100644
> +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
> @@ -56,10 +56,16 @@ static void flush_work_handle(struct work_struct *work)
>  	attr_mask = IB_QP_STATE;
>  	attr.qp_state = IB_QPS_ERR;
>  
> -	ret = hns_roce_modify_qp(&hr_qp->ibqp, &attr, attr_mask, NULL);
> -	if (ret)
> -		dev_err(dev, "Modify QP to error state failed(%d) during CQE flush\n",
> -			ret);
> +	while (atomic_read(&hr_qp->flush_cnt)) {
> +		ret = hns_roce_modify_qp(&hr_qp->ibqp, &attr, attr_mask, NULL);
> +		if (ret)
> +			dev_err(dev, "Modify QP to error state failed(%d) during CQE flush\n",
> +				ret);
> +
> +		/* If flush_cnt larger than 1, only need one more time flush */
> +		if (atomic_dec_and_test(&hr_qp->flush_cnt))
> +			atomic_set(&hr_qp->flush_cnt, 1);
> +	}

And this while loop is just 

if (atomic_xchg(&hr_qp->flush_cnt, 0)) {
  [..]
}

I'm not even sure this needs to be a counter, all you need is set_bit()
and test_and_clear()

Jason

  parent reply	other threads:[~2020-01-28 20:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  9:49 [PATCH v7 for-next 0/2] RDMA/hns: Add the workqueue framework for flush cqe handler Yixian Liu
2020-01-15  9:49 ` [PATCH v7 for-next 1/2] " Yixian Liu
2020-01-15  9:49 ` [PATCH v7 for-next 2/2] RDMA/hns: Delayed flush cqe process with workqueue Yixian Liu
2020-01-28 19:56   ` Jason Gunthorpe
2020-02-04  7:41     ` Liuyixian (Eason)
2020-01-28 20:05   ` Jason Gunthorpe [this message]
2020-02-04  8:47     ` Liuyixian (Eason)
2020-02-05 20:30       ` Jason Gunthorpe
2020-02-06  9:14         ` 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=20200128200505.GB8107@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liuyixian@huawei.com \
    /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).