All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	xen-devel@lists.xenproject.org, Juergen Gross <jgross@ssue.com>
Subject: Re: [PATCH 4/9] xen: sched: add .init_pdata hook to the scheduler interface
Date: Thu, 1 Oct 2015 11:26:19 +0200	[thread overview]
Message-ID: <1443691579.3276.242.camel@citrix.com> (raw)
In-Reply-To: <560D082402000078000A7573@prv-mh.provo.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 2805 bytes --]

On Thu, 2015-10-01 at 02:17 -0600, Jan Beulich wrote:
> > > > On 29.09.15 at 18:55, <dario.faggioli@citrix.com> wrote:
> > This happens because, right now, the scheduler of the
> > target pool remaps the runqueue lock during (rt_)alloc_pdata,
> > which is called at the very beginning of schedule_cpu_switch().
> > Credit2's csched2_free_pdata(), however, wants to find the spin
> > lock the same way it was put by csched2_alloc_pdata(), and
> > explodes, it not being the case.
> > 
> > This patch also fixes this as, now, spin lock remapping
> > happens in the init_pdata hook of the target scheduler for
> > the pCPU, which we can easily make sure it is ivoked *after*
> > the free_pdata hook of the old scheduler (which is exactly
> > what is done in this patch), without needing to restructure
> > schedule_cpu_switch().
> 
> Hmm, while I can see this to be okay for the
> cpupool_unassign_cpu_helper() case (due to the call to
> cpu_disable_scheduler() up front) as well as for the
> cpupool_cpu_add() one (I take it that the CPU can't be
> scheduled on in that case), I don't see how this would be
> safe for the XEN_SYSCTL_CPUPOOL_OP_ADDCPU case: How is
> scheduling activity being prevented to happen after the new
> ppriv got installed, but before it gets initialized via the
> init_pdata
> hook? Or how would scheduling activity be safe with an allocated
> but not yet initialized ppriv?
> 
Not sure I'm getting, but let me try.

XEN_SYSCTL_CPUPOOL_OP_ADDCPU is what adds a CPU to a pool. If we are
adding a CPU to a pool, it means the CPU is currently free, i.e.,
outside of any pool. This, in turn, means no pool has the CPU's bit set
in its cpupool->cpu_valid mask, which is what we check, within the
scheduler, to see where we can schedule the vcpus subject to a
particular scheduler.

If no pool has that bit set in its mask, nothing is being scheduled on
that CPU. (Actually, making sure that that is really the case, has been
the subject of some patches I sent back in July.)

Ok, now XEN_SYSCTL_CPUPOOL_OP_ADDCPU calls cpupool_assign_cpu_locked(),
which calls schedule_cpu_switch(cpu --> c) and, *only* *after* *that*,
does the following:

    cpumask_clear_cpu(cpu, &cpupool_free_cpus);
    ...
    cpumask_set_cpu(cpu, c->cpu_valid);

So, still assuming that I got your question right, the answer is:
scheduling activity was stopped already, and is restarted only after
both allocation and initialization have happened.

Let me know what you think.

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: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2015-10-01  9:26 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 16:55 [PATCH 0/9] xen: sched: improve (a lot! :-D) Credit2 runqueue handling Dario Faggioli
2015-09-29 16:55 ` [PATCH 1/9] xen: sched: fix an 'off by one \t' in credit2 debug dump Dario Faggioli
2015-10-01  5:22   ` Juergen Gross
2015-10-08 14:09   ` George Dunlap
2015-09-29 16:55 ` [PATCH 2/9] xen: sched: improve scope and placement of credit2 boot parameters Dario Faggioli
2015-10-01  5:23   ` Juergen Gross
2015-10-01  7:51   ` Jan Beulich
2015-10-01  8:17     ` Dario Faggioli
2015-09-29 16:55 ` [PATCH 3/9] xen: sched: make locking for {insert, remove}_vcpu consistent Dario Faggioli
2015-09-29 17:31   ` Andrew Cooper
2015-09-29 21:40     ` Dario Faggioli
2015-09-29 21:56       ` Dario Faggioli
2015-09-30  9:00       ` Andrew Cooper
2015-10-08 14:58     ` George Dunlap
2015-10-08 15:20       ` Andrew Cooper
2015-10-08 16:46         ` George Dunlap
2015-10-08 17:23           ` Andrew Cooper
2015-10-08 20:44             ` Dario Faggioli
2015-10-12  9:44             ` George Dunlap
2015-10-08 20:39         ` Dario Faggioli
2015-10-09 13:05           ` Andrew Cooper
2015-10-09 16:56             ` Dario Faggioli
2015-10-01  8:03   ` Jan Beulich
2015-10-01 11:59     ` Dario Faggioli
2015-09-29 16:55 ` [PATCH 4/9] xen: sched: add .init_pdata hook to the scheduler interface Dario Faggioli
2015-10-01  5:21   ` Juergen Gross
2015-10-01  6:33     ` Dario Faggioli
2015-10-01  7:43       ` Juergen Gross
2015-10-01  9:32         ` Andrew Cooper
2015-10-01  9:40           ` Dario Faggioli
2015-10-01  8:17   ` Jan Beulich
2015-10-01  9:26     ` Dario Faggioli [this message]
2015-10-01 10:12       ` Jan Beulich
2015-10-01 10:35         ` Dario Faggioli
2015-10-01 10:47           ` Jan Beulich
2015-09-29 16:56 ` [PATCH 5/9] xen: sched: make implementing .alloc_pdata optional Dario Faggioli
2015-10-01  5:28   ` Juergen Gross
2015-10-01  6:35     ` Dario Faggioli
2015-10-01  7:49   ` Jan Beulich
2015-10-01  8:13     ` Dario Faggioli
2015-09-29 16:56 ` [PATCH 6/9] xen: sched: implement .init_pdata in all schedulers Dario Faggioli
2015-09-29 16:56 ` [PATCH 7/9] xen: sched: fix per-socket runqueue creation in credit2 Dario Faggioli
2015-09-29 16:56 ` [PATCH 8/9] xen: sched: allow for choosing credit2 runqueues configuration at boot Dario Faggioli
2015-10-01  5:48   ` Juergen Gross
2015-10-01  7:23     ` Dario Faggioli
2015-10-01  7:46       ` Juergen Gross
2015-09-29 16:56 ` [PATCH 9/9] xen: sched: per-core runqueues as default in credit2 Dario Faggioli
2015-10-01  5:48   ` Juergen Gross

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=1443691579.3276.242.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=jgross@ssue.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.