From: MaoXiaoyun Subject: RE: Re: VM hung after running sometime Date: Wed, 22 Sep 2010 09:19:54 +0800 Message-ID: References: , <4C98EB42.4020808@goop.org>, , <4C994B08.7050509@goop.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1348945844==" Return-path: In-Reply-To: <4C994B08.7050509@goop.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: jeremy@goop.org Cc: xen devel , keir.fraser@eu.citrix.com List-Id: xen-devel@lists.xenproject.org --===============1348945844== Content-Type: multipart/alternative; boundary="_fbeb6fdd-a671-40d7-b407-5ce65b5484eb_" --_fbeb6fdd-a671-40d7-b407-5ce65b5484eb_ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Thanks for the details. =20 Currently guest VM hang in our heavy IO stress test, (In detail, we have = created more than 12 HVMS on our 16cores physical server,=20 and each of HVM inside, iometer and ab regard as heavy IO periodically ru= n). Guest hang shows up in 1 or 2 days. So the IO is very=20 heavy, so as the interrupts, I think.=20 =20 According to the hang log, the domain blocked in _VPF_blocked_in_xen, ind= icates "x=3D1" in log file below, and that is port 1, 2. And=20 all our HVM are have PVdriver installed, one thing I am not clear right = now is the IO event in these two ports. Does it only include "mouse, vga"event, or it also includes hard disk events? (If it has hard = disk events included, the interrupt would be very heavy, right? and right now we have 4 physical CPU allocated to domain 0, is it appropr= iate ? ) =20 Anyway, I think I can have irqbalance disabled for a quick test.=20 Meanwhile, I will spent some time on the patch merge. Many thanks. =20 And its domain event info is : (XEN) Domain 10 polling vCPUs: {No periodic timer} (XEN) Event channel information for domain 10: (XEN) port [p/m] (XEN) 1 [0/1]: s=3D3 n=3D0 d=3D0 p=3D105 x=3D1 (XEN) 2 [0/1]: s=3D3 n=3D1 d=3D0 p=3D106 x=3D1 (XEN) 3 [0/0]: s=3D3 n=3D0 d=3D0 p=3D104 x=3D0 (XEN) 4 [0/1]: s=3D2 n=3D0 d=3D0 x=3D0 (XEN) 5 [0/0]: s=3D6 n=3D0 x=3D0 (XEN) 6 [0/0]: s=3D2 n=3D0 d=3D0 x=3D0 (XEN) 7 [0/0]: s=3D3 n=3D0 d=3D0 p=3D107 x=3D0 (XEN) 8 [0/0]: s=3D3 n=3D0 d=3D0 p=3D108 x=3D0 (XEN) 9 [0/0]: s=3D3 n=3D0 d=3D0 p=3D109 x=3D0 (XEN) 10 [0/0]: s=3D3 n=3D0 d=3D0 p=3D110 x=3D0 =20 > Date: Tue, 21 Sep 2010 17:17:12 -0700 > From: jeremy@goop.org > To: tinnycloud@hotmail.com > CC: keir.fraser@eu.citrix.com; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Re: VM hung after running sometime >=20 > On 09/21/2010 05:02 PM, MaoXiaoyun wrote: > > Thanks Jeremy. > > > > Regards to fix you mentioned, did you mean the patch I searched and > > pasted below, if so, it this all what I need? >=20 > No, you need more than that. There are quite a few changes from multipl= e > branches, so I'd recommend just using a current kernel. >=20 > > For irqbalance disabled, I am afried it might have negative > > performance impact, right? >=20 > I doubt it. Unless you have so many interrupts that they can't all be > handled on one cpu, it shouldn't make much difference. After all, the > interrupts have to be handled *somewhere*, but it doesn't matter much > where - who cares if cpu0 is mostly handling interrupts if it leaves th= e > other cpus free for other work? >=20 > irqbalanced is primarily concerned with migrating interrupts according > to the CPU topology to save power and (maybe) handle interrupts closer > to the interrupting device. But that's meaningless in a domain where th= e > vcpus can be mapped to different pcpus from moment to moment. >=20 > J >=20 >=20 > > > > ------------------------------------------------------- > > diff --git a/drivers/xen/events.c > > > > b/drivers/xen/events.c > > > > index 32f4a2c > > ..06fc991 > > > > 100644 (file) > > --- a/drivers/xen/events.c > > > > +++ b/drivers/xen/events.c > > > > @@ -368,7 > > > > +368,7 > > > > @@ int bind_evtchn_to_irq(unsigned int evtchn) > > irq =3D find_unbound_irq(); > > set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, > > - handle_level_irq, "event"); > > + handle_edge_irq, "event"); > > evtchn_to_irq[evtchn] =3D irq; > > irq_info[irq] =3D mk_evtchn_info(evtchn); > > > Date: Tue, 21 Sep 2010 10:28:34 -0700 > > > From: jeremy@goop.org > > > To: keir.fraser@eu.citrix.com > > > CC: tinnycloud@hotmail.com; xen-devel@lists.xensource.com > > > Subject: Re: [Xen-devel] Re: VM hung after running sometime > > > > > > On 09/21/2010 12:53 AM, Keir Fraser wrote: > > > > On 21/09/2010 06:02, "MaoXiaoyun" wrote: > > > > > > > >> Take a look at domain 0 event channel with port 105,106, I find > > on port 105, > > > >> it pending is > > > >> 1.(in [1,0], first bit refer to pending, and is 1, second bit > > refer to mask, > > > >> is 0). > > > >> > > > >> (XEN) 105 [1/0]: s=3D3 n=3D2 d=3D10 p=3D1 x=3D0 > > > >> (XEN) 106 [0/0]: s=3D3 n=3D2 d=3D10 p=3D2 x=3D0 > > > >> > > > >> In all, we have domain U cpu blocking on _VPF_blocked_in_xen, an= d > > it must set > > > >> the pending bit. > > > >> Consider pending is 1, it looks like the irq is not triggered, a= m > > I right ? > > > >> Since if it is triggerred, it should clear the pending bit. (lin= e > > 361). > > > > Yes it looks like dom0 is not handling the event for some reason. > > Qemu looks > > > > like it still works and is waiting for a notification via > > select(). But that > > > > won't happen until dom0 kernel handles the event as an IRQ and > > calls the > > > > relevant irq handler (drivers/xen/evtchn.c:evtchn_interrupt()). > > > > > > > > I think you're on the right track in your debugging. I don't know > > much about > > > > the pv_ops irq handling path, except to say that this aspect is > > different > > > > than non-pv_ops kernels which special-case handling of events bou= nd to > > > > user-space rather more. So at the moment my best guess would be > > that the bug > > > > is in the pv_ops kernel irq handling for this type of user-space-= bound > > > > event. > > > > > > We no longer use handle_level_irq because there's a race which lose= s > > > events when interrupt migration is enabled. Current xen/stable-2.6.= 32.x > > > has a proper fix for this, but the quick workaround is to disable > > > irqbalanced. > > > > > > J > > > > > > > -- Keir > > > > > > > >> > > ------------------------------/linux-2.6-pvops.git/kernel/irq/chip.c-= -- > > > >> 354 void > > > >> 355 handle_level_irq(unsigned int irq, struct irq_desc *desc) > > > >> 356 { > > > >> 357 struct irqaction *action; > > > >> 358 irqreturn_t action_ret; > > > >> 359 > > > >> 360 spin_lock(&desc->lock); > > > >> 361 mask_ack_irq(desc, irq); > > > >> 362 > > > >> 363 if (unlikely(desc->status & IRQ_INPROGRESS)) > > > >> 364 goto out_unlock; > > > >> 365 desc->status &=3D ~(IRQ_REPLAY | IRQ_WAITING); > > > >> 366 kstat_incr_irqs_this_cpu(irq, desc); > > > >> 367 > > > >> > > > >> BTW, the qemu still works fine when VM is hang. Below is it > > strace output. > > > >> No much difference between other well worked qemu instance, othe= r > > than select > > > >> all Timeout. > > > >> ------------------- > > > >> select(14, [3 7 11 12 13], [], [], {0, 10000}) =3D 0 (Timeout) > > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 59535265}) =3D 0 > > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 59629728}) =3D 0 > > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 59717700}) =3D 0 > > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 59806552}) =3D 0 > > > >> select(14, [3 7 11 12 13], [], [], {0, 10000}) =3D 0 (Timeout) > > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 70234406}) =3D 0 > > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 70332116}) =3D 0 > > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 70419835}) =3D 0 > > > >> > > > >> > > > >> > > > >> > > > >>> Date: Mon, 20 Sep 2010 10:35:46 +0100 > > > >>> Subject: Re: VM hung after running sometime > > > >>> From: keir.fraser@eu.citrix.com > > > >>> To: tinnycloud@hotmail.com > > > >>> CC: xen-devel@lists.xensource.com; jbeulich@novell.com > > > >>> > > > >>> On 20/09/2010 10:15, "MaoXiaoyun" wrot= e: > > > >>> > > > >>>> Thanks Keir. > > > >>>> > > > >>>> You're right, after I deeply looked into the > > wait_on_xen_event_channel, it > > > >>>> is > > > >>>> smart enough > > > >>>> to avoid the race I assumed. > > > >>>> > > > >>>> How about prepare_wait_on_xen_event_channel ? > > > >>>> Currently Istill don't know when it will be invoked. > > > >>>> Could enlighten me? > > > >>> As you can see it is called from hvm_send_assist_req(), hence i= t > > is called > > > >>> whenever an ioreq is sent to qemu-dm. Note that it is called > > *before* > > > >>> qemu-dm is notified -- hence it cannot race the wakeup from > > qemu, as we will > > > >>> not get woken until qemu-dm has done the work, and it cannot > > start the work > > > >>> until it is notified, and it is not notified until after > > > >>> prepare_wait_on_xen_event_channel has been executed. > > > >>> > > > >>> -- Keir > > > >>> > > > >>>>> Date: Mon, 20 Sep 2010 08:45:21 +0100 > > > >>>>> Subject: Re: VM hung after running sometime > > > >>>>> From: keir.fraser@eu.citrix.com > > > >>>>> To: tinnycloud@hotmail.com > > > >>>>> CC: xen-devel@lists.xensource.com; jbeulich@novell.com > > > >>>>> > > > >>>>> On 20/09/2010 07:00, "MaoXiaoyun" wr= ote: > > > >>>>> > > > >>>>>> When IO is not ready, domain U in VMEXIT->hvm_do_resume migh= t > > invoke > > > >>>>>> wait_on_xen_event_channel > > > >>>>>> (where it is blocked in _VPF_blocked_in_xen). > > > >>>>>> > > > >>>>>> Here is my assumption of event missed. > > > >>>>>> > > > >>>>>> step 1: hvm_do_resume execute 260, and suppose p->state is > > > >>>>>> STATE_IOREQ_READY > > > >>>>>> or STATE_IOREQ_INPROCESS > > > >>>>>> step 2: then in cpu_handle_ioreq is in line 547, it execute > > line 548 so > > > >>>>>> quickly before hvm_do_resume execute line 270. > > > >>>>>> Well, the event is missed. > > > >>>>>> In other words, the _VPF_blocked_in_xen is cleared before it > > is actually > > > >>>>>> setted, and Domian U who is blocked > > > >>>>>> might never get unblocked, it this possible? > > > >>>>> Firstly, that code is very paranoid and it should never > > actually be the > > > >>>>> case > > > >>>>> that we see STATE_IOREQ_READY or STATE_IOREQ_INPROCESS in > > hvm_do_resume(). > > > >>>>> Secondly, even if you do, take a look at the implementation o= f > > > >>>>> wait_on_xen_event_channel() -- it is smart enough to avoid th= e > > race you > > > >>>>> mention. > > > >>>>> > > > >>>>> -- Keir > > > >>>>> > > > >>>>> > > > >>> > > > >> > > > > > > > > > > > > _______________________________________________ > > > > Xen-devel mailing list > > > > Xen-devel@lists.xensource.com > > > > http://lists.xensource.com/xen-devel > > > > > > > >=20 =20 --_fbeb6fdd-a671-40d7-b407-5ce65b5484eb_ Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable Thanks for the details.
 
