From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmdom-00054A-W1 for qemu-devel@nongnu.org; Wed, 21 Sep 2016 05:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmdoh-00058q-LN for qemu-devel@nongnu.org; Wed, 21 Sep 2016 05:27:51 -0400 Date: Wed, 21 Sep 2016 17:21:31 +1000 From: David Gibson Message-ID: <20160921072131.GA1809@umbus.fritz.box> References: <1474266577-11704-1-git-send-email-nikunj@linux.vnet.ibm.com> <1474266577-11704-3-git-send-email-nikunj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <1474266577-11704-3-git-send-email-nikunj@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v4 2/9] ppc/xics: Fix migration failure with kernel-irqchip=off List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, benh@kernel.crashing.org, clg@kaod.org --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 19, 2016 at 11:59:30AM +0530, Nikunj A Dadhania wrote: > With a single cpu VM running with kernel-irqchip=3Doff and a flood ping > running in the guest. Migration fails once in few times. >=20 > Found that whenever there is an interrupt (in this case lsi int 3 from > e1000), we raise an interrupt using qemu_irq_pulse() and also see that > the kvm ioctl is complete. Uh.. for an lsi qemu_irq_pulse() should not ever be used - that should only be used for edge or message interrupts. > 67351@1468011062.810020:xics_set_irq_lsi set_irq_lsi: srcno 3 [irq 0x1003] > 67351@1468011062.810031:xics_icp_irq cpu 0 trying to deliver irq 0x1003 p= riority 0x5 > 67351@1468011062.810038:xics_icp_raise raising IRQ new XIRR=3D0xff001003 > new pending priority=3D0x5 >=20 > After migration on the target side, interrupts(prio 0x5) are rejected as > there is a interrupt pending (pending_priority 0x5). Moreover, we never > get an icp_accept from the guest, so it hangs and crashes. Sorry, I'm still having a lot of trouble following this description of what's happening. > Basically, resend the irq pulse(lsi) to the guest. >=20 > Signed-off-by: Nikunj A Dadhania > --- > hw/intc/xics.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) >=20 > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index 69162f0..f765b08 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -209,7 +209,7 @@ static const TypeInfo xics_common_info =3D { > #define CPPR(ss) (((ss)->xirr) >> 24) > =20 > static void ics_reject(ICSState *ics, int nr); > -static void ics_resend(ICSState *ics); > +static void ics_resend(ICSState *ics, int server); > static void ics_eoi(ICSState *ics, int nr); > =20 > static void icp_check_ipi(XICSState *xics, int server) > @@ -238,7 +238,7 @@ static void icp_resend(XICSState *xics, int server) > if (ss->mfrr < CPPR(ss)) { > icp_check_ipi(xics, server); > } > - ics_resend(xics->ics); > + ics_resend(xics->ics, server); > } > =20 > void icp_set_cppr(XICSState *xics, int server, uint8_t cppr) > @@ -512,13 +512,24 @@ static void ics_reject(ICSState *ics, int nr) > } > } > =20 > -static void ics_resend(ICSState *ics) > +static void ics_resend(ICSState *ics, int server) > { > int i; > + ICPState *ss =3D ics->xics->ss + server; > + ICSIRQState *irq; > =20 > for (i =3D 0; i < ics->nr_irqs; i++) { > /* FIXME: filter by server#? */ > - if (ics->irqs[i].flags & XICS_FLAGS_IRQ_LSI) { > + irq =3D &ics->irqs[i]; > + if (!(irq->flags & XICS_FLAGS_IRQ_MASK)) { > + continue; > + } > + > + if (irq->flags & XICS_FLAGS_IRQ_LSI) { > + if (irq->status & XICS_STATUS_SENT) { > + qemu_irq_raise(ss->output); > + continue; Directly reraising the CPU irq line from an ics function rather than an icp function seems very dubious. It really seems like instead we need to be recalculating the output line state from the ICP state, after we've done all the ICS resends. > + } > resend_lsi(ics, i); > } else { > resend_msi(ics, i); --=20 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 --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX4jT4AAoJEGw4ysog2bOSQkYP/3j8UwSHav7vCjslH1fO1W+G 6wZlCCx5SnaoaHcHSsEmN/R3mwFgqO5Sfwhhawi8BHfzHRV6Ujv3dBcvP2WiZEHR Cb3fKDDvPh6VuFMLqGOcgPW4ITbH51VzEwUnmsWdPcOrpSBxIe3lGztHgfjGxu1F QbhfxY9g+CWq+kznSrLJVzg56j2KkSOnvwT6IX8tVU7dL/dH6f3uhUg/qwY1lTsa TpI+jq6CNl4SfzGFBUc6G32dTHrsk190jCqoilqf+l2KBylHgCAMlYmhhgi6zn3X fmVeNX3Emyq2qG/IqXK/2NFVi3ppZcKi0zsVTAyuSy/iJMhrQbw8g3nM5miYRk7C ra0pcE6y2Boo5I7jfP65qlzGeVABNBTlWCaY6XZWpocbkUvQNViT+/NDxqDkFCUk Blr3rLlVH3ER8AKlCm+XKmp/xfeP9ATfsopEeC6OI0qO3gsobuK4lZEYYiJXnc3Z xsKXg+E4HzgzguDMzKxvSb7o2k98btOPE1LtVQLbNbUOU62yRIHhaOGUxnd/uf+X G7S/WEWSmY6N0iz7mYDNmk+LaPQF4wbZayK3jXUs0laSyOBXd6HZ6sUuSrl59bwe 19jNF3l0eSpE5wEtGLRDbrZdE7COw/0GwqTUwRLHcA9ktACd1a3j9/i6SU729vp+ R+CudB06kKDu4PrBJqsB =HMCs -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9--