From patchwork Mon Sep 19 06:29:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nikunj A. Dadhania" X-Patchwork-Id: 9338597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F07B6022E for ; Mon, 19 Sep 2016 06:34:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E26B29139 for ; Mon, 19 Sep 2016 06:34:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 330582913E; Mon, 19 Sep 2016 06:34:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CBFDB29139 for ; Mon, 19 Sep 2016 06:34:33 +0000 (UTC) Received: from localhost ([::1]:53083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bls9x-0006Fc-3v for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Sep 2016 02:34:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bls5U-0002u3-Ia for qemu-devel@nongnu.org; Mon, 19 Sep 2016 02:29:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bls5O-00082q-Cg for qemu-devel@nongnu.org; Mon, 19 Sep 2016 02:29:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bls5O-00082Q-3R for qemu-devel@nongnu.org; Mon, 19 Sep 2016 02:29:50 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8J6ShZ8082007 for ; Mon, 19 Sep 2016 02:29:49 -0400 Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) by mx0a-001b2d01.pphosted.com with ESMTP id 25jam90cub-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 19 Sep 2016 02:29:48 -0400 Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Sep 2016 16:29:46 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Sep 2016 16:29:45 +1000 Received: from d23relay10.au.ibm.com (d23relay10.au.ibm.com [9.190.26.77]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 86D592CE8054; Mon, 19 Sep 2016 16:29:44 +1000 (EST) Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8J6TiE841222186; Mon, 19 Sep 2016 16:29:44 +1000 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u8J6ThbC012504; Mon, 19 Sep 2016 16:29:44 +1000 Received: from abhimanyu.in.ibm.com (abhimanyu.in.ibm.com [9.124.35.169]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u8J6TcTa012399; Mon, 19 Sep 2016 16:29:42 +1000 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Mon, 19 Sep 2016 11:59:30 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474266577-11704-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1474266577-11704-1-git-send-email-nikunj@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091906-0016-0000-0000-000001D3E768 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091906-0017-0000-0000-000005777BC6 Message-Id: <1474266577-11704-3-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-19_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609190094 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 2/9] ppc/xics: Fix migration failure with kernel-irqchip=off X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, nikunj@linux.vnet.ibm.com, clg@kaod.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP With a single cpu VM running with kernel-irqchip=off and a flood ping running in the guest. Migration fails once in few times. 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. 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 priority 0x5 67351@1468011062.810038:xics_icp_raise raising IRQ new XIRR=0xff001003 new pending priority=0x5 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. Basically, resend the irq pulse(lsi) to the guest. Signed-off-by: Nikunj A Dadhania --- hw/intc/xics.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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 = { #define CPPR(ss) (((ss)->xirr) >> 24) 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); 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); } void icp_set_cppr(XICSState *xics, int server, uint8_t cppr) @@ -512,13 +512,24 @@ static void ics_reject(ICSState *ics, int nr) } } -static void ics_resend(ICSState *ics) +static void ics_resend(ICSState *ics, int server) { int i; + ICPState *ss = ics->xics->ss + server; + ICSIRQState *irq; for (i = 0; i < ics->nr_irqs; i++) { /* FIXME: filter by server#? */ - if (ics->irqs[i].flags & XICS_FLAGS_IRQ_LSI) { + irq = &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; + } resend_lsi(ics, i); } else { resend_msi(ics, i);