lkml.org 
[lkml]   [2018]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] eeprom: at24: Fix unexpected timeout under high load
On Sat, Aug 4, 2018 at 8:43 PM, Mark Jonas <mark.jonas@de.bosch.com> wrote:


> -#define at24_loop_until_timeout(tout, op_time) \
> - for (tout = jiffies + msecs_to_jiffies(at24_write_timeout), \
> - op_time = 0; \
> - op_time ? time_before(op_time, tout) : true; \
> - usleep_range(1000, 1500), op_time = jiffies)

This one understandble and represents one operation.

> +#define at24_loop_until_timeout_begin(tout, op_time) \
> + tout = jiffies + msecs_to_jiffies(at24_write_timeout); \
> + while (true) { \
> + op_time = jiffies;
> +
> +#define at24_loop_until_timeout_end(tout, op_time) \
> + if (time_before(tout, op_time)) \
> + break; \
> + usleep_range(1000, 1500); \
> + }

Besides `while (true)`, which is a red flag for timeout loops,
these are done in an hack way. Just open code them in both cases, or
rewrite original one to keel it's semantics.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-08-04 22:53    [W:0.048 / U:5.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site