linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wenpeng Liang <liangwenpeng@huawei.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: <dledford@redhat.com>, <jgg@nvidia.com>,
	<linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>,
	Xi Wang <wangxi11@huawei.com>
Subject: Re: [PATCH v3 for-next 12/12] RDMA/hns: Dump detailed driver-specific UCTX
Date: Wed, 28 Jul 2021 14:13:15 +0800	[thread overview]
Message-ID: <d5427613-b9bc-f527-1a28-8f20c288394c@huawei.com> (raw)
In-Reply-To: <YP/0ksOdlErAT9lh@unreal>



On 2021/7/27 19:57, Leon Romanovsky wrote:
> On Tue, Jul 27, 2021 at 11:27:32AM +0800, Wenpeng Liang wrote:
>> From: Xi Wang <wangxi11@huawei.com>
>>
>> Dump DCA mem pool status in UCTX restrack.
>>
>> Sample output:
>> $ rdma res show ctx dev hns_0 -dd
>>  dev hns_0 ctxn 7 pid 1410 comm python3 drv_dca-loading 37.50 drv_dca-total 65536 drv_dca-free 40960
>>  dev hns_0 ctxn 8 pid 1410 comm python3 drv_dca-loading 0.00 drv_dca-total 0 drv_dca-free 0
>>
>> Signed-off-by: Xi Wang <wangxi11@huawei.com>
>> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
>> ---
>>  drivers/infiniband/hw/hns/hns_roce_device.h   |  2 +
>>  drivers/infiniband/hw/hns/hns_roce_main.c     |  1 +
>>  drivers/infiniband/hw/hns/hns_roce_restrack.c | 85 +++++++++++++++++++++++++++
>>  3 files changed, 88 insertions(+)
> <...>
> 
>> +static int hns_roce_fill_dca_uctx(struct hns_roce_dca_ctx *ctx,
>> +				  struct sk_buff *msg)
>> +{
>> +	char tmp_str[LOADING_PERCENT_CHARS];
>> +	unsigned long flags;
>> +	u64 total, free;
>> +	u64 percent;
>> +	u32 rem = 0;
>> +
>> +	spin_lock_irqsave(&ctx->pool_lock, flags);
>> +	total = ctx->total_size;
>> +	free = ctx->free_size;
>> +	spin_unlock_irqrestore(&ctx->pool_lock, flags);
>> +
>> +	percent = calc_dca_loading_percent(total, free, &rem);
>> +	scnprintf(tmp_str, sizeof(tmp_str), "%llu.%0*u\n", percent,
>> +		  LOADING_PERCENT_SHIFT, rem);
>> +
>> +	if (rdma_nl_put_driver_string(msg, "dca-loading", tmp_str))
>> +		goto err;
> Please no, users can calculate percentage by themselves. We don't need
> to complicate kernel for it.
> 
> Thanks
> 

The next version will remove "dca-loading".

Thanks

>> +
>> +	if (rdma_nl_put_driver_u64(msg, "dca-total", total))
>> +		goto err;
>> +
>> +	if (rdma_nl_put_driver_u64(msg, "dca-free", free))
>> +		goto err;
>> +
>> +	return 0;
>> +
>> +err:
>> +	return -EMSGSIZE;
>> +}

      reply	other threads:[~2021-07-28  6:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  3:27 [PATCH v3 for-next 00/12] RDMA/hns: Add support for Dynamic Context Attachment Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 01/12] RDMA/hns: Introduce DCA for RC QP Wenpeng Liang
2021-07-27 12:07   ` Leon Romanovsky
2021-07-28  6:10     ` Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 02/12] RDMA/hns: Add method for shrinking DCA memory pool Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 03/12] RDMA/hns: Configure DCA mode for the userspace QP Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 04/12] RDMA/hns: Refactor QP modify flow Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 05/12] RDMA/hns: Add method for attaching WQE buffer Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 06/12] RDMA/hns: Setup the configuration of WQE addressing to QPC Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 07/12] RDMA/hns: Add method to detach WQE buffer Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 08/12] RDMA/hns: Add method to query WQE buffer's address Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 09/12] RDMA/hns: Add a shared memory to sync DCA status Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 10/12] RDMA/hns: Sync DCA status by the shared memory Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 11/12] RDMA/nldev: Add detailed CTX information support Wenpeng Liang
2021-07-27  3:27 ` [PATCH v3 for-next 12/12] RDMA/hns: Dump detailed driver-specific UCTX Wenpeng Liang
2021-07-27 11:57   ` Leon Romanovsky
2021-07-28  6:13     ` Wenpeng Liang [this message]

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=d5427613-b9bc-f527-1a28-8f20c288394c@huawei.com \
    --to=liangwenpeng@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=wangxi11@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).