accel-config/test: Fix description timeout calculation to overflow
Tony Zhu
PATCH 1/1 accel-config/test: Fix description timeout calculation to overflow
Dsa_test application will fail when when utilizing memory sizes larger than 128MiB against multiple devices. The init of timeout should use the input msec_timeout.
--- test/accel_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
test/accel_test.c +1 -1
@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp, j++; } }else { -unsigned long timeout = (ms_timeout *1000000 ) *3 ; +unsigned long timeout = (msec_timeout *1000000ul ) *3 ;int r =1 ;unsigned long t =0 ;
Signature · 1 line
2.27.0
Dave Jiang
Quoted 5 lines · Tony Zhu
Dsa_testapplication will fail when when utilizing memory sizes larger than 128MiB against multiple devices. The init of timeout should use the inputmsec_timeout.Signed-off-by Tony Zhu <tony.zhu(a)intel.com>
Ken, you want your sign off added?
Quoted 9 lines
--- test/accel_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)test/accel_test.c +0
-0
test/accel_test.c int acctest_wait_on_desc_timeout(struct completion_record *comp, · line 334
Quoted 5 lines
test/accel_test.c +1
-1@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp, j++; } }else { -unsigned long timeout = (ms_timeout *1000000 ) *3 ; +unsigned long timeout = (msec_timeout *1000000ul ) *3 ;
Couple things. This looks like changed with the common code refactoring? Has that merged by Ramesh? If not then maybe do the diff before that code since we need to get this fix released. And then make sure the refactoring take this change into account.
Also, did you compile test this? I don't see the var name ms_timeout changed to msec_timeout.
Quoted 3 lines
test/accel_test.c +0
-0int r =1 ;unsigned long t =0 ;
Zhu
Dave,
The code base is pending branch. It included the common code refactoring.
I've tested it. msec_timeout is defined in the function.
int acctest_wait_on_desc_timeout(struct completion_record *comp,
struct acctest_context *ctx, unsigned int msec_timeout)
unsigned int ms_timeout = 5000, should not use it in this function.
Tony(zhu, xinzhan)
Cube:SHZ1-3W-279
iNet:8821-5077
-----Original Message-----
From: Jiang, Dave <dave.jiang(a)intel.com>
Sent: Thursday, April 28, 2022 9:49 AM
To: Zhu, Tony <tony.zhu(a)intel.com>; accel-config(a)lists.01.org
Cc: Thomas, Ramesh <ramesh.thomas(a)intel.com>; Buchanan, Kenneth <kenneth.buchanan(a)intel.com>
Subject: Re: [PATCH v1 1/1] accel-config/test: Fix description timeout calculation to overflow
Quoted 5 lines · Tony Zhu
Dsa_testapplication will fail when when utilizing memory sizes larger than 128MiB against multiple devices. The init of timeout should use the inputmsec_timeout.Signed-off-by Tony Zhu <tony.zhu(a)intel.com>
Ken, you want your sign off added?
Quoted 9 lines
--- test/accel_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)test/accel_test.c index renamed from test/accel_test.c +0
-08487099..0468a00 100644
test/accel_test.c int acctest_wait_on_desc_timeout(struct completion_record *comp, · line 334
Quoted 5 lines
test/accel_test.c +1
-1@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp, j++; } }else { -unsigned long timeout = (ms_timeout *1000000 ) *3 ; +unsigned long timeout = (msec_timeout *1000000ul ) *3 ;
Couple things. This looks like changed with the common code refactoring?
Has that merged by Ramesh? If not then maybe do the diff before that code since we need to get this fix released. And then make sure the refactoring take this change into account.
Also, did you compile test this? I don't see the var name ms_timeout changed to msec_timeout.
Quoted 3 lines
test/accel_test.c +0
-0int r =1 ;unsigned long t =0 ;
Dave Jiang
Quoted 11 lines · Tony
Dave,
The code base is pending branch. It included the common code refactoring.
I've tested it.
msec_timeoutis defined in the function.int acctest_wait_on_desc_timeout(struct
completion_record*comp,
structacctest_context*ctx, unsigned intmsec_timeout)unsigned int
ms_timeout= 5000, should not use it in this function.
Gotcha. Should the unused var be removed? Otherwise Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
Quoted 43 lines
Tony(zhu, xinzhan)
Cube:SHZ1-3W-279
iNet:8821-5077-----Original Message-----
From: Jiang, Dave <dave.jiang(a)intel.com>
Sent: Thursday, April 28, 2022 9:49 AM
To: Zhu, Tony <tony.zhu(a)intel.com>; accel-config(a)lists.01.org
Cc: Thomas, Ramesh <ramesh.thomas(a)intel.com>; Buchanan, Kenneth <kenneth.buchanan(a)intel.com>
Subject: Re: [PATCH v1 1/1] accel-config/test: Fix description timeout calculation to overflowQuoted 5 lines · Tony Zhu
Dsa_testapplication will fail when when utilizing memory sizes larger than 128MiB against multiple devices. The init of timeout should use the inputmsec_timeout.Signed-off-by Tony Zhu <tony.zhu(a)intel.com>Ken, you want your sign off added?
Quoted 9 lines
--- test/accel_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)test/accel_test.c index renamed from test/accel_test.c +0
-08487099..0468a00 100644
test/accel_test.c int acctest_wait_on_desc_timeout(struct completion_record *comp, · line 334
Quoted 5 lines
test/accel_test.c +1
-1@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp, j++; } }else { -unsigned long timeout = (ms_timeout *1000000 ) *3 ; +unsigned long timeout = (msec_timeout *1000000ul ) *3 ;Couple things. This looks like changed with the common code refactoring?
Has that merged by Ramesh? If not then maybe do the diff before that code since we need to get this fix released. And then make sure the refactoring take this change into account.Also, did you compile test this? I don't see the var name
ms_timeoutchanged tomsec_timeout.Quoted 3 lines
test/accel_test.c +0
-0int r =1 ;unsigned long t =0 ;
Zhu
It is used in other functions, could not be removed.
Tony(zhu, xinzhan)
Cube:SHZ1-3W-279
iNet:8821-5077
-----Original Message-----
From: Jiang, Dave <dave.jiang(a)intel.com>
Sent: Thursday, April 28, 2022 10:20 AM
To: Zhu, Tony <tony.zhu(a)intel.com>; accel-config(a)lists.01.org
Cc: Thomas, Ramesh <ramesh.thomas(a)intel.com>; Buchanan, Kenneth <kenneth.buchanan(a)intel.com>
Subject: Re: [PATCH v1 1/1] accel-config/test: Fix description timeout calculation to overflow
Quoted 11 lines · Tony
Dave,
The code base is pending branch. It included the common code refactoring.
I've tested it.
msec_timeoutis defined in the function.int acctest_wait_on_desc_timeout(struct
completion_record*comp,
structacctest_context*ctx, unsigned intmsec_timeout)unsigned int
ms_timeout= 5000, should not use it in this function.
Gotcha. Should the unused var be removed? Otherwise Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
Quoted 45 lines
Tony(zhu, xinzhan)
Cube:SHZ1-3W-279
iNet:8821-5077-----Original Message-----
From: Jiang, Dave <dave.jiang(a)intel.com>
Sent: Thursday, April 28, 2022 9:49 AM
To: Zhu, Tony <tony.zhu(a)intel.com>; accel-config(a)lists.01.org
Cc: Thomas, Ramesh <ramesh.thomas(a)intel.com>; Buchanan, Kenneth <kenneth.buchanan(a)intel.com>
Subject: Re: [PATCH v1 1/1] accel-config/test: Fix description timeout calculation to overflowQuoted 5 lines · Tony Zhu
Dsa_testapplication will fail when when utilizing memory sizes larger than 128MiB against multiple devices. The init of timeout should use the inputmsec_timeout.Signed-off-by Tony Zhu <tony.zhu(a)intel.com>Ken, you want your sign off added?
Quoted 9 lines
--- test/accel_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)test/accel_test.c index renamed from test/accel_test.c +0
-08487099..0468a00 100644
test/accel_test.c int acctest_wait_on_desc_timeout(struct completion_record *comp, · line 334
Quoted 5 lines
test/accel_test.c +1
-1@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp, j++; } }else { -unsigned long timeout = (ms_timeout *1000000 ) *3 ; +unsigned long timeout = (msec_timeout *1000000ul ) *3 ;Couple things. This looks like changed with the common code refactoring?
Has that merged by Ramesh? If not then maybe do the diff before that code since we need to get this fix released. And then make sure the refactoring take this change into account.Also, did you compile test this? I don't see the var name
ms_timeoutchanged tomsec_timeout.Quoted 3 lines
test/accel_test.c +0
-0int r =1 ;unsigned long t =0 ;
Dave Jiang
Reviewed-by on v1 1/1Quoted 3 lines · Tony Zhu
Dsa_testapplication will fail when when utilizing memory sizes larger than 128MiB against multiple devices. The init of timeout should use the inputmsec_timeout.
Quoted 1 line
Signed-off-by Tony Zhu <tony.zhu(a)intel.com>
Quoted 17 lines
--- test/accel_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)test/accel_test.c +1
-1@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp, j++; } }else { -unsigned long timeout = (ms_timeout *1000000 ) *3 ; +unsigned long timeout = (msec_timeout *1000000ul ) *3 ;int r =1 ;unsigned long t =0 ;
Dave Jiang
Quoted 5 lines · Dave Jiang
Quoted 3 lines · Tony Zhu
Dsa_testapplication will fail when when utilizing memory sizes larger than 128MiB against multiple devices. The init of timeout should use the inputmsec_timeout.
The commit message should say:
Testing has shown that when using large transfer size, the mwait value is not working correctly. The dsa_test application will fail due to constant value converted by compiler to integer and cause the math to overflow on large values. Explicitly declare constant to UL in order to force type casting of unsigned long. Also, the calculation should use the passed in timeout parameter and not the global constant.
Tony, can you also add a patch and remove the global variable ms_timeout since it's not being used anywhere now? This is not urgent. Thanks!
Quoted 26 lines
Signed-off-by Ken Buchanan <kenneth.buchanan(a)intel.com>Quoted 1 line
Signed-off-by Tony Zhu <tony.zhu(a)intel.com>Reviewed-by Dave Jiang <dave.jiang(a)intel.com>Quoted 9 lines
---
test/accel_test.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)test/accel_test.c +0
-0test/accel_test.c int acctest_wait_on_desc_timeout(struct · line 337
Quoted 8 lines
test/accel_test.c +1
-1@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(structcompletion_record *comp, j++; } } else { - unsigned long timeout = (ms_timeout * 1000000) * 3; + unsigned long timeout = (msec_timeout * 1000000ul) * 3; int r = 1; unsigned long t = 0;_______________________________________________
Accel-config mailing list -- accel-config(a)lists.01.org To unsubscribe send an email to accel-config-leave(a)lists.01.org