From patchwork Mon Aug 7 23:53:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venu Busireddy X-Patchwork-Id: 9886323 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 A2EC460352 for ; Mon, 7 Aug 2017 23:54:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95852286E6 for ; Mon, 7 Aug 2017 23:54:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A74928726; Mon, 7 Aug 2017 23:54:35 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 32FC0286F5 for ; Mon, 7 Aug 2017 23:54:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1derox-00007C-Ug; Mon, 07 Aug 2017 23:52:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1derow-00006W-EM for xen-devel@lists.xen.org; Mon, 07 Aug 2017 23:52:26 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id CD/40-01732-93DF8895; Mon, 07 Aug 2017 23:52:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeJIrShJLcpLzFFi42LpnVTnqmv5tyP S4MNffoslHxezODB6HN39mymAMYo1My8pvyKBNePBnquMBZ/4Ktof/2FtYFzO3cXIxSEkMIFJ YtWrC+wQzi9GiQWtm5khnPWMEnMOz2CCcCYySuz+spS1i5GTg03AQOLo4R5WkISIQBujxOoTl xlBEsIC/hJTF2wEs1kEVCV6zs9jA7F5BWwlZk0/DBaXEJCTWLr9OjOIzSlgJzF5/1uwGiGgmi 2rQbaB1BhKfN64lHkCI+8CRoZVjBrFqUVlqUW6RhZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTm JScV6yfm5mxiBYVHPwMC4g7H9hN8hRkkOJiVRXs4tHZFCfEn5KZUZicUZ8UWlOanFhxhlODiU JHgn/gbKCRalpqdWpGXmAAMUJi3BwaMkwqv+ByjNW1yQmFucmQ6ROsVozLFh9fovTByvJvz/x iTEkpeflyolzlsPMkkApDSjNA9uECxyLjHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5v0JMo UnM68Ebt8roFOYgE55k9gKckpJIkJKqoFxk2+7RAL3xqen+g5duGZsclCG03yK/l3Z3TdfMb/ ssp8vN++5zwbtmgW6LoUMQdHOa3U+zHdWWHhTWPNN/2nnn2LsEw9Ms73zlY13y9HpX1yenp/z eXJR0I7Dbht+sXeXHt5Rl3zYzrBW1td5Ub74zwfn8343M5YLtPok7vRU0mZ+Y3Xxq0mcEktxR qKhFnNRcSIAA4H3GZcCAAA= X-Env-Sender: venu.busireddy@oracle.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1502149943!97303881!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17471 invoked from network); 7 Aug 2017 23:52:25 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-2.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Aug 2017 23:52:25 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v77NqL8b002593 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Aug 2017 23:52:22 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v77NqLtd009075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Aug 2017 23:52:21 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v77NqLCo006751; Mon, 7 Aug 2017 23:52:21 GMT Received: from ban25uut183.us.oracle.com (/10.153.74.183) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Aug 2017 16:52:21 -0700 From: Venu Busireddy To: venu.busireddy@oracle.com, xen-devel@lists.xen.org, Ian Jackson , Wei Liu Date: Mon, 7 Aug 2017 18:53:25 -0500 Message-Id: <20170807235325.3894-3-venu.busireddy@oracle.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170807235325.3894-1-venu.busireddy@oracle.com> References: <20170807235325.3894-1-venu.busireddy@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Subject: [Xen-devel] [PATCH v3 2/2] xl: Register the AER event handler to handle AER errors X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When a guest is created, register the AER event handler to handle the AER errors. When an AER error occurs, the handler will forcibly remove the erring PCIe device from the guest. Signed-off-by: Venu Busireddy --- tools/xl/xl_vmcontrol.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index 89c2b25..9855cdb 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -656,6 +656,7 @@ int create_domain(struct domain_create *dom_info) const char *restore_source = NULL; int migrate_fd = dom_info->migrate_fd; bool config_in_json; + libxl_aer_watch *aer_ws = NULL; int i; int need_daemon = daemonize; @@ -966,6 +967,12 @@ start: LOG("Waiting for domain %s (domid %u) to die [pid %ld]", d_config.c_info.name, domid, (long)getpid()); + ret = libxl_reg_aer_events_handler(ctx, domid, &aer_ws); + if (ret) { + /* Log the error, and move on... */ + LOG("libxl_reg_aer_events_handler() failed, ret = 0x%08x", ret); + } + ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw); if (ret) goto out; @@ -993,6 +1000,7 @@ start: LOG("Domain %u has shut down, reason code %d 0x%x", domid, event->u.domain_shutdown.shutdown_reason, event->u.domain_shutdown.shutdown_reason); + libxl_unreg_aer_events_handler(ctx, domid, aer_ws); switch (handle_domain_death(&domid, event, &d_config)) { case DOMAIN_RESTART_SOFT_RESET: domid_soft_reset = domid; @@ -1059,6 +1067,7 @@ start: case LIBXL_EVENT_TYPE_DOMAIN_DEATH: LOG("Domain %u has been destroyed.", domid); + libxl_unreg_aer_events_handler(ctx, domid, aer_ws); libxl_event_free(ctx, event); ret = 0; goto out;