From: Dario Faggioli <dario.faggioli@citrix.com>
To: George Dunlap <george.dunlap@citrix.com>, xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH] xen: credit1: fix a race when picking initial pCPU for a vCPU
Date: Fri, 12 Aug 2016 17:17:16 +0200 [thread overview]
Message-ID: <1471015036.6250.100.camel@citrix.com> (raw)
In-Reply-To: <9ae42c19-8326-f13c-4c9c-83641c93efcd@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 2469 bytes --]
On Fri, 2016-08-12 at 10:14 +0100, George Dunlap wrote:
> On 12/08/16 05:07, Dario Faggioli wrote:
> Let me know if you want me to check this in as-is or if you think you
> might send a follow-up patch adding an ASSERT.
>
Done, and it actually explodes like this:
(XEN) [ 4.870128] Xen call trace:
(XEN) [ 4.870130] [<ffff82d080131cba>] spinlock.c#check_lock+0x42/0x46
(XEN) [ 4.870133] [<ffff82d080131db2>] _spin_is_locked+0x11/0x4d
(XEN) [ 4.870139] [<ffff82d080126c2b>] sched_credit.c#_csched_cpu_pick+0x1a9/0x632
(XEN) [ 4.870142] [<ffff82d08012747f>] sched_credit.c#csched_tick+0x1fd/0x385
(XEN) [ 4.870146] [<ffff82d080134a16>] timer.c#execute_timer+0x47/0x62
(XEN) [ 4.870148] [<ffff82d080134b0c>] timer.c#timer_softirq_action+0xdb/0x22c
(XEN) [ 4.870151] [<ffff82d080131487>] softirq.c#__do_softirq+0x7f/0x8a
(XEN) [ 4.870153] [<ffff82d0801314dc>] do_softirq+0x13/0x15
(XEN) [ 4.870157] [<ffff82d080243e01>] entry.o#process_softirqs+0x21/0x30
(XEN) [ 4.870159]
(XEN) [ 5.619096]
(XEN) [ 5.621085] ****************************************
(XEN) [ 5.626536] Panic on CPU 0:
(XEN) [ 5.629826] Xen BUG at spinlock.c:48
(XEN) [ 5.633895] ****************************************
And if I look at csched_tick(), it indeed is the case that we
call csched_vcpu_acct() **without** holding the runq lock.
It in turns calls things like burn_credits(), accesses current, and
other stuff, which I'm having a little bit of an hard time convincing
myself it is safe... Although it must be, if there have been no issues
after all these years. :-O
csched_runq_sort(), called later, still by csched_tick(), acquires the
lock by itself, and we can't acquire it in csched_tick(), because
__csched_vcpu_acct_start() acquires the private lock, and we'd violate
the nesting rule.
In summary, this is looking more complicated than it seemed, and I'll
have to look at this again on Tuesday (it's public holiday, here, on
Monday).
Gosh, how much I hate this scheduler!! :-/
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
prev parent reply other threads:[~2016-08-12 15:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 4:07 [PATCH] xen: credit1: fix a race when picking initial pCPU for a vCPU Dario Faggioli
2016-08-12 9:14 ` George Dunlap
2016-08-12 9:46 ` Dario Faggioli
2016-08-12 15:17 ` Dario Faggioli [this message]
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=1471015036.6250.100.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=george.dunlap@eu.citrix.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 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).