diff mbox

linux-generic: timer: limit notification about resolution incorrectness

Message ID 1453475251-8501-1-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit 7f303349beb5414c1316eb694daea0ceb7af4b23
Headers show

Commit Message

Ivan Khoronzhuk Jan. 22, 2016, 3:07 p.m. UTC
https://bugs.linaro.org/show_bug.cgi?id=1992

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 platform/linux-generic/odp_timer.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Ivan Khoronzhuk Jan. 22, 2016, 3:10 p.m. UTC | #1
+ Stuart Haslam

On 22.01.16 17:07, Ivan Khoronzhuk wrote:
> https://bugs.linaro.org/show_bug.cgi?id=1992
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> ---
>   platform/linux-generic/odp_timer.c | 14 ++++++++++----
>   1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
> index 4bab481..01339ad 100644
> --- a/platform/linux-generic/odp_timer.c
> +++ b/platform/linux-generic/odp_timer.c
> @@ -168,6 +168,7 @@ typedef struct odp_timer_pool_s {
>   	char name[ODP_TIMER_POOL_NAME_LEN];
>   	odp_shm_t shm;
>   	timer_t timerid;
> +	int notify_overrun;
>   } odp_timer_pool;
>
>   #define MAX_TIMER_POOLS 255 /* Leave one for ODP_TIMER_INVALID */
> @@ -239,6 +240,7 @@ static odp_timer_pool *odp_timer_pool_new(
>   	tp->num_alloc = 0;
>   	odp_atomic_init_u32(&tp->high_wm, 0);
>   	tp->first_free = 0;
> +	tp->notify_overrun = 1;
>   	tp->tick_buf = (void *)((char *)odp_shm_addr(shm) + sz0);
>   	tp->timers = (void *)((char *)odp_shm_addr(shm) + sz0 + sz1);
>   	/* Initialize all odp_timer entries */
> @@ -635,10 +637,14 @@ static void timer_notify(sigval_t sigval)
>   	int overrun;
>   	odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr;
>
> -	overrun = timer_getoverrun(tp->timerid);
> -	if (overrun)
> -		ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
> -			overrun, tp->name);
> +	if (tp->notify_overrun) {
> +		overrun = timer_getoverrun(tp->timerid);
> +		if (overrun) {
> +			ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
> +				overrun, tp->name);
> +			tp->notify_overrun = 0;
> +		}
> +	}
>
>   #ifdef __ARM_ARCH
>   	odp_timer *array = &tp->timers[0];
>
Stuart Haslam Jan. 22, 2016, 5:20 p.m. UTC | #2
On Fri, Jan 22, 2016 at 05:07:31PM +0200, Ivan Khoronzhuk wrote:
> https://bugs.linaro.org/show_bug.cgi?id=1992
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Reviewed-and-Tested-by: Stuart Haslam <stuart.haslam@linaro.org>

> ---
>  platform/linux-generic/odp_timer.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
> index 4bab481..01339ad 100644
> --- a/platform/linux-generic/odp_timer.c
> +++ b/platform/linux-generic/odp_timer.c
> @@ -168,6 +168,7 @@ typedef struct odp_timer_pool_s {
>  	char name[ODP_TIMER_POOL_NAME_LEN];
>  	odp_shm_t shm;
>  	timer_t timerid;
> +	int notify_overrun;
>  } odp_timer_pool;
>  
>  #define MAX_TIMER_POOLS 255 /* Leave one for ODP_TIMER_INVALID */
> @@ -239,6 +240,7 @@ static odp_timer_pool *odp_timer_pool_new(
>  	tp->num_alloc = 0;
>  	odp_atomic_init_u32(&tp->high_wm, 0);
>  	tp->first_free = 0;
> +	tp->notify_overrun = 1;
>  	tp->tick_buf = (void *)((char *)odp_shm_addr(shm) + sz0);
>  	tp->timers = (void *)((char *)odp_shm_addr(shm) + sz0 + sz1);
>  	/* Initialize all odp_timer entries */
> @@ -635,10 +637,14 @@ static void timer_notify(sigval_t sigval)
>  	int overrun;
>  	odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr;
>  
> -	overrun = timer_getoverrun(tp->timerid);
> -	if (overrun)
> -		ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
> -			overrun, tp->name);
> +	if (tp->notify_overrun) {
> +		overrun = timer_getoverrun(tp->timerid);
> +		if (overrun) {
> +			ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
> +				overrun, tp->name);
> +			tp->notify_overrun = 0;
> +		}
> +	}
>  
>  #ifdef __ARM_ARCH
>  	odp_timer *array = &tp->timers[0];
> -- 
> 1.9.1
>
Maxim Uvarov Jan. 25, 2016, 12:17 p.m. UTC | #3
Merged,

