From patchwork Mon Aug 7 23:50:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venu Busireddy X-Patchwork-Id: 9886295 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 5449D602CC for ; Mon, 7 Aug 2017 23:51:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4674F28712 for ; Mon, 7 Aug 2017 23:51:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B67D2873F; Mon, 7 Aug 2017 23:51:58 +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 BF59728712 for ; Mon, 7 Aug 2017 23:51:57 +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 1derm8-0007oO-A4; Mon, 07 Aug 2017 23:49:32 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1derm7-0007oA-DL for xen-devel@lists.xen.org; Mon, 07 Aug 2017 23:49:31 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 8B/87-02177-A8CF8895; Mon, 07 Aug 2017 23:49:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeJIrShJLcpLzFFi42KZM10+ULfzT0e kwezHMhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aDPVcZCz7xVbQ//sPawLicu4uRk0NIYAKT RMNz3i5GLiD7D6NE/5tljBDOBkaJrq9vmSCciYwSt1ZNZARpYRMwkDh6uIcVJCEi0MYosfrEZ bCEsIC/xNQFG8FsFgFViZ5Zd5lAbF4BW4mrp5Ywg9gSAnISS7dfB7I5ODgF7CQ+PrGBOMNW4t 3ua4wQJYYSnzcuZZ7AyLuAkWEVo3pxalFZapGuqV5SUWZ6RkluYmaOrqGBsV5uanFxYnpqTmJ SsV5yfu4mRmBA1DMwMO5gvPzV6RCjJAeTkigv55aOSCG+pPyUyozE4oz4otKc1OJDjDIcHEoS vJy/gXKCRanpqRVpmTnA0IRJS3DwKInw/voFlOYtLkjMLc5Mh0idYjTm2LB6/RcmjlcT/n9jE mLJy89LlRLnrQeZJABSmlGaBzcIFjOXGGWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKgnzTgZZyJ OZVwK37xXQKUxAp7xJbAU5pSQRISXVwLhlIsMJu/A+xQNvGPS4MhTV3iz8yxR6jO3qdieO+6f +ui/UFJ8lky2/eVJZcpfncdeUl6v46xd1rpWtOr/hz7N7PeWpD1JLDljOjniqmsx3Z/a29qIb uxff+u6vOXdFU+f72YIBvMc/1Iep6F21lJ5ScvLZhL4DDCx6dawK+/mUXu+4vXv7zpNKLMUZi YZazEXFiQBXTZqplAIAAA== X-Env-Sender: venu.busireddy@oracle.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1502149767!108826624!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26009 invoked from network); 7 Aug 2017 23:49:29 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-14.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Aug 2017 23:49:29 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v77NnNhg017877 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Aug 2017 23:49:23 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v77NnNpf003500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Aug 2017 23:49:23 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v77NnMd4001713; Mon, 7 Aug 2017 23:49:22 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:49:22 -0700 From: Venu Busireddy To: venu.busireddy@oracle.com, xen-devel@lists.xen.org, Ian Jackson , Wei Liu Date: Mon, 7 Aug 2017 18:50:12 -0500 Message-Id: <20170807235012.3804-3-venu.busireddy@oracle.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170807235012.3804-1-venu.busireddy@oracle.com> References: <20170807235012.3804-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;