Currently guest VM hang in= our heavy IO stress test, (In detail, we have created more than 12 = HVMS on our 16cores physical server, 
and each of HVM inside= , iometer and ab regard as heavy IO periodically run). Gue= st hang shows up in 1 or 2 days. So the IO is very
heavy, so as = the interrupts, I think. 
 
According to the hang lo= g, the domain blocked in _VPF_blocked_in_xen, indicates  "x=3D1" in l= og file below, and that is port 1, 2.=   And
all our HVM are have PVdriver installed,  one thing= I am not clear right now is the IO event in these two ports.  = Does it only include
"mouse, vga"event, or it also i= ncludes hard disk events? (If it has hard disk events include d, the interrupt would be very heavy, right?
and right now we hav= e 4 physical CPU allocated to domain 0, is it appropriate ? )=
 
Anyway, I think I can have irqbalance disabled for a q= uick test. 
Meanwhile, I will spent some time on the patch merge.
Many thanks.
 
And its domain event info is :
(XEN) Domain 10 = polling vCPUs: {No periodic timer}
(XEN) Event channel information for= domain 10:
(XEN)     port [p/m]
(XEN) &nb= sp;      1 [0/1]: s=3D3 n=3D0 d=3D0 p=3D105 x=3D= 1
(XEN)        2 [0/1]: s=3D3 n=3D1= d=3D0 p=3D106 x=3D1
(XEN)        3= [0/0]: s=3D3 n=3D0 d=3D0 p=3D104 x=3D0
(XEN)    &= nbsp;   4 [0/1]: s=3D2 n=3D0 d=3D0 x=3D0
(XEN)  &n= bsp;     5 [0/0]: s=3D6 n=3D0 x=3D0
(XEN) &nb= sp;      6 [0/0]: s=3D2 n=3D0 d=3D0 x=3D0
(XE= N)        7 [0/0]: s=3D3 n=3D0 d=3D0 p= =3D107 x=3D0
(XEN)      & nbsp; 8 [0/0]: s=3D3 n=3D0 d=3D0 p=3D108 x=3D0
(XEN)   = ;     9 [0/0]: s=3D3 n=3D0 d=3D0 p=3D109 x=3D0
(XE= N)       10 [0/0]: s=3D3 n=3D0 d=3D0 p=3D11= 0 x=3D0

 
> Date: Tue, 21 Sep 2010 17:17:12 -0700> From: jeremy@goop.org
> To: tinnycloud@hotmail.com
> CC= : keir.fraser@eu.citrix.com; xen-devel@lists.xensource.com
> Subjec= t: Re: [Xen-devel] Re: VM hung after running sometime
>
> On= 09/21/2010 05:02 PM, MaoXiaoyun wrote:
> > Thanks Jeremy.
&g= t; >
> > Regards to fix you mentioned, did you mean the patch= I searched and
> > pasted below, if so, it this all what I need= ?
>
> No, you need more than that. There are quite a few cha= nges from multiple
> branches, so I'd recommend just using a curren= t kernel.
>
> > For irqbalance disabled, I am afried it m= ight have negative
> > performance impact, right?
>
& gt; I doubt it. Unless you have so many interrupts that they can't all b= e
> handled on one cpu, it shouldn't make much difference. After al= l, the
> interrupts have to be handled *somewhere*, but it doesn't = matter much
> where - who cares if cpu0 is mostly handling interrup= ts if it leaves the
> other cpus free for other work?
>
&= gt; irqbalanced is primarily concerned with migrating interrupts accordin= g
> to the CPU topology to save power and (maybe) handle interrupts= closer
> to the interrupting device. But that's meaningless in a d= omain where the
> vcpus can be mapped to different pcpus from momen= t to moment.
>
> J
>
>
> >
> &g= t; -------------------------------------------------------
> > d= iff --git a/drivers/xen/events.c
> > <http://git.kernel.org/?= p=3Dlinux/kernel/git/jeremy/xen.git;a=3Dblob;f=3Ddrivers/xen/events.c;h=3D= 32f4a2cfe11e342104b9e568c230f2f17b5ae856;hb=3D32f4a 2cfe11e342104b9e568c230f2f17b5ae856>
> > b/drivers/xen/event= s.c
> > <http://git.kernel.org/?p=3Dlinux/kernel/git/jeremy/x= en.git;a=3Dblob;f=3Ddrivers/xen/events.c;h=3D06fc9915176cdceca49f554c7a10= 8c0fc3c5e608;hb=3D06fc9915176cdceca49f554c7a108c0fc3c5e608>
> &g= t; index 32f4a2c
> > <http://git.kernel.org/?p=3Dlinux/kernel= /git/jeremy/xen.git;a=3Dblob;f=3Ddrivers/xen/events.c;h=3D32f4a2cfe11e342= 104b9e568c230f2f17b5ae856;hb=3D32f4a2cfe11e342104b9e568c230f2f17b5ae856&g= t;..06fc991
> > <http://git.kernel.org/?p=3Dlinux/kernel/git/= jeremy/xen.git;a=3Dblob;f=3Ddrivers/xen/events.c;h=3D06fc9915176cdceca49f= 554c7a108c0fc3c5e608;hb=3D06fc9915176cdceca49f554c7a108c0fc3c5e608>> > 100644 (file)
> > --- a/drivers/xen/events.c
> = > <http://git.kernel.org/?p=3Dlinux/kernel/git/jeremy/xen.git;a=3Db= lob;f=3Ddrivers/xen/events.c;h=3D32f4a2cfe11e342104b9e568c230f2f17b5ae856= ;hb=3D32f4a2cfe11e342104b9e568c230f2f17b5ae856>
> > +++ b/dri= vers/xen/ events.c
> > <http://git.kernel.org/?p=3Dlinux/kernel/git/je= remy/xen.git;a=3Dblob;f=3Ddrivers/xen/events.c;h=3D06fc9915176cdceca49f55= 4c7a108c0fc3c5e608;hb=3D06fc9915176cdceca49f554c7a108c0fc3c5e608>
&= gt; > @@ -368,7
> > <http://git.kernel.org/?p=3Dlinux/kern= el/git/jeremy/xen.git;a=3Dblob;f=3Ddrivers/xen/events.c;h=3D32f4a2cfe11e3= 42104b9e568c230f2f17b5ae856;hb=3D32f4a2cfe11e342104b9e568c230f2f17b5ae856= #l368>
> > +368,7
> > <http://git.kernel.org/?p=3D= linux/kernel/git/jeremy/xen.git;a=3Dblob;f=3Ddrivers/xen/events.c;h=3D06f= c9915176cdceca49f554c7a108c0fc3c5e608;hb=3D06fc9915176cdceca49f554c7a108c= 0fc3c5e608#l368>
> > @@ int bind_evtchn_to_irq(unsigned int e= vtchn)
> > irq =3D find_unbound_irq();
> > set_irq_chip= _and_handler_name(irq, &xen_dynamic_chip,
> > - handle_level= _irq, "event");
> > + handle_edge_irq, "event");
> > ev= tchn_to_irq[evtchn] =3D irq;
> > irq_info[irq] =3D mk_evtchn_inf= o(ev tchn);
> > > Date: Tue, 21 Sep 2010 10:28:34 -0700
> &= gt; > From: jeremy@goop.org
> > > To: keir.fraser@eu.citri= x.com
> > > CC: tinnycloud@hotmail.com; xen-devel@lists.xenso= urce.com
> > > Subject: Re: [Xen-devel] Re: VM hung after run= ning sometime
> > >
> > > On 09/21/2010 12:53 AM,= Keir Fraser wrote:
> > > > On 21/09/2010 06:02, "MaoXiaoy= un" <tinnycloud@hotmail.com> wrote:
> > > >
> = > > >> Take a look at domain 0 event channel with port 105,10= 6, I find
> > on port 105,
> > > >> it pending= is
> > > >> 1.(in [1,0], first bit refer to pending, a= nd is 1, second bit
> > refer to mask,
> > > >>= ; is 0).
> > > >>
> > > >> (XEN) 105 = [1/0]: s=3D3 n=3D2 d=3D10 p=3D1 x=3D0
> > > >> (XEN) 10= 6 [0/0]: s=3D3 n=3D2 d=3D10 p=3D2 x=3D0
> > > > >
> > > >> In all, we have domain U cpu blocking on= _VPF_blocked_in_xen, and
> > it must set
> > > >= > the pending bit.
> > > >> Consider pending is 1, i= t looks like the irq is not triggered, am
> > I right ?
> = > > >> Since if it is triggerred, it should clear the pending= bit. (line
> > 361).
> > > > Yes it looks like d= om0 is not handling the event for some reason.
> > Qemu looks> > > > like it still works and is waiting for a notificatio= n via
> > select(). But that
> > > > won't happen= until dom0 kernel handles the event as an IRQ and
> > calls the=
> > > > relevant irq handler (drivers/xen/evtchn.c:evtchn= _interrupt()).
> > > >
> > > > I think you'= re on the right track in your debugging. I don't know
> > much a= bout
> > > > the pv_ops irq handling path, except to say that this aspect is
> > different=
> > > > than non-pv_ops kernels which special-case handli= ng of events bound to
> > > > user-space rather more. So a= t the moment my best guess would be
> > that the bug
> >= ; > > is in the pv_ops kernel irq handling for this type of user-sp= ace-bound
> > > > event.
> > >
> > &g= t; We no longer use handle_level_irq because there's a race which loses> > > events when interrupt migration is enabled. Current xen/= stable-2.6.32.x
> > > has a proper fix for this, but the quic= k workaround is to disable
> > > irqbalanced.
> > &g= t;
> > > J
> > >
> > > > -- Keir> > > >
> > > >>
> > -----------= -------------------/linux-2.6-pvops.git/kernel/irq/chip.c---
> >= > >> 354 void
> > >=20 >> 355 handle_level_irq(unsigned int irq, struct irq_desc *desc)> > > >> 356 {
> > > >> 357 struct irq= action *action;
> > > >> 358 irqreturn_t action_ret;> > > >> 359
> > > >> 360 spin_lock(&am= p;desc->lock);
> > > >> 361 mask_ack_irq(desc, irq);=
> > > >> 362
> > > >> 363 if (unlike= ly(desc->status & IRQ_INPROGRESS))
> > > >> 364 = goto out_unlock;
> > > >> 365 desc->status &=3D = ~(IRQ_REPLAY | IRQ_WAITING);
> > > >> 366 kstat_incr_ir= qs_this_cpu(irq, desc);
> > > >> 367
> > > = >>
> > > >> BTW, the qemu still works fine when V= M is hang. Below is it
> > strace output.
> > > >= > No much difference between other well worked qemu instance, other> > than select
> > > > ;> all Timeout.
> > > >> -------------------
>= ; > > >> select(14, [3 7 11 12 13], [], [], {0, 10000}) =3D 0= (Timeout)
> > > >> clock_gettime(CLOCK_MONOTONIC, {673= 470, 59535265}) =3D 0
> > > >> clock_gettime(CLOCK_MONO= TONIC, {673470, 59629728}) =3D 0
> > > >> clock_gettime= (CLOCK_MONOTONIC, {673470, 59717700}) =3D 0
> > > >> cl= ock_gettime(CLOCK_MONOTONIC, {673470, 59806552}) =3D 0
> > > = >> select(14, [3 7 11 12 13], [], [], {0, 10000}) =3D 0 (Timeout)> > > >> clock_gettime(CLOCK_MONOTONIC, {673470, 7023440= 6}) =3D 0
> > > >> clock_gettime(CLOCK_MONOTONIC, {6734= 70, 70332116}) =3D 0
> > > >> clock_gettime(CLOCK_MONOT= ONIC, {673470, 70419835}) =3D 0
> > > >>
> > &= gt; >>
> > > >>
> > > >>
>= ; > > >>> Date: Mon, 20 Sep 2010 10:35:46 +01 00
> > > >>> Subject: Re: VM hung after running som= etime
> > > >>> From: keir.fraser@eu.citrix.com
&= gt; > > >>> To: tinnycloud@hotmail.com
> > > &= gt;>> CC: xen-devel@lists.xensource.com; jbeulich@novell.com
>= ; > > >>>
> > > >>> On 20/09/2010 10:= 15, "MaoXiaoyun" <tinnycloud@hotmail.com> wrote:
> > > = >>>
> > > >>>> Thanks Keir.
> >= > >>>>
> > > >>>> You're right, a= fter I deeply looked into the
> > wait_on_xen_event_channel, it<= BR>> > > >>>> is
> > > >>>> = smart enough
> > > >>>> to avoid the race I assum= ed.
> > > >>>>
> > > >>>>= How about prepare_wait_on_xen_event_channel ?
> > > >>= >> Currently Istill don't know when=20 it will be invoked.
> > > >>>> Could enlighten m= e?
> > > >>> As you can see it is called from hvm_se= nd_assist_req(), hence it
> > is called
> > > >&g= t;> whenever an ioreq is sent to qemu-dm. Note that it is called
&g= t; > *before*
> > > >>> qemu-dm is notified -- he= nce it cannot race the wakeup from
> > qemu, as we will
> = > > >>> not get woken until qemu-dm has done the work, and= it cannot
> > start the work
> > > >>> unt= il it is notified, and it is not notified until after
> > > &= gt;>> prepare_wait_on_xen_event_channel has been executed.
> = > > >>>
> > > >>> -- Keir
> >= ; > >>>
> > > >>>>> Date: Mon, 20 = Sep 2010 08:45:21 +0100
> > > >>>>> Subject: R= e: VM hung after running sometime
>=20 > > >>>>> From: keir.fraser@eu.citrix.com
> &= gt; > >>>>> To: tinnycloud@hotmail.com
> > >= ; >>>>> CC: xen-devel@lists.xensource.com; jbeulich@novell= .com
> > > >>>>>
> > > >>>= ;>> On 20/09/2010 07:00, "MaoXiaoyun" <tinnycloud@hotmail.com>= ; wrote:
> > > >>>>>
> > > >>= ;>>>> When IO is not ready, domain U in VMEXIT->hvm_do_res= ume might
> > invoke
> > > >>>>>> = wait_on_xen_event_channel
> > > >>>>>> (whe= re it is blocked in _VPF_blocked_in_xen).
> > > >>>&= gt;>>
> > > >>>>>> Here is my assumpt= ion of event missed.
> > > >>>>>>
> &= gt; > >>>>>> step 1: hvm_do_resume execute 260, and = suppose p->state is
> > > & gt;>>>>> STATE_IOREQ_READY
> > > >>>= >>> or STATE_IOREQ_INPROCESS
> > > >>>>&= gt;> step 2: then in cpu_handle_ioreq is in line 547, it execute
&g= t; > line 548 so
> > > >>>>>> quickly be= fore hvm_do_resume execute line 270.
> > > >>>>&g= t;> Well, the event is missed.
> > > >>>>>&= gt; In other words, the _VPF_blocked_in_xen is cleared before it
> = > is actually
> > > >>>>>> setted, and D= omian U who is blocked
> > > >>>>>> might n= ever get unblocked, it this possible?
> > > >>>>&= gt; Firstly, that code is very paranoid and it should never
> > = actually be the
> > > >>>>> case
> > = > >>>>> that we see STATE_IOREQ_READY or STATE_IOREQ_IN= PROCESS in
> > hvm_do_resume().> > > >>>>> Secondly, even if you do, take a l= ook at the implementation of
> > > >>>>> wait_= on_xen_event_channel() -- it is smart enough to avoid the
> > ra= ce you
> > > >>>>> mention.
> > > = >>>>>
> > > >>>>> -- Keir
&g= t; > > >>>>>
> > > >>>>><= BR>> > > >>>
> > > >>
> > &g= t; >
> > > >
> > > > ___________________= ____________________________
> > > > Xen-devel mailing lis= t
> > > > Xen-devel@lists.xensource.com
> > > = > http://lists.xensource.com/xen-devel
> > > >
> = > >
>

--_fbeb6fdd-a671-40d7-b407-5ce65b5484eb_-- --===============1348945844== 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 --===============1348945844==--