Re: [PATCH v3 for-next 12/12] RDMA/hns: Dump detailed driver-specific UCTX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>
>>
>> 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@xxxxxxxxxx>
>> Signed-off-by: Wenpeng Liang <liangwenpeng@xxxxxxxxxx>
>> ---
>>  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;
>> +}



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux