All of lore.kernel.org
 help / color / mirror / Atom feed
From: "'Marek Marczykowski-Górecki'" <marmarek@invisiblethingslab.com>
To: paul@xen.org
Cc: 'Andrew Cooper' <andrew.cooper3@citrix.com>,
	'Jan Beulich' <jbeulich@suse.com>,
	'xen-devel' <xen-devel@lists.xenproject.org>
Subject: Re: handle_pio looping during domain shutdown, with qemu 4.2.0 in stubdom
Date: Fri, 5 Jun 2020 22:43:10 +0200	[thread overview]
Message-ID: <20200605204310.GK98582@mail-itl> (raw)
In-Reply-To: <001501d63b5e$26a991a0$73fcb4e0$@xen.org>

[-- Attachment #1: Type: text/plain, Size: 2726 bytes --]

On Fri, Jun 05, 2020 at 06:24:20PM +0100, Paul Durrant wrote:
> > -----Original Message-----
> > From: 'Marek Marczykowski-Górecki' <marmarek@invisiblethingslab.com>
> > Sent: 05 June 2020 18:14
> > To: paul@xen.org
> > Cc: 'Jan Beulich' <jbeulich@suse.com>; 'Andrew Cooper' <andrew.cooper3@citrix.com>; 'xen-devel' <xen-
> > devel@lists.xenproject.org>
> > Subject: Re: handle_pio looping during domain shutdown, with qemu 4.2.0 in stubdom
> > 
> > On Fri, Jun 05, 2020 at 04:48:39PM +0100, Paul Durrant wrote:
> > > This (untested) patch might help:
> > 
> > It is different now. I don't get domain_crash because of
> > X86EMUL_UNHANDLEABLE anymore, but I still see handle_pio looping for
> > some time. But it eventually ends, not really sure why.
> 
> That'll be the shutdown deferral, which I realised later that I forgot about...
> 
> > 
> > I've tried the patch with a modification to make it build:
> > 
> > > diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
> > > index c55c4bc4bc..8aa8779ba2 100644
> > > --- a/xen/arch/x86/hvm/ioreq.c
> > > +++ b/xen/arch/x86/hvm/ioreq.c
> > > @@ -109,12 +109,7 @@ static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
> > >      ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
> > >
> > >      if ( hvm_ioreq_needs_completion(ioreq) )
> > > -    {
> > > -        ioreq->state = STATE_IORESP_READY;
> > >          ioreq->data = data;
> > > -    }
> > > -    else
> > > -        ioreq->state = STATE_IOREQ_NONE;
> > >
> > >      msix_write_completion(v);
> > >      vcpu_end_shutdown_deferral(v);
> 
> In fact, move both of these lines...
> 
> > > @@ -209,6 +204,9 @@ bool handle_hvm_io_completion(struct vcpu *v)
> > >          }
> > >      }
> > >
> > > +    ioreq->state = hvm_ioreq_needs_completion(&vio->ioreq) ?
> >        vio->io_req->state ... &vio->io_req
> > 
> > > +        STATE_IORESP_READY : STATE_IOREQ_NONE;
> > > +
> 
> ... to here too.
> 
> > >      io_completion = vio->io_completion;
> > >      vio->io_completion = HVMIO_no_completion;
> > >
> > 
> > The full patch (together with my debug prints):
> > https://gist.github.com/marmarek/da37da3722179057a6e7add4fb361e06

The current patch:
https://gist.github.com/marmarek/5ae795129c1be2dae13bfc517547c0f1

> I guess it is the destroy being held off by the shutdown deferral? Hopefully the above tweaks should sort that out.

Yes, now it works (tried 5 times in a row, previously it crashed on
the first or the second one). Thanks!

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-06-05 20:43 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04  1:46 handle_pio looping during domain shutdown, with qemu 4.2.0 in stubdom Marek Marczykowski-Górecki
2020-06-04  7:08 ` Jan Beulich
2020-06-04  7:17   ` Jan Beulich
2020-06-04 11:13   ` Andrew Cooper
2020-06-04 12:36     ` Jan Beulich
2020-06-04 14:25       ` Marek Marczykowski-Górecki
2020-06-05  9:09         ` Jan Beulich
2020-06-05  9:22           ` Jan Beulich
2020-06-05 12:01             ` Marek Marczykowski-Górecki
2020-06-05 12:39               ` Paul Durrant
2020-06-05 13:04                 ` 'Marek Marczykowski-Górecki'
2020-06-05 13:24                   ` Paul Durrant
2020-06-05 12:44               ` Andrew Cooper
2020-06-05 14:13               ` Jan Beulich
2020-06-05 11:05           ` Paul Durrant
2020-06-05 11:25             ` Paul Durrant
2020-06-05 13:36               ` Jan Beulich
2020-06-05 13:43                 ` Paul Durrant
2020-06-05 13:46                   ` Jan Beulich
2020-06-05 13:49                     ` Paul Durrant
2020-06-05 15:48                       ` Paul Durrant
2020-06-05 17:13                         ` 'Marek Marczykowski-Górecki'
2020-06-05 17:24                           ` Paul Durrant
2020-06-05 20:43                             ` 'Marek Marczykowski-Górecki' [this message]
2020-06-07 13:32                               ` Paul Durrant
2020-06-05 13:32             ` Jan Beulich
2020-06-05 13:37               ` Paul Durrant
2020-06-05 13:57                 ` Jan Beulich
2020-06-05 15:39                   ` Paul Durrant
2020-06-05 16:18                     ` 'Marek Marczykowski-Górecki'
2020-06-08  8:13                       ` Jan Beulich
2020-06-08  9:15                         ` Paul Durrant
2020-06-08  9:24                           ` Jürgen Groß
2020-06-08 12:38                             ` Paul Durrant
2020-06-08 12:46                               ` Jan Beulich
2020-06-08 12:54                                 ` Paul Durrant
2020-06-05  9:38 ` Jan Beulich
2020-06-05 11:18   ` Marek Marczykowski-Górecki
2020-06-05 13:59     ` Jan Beulich
2020-06-05 15:10       ` Paul Durrant

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=20200605204310.GK98582@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=paul@xen.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 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.