[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131220132323.524cf2b1@gandalf.local.home>
Date: Fri, 20 Dec 2013 13:23:23 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: tglx@...utronix.de, mingo@...hat.com, oleg@...hat.com,
fweisbec@...il.com, darren@...art.com, johan.eker@...csson.com,
p.faure@...tech.ch, linux-kernel@...r.kernel.org,
claudio@...dence.eu.com, michael@...rulasolutions.com,
fchecconi@...il.com, tommaso.cucinotta@...up.it,
juri.lelli@...il.com, nicola.manica@...i.unitn.it,
luca.abeni@...tn.it, dhaval.giani@...il.com, hgu1972@...il.com,
paulmck@...ux.vnet.ibm.com, raistlin@...ux.it,
insop.song@...il.com, liming.wang@...driver.com, jkacur@...hat.com
Subject: Re: [PATCH 09/13] sched: Add bandwidth management for sched_dl
On Fri, 20 Dec 2013 18:42:00 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
> On Fri, Dec 20, 2013 at 12:37:07PM -0500, Steven Rostedt wrote:
> > On Fri, 20 Dec 2013 18:13:43 +0100
> > Peter Zijlstra <peterz@...radead.org> wrote:
> >
> >
> > > @@ -4985,6 +4942,23 @@ migration_call(struct notifier_block *nf
> > > unsigned long flags;
> > > struct rq *rq = cpu_rq(cpu);
> > >
> > > + switch (action) {
> > > + case CPU_DOWN_PREPARE: /* explicitly allow suspend */
> > > + {
> > > + struct dl_bw *dl_b = dl_bw_of(cpu);
> > > + int cpus = dl_bw_cpus(cpu);
> > > + bool overflow;
> > > +
> > > + raw_spin_lock_irqsave(&dl_b->lock, flags);
> > > + overflow = __dl_overflow(dl_b, cpus-1, 0, 0);
> > > + raw_spin_unlock_irqrestore(&dl_b->lock, flags);
> > > +
> > > + if (overflow)
> > > + return notifier_from_errno(-EBUSY);
> >
> > Is it possible to have a race here to create a new deadline task that
> > may work with cpus but not cpus-1? That is, if a new deadline task is
> > currently being created as a CPU is going offline, this check happens
> > first while the creation is spinning on the dl_b->lock, and it sets
> > overflow to false, then once the lock is released, the new deadline
> > task makes the condition true.
> >
> > Should the system call have a get_online_cpus() somewhere?
>
> No, should be all good; the entire admission control is serialized by
> that dl_b->lock, and its a raw_spin_lock (as can be seen from the above)
> which already very much excludes hotplug.
I'm saying what stops this?
CPU 0 CPU 1
----- -----
sched_setattr()
dl_overflow()
cpus = __dl_span_weight()
cpu_down()
raw_spin_lock()
raw_spin_lock() /* blocks */
overflow = __dl_overflow(cpus-1);
raw_spin_unlock();
/* gets lock */
__dl_overflow(cpus) /* all OK! */
/* cpus goes to cpus - 1 making
__dl_overflow() not OK anymore */
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists