Re: yield() in i2c non-happy paths hits BUG under -rt patch

From: Leon Woestenberg
Date: Tue Nov 17 2009 - 19:50:22 EST


Hello,

On Mon, Nov 16, 2009 at 4:56 PM, Mark Brown
<broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Nov 13, 2009 at 11:03:39PM +0100, Thomas Gleixner wrote:
>
>> Q: Why put people yield() into their code ?
>> A: Because:
>>    - it is less nasty than busy waiting for a long time
>>    - it works better
>
> ...
>
>> I can see the idea of using yield() to let other tasks making progress
>> in situations where the hardware is a design failure as well,
>> e.g. bitbang devices. But if we have to deal with hardware which is
>> crap by design yield() is the worst of all answers simply due to its
>> horrible semantics.
>
> What other options are there available for the first case (which is
> often why things work better with the use of yield) that don't involve
> sleeps, or is the idea that in situations like this drivers should
> always sleep?
>
Good point.

I think the yield()s in the device driver code means "I need a small
delay before the hardware is ready" which might translate to some
arbitrary "let me msleep()" or "do not select this task in the next
scheduler run, EVEN IF this task is highest priority".

Can we mark a task sleeping infinitely short, in such a way that the
scheduler does not schedule it at first resched?

During a next timer timeout check, the task would be marked schedulable again.

I assume this is rather dirty and has too much overhead on the timer interfaces.

Regards,

Leon.

--
Leon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/