From: Dario Faggioli <dario.faggioli@citrix.com>
To: George Dunlap <george.dunlap@citrix.com>, xen-devel@lists.xenproject.org
Cc: Jonathan Davies <Jonathan.Davies@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Marcus Granado <marcus.granado@citrix.com>
Subject: Re: [PATCH 1/3] xen: sched: introduce the 'null' semi-static scheduler
Date: Thu, 6 Apr 2017 17:07:11 +0200 [thread overview]
Message-ID: <1491491231.18721.20.camel@citrix.com> (raw)
In-Reply-To: <070ec8e5-ee87-ef5f-e83c-099c9743e926@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 2236 bytes --]
On Mon, 2017-03-27 at 11:31 +0100, George Dunlap wrote:
> On 17/03/17 18:42, Dario Faggioli wrote:
> > +static void null_vcpu_insert(const struct scheduler *ops, struct
> > vcpu *v)
> > +{
> > + struct null_private *prv = null_priv(ops);
> > + struct null_vcpu *nvc = null_vcpu(v);
> > + unsigned int cpu;
> > + spinlock_t *lock;
> > +
> > + ASSERT(!is_idle_vcpu(v));
> > +
> > + retry:
> > + lock = vcpu_schedule_lock_irq(v);
> > +
> > + cpu = pick_cpu(prv, v);
> > +
> > + /* We hold v->processor's runq lock, but we need cpu's one */
> > + if ( cpu != v->processor )
> > + {
> > + spin_unlock(lock);
> > + lock = pcpu_schedule_lock(cpu);
>
> Don't we need to hold the lock for v->processor until we change
> v->processor? Otherwise someone might call vcpu_schedule_lock(v) at
> this point and reasonably believe that is has the right to modify v.
>
Yes, this is actually the case.
> Or does this not matter because we're just now calling insert (and so
> nobody else is going to call vcpu_schedule_lock() on v?
>
Indeed no one will. But I still prefer to turn this into something much
more similar to what other schedulers do, and what is the most correct
and safe to do, i.e., as you suggest, change v->processor while holding
the original lock.
> > diff --git a/xen/common/schedule.c b/xen/common/schedule.c
> > index 223a120..b482037 100644
> > --- a/xen/common/schedule.c
> > +++ b/xen/common/schedule.c
> > @@ -1785,6 +1785,8 @@ int schedule_cpu_switch(unsigned int cpu,
> > struct cpupool *c)
> >
> > out:
> > per_cpu(cpupool, cpu) = c;
> > + /* Trigger a reschedule so the CPU can pick up some work ASAP.
> > */
> > + cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ);
>
> Is this a more generic fix / improvement?
>
Yep, I'm moving it in its own patch.
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-04-06 15:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 18:42 [PATCH 0/3] The 'null' Scheduler Dario Faggioli
2017-03-17 18:42 ` [PATCH 1/3] xen: sched: introduce the 'null' semi-static scheduler Dario Faggioli
2017-03-20 23:21 ` Stefano Stabellini
2017-03-21 8:26 ` Dario Faggioli
2017-03-27 10:31 ` George Dunlap
2017-03-27 10:48 ` George Dunlap
2017-04-06 14:43 ` Dario Faggioli
2017-04-06 15:07 ` Dario Faggioli [this message]
2017-03-17 18:43 ` [PATCH 2/3] xen: sched_null: support for hard affinity Dario Faggioli
2017-03-20 23:46 ` Stefano Stabellini
2017-03-21 8:47 ` Dario Faggioli
2017-03-17 18:43 ` [PATCH 3/3] tools: sched: add support for 'null' scheduler Dario Faggioli
2017-03-20 22:28 ` Stefano Stabellini
2017-03-21 17:09 ` Wei Liu
2017-03-27 10:50 ` George Dunlap
2017-04-06 10:49 ` Dario Faggioli
2017-04-06 13:59 ` George Dunlap
2017-04-06 15:18 ` Dario Faggioli
2017-04-07 9:42 ` Wei Liu
2017-04-07 10:05 ` Dario Faggioli
2017-04-07 10:13 ` Wei Liu
2017-03-20 22:23 ` [PATCH 0/3] The 'null' Scheduler Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491491231.18721.20.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=Jonathan.Davies@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=julien.grall@arm.com \
--cc=marcus.granado@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).