diff mbox

validation: timer: don't access non-existing timers

Message ID 1458321904-24247-1-git-send-email-zoltan.kiss@linaro.org
State Accepted
Commit 65dfc6bccc751d42104d163961e621f336e993ff
Headers show

Commit Message

Zoltan Kiss March 18, 2016, 5:25 p.m. UTC
Since e5c85d3f "validation: timer: handle early exhaustion of pool" the
workers can handle if object caches retain packets, but with enough
threads it can happen that a late starting thread won't be able to
allocate any. This for loop should take that into account and not
trying to access tt[0].ev.

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---
 test/validation/timer/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zoltan Kiss March 18, 2016, 5:26 p.m. UTC | #1
Note, this is just a resend with a different set of CC recipients

On 18/03/16 17:25, Zoltan Kiss wrote:
> Since e5c85d3f "validation: timer: handle early exhaustion of pool" the
> workers can handle if object caches retain packets, but with enough
> threads it can happen that a late starting thread won't be able to
> allocate any. This for loop should take that into account and not
> trying to access tt[0].ev.
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> ---
>   test/validation/timer/timer.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
> index 5854b32..7b76dbf 100644
> --- a/test/validation/timer/timer.c
> +++ b/test/validation/timer/timer.c
> @@ -338,7 +338,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
>   	uint32_t ms;
>   	uint64_t prev_tick = odp_timer_current_tick(tp);
>
> -	for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
> +	for (ms = 0; ms < 7 * RANGE_MS / 10 && allocated > 0; ms++) {
>   		odp_event_t ev;
>   		while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
>   			/* Subtract one from prev_tick to allow for timeouts
>
Zoltan Kiss March 22, 2016, 10:56 a.m. UTC | #2
Ping

On 18/03/16 17:25, Zoltan Kiss wrote:
> Since e5c85d3f "validation: timer: handle early exhaustion of pool" the
> workers can handle if object caches retain packets, but with enough
> threads it can happen that a late starting thread won't be able to
> allocate any. This for loop should take that into account and not
> trying to access tt[0].ev.
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> ---
>   test/validation/timer/timer.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
> index 5854b32..7b76dbf 100644
> --- a/test/validation/timer/timer.c
> +++ b/test/validation/timer/timer.c
> @@ -338,7 +338,7 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
>   	uint32_t ms;
>   	uint64_t prev_tick = odp_timer_current_tick(tp);
>
> -	for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
> +	for (ms = 0; ms < 7 * RANGE_MS / 10 && allocated > 0; ms++) {
>   		odp_event_t ev;
>   		while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
>   			/* Subtract one from prev_tick to allow for timeouts
>
Maxim Uvarov March 22, 2016, 12:32 p.m. UTC | #3
Merged, with my review.

Maxim.

On 03/22/16 13:56, Zoltan Kiss wrote:
> Ping
>
> On 18/03/16 17:25, Zoltan Kiss wrote:
>> Since e5c85d3f "validation: timer: handle early exhaustion of pool" the
>> workers can handle if object caches retain packets, but with enough
>> threads it can happen that a late starting thread won't be able to
>> allocate any. This for loop should take that into account and not
>> trying to access tt[0].ev.
>>
>> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
>> ---
>>   test/validation/timer/timer.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/test/validation/timer/timer.c 
>> b/test/validation/timer/timer.c
>> index 5854b32..7b76dbf 100644
>> --- a/test/validation/timer/timer.c
>> +++ b/test/validation/timer/timer.c
>> @@ -338,7 +338,7 @@ static void *worker_entrypoint(void *arg 
>> TEST_UNUSED)
>>       uint32_t ms;
>>       uint64_t prev_tick = odp_timer_current_tick(tp);
>>
>> -    for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
>> +    for (ms = 0; ms < 7 * RANGE_MS / 10 && allocated > 0; ms++) {
>>           odp_event_t ev;
>>           while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
>>               /* Subtract one from prev_tick to allow for timeouts
>>
diff mbox

Patch

diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index 5854b32..7b76dbf 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -338,7 +338,7 @@  static void *worker_entrypoint(void *arg TEST_UNUSED)
 	uint32_t ms;
 	uint64_t prev_tick = odp_timer_current_tick(tp);
 
-	for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
+	for (ms = 0; ms < 7 * RANGE_MS / 10 && allocated > 0; ms++) {
 		odp_event_t ev;
 		while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
 			/* Subtract one from prev_tick to allow for timeouts