From patchwork Fri Dec 2 15:08:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9458727 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 504B360236 for ; Fri, 2 Dec 2016 15:11:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40F982847C for ; Fri, 2 Dec 2016 15:11:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 337AA2856B; Fri, 2 Dec 2016 15:11:52 +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 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 B00F62847C for ; Fri, 2 Dec 2016 15:11:50 +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 1cCpSi-000375-BN; Fri, 02 Dec 2016 15:09:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cCpSh-000353-6z for xen-devel@lists.xen.org; Fri, 02 Dec 2016 15:09:19 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id 07/67-28694-E9E81485; Fri, 02 Dec 2016 15:09:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42I53H6XVXdun2O EQd8+E4slHxezODB6HN39mymAMYo1My8pvyKBNePT3cVsBQ+sKrbeu8zawPhPu4uRi0NIYAmj xOEVT1m7GDk52ATsJbr+HGUCsUUEpCWufb7MCGIzC5RINJ3rZAaxhQU8JR7MecnSxcjBwSKgK vH+Rx5ImFfAUuL2iXtg5RIC8hILzx8BG8MJFH/Qch0sLiRgIdF84w4LRL2gxMmZT8DGMAuoS6 yfJwSxSV6ieets5gmMvLOQVM1CqJqFpGoBI/MqRo3i1KKy1CJdQ3O9pKLM9IyS3MTMHF1DAzO 93NTi4sT01JzEpGK95PzcTYzAgGIAgh2MtzcGHGKU5GBSEuU1zXGMEOJLyk+pzEgszogvKs1J LT7EKMPBoSTBa9YNlBMsSk1PrUjLzAGGNkxagoNHSYTXFSTNW1yQmFucmQ6ROsWoKCXOGweSE ABJZJTmwbXB4ukSo6yUMC8j0CFCPAWpRbmZJajyrxjFORiVhHk1QKbwZOaVwE1/BbSYCWhxx3 V7kMUliQgpqQbGeiPr5991op8sSXGWd7Y9qPL6/hGxEhWl/GSBcyk6tVFBvC+TbXKXqB36Gij 14ONfbaETf2I1UgwvflTwvPhRbAmPrWXR3z/buv4eai1YduqCePYZy6lTl6UbxH43n/7zjc3Z 1hUvNe7ufntCa3bEhi+rtLY8F1yx78XRfT9L1k99pnTv52OjIiWW4oxEQy3mouJEANdxMqiiA gAA X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1480691357!62930687!1 X-Originating-IP: [195.135.221.5] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25709 invoked from network); 2 Dec 2016 15:09:17 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-14.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Dec 2016 15:09:17 -0000 Received: from laptop.vms (mhy71-2-88-167-63-197.fbx.proxad.net [88.167.63.197]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Fri, 02 Dec 2016 16:09:16 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Fri, 2 Dec 2016 16:08:23 +0100 Message-Id: <20161202150841.31227-18-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161202150841.31227-1-cbosdonnat@suse.com> References: <20161202150841.31227-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: Ian Jackson , Wei Liu , Cedric Bosdonnat Subject: [Xen-devel] [PATCH v2 17/35] libxl/libxl_dom_suspend.c: used LOG*D functions 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cedric Bosdonnat Use LOG*D logging functions where possible instead of the LOG* ones. Signed-off-by: Cédric Bosdonnat Acked-by: Wei Liu --- tools/libxl/libxl_dom_suspend.c | 45 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c index 0648919..d258a1c 100644 --- a/tools/libxl/libxl_dom_suspend.c +++ b/tools/libxl/libxl_dom_suspend.c @@ -54,7 +54,7 @@ int libxl__domain_suspend_init(libxl__egc *egc, domid, port, &dsps->guest_evtchn_lockfd); if (dsps->guest_evtchn.port < 0) { - LOG(WARN, "Suspend event channel initialization failed"); + LOGD(WARN, domid, "Suspend event channel initialization failed"); rc = ERROR_FAIL; goto out; } @@ -77,7 +77,7 @@ int libxl__domain_suspend_device_model(libxl__gc *gc, switch (libxl__device_model_version_running(gc, domid)) { case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: { - LOG(DEBUG, "Saving device model state to %s", filename); + LOGD(DEBUG, domid, "Saving device model state to %s", filename); libxl__qemu_traditional_cmd(gc, domid, "save"); libxl__wait_for_device_model_deprecated(gc, domid, "paused", NULL, NULL, NULL); break; @@ -154,11 +154,11 @@ static void domain_suspend_callback_common(libxl__egc *egc, } if ((hvm_s_state == 0) && (dsps->guest_evtchn.port >= 0)) { - LOG(DEBUG, "issuing %s suspend request via event channel", + LOGD(DEBUG, domid, "issuing %s suspend request via event channel", dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV"); ret = xenevtchn_notify(CTX->xce, dsps->guest_evtchn.port); if (ret < 0) { - LOG(ERROR, "xenevtchn_notify failed ret=%d", ret); + LOGD(ERROR, domid, "xenevtchn_notify failed ret=%d", ret); rc = ERROR_FAIL; goto err; } @@ -176,10 +176,10 @@ static void domain_suspend_callback_common(libxl__egc *egc, } if (dsps->type == LIBXL_DOMAIN_TYPE_HVM && (!hvm_pvdrv || hvm_s_state)) { - LOG(DEBUG, "Calling xc_domain_shutdown on HVM domain"); + LOGD(DEBUG, domid, "Calling xc_domain_shutdown on HVM domain"); ret = xc_domain_shutdown(CTX->xch, domid, SHUTDOWN_suspend); if (ret < 0) { - LOGE(ERROR, "xc_domain_shutdown failed"); + LOGED(ERROR, domid, "xc_domain_shutdown failed"); rc = ERROR_FAIL; goto err; } @@ -189,7 +189,7 @@ static void domain_suspend_callback_common(libxl__egc *egc, return; } - LOG(DEBUG, "issuing %s suspend request via XenBus control node", + LOGD(DEBUG, domid, "issuing %s suspend request via XenBus control node", dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV"); libxl__domain_pvcontrol_write(gc, XBT_NULL, domid, "suspend"); @@ -260,8 +260,8 @@ static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc, rc = libxl__xs_transaction_commit(gc, &t); if (!rc) { - LOG(ERROR, - "guest didn't acknowledge suspend, cancelling request"); + LOGD(ERROR, dsps->domid, + "guest didn't acknowledge suspend, cancelling request"); goto err; } if (rc<0) goto err; @@ -272,7 +272,7 @@ static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc, } assert(domain_suspend_pvcontrol_acked(state)); - LOG(DEBUG, "guest acknowledged suspend request"); + LOGD(DEBUG, dsps->domid, "guest acknowledged suspend request"); libxl__xs_transaction_abort(gc, &t); dsps->guest_responded = 1; @@ -291,7 +291,7 @@ static void domain_suspend_common_wait_guest(libxl__egc *egc, STATE_AO_GC(dsps->ao); int rc; - LOG(DEBUG, "wait for the guest to suspend"); + LOGD(DEBUG, dsps->domid, "wait for the guest to suspend"); rc = libxl__ev_xswatch_register(gc, &dsps->guest_watch, suspend_common_wait_guest_watch, @@ -328,13 +328,12 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, ret = xc_domain_getinfolist(CTX->xch, domid, 1, &info); if (ret < 0) { - LOGE(ERROR, "unable to check for status of guest %"PRId32"", domid); + LOGED(ERROR, domid, "unable to check for status of guest"); goto err; } if (!(ret == 1 && info.domain == domid)) { - LOGE(ERROR, "guest %"PRId32" we were suspending has been destroyed", - domid); + LOGED(ERROR, domid, "guest we were suspending has been destroyed"); goto err; } @@ -345,12 +344,12 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, shutdown_reason = (info.flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask; if (shutdown_reason != SHUTDOWN_suspend) { - LOG(DEBUG, "guest %"PRId32" we were suspending has shut down" - " with unexpected reason code %d", domid, shutdown_reason); + LOGD(DEBUG, domid, "guest we were suspending has shut down" + " with unexpected reason code %d", shutdown_reason); goto err; } - LOG(DEBUG, "guest has suspended"); + LOGD(DEBUG, domid, "guest has suspended"); domain_suspend_common_guest_suspended(egc, dsps); return; @@ -364,7 +363,7 @@ static void suspend_common_wait_guest_timeout(libxl__egc *egc, libxl__domain_suspend_state *dsps = CONTAINER_OF(ev, *dsps, guest_timeout); STATE_AO_GC(dsps->ao); if (rc == ERROR_TIMEDOUT) { - LOG(ERROR, "guest did not suspend, timed out"); + LOGD(ERROR, dsps->domid, "guest did not suspend, timed out"); rc = ERROR_GUEST_TIMEDOUT; } domain_suspend_common_done(egc, dsps, rc); @@ -383,7 +382,8 @@ static void domain_suspend_common_guest_suspended(libxl__egc *egc, if (dsps->type == LIBXL_DOMAIN_TYPE_HVM) { rc = libxl__domain_suspend_device_model(gc, dsps); if (rc) { - LOG(ERROR, "libxl__domain_suspend_device_model failed ret=%d", rc); + LOGD(ERROR, dsps->domid, + "libxl__domain_suspend_device_model failed ret=%d", rc); domain_suspend_common_done(egc, dsps, rc); return; } @@ -457,7 +457,7 @@ int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel) int rc = 0; if (xc_domain_resume(CTX->xch, domid, suspend_cancel)) { - LOGE(ERROR, "xc_domain_resume failed for domain %u", domid); + LOGED(ERROR, domid, "xc_domain_resume failed"); rc = ERROR_FAIL; goto out; } @@ -471,14 +471,13 @@ int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel) if (type == LIBXL_DOMAIN_TYPE_HVM) { rc = libxl__domain_resume_device_model(gc, domid); if (rc) { - LOG(ERROR, "failed to resume device model for domain %u:%d", - domid, rc); + LOGD(ERROR, domid, "failed to resume device model:%d", rc); goto out; } } if (!xs_resume_domain(CTX->xsh, domid)) { - LOGE(ERROR, "xs_resume_domain failed for domain %u", domid); + LOGED(ERROR, domid, "xs_resume_domain failed"); rc = ERROR_FAIL; } out: