From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
Cc: dledford@redhat.com, linux-rdma@vger.kernel.org,
lijun_nudt@163.com, oulijun@huawei.com, liudongdong3@huawei.com,
linuxarm@huawei.com, linux-kernel@vger.kernel.org,
xavier_huwei@163.com
Subject: Re: [PATCH V2 rdma-next 2/3] RDMA/hns: Fix the chip hanging caused by sending mailbox&CMQ during reset
Date: Fri, 25 Jan 2019 14:50:18 -0700 [thread overview]
Message-ID: <20190125215018.GF23001@ziepe.ca> (raw)
In-Reply-To: <5C4A714C.2070109@huawei.com>
On Fri, Jan 25, 2019 at 10:15:40AM +0800, Wei Hu (Xavier) wrote:
>
>
> On 2019/1/25 2:31, Jason Gunthorpe wrote:
> > On Thu, Jan 24, 2019 at 11:13:29AM +0800, Wei Hu (Xavier) wrote:
> >>
> >> On 2019/1/24 6:40, Jason Gunthorpe wrote:
> >>> On Sat, Jan 19, 2019 at 11:36:06AM +0800, Wei Hu (Xavier) wrote:
> >>>
> >>>> +static int hns_roce_v2_cmd_hw_resetting(struct hns_roce_dev *hr_dev,
> >>>> + unsigned long instance_stage,
> >>>> + unsigned long reset_stage)
> >>>> +{
> >>>> + struct hns_roce_v2_priv *priv = (struct hns_roce_v2_priv *)hr_dev->priv;
> >>>> + struct hnae3_handle *handle = priv->handle;
> >>>> + const struct hnae3_ae_ops *ops = handle->ae_algo->ops;
> >>>> + unsigned long end;
> >>>> +
> >>>> + /* When hardware reset is detected, we should stop sending mailbox&cmq
> >>>> + * to hardware, and wait until hardware reset finished. If now
> >>>> + * in .init_instance() function, we should exit with error. If now at
> >>>> + * HNAE3_INIT_CLIENT stage of soft reset process, we should exit with
> >>>> + * error, and then HNAE3_INIT_CLIENT related process can rollback the
> >>>> + * operation like notifing hardware to free resources, HNAE3_INIT_CLIENT
> >>>> + * related process will exit with error to notify NIC driver to
> >>>> + * reschedule soft reset process once again.
> >>>> + */
> >>>> + end = msecs_to_jiffies(HNS_ROCE_V2_HW_RST_TIMEOUT) + jiffies;
> >>>> + while (ops->get_hw_reset_stat(handle) && time_before(jiffies, end))
> >>>> + udelay(1);
> >>> I thought you were getting rid of these loops?
> >> Hi, Jason
> >>
> >> Upper applications maybe notify driver to issue mailbox or CMD
> >> commands to hardware, some commands used to cancel resources,
> >> destory bt/destory cq/unreg mr/destory qp etc. when such
> >> commands are executed successfully, the hardware engine will
> >> no longer access some memory registered by the driver.
> >>
> >> When reset occurs, it is possible for upper applications notify driver
> >> to issue mailbox or CMD commands, we need to wait until hardware
> >> reset finished to ensure that hardware no longer accesses related
> >> memory.
> > You should not wait for things using loops like the above.
> Hi, Jason
>
> Are your comments foucsing on udelay? If not, thanks for your detail
> information.
> In hns3 RoCE driver, some CMQ/mailbox operation are called inside
> the lock,
> we can't use msleep in the lock, otherwise it will cause deadlock.
> When reset occurs, RDMA service cannot be provided normally, I think
> in this
> case using udelay will not have a great impact.
You should not use any kind of sleep call in a loop like this.
Jason
next prev parent reply other threads:[~2019-01-25 21:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-19 3:36 [PATCH V2 rdma-next 0/3] RDMA/hns: Some fixes for hns RoCE driver Wei Hu (Xavier)
2019-01-19 3:36 ` [PATCH V2 rdma-next 1/3] RDMA/hns: Fix the Oops during rmmod or insmod ko when reset occurs Wei Hu (Xavier)
2019-01-19 3:36 ` [PATCH V2 rdma-next 2/3] RDMA/hns: Fix the chip hanging caused by sending mailbox&CMQ during reset Wei Hu (Xavier)
2019-01-23 22:40 ` Jason Gunthorpe
2019-01-24 3:13 ` Wei Hu (Xavier)
2019-01-24 18:31 ` Jason Gunthorpe
2019-01-25 2:15 ` Wei Hu (Xavier)
2019-01-25 21:50 ` Jason Gunthorpe [this message]
2019-01-26 1:47 ` Wei Hu (Xavier)
2019-01-26 3:27 ` Wei Hu (Xavier)
2019-01-28 18:27 ` Jason Gunthorpe
2019-01-29 2:18 ` Wei Hu (Xavier)
2019-01-29 3:45 ` Jason Gunthorpe
2019-02-03 12:46 ` Wei Hu (Xavier)
2019-01-19 3:36 ` [PATCH V2 rdma-next 3/3] RDMA/hns: Fix the chip hanging caused by sending doorbell " Wei Hu (Xavier)
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=20190125215018.GF23001@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dledford@redhat.com \
--cc=lijun_nudt@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liudongdong3@huawei.com \
--cc=oulijun@huawei.com \
--cc=xavier.huwei@huawei.com \
--cc=xavier_huwei@163.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).