Re: INFO: rcu detected stall in do_idle

From: luca abeni
Date: Thu Oct 18 2018 - 07:08:21 EST


On Thu, 18 Oct 2018 12:47:13 +0200
Juri Lelli <juri.lelli@xxxxxxxxxx> wrote:

> Hi,
>
> On 18/10/18 12:23, luca abeni wrote:
> > Hi Juri,
> >
> > On Thu, 18 Oct 2018 10:28:38 +0200
> > Juri Lelli <juri.lelli@xxxxxxxxxx> wrote:
> > [...]
> > > struct sched_attr {
> > > .size = 0,
> > > .policy = 6,
> > > .flags = 0,
> > > .nice = 0,
> > > .priority = 0,
> > > .runtime = 0x9917,
> > > .deadline = 0xffff,
> > > .period = 0,
> > > }
> > >
> > > So, we seem to be correctly (in theory, see below) accepting the
> > > task.
> > >
> > > What seems to generate the problem here is that CONFIG_HZ=100 and
> > > reproducer task has "tiny" runtime (~40us) and deadline (~66us)
> > > parameters, combination that "bypasses" the enforcing mechanism
> > > (performed at each tick).
> >
> > Ok, so the task can execute for at most 1 tick before being
> > throttled... Which does not look too bad.
> >
> > I missed the original emails, but maybe the issue is that the task
> > blocks before the tick, and when it wakes up again something goes
> > wrong with the deadline and runtime assignment? (maybe because the
> > deadline is in the past?)
>
> No, the problem is that the task won't be throttled at all, because
> its replenishing instant is always way in the past when tick
> occurs. :-/

Ok, I see the issue now: the problem is that the "while (dl_se->runtime
<= 0)" loop is executed at replenishment time, but the deadline should
be postponed at enforcement time.

I mean: in update_curr_dl() we do:
dl_se->runtime -= scaled_delta_exec;
if (dl_runtime_exceeded(dl_se) || dl_se->dl_yielded) {
...
enqueue replenishment timer at dl_next_period(dl_se)
But dl_next_period() is based on a "wrong" deadline!


I think that inserting a
while (dl_se->runtime <= -pi_se->dl_runtime) {
dl_se->deadline += pi_se->dl_period;
dl_se->runtime += pi_se->dl_runtime;
}
immediately after "dl_se->runtime -= scaled_delta_exec;" would fix the
problem, no?
If we go this way, then we can remove the while loop from
replenish_dl_entity(), and change it in
WARN_ON(dl_se->runtime <= -pi_se->dl_runtime);
WARN_ON(dl_se->runtime > 0);
dl_se->deadline += pi_se->dl_period;
dl_se->runtime += pi_se->dl_runtime;
or something similar.


Luca