From: Yangyang Li <liyangyang20@huawei.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>
Cc: Lijun Ou <oulijun@huawei.com>, <dledford@redhat.com>,
<linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: Re: [PATCH for-next 8/9] RDMA/hns: Kernel notify usr space to stop ring db
Date: Wed, 14 Aug 2019 13:54:02 +0800 [thread overview]
Message-ID: <6ab06eaf-e257-2a3b-2c1b-c008f2a70038@huawei.com> (raw)
In-Reply-To: <20190812131437.GG24457@ziepe.ca>
Hi, Leon & Jason
Thanks a lot for your reply.
在 2019/8/12 21:14, Jason Gunthorpe 写道:
> On Mon, Aug 12, 2019 at 08:52:20AM +0300, Leon Romanovsky wrote:
>> On Fri, Aug 09, 2019 at 05:41:05PM +0800, Lijun Ou wrote:
>>> From: Yangyang Li <liyangyang20@huawei.com>
>>>
>>> In the reset scenario, if the kernel receives the reset signal,
>>> it needs to notify the user space to stop ring doorbell.
>>
>> I doubt about it, it is racy like hell and relies on assumption that
>> userspace will honor such request to stop.
>
> Sounds like this is the device unplug flow we already have support
> for, use the APIs to drop the VMA refering to the doorbell
Thanks for the suggestion, I have found this new unplug API,
and I am trying to use it in the driver..
>
>>> Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
>>> drivers/infiniband/hw/hns/hns_roce_device.h | 4 +++
>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 52 ++++++++++++++++++++++++++++-
>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 4 +++
>>> drivers/infiniband/hw/hns/hns_roce_main.c | 22 ++++++------
>>> 4 files changed, 70 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
>>> index 32465f5..be65fce 100644
>>> +++ b/drivers/infiniband/hw/hns/hns_roce_device.h
>>> @@ -268,6 +268,8 @@ enum {
>>>
>>> #define PAGE_ADDR_SHIFT 12
>>>
>>> +#define HNS_ROCE_IS_RESETTING 1
>>> +
>>> struct hns_roce_uar {
>>> u64 pfn;
>>> unsigned long index;
>>> @@ -1043,6 +1045,8 @@ struct hns_roce_dev {
>>> u32 odb_offset;
>>> dma_addr_t tptr_dma_addr; /* only for hw v1 */
>>> u32 tptr_size; /* only for hw v1 */
>>> + struct page *reset_page; /* store reset state */
>>> + void *reset_kaddr; /* addr of reset page */
>>> const struct hns_roce_hw *hw;
>>> void *priv;
>>> struct workqueue_struct *irq_workq;
>>> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>>> index d33341e..138e5a8 100644
>>> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>>> @@ -1867,17 +1867,49 @@ static void hns_roce_free_link_table(struct hns_roce_dev *hr_dev,
>>> link_tbl->table.map);
>>> }
>>>
>>> +static int hns_roce_v2_get_reset_page(struct hns_roce_dev *hr_dev)
>>> +{
>>> + hr_dev->reset_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
>>> + if (!hr_dev->reset_page)
>>> + return -ENOMEM;
>>> +
>>> + hr_dev->reset_kaddr = vmap(&hr_dev->reset_page, 1, VM_MAP, PAGE_KERNEL);
>>> + if (!hr_dev->reset_kaddr)
>>> + goto err_with_vmap;
>
> Yes, this vmap is nonsense too, get_zeroed_page() is the right API
>
> Jason
>
>
Thanks for the suggestion, put_page is not the correct usage,
I will use the appropriate API to fix it in the next patch.
Thanks
next prev parent reply other threads:[~2019-08-14 5:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-09 9:40 [PATCH for-next 0/9] Bugfixes for 5.3-rc2 Lijun Ou
2019-08-09 9:40 ` [PATCH for-next 1/9] RDMA/hns: Logic optimization of wc_flags Lijun Ou
2019-08-09 9:40 ` [PATCH for-next 2/9] RDMA/hns: Bugfix for creating qp attached to srq Lijun Ou
2019-08-12 15:29 ` Doug Ledford
2019-08-09 9:41 ` [PATCH for-next 3/9] RDMA/hns: Completely release qp resources when hw err Lijun Ou
2019-08-12 15:29 ` Doug Ledford
2019-08-14 6:02 ` Yangyang Li
2019-08-14 15:05 ` Doug Ledford
2019-08-14 18:47 ` Leon Romanovsky
2019-08-19 17:39 ` Doug Ledford
2019-10-08 8:43 ` liweihang
2019-08-09 9:41 ` [PATCH for-next 4/9] RDMA/hns: Modify pi vlaue when cq overflows Lijun Ou
2019-08-09 9:41 ` [PATCH for-next 5/9] RDMA/hns: Bugfix for slab-out-of-bounds when unloading hip08 driver Lijun Ou
2019-08-09 9:41 ` [PATCH for-next 6/9] RDMA/hns: bugfix for slab-out-of-bounds when loading " Lijun Ou
2019-08-09 9:41 ` [PATCH for-next 7/9] RDMA/hns: Remove unuseful member Lijun Ou
2019-08-09 9:41 ` [PATCH for-next 8/9] RDMA/hns: Kernel notify usr space to stop ring db Lijun Ou
2019-08-12 5:52 ` Leon Romanovsky
2019-08-12 13:14 ` Jason Gunthorpe
2019-08-14 5:54 ` Yangyang Li [this message]
2019-08-09 9:41 ` [PATCH for-next 9/9] RDMA/hns: Copy some information of AV to user Lijun Ou
2019-10-21 17:23 ` Doug Ledford
2019-10-22 1:13 ` oulijun
2019-08-13 16:34 ` [PATCH for-next 0/9] Bugfixes for 5.3-rc2 Doug Ledford
2019-08-24 6:23 ` oulijun
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=6ab06eaf-e257-2a3b-2c1b-c008f2a70038@huawei.com \
--to=liyangyang20@huawei.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).