with fix:

WARNING: 'Reviewed-and-tested-by:' is the preferred signature form
#10:
Reviewed-and-Tested-by: Stuart Haslam <stuart.haslam@linaro.org>

Maxim.

On 01/22/2016 20:20, Stuart Haslam wrote:
> On Fri, Jan 22, 2016 at 05:07:31PM +0200, Ivan Khoronzhuk wrote:
>> https://bugs.linaro.org/show_bug.cgi?id=1992
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> Reviewed-and-Tested-by: Stuart Haslam <stuart.haslam@linaro.org>
>
>> ---
>>   platform/linux-generic/odp_timer.c | 14 ++++++++++----
>>   1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
>> index 4bab481..01339ad 100644
>> --- a/platform/linux-generic/odp_timer.c
>> +++ b/platform/linux-generic/odp_timer.c
>> @@ -168,6 +168,7 @@ typedef struct odp_timer_pool_s {
>>   	char name[ODP_TIMER_POOL_NAME_LEN];
>>   	odp_shm_t shm;
>>   	timer_t timerid;
>> +	int notify_overrun;
>>   } odp_timer_pool;
>>   
>>   #define MAX_TIMER_POOLS 255 /* Leave one for ODP_TIMER_INVALID */
>> @@ -239,6 +240,7 @@ static odp_timer_pool *odp_timer_pool_new(
>>   	tp->num_alloc = 0;
>>   	odp_atomic_init_u32(&tp->high_wm, 0);
>>   	tp->first_free = 0;
>> +	tp->notify_overrun = 1;
>>   	tp->tick_buf = (void *)((char *)odp_shm_addr(shm) + sz0);
>>   	tp->timers = (void *)((char *)odp_shm_addr(shm) + sz0 + sz1);
>>   	/* Initialize all odp_timer entries */
>> @@ -635,10 +637,14 @@ static void timer_notify(sigval_t sigval)
>>   	int overrun;
>>   	odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr;
>>   
>> -	overrun = timer_getoverrun(tp->timerid);
>> -	if (overrun)
>> -		ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
>> -			overrun, tp->name);
>> +	if (tp->notify_overrun) {
>> +		overrun = timer_getoverrun(tp->timerid);
>> +		if (overrun) {
>> +			ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
>> +				overrun, tp->name);
>> +			tp->notify_overrun = 0;
>> +		}
>> +	}
>>   
>>   #ifdef __ARM_ARCH
>>   	odp_timer *array = &tp->timers[0];
>> -- 
>> 1.9.1
>>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 4bab481..01339ad 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -168,6 +168,7 @@  typedef struct odp_timer_pool_s {
 	char name[ODP_TIMER_POOL_NAME_LEN];
 	odp_shm_t shm;
 	timer_t timerid;
+	int notify_overrun;
 } odp_timer_pool;
 
 #define MAX_TIMER_POOLS 255 /* Leave one for ODP_TIMER_INVALID */
@@ -239,6 +240,7 @@  static odp_timer_pool *odp_timer_pool_new(
 	tp->num_alloc = 0;
 	odp_atomic_init_u32(&tp->high_wm, 0);
 	tp->first_free = 0;
+	tp->notify_overrun = 1;
 	tp->tick_buf = (void *)((char *)odp_shm_addr(shm) + sz0);
 	tp->timers = (void *)((char *)odp_shm_addr(shm) + sz0 + sz1);
 	/* Initialize all odp_timer entries */
@@ -635,10 +637,14 @@  static void timer_notify(sigval_t sigval)
 	int overrun;
 	odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr;
 
-	overrun = timer_getoverrun(tp->timerid);
-	if (overrun)
-		ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
-			overrun, tp->name);
+	if (tp->notify_overrun) {
+		overrun = timer_getoverrun(tp->timerid);
+		if (overrun) {
+			ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n",
+				overrun, tp->name);
+			tp->notify_overrun = 0;
+		}
+	}
 
 #ifdef __ARM_ARCH
 	odp_timer *array = &tp->timers[0];