qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org,
	qemu-ppc@nongnu.org, clg@kaod.org, philmd@redhat.com
Subject: Re: [Qemu-devel] [PATCH 7/7] spapr: Perform machine reset in a more sensible order
Date: Wed, 11 Sep 2019 17:51:42 +1000	[thread overview]
Message-ID: <20190911075142.GA13785@umbus.fritz.box> (raw)
In-Reply-To: <b727dcb2-3cdd-77f9-b772-3253e52f2133@ozlabs.ru>

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

On Wed, Sep 11, 2019 at 05:40:58PM +1000, Alexey Kardashevskiy wrote:
> 
> 
> On 11/09/2019 14:04, David Gibson wrote:
> > We've made several changes in the past to the machine reset order to fix
> > specific problems.  However, we've ended up with an order that doesn't make
> > a lot of logical sense.  This is an attempt to rectify this.
> > 
> > First we reset global CAS options, since that should depend on nothing
> > else.  Then we reset the CPUs, which shouldn't depend on external devices.
> > Then the irq subsystem, then the bulk of devices (which might rely on
> > irqs).  Finally we set up the entry state ready for boot, which could
> > potentially rely on a bunch of other things.
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> 
> 
> Breaks console on P8 and asserts on rebooting a P9 guest.

Yeah, I jumped the gun on this one - I need to rethink and test more thoroughly.

> 
> 
> 
> > ---
> >  hw/ppc/spapr.c | 47 +++++++++++++++++++++++++----------------------
> >  1 file changed, 25 insertions(+), 22 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 5a919a6cc1..1560a11738 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -1724,6 +1724,28 @@ static void spapr_machine_reset(MachineState *machine)
> >      void *fdt;
> >      int rc;
> >  
> > +    /*
> > +     * If this reset wasn't generated by CAS, we should reset our
> > +     * negotiated options and start from scratch
> > +     */
> > +    if (!spapr->cas_reboot) {
> > +        spapr_ovec_cleanup(spapr->ov5_cas);
> > +        spapr->ov5_cas = spapr_ovec_new();
> > +
> > +        ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal);
> > +    }
> > +
> > +    /*
> > +     * There is no CAS under qtest. Simulate one to please the code that
> > +     * depends on spapr->ov5_cas. This is especially needed to test device
> > +     * unplug, so we do that before resetting the DRCs.
> > +     */
> > +    if (qtest_enabled()) {
> > +        spapr_ovec_cleanup(spapr->ov5_cas);
> > +        spapr->ov5_cas = spapr_ovec_clone(spapr->ov5);
> > +    }
> > +
> > +    /* Reset the CPUs */
> >      spapr_caps_apply(spapr);
> >  
> >      first_ppc_cpu = POWERPC_CPU(first_cpu);
> > @@ -1741,34 +1763,15 @@ static void spapr_machine_reset(MachineState *machine)
> >          spapr_setup_hpt_and_vrma(spapr);
> >      }
> >  
> > -    qemu_devices_reset();
> > -
> > -    /*
> > -     * If this reset wasn't generated by CAS, we should reset our
> > -     * negotiated options and start from scratch
> > -     */
> > -    if (!spapr->cas_reboot) {
> > -        spapr_ovec_cleanup(spapr->ov5_cas);
> > -        spapr->ov5_cas = spapr_ovec_new();
> > -
> > -        ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal);
> > -    }
> > -
> > +    /* Reset IRQ subsystem */
> >      /*
> >       * This is fixing some of the default configuration of the XIVE
> >       * devices. To be called after the reset of the machine devices.
> >       */
> >      spapr_irq_reset(spapr, &error_fatal);
> >  
> > -    /*
> > -     * There is no CAS under qtest. Simulate one to please the code that
> > -     * depends on spapr->ov5_cas. This is especially needed to test device
> > -     * unplug, so we do that before resetting the DRCs.
> > -     */
> > -    if (qtest_enabled()) {
> > -        spapr_ovec_cleanup(spapr->ov5_cas);
> > -        spapr->ov5_cas = spapr_ovec_clone(spapr->ov5);
> > -    }
> > +    /* Reset other devices */
> > +    qemu_devices_reset();
> >  
> >      /* DRC reset may cause a device to be unplugged. This will cause troubles
> >       * if this device is used by another device (eg, a running vhost backend
> > 
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

  reply	other threads:[~2019-09-11  7:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11  4:04 [Qemu-devel] [PATCH 0/7] spapr: CAS and reset cleanup preliminaries David Gibson
2019-09-11  4:04 ` [Qemu-devel] [PATCH 1/7] spapr: Simplify handling of pre ISA 3.0 guest workaround handling David Gibson
2019-09-11  7:09   ` Cédric Le Goater
2019-09-11  7:26   ` Greg Kurz
2019-09-11  7:37   ` Alexey Kardashevskiy
2019-09-11  4:04 ` [Qemu-devel] [PATCH 2/7] spapr: Move handling of special NVLink numa node from reset to init David Gibson
2019-09-11  7:28   ` Cédric Le Goater
2019-09-11  7:33   ` Greg Kurz
2019-09-11  7:41   ` Alexey Kardashevskiy
2019-09-11  4:04 ` [Qemu-devel] [PATCH 3/7] spapr: Fixes a leak in CAS David Gibson
2019-09-11  7:28   ` Cédric Le Goater
2019-09-11  7:36   ` Greg Kurz
2019-09-11  4:04 ` [Qemu-devel] [PATCH 4/7] spapr: Skip leading zeroes from memory@ DT node names David Gibson
2019-09-11  8:01   ` Greg Kurz
2019-09-11  4:04 ` [Qemu-devel] [PATCH 5/7] spapr: Do not put empty properties for -kernel/-initrd/-append David Gibson
2019-09-11  8:46   ` Greg Kurz
2019-09-12  1:59     ` Alexey Kardashevskiy
2019-09-11  4:04 ` [Qemu-devel] [PATCH 6/7] spapr: Stop providing RTAS blob David Gibson
2019-09-11  9:16   ` Greg Kurz
2019-09-12  1:50     ` Alexey Kardashevskiy
2019-09-12  7:20       ` Greg Kurz
2019-09-11  4:04 ` [Qemu-devel] [PATCH 7/7] spapr: Perform machine reset in a more sensible order David Gibson
2019-09-11  7:40   ` Alexey Kardashevskiy
2019-09-11  7:51     ` David Gibson [this message]
2019-09-11  7:54   ` Cédric Le Goater

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=20190911075142.GA13785@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=clg@kaod.org \
    --cc=groug@kaod.org \
    --cc=lvivier@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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).