lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 19 Nov 2019 14:38:23 -0800
From:   Rao Shoaib <rao.shoaib@...cle.com>
To:     Jason Gunthorpe <jgg@...pe.ca>
Cc:     monis@...lanox.com, dledford@...hat.com, sean.hefty@...el.com,
        hal.rosenstock@...il.com, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] Introduce maximum WQE size to check limits


On 11/19/19 12:31 PM, Jason Gunthorpe wrote:
> On Mon, Nov 18, 2019 at 11:54:38AM -0800, rao Shoaib wrote:
>> From: Rao Shoaib <rao.shoaib@...cle.com>
>>
>> Introduce maximum WQE size to impose limits on max SGE's and inline data
>>
>> Signed-off-by: Rao Shoaib <rao.shoaib@...cle.com>
>>   drivers/infiniband/sw/rxe/rxe_param.h | 3 ++-
>>   drivers/infiniband/sw/rxe/rxe_qp.c    | 7 +++++--
>>   2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h
>> index 1b596fb..31fb5c7 100644
>> +++ b/drivers/infiniband/sw/rxe/rxe_param.h
>> @@ -68,7 +68,6 @@ enum rxe_device_param {
>>   	RXE_HW_VER			= 0,
>>   	RXE_MAX_QP			= 0x10000,
>>   	RXE_MAX_QP_WR			= 0x4000,
>> -	RXE_MAX_INLINE_DATA		= 400,
>>   	RXE_DEVICE_CAP_FLAGS		= IB_DEVICE_BAD_PKEY_CNTR
>>   					| IB_DEVICE_BAD_QKEY_CNTR
>>   					| IB_DEVICE_AUTO_PATH_MIG
>> @@ -79,7 +78,9 @@ enum rxe_device_param {
>>   					| IB_DEVICE_RC_RNR_NAK_GEN
>>   					| IB_DEVICE_SRQ_RESIZE
>>   					| IB_DEVICE_MEM_MGT_EXTENSIONS,
>> +	RXE_MAX_WQE_SIZE		= 0x2d0, /* For RXE_MAX_SGE */
> This shouldn't just be a random constant, I think you are trying to
> say:
>
>    RXE_MAX_WQE_SIZE = sizeof(struct rxe_send_wqe) + sizeof(struct ib_sge)*RXE_MAX_SGE
I thought you wanted this value to be independent of RXE_MAX_SGE, else 
why are defining it.
>
> Just say that
>
>>   	RXE_MAX_SGE			= 32,
>> +	RXE_MAX_INLINE_DATA		= RXE_MAX_WQE_SIZE,
> This is mixed up now, it should be
>
>    RXE_MAX_INLINE_DATA = RXE_MAX_WQE_SIZE - sizeof(rxe_send_wqe)

I agree to what you are suggesting, it will make the current patch 
better. However, In my previous patch I had

RXE_MAX_INLINE_DATA		= RXE_MAX_SGE * sizeof(struct ib_sge)

IMHO that conveys the intent much better. I do not see the reason for 
defining RXE_MAX_WQE_SIZE, ib_device_attr does not even have an entry 
for it and hence the value is not used anywhere by rxe or by any other 
relevant driver.

I will re-submit with the changes you have suggested.

Shoaib


>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
>> index aeea994..323e43d 100644
>> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
>> @@ -78,9 +78,12 @@ static int rxe_qp_chk_cap(struct rxe_dev *rxe, struct ib_qp_cap *cap,
>>   		}
>>   	}
>>   
>> -	if (cap->max_inline_data > rxe->max_inline_data) {
>> +	if (cap->max_inline_data >
>> +	    rxe->max_inline_data - sizeof(struct rxe_send_wqe)) {
>>   		pr_warn("invalid max inline data = %d > %d\n",
>> -			cap->max_inline_data, rxe->max_inline_data);
>> +			cap->max_inline_data,
>> +			rxe->max_inline_data -
>> +			    (u32)sizeof(struct rxe_send_wqe));
> Then this isn't needed
>
> And this code in the other patch:
>
> +	wqe_size = max_t(int, init->cap.max_send_sge * sizeof(struct ib_sge),
> +			 init->cap.max_inline_data);
> +	qp->sq.max_sge = wqe_size/sizeof(struct ib_sge);
> +	qp->sq.max_inline = wqe_size;
>
> Makes sense as both max_inline_data and 'init->cap.max_send_sge *
> sizeof(struct ib_sge)' are exclusive of the wqe header
>
> Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