From patchwork Wed May 8 12:46:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10935609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B11BF1398 for ; Wed, 8 May 2019 12:48:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F08628565 for ; Wed, 8 May 2019 12:48:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 932C82880D; Wed, 8 May 2019 12:48:30 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2C40E28565 for ; Wed, 8 May 2019 12:48:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hOLyL-00049n-Va; Wed, 08 May 2019 12:46:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hOLyL-00049b-7a for xen-devel@lists.xenproject.org; Wed, 08 May 2019 12:46:57 +0000 X-Inumbo-ID: 5acb1aec-718f-11e9-8cfb-17e739a59b60 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5acb1aec-718f-11e9-8cfb-17e739a59b60; Wed, 08 May 2019 12:46:53 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Wed, 08 May 2019 06:46:52 -0600 Message-Id: <5CD2CFBB020000780022CCC6@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Wed, 08 May 2019 06:46:51 -0600 From: "Jan Beulich" To: "xen-devel" References: <5CD2CDEC020000780022CC95@prv1-mh.provo.novell.com> In-Reply-To: <5CD2CDEC020000780022CC95@prv1-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH 2/4] x86/IRQ: bail early from irq_guest_eoi_timer_fn() when nothing is in flight X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP There's no point entering the loop in the function in this case. Instead there still being something in flight _after_ the loop would be an actual problem: No timer would be running anymore for issuing the EOI eventually, and hence this IRQ (and possibly lower priority ones) would be blocked, perhaps indefinitely. Issue a warning instead and prefer breaking some (presumably misbehaving) guest over stalling perhaps the entire system. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné Reviewed-by: Andrew Cooper --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1115,7 +1115,7 @@ static void irq_guest_eoi_timer_fn(void action = (irq_guest_action_t *)desc->action; - if ( timer_is_active(&action->eoi_timer) ) + if ( !action->in_flight || timer_is_active(&action->eoi_timer) ) goto out; if ( action->ack_type != ACKTYPE_NONE ) @@ -1130,8 +1130,10 @@ static void irq_guest_eoi_timer_fn(void } } - if ( action->in_flight != 0 ) - goto out; + if ( action->in_flight ) + printk(XENLOG_G_WARNING + "IRQ%d: %d handlers still in flight at forced EOI\n", + desc->irq, action->in_flight); switch ( action->ack_type ) {