From: liweihang <liweihang@hisilicon.com>
To: Leon Romanovsky <leon@kernel.org>, oulijun <oulijun@huawei.com>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"jgg@ziepe.ca" <jgg@ziepe.ca>,
"dledford@redhat.com" <dledford@redhat.com>,
Linuxarm <linuxarm@huawei.com>
Subject: RE: [PATCH for-next 1/9] RDMA/hns: Refactor cmd init and mode selection for hip08
Date: Mon, 26 Aug 2019 08:43:25 +0000 [thread overview]
Message-ID: <B82435381E3B2943AA4D2826ADEF0B3A0203B3B7@DGGEML522-MBX.china.huawei.com> (raw)
In-Reply-To: <20190821171928.GB27741@mtr-leonro.mtl.com>
> -----Original Message-----
> From: Linuxarm [mailto:linuxarm-bounces@huawei.com] On Behalf Of Leon
> Romanovsky
> Sent: Thursday, August 22, 2019 1:19 AM
> To: oulijun <oulijun@huawei.com>
> Cc: linux-rdma@vger.kernel.org; jgg@ziepe.ca; dledford@redhat.com;
> Linuxarm <linuxarm@huawei.com>
> Subject: Re: [PATCH for-next 1/9] RDMA/hns: Refactor cmd init and mode
> selection for hip08
>
> On Wed, Aug 21, 2019 at 09:14:28PM +0800, Lijun Ou wrote:
> > From: Yixian Liu <liuyixian@huawei.com>
> >
> > This patch refactor the initialization of cmd, and also for the cmd
> > mode selection on event and poll mode.
> >
> > Signed-off-by: Yixian Liu <liuyixian@huawei.com>
> > Signed-off-by: Lang Chen <chenglang@huawei.com>
> > ---
> > drivers/infiniband/hw/hns/hns_roce_cmd.c | 14 ++++----------
> > drivers/infiniband/hw/hns/hns_roce_main.c | 18 ++++++++----------
> > 2 files changed, 12 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/hns/hns_roce_cmd.c
> > b/drivers/infiniband/hw/hns/hns_roce_cmd.c
> > index ade26fa..547002f 100644
> > --- a/drivers/infiniband/hw/hns/hns_roce_cmd.c
> > +++ b/drivers/infiniband/hw/hns/hns_roce_cmd.c
> > @@ -251,23 +251,17 @@ int hns_roce_cmd_use_events(struct
> hns_roce_dev *hr_dev)
> > hr_cmd->token_mask = CMD_TOKEN_MASK;
> > hr_cmd->use_events = 1;
> >
> > - down(&hr_cmd->poll_sem);
> > -
> > return 0;
> > }
> >
> > void hns_roce_cmd_use_polling(struct hns_roce_dev *hr_dev) {
> > struct hns_roce_cmdq *hr_cmd = &hr_dev->cmd;
> > - int i;
> > -
> > - hr_cmd->use_events = 0;
> >
> > - for (i = 0; i < hr_cmd->max_cmds; ++i)
> > - down(&hr_cmd->event_sem);
> > -
> > - kfree(hr_cmd->context);
> > - up(&hr_cmd->poll_sem);
> > + if (hr_cmd->use_events) {
>
> Ensure that hr_cmd->context == NULL in places where it shouldn't be kfreed
> and remove this "if (hr_cmd->use_events)".
>
> Thanks
> .
Hi Leon,
Thanks for your advice, will remove above judgement in v2.
>
>
> > + kfree(hr_cmd->context);
> > + hr_cmd->use_events = 0;
> > + }
> > }
> >
> > struct hns_roce_cmd_mailbox
> > diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c
> > b/drivers/infiniband/hw/hns/hns_roce_main.c
> > index 1b757cc..f3b2f67 100644
> > --- a/drivers/infiniband/hw/hns/hns_roce_main.c
> > +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
> > @@ -902,6 +902,7 @@ int hns_roce_init(struct hns_roce_dev *hr_dev)
> > goto error_failed_cmd_init;
> > }
> >
> > + /* EQ depends on poll mode, event mode depends on EQ */
> > ret = hr_dev->hw->init_eq(hr_dev);
> > if (ret) {
> > dev_err(dev, "eq init failed!\n");
> > @@ -911,8 +912,9 @@ int hns_roce_init(struct hns_roce_dev *hr_dev)
> > if (hr_dev->cmd_mod) {
> > ret = hns_roce_cmd_use_events(hr_dev);
> > if (ret) {
> > - dev_err(dev, "Switch to event-driven cmd failed!\n");
> > - goto error_failed_use_event;
> > + dev_warn(dev,
> > + "Cmd event mode failed, set back to
> poll!\n");
> > + hns_roce_cmd_use_polling(hr_dev);
> > }
> > }
> >
> > @@ -928,12 +930,10 @@ int hns_roce_init(struct hns_roce_dev *hr_dev)
> > goto error_failed_setup_hca;
> > }
> >
> > - if (hr_dev->hw->hw_init) {
> > - ret = hr_dev->hw->hw_init(hr_dev);
> > - if (ret) {
> > - dev_err(dev, "hw_init failed!\n");
> > - goto error_failed_engine_init;
> > - }
> > + ret = hr_dev->hw->hw_init(hr_dev);
> > + if (ret) {
> > + dev_err(dev, "hw_init failed!\n");
> > + goto error_failed_engine_init;
> > }
> >
> > ret = hns_roce_register_device(hr_dev); @@ -955,8 +955,6 @@ int
> > hns_roce_init(struct hns_roce_dev *hr_dev)
> > error_failed_init_hem:
> > if (hr_dev->cmd_mod)
> > hns_roce_cmd_use_polling(hr_dev);
> > -
> > -error_failed_use_event:
> > hr_dev->hw->cleanup_eq(hr_dev);
> >
> > error_failed_eq_table:
> > --
> > 2.8.1
> >
> _______________________________________________
> Linuxarm mailing list
> Linuxarm@huawei.com
> http://hulk.huawei.com/mailman/listinfo/linuxarm
next prev parent reply other threads:[~2019-08-26 8:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 13:14 [PATCH for-next 0/9] Fixes for hip08 driver Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 1/9] RDMA/hns: Refactor cmd init and mode selection for hip08 Lijun Ou
2019-08-21 17:19 ` Leon Romanovsky
2019-08-26 8:43 ` liweihang [this message]
2019-08-21 13:14 ` [PATCH for-next 2/9] RDMA/hns: Refactor the codes of creating qp Lijun Ou
2019-08-28 15:19 ` Doug Ledford
2019-08-29 0:56 ` oulijun
2019-08-21 13:14 ` [PATCH for-next 3/9] RDMA/hns: Modify the data structure of hns_roce_av Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 4/9] RDMA/hns: Remove the some magic number Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 5/9] RDMA/hns: Fix cast from or to restricted __le32 for driver Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 6/9] RDMA/hns: Add reset process for function-clear Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 7/9] RDMA/hns: Remove if-else judgment statements for creating srq Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 8/9] RDMA/hns: Delete the not-used lines Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 9/9] RDMA/hns: Fix wrong assignment of qp_access_flags Lijun Ou
2019-08-28 15:31 ` [PATCH for-next 0/9] Fixes for hip08 driver Doug Ledford
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=B82435381E3B2943AA4D2826ADEF0B3A0203B3B7@DGGEML522-MBX.china.huawei.com \
--to=liweihang@hisilicon.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=oulijun@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).