From: George Dunlap Subject: Re: dom0 hang Date: Thu, 2 Jul 2009 22:37:55 +0100 Message-ID: References: <4A426D50.80401@oracle.com> <4A4C2743.5030703@oracle.com> <4A4D0710.10309@oracle.com> <4A4D2253.8070807@oracle.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001636c5a9b14bdccb046dbfda54 Return-path: In-Reply-To: <4A4D2253.8070807@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: mukesh.rathor@oracle.com, "Tian, Kevin" , Yu Ke Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --001636c5a9b14bdccb046dbfda54 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable [Oops, adding back in distro list, also adding Kevin Tian and Yu Ke who wrote cs 19460] The functionality I was talking about, subtracting credits and clearing BOOST, happens in csched_vcpu_acct() (which is different than csched_acct()). vcpu_acct() is called from csched_tick(), which should still happen every 10ms on every cpu. The patch I referred to (cs 19460) disables and re-enables tickers in xen/arch/x86/acpi/cpu_idle.c:acpi_processor_idle() every time the processor idles. I can't see anywhere else that tickers are disabled, so it's probably something not properly re-enabling them again. Try applying the attached patch to see if that changes anything. (I'm on the road, so I can't repro the lockup issue.) If that doesn't work, try disabling c-states and see if that helps. Then at least we'll know where the problem lies. -George On Thu, Jul 2, 2009 at 10:10 PM, Mukesh Rathor wr= ote: > that seems to only suspend csched_pcpu.ticker which is csched_tick that i= s > only sorting local runq. > > again, we are concerned about csched_priv.master_ticker that calls > csched_acct? correct, so i can trace that? > > thanks, > mukesh > > > George Dunlap wrote: >> >> Ah, I see that there's been some changes to tick stuff with the >> c-state (e.g., cs 19460). =A0It looks like they're supposed to be going >> still, but perhaps the tick_suspend() and tick_resume() aren't being >> called properly. =A0Let me take a closer look. >> >> =A0-George >> >> On Thu, Jul 2, 2009 at 8:14 PM, Mukesh Rathor >> wrote: >>> >>> George Dunlap wrote: >>>> >>>> On Thu, Jul 2, 2009 at 4:19 AM, Mukesh Rathor >>>> wrote: >>>>> >>>>> dom0 hang: >>>>> =A0vcpu0 is trying to wakeup a task and in try_to_wake_up() calls >>>>> =A0task_rq_lock(). since the task has cpu set to 1, it gets runq lock >>>>> =A0for vcpu1. next it calls resched_task() which results in sending I= PI >>>>> =A0to vcpu1. for that, vcpu0 gets into the HYPERVISOR_event_channel_o= p >>>>> =A0HCALL and is waiting to return. Meanwhile, vcpu1 got running, and = is >>>>> =A0spinning on it's runq lock in "schedule():spin_lock_irq(&rq->lock)= ;", >>>>> =A0that vcpu0 is holding (and is waiting to return from the HCALL). >>>>> >>>>> =A0As I had noticed before, vcpu0 never gets scheduled in xen. So >>>>> =A0looking further into xen: >>>>> >>>>> xen: >>>>> =A0Both vcpu's are on the same runq, in this case cpu1. But the >>>>> =A0priority of vcpu1 has been set to CSCHED_PRI_TS_BOOST. As a result= , >>>>> =A0the scheduler always picks vcpu1, and vcpu0 is starved. Also, I se= e in >>>>> =A0kdb that the scheduler timer is not set on cpu 0. That would've >>>>> =A0allowed csched_load_balance() to kick in on cpu0. [Also, on >>>>> =A0cpu1, the accounting timer, csched_tick, is not set. =A0Altho, >>>>> =A0csched_tick() is running on cpu0, it only checks runq for cpu0.] >>>>> >>>>> =A0Looks like c/s 19500 changed csched_schedule(): >>>>> >>>>> - =A0 =A0ret.time =3D MILLISECS(CSCHED_MSECS_PER_TSLICE); >>>>> + =A0 =A0ret.time =3D (is_idle_vcpu(snext->vcpu) ? >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-1 : MILLISECS(CSCHED_MSECS_PER_TSLI= CE)); >>>>> >>>>> =A0The quickest fix for us would be to just back that out. >>>>> >>>>> >>>>> =A0BTW, just a comment on following (all in sched_credit.c): >>>>> >>>>> =A0 =A0if ( svc->pri =3D=3D CSCHED_PRI_TS_UNDER && >>>>> =A0 =A0 =A0 !(svc->flags & CSCHED_FLAG_VCPU_PARKED) ) >>>>> =A0 =A0{ >>>>> =A0 =A0 =A0 svc->pri =3D CSCHED_PRI_TS_BOOST; >>>>> =A0 =A0} >>>>> =A0comibined with >>>>> =A0if ( snext->pri > CSCHED_PRI_TS_OVER ) >>>>> =A0 =A0 =A0 =A0 =A0__runq_remove(snext); >>>>> >>>>> =A0 =A0Setting CSCHED_PRI_TS_BOOST as pri of vcpu seems dangerous. To= me, >>>>> =A0 =A0since csched_schedule() never checks for time accumulated by a >>>>> =A0 =A0vcpu at pri CSCHED_PRI_TS_BOOST, that is same as pinning a vcp= u to a >>>>> =A0 =A0pcpu. if that vcpu never makes progress, essentially, the syst= em >>>>> =A0 =A0has lost a physical cpu. =A0Optionally, csched_schedule() shou= ld >>>>> always >>>>> =A0 =A0check for cpu time accumulated and reduce the priority over ti= me. >>>>> =A0 =A0I can't tell right off if it already does that. or something l= ike >>>>> =A0 =A0that :)... =A0my 2 cents. >>>> >>>> Hmm... what's supposed to happen is that eventually a timer tick will >>>> interrupt vcpu1. =A0If cpu1 is set to be "active", then it will be >>>> debited 10ms worth of credit. =A0Eventually, it will go into OVER, and >>>> lose BOOST. =A0If it's "inactive", then when the tick happens, it will >>>> be set to "active" and be debited 10ms again, setting it directly into >>>> OVER (and thus also losing boost). >>>> >>>> Can you see if the timer ticks are still happening, and perhaps put >>>> some tracing it to verify that what I described above is happening? >>>> >>>> =A0-George >>> >>> George, >>> >>> Is that in csched_acct()? Looks like that's somehow gotten removed. If >>> true, then may be that's the fundamental problem to chase. >>> >>> Here's what the trq looks like when hung, not in any schedule function: >>> >>> [0]xkdb> dtrq >>> CPU[00]: NOW:0x00003f2db9af369e >>> =A01: exp=3D0x00003ee31cb32200 fn:csched_tick data:0000000000000000 >>> =A02: exp=3D0x00003ee347ece164 fn:time_calibration data:000000000000000= 0 >>> =A03: exp=3D0x00003ee69a28f04b fn:mce_work_fn data:0000000000000000 >>> =A04: exp=3D0x00003f055895e25f fn:plt_overflow data:0000000000000000 >>> =A05: exp=3D0x00003ee353810216 fn:rtc_update_second data:ffff83007f0226= d8 >>> >>> CPU[01]: NOW:0x00003f2db9af369e >>> =A01: exp=3D0x00003ee30b847988 fn:s_timer_fn data:0000000000000000 >>> =A02: exp=3D0x00003f1b309ebd45 fn:pmt_timer_callback data:ffff83007f022= a68 >>> >>> >>> thanks >>> Mukesh >>> > --001636c5a9b14bdccb046dbfda54 Content-Type: text/x-diff; charset=US-ASCII; name="simplify-tick-resume.diff" Content-Disposition: attachment; filename="simplify-tick-resume.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fwnzv8pw0 ZGlmZiAtciBiZTBiZmQ1OGQ1NzQgeGVuL2NvbW1vbi9zY2hlZF9jcmVkaXQuYwotLS0gYS94ZW4v Y29tbW9uL3NjaGVkX2NyZWRpdC5jCVdlZCBKdW4gMjQgMTk6NDU6NTYgMjAwOSArMDEwMAorKysg Yi94ZW4vY29tbW9uL3NjaGVkX2NyZWRpdC5jCVRodSBKdWwgMDIgMjI6Mjg6NDcgMjAwOSArMDEw MApAQCAtMTM0MCw4ICsxMzQwLDcgQEAKIAogICAgIHNwYyA9IENTQ0hFRF9QQ1BVKHNtcF9wcm9j ZXNzb3JfaWQoKSk7CiAKLSAgICBzZXRfdGltZXIoJnNwYy0+dGlja2VyLCBub3cgKyBNSUxMSVNF Q1MoQ1NDSEVEX01TRUNTX1BFUl9USUNLKQotICAgICAgICAgICAgLSBub3cgJSBNSUxMSVNFQ1Mo Q1NDSEVEX01TRUNTX1BFUl9USUNLKSApOworICAgIHNldF90aW1lcigmc3BjLT50aWNrZXIsIG5v dyArIE1JTExJU0VDUyhDU0NIRURfTVNFQ1NfUEVSX1RJQ0spKTsKIH0KIAogc3RydWN0IHNjaGVk dWxlciBzY2hlZF9jcmVkaXRfZGVmID0gewo= --001636c5a9b14bdccb046dbfda54 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --001636c5a9b14bdccb046dbfda54--